{
  "version": 3,
  "sources": ["ssg: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() // \u2705 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() // \u2705 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\":\"reactHoc\",\"name\":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AE,eAAQ,IAAI,kBAAkBF,EAAM,OAAO,EAAsBG,EAAKL,EAAU,CAAC,GAAGC,EAAM,SAASK,GAAG,CAAC,IAAMC,EAAOD,EAAE,OAAOI,EAAqBH,CAAM,EAAEJ,EAASK,IAAO,CAAC,GAAGA,EAAK,QAAQD,EAAO,KAAK,EAAE,CAAE,CAAC,CAAC,CAAE,CAAE",
  "names": ["init_ssg_sandbox_shims", "useStore", "createStore", "validateEmail", "email", "emailValue", "blockedDomains", "EmailDomainList", "emailDomain", "validateWebsite", "website", "websiteValue", "urlToValidate", "websiteDomain", "validateWebsiteInput", "input", "value", "domain", "BlockedWebsiteDomains", "withEmailPass", "Component", "props", "store", "p", "validateEmailInput", "input", "value", "domain", "EmailDomainList", "withEmailSave", "Component", "props", "store", "setStore", "useStore", "p", "e", "target", "prev", "withWebsiteSave", "validateWebsiteInput"]
}
