{"version":3,"file":"Examples_1.UxAemo5Q.mjs","names":[],"sources":["https:/framerusercontent.com/modules/l5MleDDbh89SL5raJVlE/JrIuIJW2YaVKOQBQOJqN/Examples_1.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";const useStore=createStore({background:\"#0099FF\",email:\"\"});/** Cookie helpers */function getCookie(name){if(typeof document===\"undefined\")return\"\";const escaped=name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g,\"\\\\$&\");const match=document.cookie.match(new RegExp(\"(^| )\"+escaped+\"=([^;]+)\"));return match?decodeURIComponent(match[2]):\"\";}function setCookie(name,value,days=90){if(typeof document===\"undefined\")return;const maxAge=days*24*60*60;document.cookie=`${name}=${encodeURIComponent(value)}; path=/; max-age=${maxAge}; SameSite=Lax`;}function nowSeconds(){return Math.floor(Date.now()/1e3);}/**\n * IMPORTANT:\n * - If Meta Pixel is installed, it usually creates _fbp automatically.\n * - We treat _fbp as READ-ONLY (we do not overwrite it) to avoid fighting other scripts.\n */function getFbpReadOnly(){const fbp=getCookie(\"_fbp\");return fbp||\"\";}/**\n * _fbc may not exist even if there is a fbclid in the URL.\n * In that case, we create _fbc with the correct Meta format (SECONDS timestamp).\n */function getOrCreateFbcFromFbclid(fbclid){const existing=getCookie(\"_fbc\");if(existing)return existing;if(!fbclid)return\"\";const fbc=`fb.1.${nowSeconds()}.${fbclid}`;setCookie(\"_fbc\",fbc,90);return fbc;}/** Get fbclid from URL + fbc + fbp */function getMetaParams(){if(typeof window===\"undefined\")return{fbclid:\"\",fbc:\"\",fbp:\"\"};const urlParams=new URLSearchParams(window.location.search);const fbclid=urlParams.get(\"fbclid\")||\"\";const fbp=getFbpReadOnly();const fbc=getOrCreateFbcFromFbclid(fbclid);return{fbclid,fbc,fbp};}// Send data to your webhook\nasync function sendToWebhook(payload){const webhookUrl=\"https://api.speechly.io/lead\";try{const res=await fetch(webhookUrl,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({...payload,timestamp:new Date().toISOString(),source:\"framer_lp\"})});console.log(\"Webhook response:\",res.status);return res.ok;}catch(err){console.error(\"Webhook error:\",err);return false;}}// Override: capture email from an input\nexport function withEmailCapture(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,value:store.email,onChange:e=>{setStore({email:e.target.value});if(props.onChange)props.onChange(e);}});});}// Override: submit button tracking\nexport function withSubmitTracking(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();const handleClick=async e=>{const email=(store.email||\"\").trim();if(!email){console.log(\"No email captured\");if(props.onClick)props.onClick(e);return;}window?.datafast(\"mobile_mail\");const{fbclid,fbc,fbp}=getMetaParams();const page_url=typeof window!==\"undefined\"?window.location.href:\"\";const toSend={email,fbclid,fbc,fbp,page_url};console.log(\"Sending:\",toSend);await sendToWebhook(toSend);if(props.onClick)props.onClick(e);};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick});});}// Existing overrides\nexport function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>/*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}}));}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>/*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}}));}export function withRandomColor(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{background:store.background},onClick:()=>setStore({background:randomColor()})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEmailCapture\":{\"type\":\"reactHoc\",\"name\":\"withEmailCapture\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSubmitTracking\":{\"type\":\"reactHoc\",\"name\":\"withSubmitTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples_1.map"],"mappings":"+LAAoS,SAAS,EAAU,EAAK,CAAC,GAAG,OAAO,SAAW,IAAY,MAAM,GAAG,IAAM,EAAQ,EAAK,QAAQ,2BAA2B,OAAO,CAAO,EAAM,SAAS,OAAO,MAAU,OAAO,QAAQ,EAAQ,WAAW,CAAC,CAAC,OAAO,EAAM,mBAAmB,EAAM,GAAG,CAAC,GAAI,SAAS,EAAU,EAAK,EAAM,EAAK,GAAG,CAAC,GAAG,OAAO,SAAW,IAAY,OAAO,IAAM,EAAO,EAAK,GAAG,GAAG,GAAG,SAAS,OAAO,GAAG,EAAK,GAAG,mBAAmB,EAAM,CAAC,oBAAoB,EAAO,gBAAiB,SAAS,GAAY,CAAC,OAAO,KAAK,MAAM,KAAK,KAAK,CAAC,IAAI,CAI5xB,SAAS,GAAgB,CAA6B,OAAlB,EAAU,OAAO,EAAa,GAGlE,SAAS,EAAyB,EAAO,CAAC,IAAM,EAAS,EAAU,OAAO,CAAC,GAAG,EAAS,OAAO,EAAS,GAAG,CAAC,EAAO,MAAM,GAAG,IAAM,EAAI,QAAQ,GAAY,CAAC,GAAG,IAAkC,OAAzB,EAAU,OAAO,EAAI,GAAG,CAAQ,EAA2C,SAAS,GAAe,CAAC,GAAU,IAAS,OAAY,MAAM,CAAC,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,CAA6D,IAAM,EAAlD,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAwB,IAAI,SAAS,EAAE,GAAS,EAAI,GAAgB,CAA4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