{"version":3,"file":"CustomEmailCaptureForm.CZqF6ot9.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Bk8XI7Kso6TNTWllgEwD/Ycytsilht9hJJoA5FMP5/CustomEmailCaptureForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function addDemoTag(email){if(!/\\+demo(?=@)/.test(email)){return email.replace(/@/,\"+demo@\");}return email;}export default function CustomEmailCaptureForm(props){const[email,setEmail]=useState(\"\");const[loading,setLoading]=useState(false);const[errors,setErrors]=useState({email:\"\",websiteUrl:\"\",general:\"\"});// Clear error when user starts typing\nconst handleEmailChange=e=>{setEmail(e.target.value);if(errors.email){setErrors(prev=>({...prev,email:\"\"}));}};// Validate inputs before submission\nconst validateInputs=()=>{const newErrors={email:\"\",websiteUrl:\"\",general:\"\"};// Email validation\nif(!email.trim()){newErrors.email=\"Email is required\";}else if(!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)){newErrors.email=\"Please enter a valid email address\";}setErrors(newErrors);return!newErrors.email&&!newErrors.websiteUrl;};const handleSubmit=async e=>{e.preventDefault();// Clear any prior general error\nsetErrors(prev=>({...prev,general:\"\"}));// Validate inputs\nif(!validateInputs()){return;}setLoading(true);try{const modifiedEmail=email;const encodedEmail=encodeURIComponent(modifiedEmail);const redirectUrl=`${props.successRedirectUrl}?email=${encodedEmail}`;// 🚀 Simple navigation - works everywhere!\nwindow.location.href=redirectUrl;}catch(error){console.error(\"Submission error:\",error);setErrors(prev=>({...prev,general:\"We have a problem generating a demo for this email. Please make sure this is the first time you request one\"}));}finally{setLoading(false);}};return /*#__PURE__*/_jsxs(\"div\",{style:{padding:\"24px\",border:\"1px solid #E0E0E0\",borderRadius:\"12px\",maxWidth:\"480px\",backgroundColor:\"#fff\",fontFamily:\"Inter, sans-serif\",boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"column\",gap:\"16px\"},children:[errors.general&&/*#__PURE__*/_jsx(\"div\",{style:{padding:\"12px\",backgroundColor:\"#FEF2F2\",border:\"1px solid #FECACA\",borderRadius:\"8px\",color:\"#DC2626\",fontSize:\"14px\",marginBottom:\"8px\"},children:errors.general}),/*#__PURE__*/_jsxs(\"label\",{style:{fontWeight:500},children:[\"Email\",/*#__PURE__*/_jsx(\"span\",{style:{color:\"#FF4D4F\"},children:\"*\"}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",placeholder:\"What email address do you use for your business?\",value:email,onChange:handleEmailChange,required:true,style:{marginTop:\"6px\",padding:\"14px\",border:`1px solid ${errors.email?\"#FF4D4F\":\"#E0E0E0\"}`,borderRadius:\"12px\",fontSize:\"14px\",width:\"100%\",boxSizing:\"border-box\",outline:errors.email?\"none\":undefined,boxShadow:errors.email?\"0 0 0 3px rgba(255, 77, 79, 0.1)\":undefined}}),errors.email&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#FF4D4F\",fontSize:\"12px\",marginTop:\"4px\",marginLeft:\"2px\"},children:errors.email})]}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:loading,style:{backgroundColor:loading?\"#A0A0A0\":\"#D45500\",color:\"white\",padding:\"16px\",border:\"none\",borderRadius:\"999px\",fontSize:\"16px\",fontWeight:\"bold\",cursor:loading?\"not-allowed\":\"pointer\",marginTop:\"8px\",transition:\"background-color 0.2s ease\"},children:loading?\"Submitting...\":\"Start your free 14-Day trial\"})]}),/*#__PURE__*/_jsxs(\"p\",{style:{fontSize:\"12px\",color:\"#333\",marginTop:\"16px\",lineHeight:\"1.4\"},children:[\"We protect your privacy. Your information is encrypted and never shared with third parties.\",/*#__PURE__*/_jsx(\"br\",{}),\"Read our\",\" \",/*#__PURE__*/_jsx(\"a\",{href:\"#\",style:{textDecoration:\"underline\",color:\"#000\"},children:\"Privacy Policy\"}),\" \",\"|\",\" \",/*#__PURE__*/_jsx(\"a\",{href:\"#\",style:{textDecoration:\"underline\",color:\"#000\"},children:\"Terms of Service\"})]})]});}addPropertyControls(CustomEmailCaptureForm,{successRedirectUrl:{type:ControlType.String,title:\"Redirect URL\",defaultValue:\"https://yourdomain.com/success\"},apiKey:{type:ControlType.String,title:\"API Key\",defaultValue:\"\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomEmailCaptureForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomEmailCaptureForm.map"],"mappings":"+LAAqP,SAAwB,EAAuB,EAAM,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAO,GAAWA,EAAS,CAAC,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,CAAC,CACvb,EAAkB,GAAG,CAAC,EAAS,EAAE,OAAO,MAAM,CAAI,EAAO,OAAO,EAAU,IAAO,CAAC,GAAG,EAAK,MAAM,GAAG,EAAE,EACrG,MAAmB,CAAC,IAAM,EAAU,CAAC,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,CACwG,OAAjL,EAAM,MAAM,CAAgD,6BAA6B,KAAK,EAAM,GAAE,EAAU,MAAM,sCAAxG,EAAU,MAAM,oBAA8H,EAAU,EAAU,CAAO,CAAC,EAAU,OAAO,CAAC,EAAU,YAGiD,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,OAAO,oBAAoB,aAAa,OAAO,SAAS,QAAQ,gBAAgB,OAAO,WAAW,oBAAoB,UAAU,aAAa,CAAC,SAAS,CAAc,EAAM,OAAO,CAAC,SAH3P,KAAM,IAAG,CAAC,KAAE,gBAAgB,CACpR,EAAU,IAAO,CAAC,GAAG,EAAK,QAAQ,GAAG,EAAE,CACnC,GAAgB,CAAU,GAAW,GAAK,CAAC,GAAG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