{"version":3,"file":"Email_save.BNqEkk5z.mjs","names":[],"sources":["https:/framerusercontent.com/modules/mqfJgwCRKtjUdOJG4TQF/eDDsWGcavTjYcz9b36d6/Email_save.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{EmailDomainList}from\"https://framerusercontent.com/modules/4XCbkV06reIR1Un4aQCF/4qeopk5sX2QHq7uBlrwh/EmailDomainList.js\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({email:\"\",website:\"\"});//helper function\nexport function validateEmail(email){const emailValue=email.trim();const blockedDomains=EmailDomainList;const emailPattern=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;if(!emailPattern.test(emailValue)){return false;}const emailDomain=emailValue.split(\"@\")[1];if(blockedDomains.includes(emailDomain)){// if (typeof window !== \"undefined\" && (window as any).posthog) {\n//     ;(window as any).posthog.capture(\"junk_lead_submission_attempt\", {\n//         email: emailValue,\n//     })\n// }\nreturn false;}return true;}export function validateWebsite(website){const websiteValue=website.trim();// Basic empty check\nif(!websiteValue){return false;}// Add protocol if missing for validation\nlet urlToValidate=websiteValue;if(!websiteValue.match(/^https?:\\/\\//)){urlToValidate=\"https://\"+websiteValue;}// Website URL pattern validation\nconst websitePattern=/^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&=]*)$/;if(!websitePattern.test(urlToValidate)){return false;}// Extract domain for blocked domain check\ntry{const urlObj=new URL(urlToValidate);const websiteDomain=urlObj.hostname.replace(/^www\\./,\"\");}catch(error){return false;}// console.log(\"Valided checked\")\nreturn true;}export function validateWebsiteInput(input){const value=input.value.trim();// Basic empty check\nif(!value){input.setCustomValidity(\"Please enter a website URL\");return false;}// Add protocol if missing for validation\nlet urlToValidate=value;if(!value.match(/^https?:\\/\\//)){urlToValidate=\"https://\"+value;}// URL pattern validation\nconst urlPattern=/^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&=]*)$/;if(!urlPattern.test(urlToValidate)){input.setCustomValidity(\"Invalid website URL\");return false;}// Extract domain for further validation\ntry{const urlObj=new URL(urlToValidate);const domain=urlObj.hostname.replace(/^www\\./,\"\");// Check against blocked domains (personal sites, social media, etc.)\nif(BlockedWebsiteDomains.includes(domain)){// window.posthog?.capture(\"junk_website_submission_attempt\", {\n//     website: value || \"website@notfound.com\",\n// })\ninput.setCustomValidity(\"Please enter your business website\");return false;}// Additional validation: ensure it's not just a subdomain without proper domain\nif(!domain.includes(\".\")||domain.split(\".\").length<2){input.setCustomValidity(\"Invalid website URL\");return false;}}catch(error){input.setCustomValidity(\"Invalid website URL\");return false;}input.setCustomValidity(\"\");return true;}// Example blocked domains list (you can customize this)\nconst BlockedWebsiteDomains=[// Generic/placeholder domains\n\"example.com\",\"test.com\",\"localhost\",\"127.0.0.1\"];export function withEmailPass(Component){return props=>{const[store]=useStore();// const getEmail = WithEmailValue() // ✅ Hook inside a function component\nconsole.log(\"WithEmailPass: \",store.email);return /*#__PURE__*/_jsx(Component,{...props,getEmail:validateEmail(store.email)?store.email:\"\",getWebsite:validateWebsite(store.website)?store.website:\"\"});};}export function withWebsitePass(Component){return props=>{const[store]=useStore();// const getEmail = WithEmailValue() // ✅ Hook inside a function component\nconsole.log(\"WithWebsitePass: \",store.website);return /*#__PURE__*/_jsx(Component,{...props,getWebsite:validateWebsite(store.website)?store.website:\"\"});};}function validateEmailInput(input){const value=input.value.trim();const emailPattern=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;if(!emailPattern.test(value)){input.setCustomValidity(\"Invalid email\");return false;}const domain=value.split(\"@\")[1];if(EmailDomainList.includes(domain)){// window.posthog?.capture(\"junk_lead_submission_attempt\", {\n//     email: value || \"email@notfound.com\",\n// })\ninput.setCustomValidity(\"Please enter your business email\");return false;}input.setCustomValidity(\"\");return true;}export function withEmailSave(Component){return props=>{const[store,setStore]=useStore();console.log(\"WithEmailSave: \",store.email);return /*#__PURE__*/_jsx(Component,{...props,onChange:e=>{const target=e.target;validateEmailInput(target);setStore(prev=>({...prev,email:target.value}));}});};}export function withWebsiteSave(Component){return props=>{const[store,setStore]=useStore();console.log(\"WithEmailSave: \",store.website);return /*#__PURE__*/_jsx(Component,{...props,onChange:e=>{const target=e.target;validateWebsiteInput(target);setStore(prev=>({...prev,website:target.value}));}});};}export function withFormEmailInsert(Component){return props=>{const[store,setStore]=useStore();useEffect(()=>{const selector=window.location.href.includes(\"/sale\")?'input[type=\"email\"]':'.focus-form-full input[type=\"email\"]';const emailField=document.querySelector(selector);if(emailField){emailField.value=store.email;validateEmailInput(emailField);}},[store.email]);return /*#__PURE__*/_jsx(Component,{...props,onChange:e=>{const target=e.target;validateEmailInput(target);prev=>({...prev,email:target.value});}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withEmailPass\":{\"type\":\"reactHoc\",\"name\":\"withEmailPass\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFormEmailInsert\":{\"type\":\"reactHoc\",\"name\":\"withFormEmailInsert\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"validateWebsiteInput\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEmailSave\":{\"type\":\"reactHoc\",\"name\":\"withEmailSave\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"validateEmail\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"validateWebsite\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWebsiteSave\":{\"type\":\"reactHoc\",\"name\":\"withWebsiteSave\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWebsitePass\":{\"type\":\"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