{"version":3,"file":"EmailDomainGuard.DLFNPsOT.mjs","names":["React.forwardRef","useState","useRef"],"sources":["https:/framerusercontent.com/modules/DOVviCJE4TiIVj0I2Geg/lCqa0A2DdVUhYxxVSMHh/m0YBVw8ZQ.js","https:/framerusercontent.com/modules/2TFLxCnV5biZbKQMVme1/L4KmHltYo0T6oi814sd7/EmailDomainGuard.js"],"sourcesContent":["// Generated by Framer (85eaff3)\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,cx,motion,useSVGTemplate,withCSS}from\"framer\";import*as React from\"react\";import{forwardRef}from\"react\";const mask=\"var(--framer-icon-mask)\";const Base=/*#__PURE__*/forwardRef(function(props,ref){return /*#__PURE__*/_jsx(\"svg\",{...props,ref:ref,children:props.children});});const MotionSVG=motion.create(Base);const SVG=/*#__PURE__*/forwardRef((props,ref)=>{const{animated,layoutId,children,...rest}=props;return animated?/*#__PURE__*/_jsx(MotionSVG,{...rest,layoutId:layoutId,ref:ref,children:children}):/*#__PURE__*/_jsx(\"svg\",{...rest,ref:ref,children:children});});const svg='<svg display=\"block\" role=\"presentation\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 9.019 0.816 C 9.108 0.343 9.521 0 10.002 0 C 10.484 0 10.897 0.343 10.985 0.816 L 12.036 6.374 C 12.189 7.183 12.822 7.816 13.63 7.968 L 19.188 9.019 C 19.662 9.108 20.005 9.521 20.005 10.002 C 20.005 10.484 19.662 10.897 19.188 10.985 L 13.63 12.036 C 12.822 12.189 12.189 12.822 12.036 13.63 L 10.985 19.188 C 10.897 19.662 10.484 20.005 10.002 20.005 C 9.521 20.005 9.108 19.662 9.019 19.188 L 7.968 13.63 C 7.816 12.822 7.183 12.189 6.374 12.036 L 0.816 10.985 C 0.343 10.897 0 10.484 0 10.002 C 0 9.521 0.343 9.108 0.816 9.019 L 6.374 7.968 C 7.183 7.816 7.816 7.183 7.968 6.374 Z\" fill=\"transparent\" height=\"20.004788889056996px\" id=\"r3ITwxBG7\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--js9iwy, 2)\" stroke=\"var(--1m973uw, rgb(0,0,0))\" transform=\"translate(1.998 1.998)\" width=\"20.004788889056993px\"/><path d=\"M 0 0 L 0 4\" fill=\"transparent\" height=\"4px\" id=\"npiFUOZYL\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--js9iwy, 2)\" stroke=\"var(--1m973uw, rgb(0,0,0))\" transform=\"translate(20 2)\" width=\"1px\"/><path d=\"M 4 0 L 0 0\" fill=\"transparent\" height=\"1px\" id=\"KnnF_NlKv\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--js9iwy, 2)\" stroke=\"var(--1m973uw, rgb(0,0,0))\" transform=\"translate(18 4)\" width=\"4px\"/><path d=\"M 0 2 C 0 0.895 0.895 0 2 0 C 3.105 0 4 0.895 4 2 C 4 3.105 3.105 4 2 4 C 0.895 4 0 3.105 0 2 Z\" fill=\"transparent\" height=\"4px\" id=\"aBzgyASOc\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--js9iwy, 2)\" stroke=\"var(--1m973uw, rgb(0,0,0))\" transform=\"translate(2 18)\" width=\"4px\"/></svg>';const getProps=({color,height,id,width,width1,...props})=>{return{...props,JEeZYcamG:width1??props.JEeZYcamG??2,P_DcoRcrY:color??props.P_DcoRcrY??\"rgb(0, 0, 0)\"};};const Component=/*#__PURE__*/React.forwardRef(function(props,ref){const{style,className,layoutId,variant,P_DcoRcrY,JEeZYcamG,...restProps}=getProps(props);const href=useSVGTemplate(\"3008297960\",svg);return /*#__PURE__*/_jsx(SVG,{...restProps,className:cx(\"framer-Efhma\",className),layoutId:layoutId,ref:ref,role:\"presentation\",style:{\"--1m973uw\":P_DcoRcrY,\"--js9iwy\":JEeZYcamG,...style},viewBox:\"0 0 24 24\",children:/*#__PURE__*/_jsx(\"use\",{href:href})});});const css=[`.framer-Efhma { -webkit-mask: ${mask}; aspect-ratio: 1; display: block; mask: ${mask}; width: 24px; }`];/**\n * This is a generated Framer component.\n * @framerIntrinsicWidth 24\n * @framerIntrinsicHeight 24\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerVariables {\"P_DcoRcrY\":\"color\",\"JEeZYcamG\":\"width1\"}\n * @framerImmutableVariables true\n * @framerVector {\"name\":\"Sparkles\",\"color\":{\"type\":\"variable\",\"value\":\"1m973uw\"},\"set\":{\"localId\":\"vectorSet/ZsiCCGPvG\",\"id\":\"ZsiCCGPvG\",\"moduleId\":\"Y7SpbVH16cWqMhj75z1M\"}}\n */const Icon=withCSS(Component,css,\"framer-Efhma\");Icon.displayName=\"Sparkles\";export default Icon;addPropertyControls(Icon,{P_DcoRcrY:{defaultValue:\"rgb(0, 0, 0)\",hidden:false,title:\"Color\",type:ControlType.Color},JEeZYcamG:{defaultValue:2,displayStepper:true,hidden:false,max:16,min:1,title:\"Width\",type:ControlType.Number}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Icon\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"24\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerImmutableVariables\":\"true\",\"framerIntrinsicWidth\":\"24\",\"framerVector\":\"{\\\"name\\\":\\\"Sparkles\\\",\\\"color\\\":{\\\"type\\\":\\\"variable\\\",\\\"value\\\":\\\"1m973uw\\\"},\\\"set\\\":{\\\"localId\\\":\\\"vectorSet/ZsiCCGPvG\\\",\\\"id\\\":\\\"ZsiCCGPvG\\\",\\\"moduleId\\\":\\\"Y7SpbVH16cWqMhj75z1M\\\"}}\",\"framerContractVersion\":\"1\",\"framerVariables\":\"{\\\"P_DcoRcrY\\\":\\\"color\\\",\\\"JEeZYcamG\\\":\\\"width1\\\"}\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useRef}from\"react\";/**\n * EmailDomainGuard — Crossbridge\n * Blocks native form submission if the email input is not a validly\n * formatted email address, OR if it uses a personal/free email domain\n * (gmail, outlook, etc). Mirrors the FileUpload component's\n * submit-interception pattern — does not replace the native email field,\n * just validates it.\n */// Standard, widely-used \"good enough\" email format check: local@domain.tld\n// Requires at least one dot in the domain portion (rejects \"user@hotmail\").\nconst EMAIL_FORMAT_REGEX=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;export default function EmailDomainGuard({blockedDomains,errorMessage,invalidFormatMessage,enabled,style}){const[errorMsg,setErrorMsg]=useState(\"\");const containerRef=useRef(null);useEffect(()=>{if(!enabled)return;const form=containerRef.current?.closest(\"form\");if(!form)return;const domainList=blockedDomains.split(\",\").map(d=>d.trim().toLowerCase()).filter(Boolean);const getEmailInput=()=>{return form.querySelector('input[type=\"email\"]')||form.querySelector('input[name*=\"mail\" i]')||form.querySelector('input[placeholder*=\"mail\" i]');};const handleSubmit=e=>{const emailInput=getEmailInput();const value=emailInput?.value?.trim().toLowerCase()||\"\";// 1. Format check first — catches things like \"user@hotmail\"\n// (no TLD), \"user@\", \"not-an-email\", etc.\nif(!EMAIL_FORMAT_REGEX.test(value)){e.preventDefault();e.stopImmediatePropagation();setErrorMsg(invalidFormatMessage);emailInput?.scrollIntoView({behavior:\"smooth\",block:\"center\"});emailInput?.focus();return;}// 2. Personal/free domain check\nconst domain=value.split(\"@\")[1]||\"\";if(domain&&domainList.includes(domain)){e.preventDefault();e.stopImmediatePropagation();setErrorMsg(errorMessage);emailInput?.scrollIntoView({behavior:\"smooth\",block:\"center\"});emailInput?.focus();return;}setErrorMsg(\"\");};// Clear the error as soon as the person edits the email again\nconst handleInput=()=>{setErrorMsg(prev=>prev?\"\":prev);};// Attach at document-level capture, not on the form itself.\n// Framer's own submit handler is part of the core runtime and attaches\n// to the form before this async-loaded code component mounts — a\n// listener on the form node would run AFTER Framer's, too late to\n// stop the webhook POST already fired by Framer's own handler.\n// A capture-phase document listener always fires first, regardless\n// of attachment order on the target node itself.\nconst handleDocumentSubmit=e=>{if(e.target!==form)return;handleSubmit(e);};const emailInput=getEmailInput();document.addEventListener(\"submit\",handleDocumentSubmit,true);emailInput?.addEventListener(\"input\",handleInput);return()=>{document.removeEventListener(\"submit\",handleDocumentSubmit,true);emailInput?.removeEventListener(\"input\",handleInput);};// eslint-disable-next-line react-hooks/exhaustive-deps\n},[enabled,blockedDomains,errorMessage,invalidFormatMessage]);if(!errorMsg){// Invisible when there's nothing to show — takes up no layout space.\nreturn /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{display:\"none\"}});}return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"100%\",fontFamily:\"'Poppins', sans-serif\",fontSize:12,fontWeight:500,color:\"rgb(255, 100, 80)\",lineHeight:\"1.4em\",...style},children:[\"⚠ \",errorMsg]});}addPropertyControls(EmailDomainGuard,{enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true,description:\"Blocks form submission if the email is malformed or uses a personal/free domain.\"},blockedDomains:{type:ControlType.String,title:\"Blocked domains\",defaultValue:\"gmail.com,hotmail.com,outlook.com,yahoo.com,icloud.com,aol.com,protonmail.com,live.com\",placeholder:\"gmail.com,yahoo.com,...\",description:\"Comma-separated list of personal email domains to reject.\"},errorMessage:{type:ControlType.String,title:\"Personal domain error\",defaultValue:\"Please use your work email address, not a personal one.\"},invalidFormatMessage:{type:ControlType.String,title:\"Invalid format error\",defaultValue:\"Please enter a valid email address.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EmailDomainGuard\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//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