{"version":3,"file":"CustomEmailCaptureForm.Deegc-Mc.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Bk8XI7Kso6TNTWllgEwD/ga154q1Ut9zdQn5HQBwI/CustomEmailCaptureForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function CustomEmailCaptureForm(props){const[email,setEmail]=useState(\"\");const[websiteUrl,setWebsiteUrl]=useState(\"\");const[loading,setLoading]=useState(false);const[verifyingUrl,setVerifyingUrl]=useState(false);const[errors,setErrors]=useState({email:\"\",websiteUrl:\"\",general:\"\"});const handleEmailChange=e=>{setEmail(e.target.value);if(errors.email)setErrors(prev=>({...prev,email:\"\"}));};const handleWebsiteUrlChange=e=>{setWebsiteUrl(e.target.value);if(errors.websiteUrl)setErrors(prev=>({...prev,websiteUrl:\"\"}));};const normalizeUrl=url=>{const trimmed=url.trim();return/^https?:\\/\\//i.test(trimmed)?trimmed:\"https://\"+trimmed;};const verifyWebsiteExists=async url=>{try{await fetch(normalizeUrl(url),{method:\"HEAD\",mode:\"no-cors\",signal:AbortSignal.timeout(8e3)});return true;}catch{return false;}};const validateInputs=()=>{const newErrors={email:\"\",websiteUrl:\"\",general:\"\"};if(!email.trim()){newErrors.email=\"Email is required\";}else if(!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)){newErrors.email=\"Please enter a valid email address\";}if(!websiteUrl.trim()){newErrors.websiteUrl=\"Website URL is required\";}else if(!/^(https?:\\/\\/)?([\\w-]+\\.)+[\\w]{2,}(\\/\\S*)?$/.test(websiteUrl.trim())){newErrors.websiteUrl=\"Please enter a valid URL\";}setErrors(newErrors);return!newErrors.email&&!newErrors.websiteUrl;};const handleSubmit=async e=>{e.preventDefault();setErrors(prev=>({...prev,general:\"\"}));if(!validateInputs())return;setVerifyingUrl(true);const siteExists=await verifyWebsiteExists(websiteUrl);setVerifyingUrl(false);if(!siteExists){setErrors(prev=>({...prev,websiteUrl:\"Website not reachable — check the URL and try again\"}));return;}setLoading(true);try{const encodedEmail=encodeURIComponent(email);const encodedUrl=encodeURIComponent(normalizeUrl(websiteUrl));const redirectUrl=`${props.successRedirectUrl}?email=${encodedEmail}&website=${encodedUrl}`;window.location.href=redirectUrl;}catch(error){console.error(\"Submission error:\",error);setErrors(prev=>({...prev,general:\"Something went wrong. Please try again.\"}));}finally{setLoading(false);}};const isSubmitting=loading||verifyingUrl;const buttonLabel=verifyingUrl?\"Verifying website...\":loading?\"Submitting...\":\"Start your free 14-Day trial\";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\"},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\",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\"},children:errors.email})]}),/*#__PURE__*/_jsxs(\"label\",{style:{fontWeight:500},children:[\"Your website URL\",/*#__PURE__*/_jsx(\"span\",{style:{color:\"#FF4D4F\"},children:\"*\"}),/*#__PURE__*/_jsx(\"input\",{type:\"text\",placeholder:\"bluumly.com\",value:websiteUrl,onChange:handleWebsiteUrlChange,style:{marginTop:\"6px\",padding:\"14px\",border:`1px solid ${errors.websiteUrl?\"#FF4D4F\":\"#E0E0E0\"}`,borderRadius:\"12px\",fontSize:\"14px\",width:\"100%\",boxSizing:\"border-box\",boxShadow:errors.websiteUrl?\"0 0 0 3px rgba(255, 77, 79, 0.1)\":undefined}}),errors.websiteUrl&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#FF4D4F\",fontSize:\"12px\",marginTop:\"4px\"},children:errors.websiteUrl})]}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:isSubmitting,style:{backgroundColor:isSubmitting?\"#A0A0A0\":\"#D45500\",color:\"white\",padding:\"16px\",border:\"none\",borderRadius:\"999px\",fontSize:\"16px\",fontWeight:\"bold\",cursor:isSubmitting?\"not-allowed\":\"pointer\",marginTop:\"8px\",transition:\"background-color 0.2s ease\"},children:buttonLabel})]}),/*#__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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