{"version":3,"file":"formSubmit.DbKefQ_y.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx","useRef"],"sources":["https:/framerusercontent.com/modules/DPG5KmlXQVukTups6fvx/aj4T51WNmTg0LjK5R34R/FocusOverride.js","https:/framerusercontent.com/modules/NJsvWibBq7jMJeZ5m5jH/q1nfPtZ9zzQ1kTRaHSeX/formSubmit.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{Data}from\"framer\";// This stores whether the input is focused\nconst data=Data({isFocused:false});// Apply this override to the input field\nexport function FocusStyle(){return{onFocus:()=>{data.isFocused=true;},onBlur:()=>{data.isFocused=false;},style:{border:\"1px solid #202020\",outline:\"none\",boxShadow:\"none\",transition:\"border-color 0.2s ease\",appearance:\"none\"}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withFocusStyle(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...FocusStyle(props)});};}withFocusStyle.displayName=\"FocusStyle\";\nexport const __FramerMetadata__ = {\"exports\":{\"FocusStyle\":{\"type\":\"override\",\"name\":\"FocusStyle\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFocusStyle\":{\"type\":\"reactHoc\",\"name\":\"withFocusStyle\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FocusOverride.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect}from\"react\";export function withCustomFormSubmit(Component){return props=>{const formRef=useRef(null);const handleSubmit=e=>{e.preventDefault();const email=formRef.current?.querySelector(\"input[type='email']\")?.value;const utms=new URLSearchParams(window.location.search).toString();const redirectUrl=`https://app.materio.co/signup?email=${encodeURIComponent(email||\"\")}${utms?\"&\"+utms:\"\"}`;window.location.href=redirectUrl;};useEffect(()=>{const form=formRef.current;if(form){form.addEventListener(\"submit\",handleSubmit);return()=>form.removeEventListener(\"submit\",handleSubmit);}else{console.warn(\"No form element found\");}},[]);return /*#__PURE__*/_jsx(Component,{ref:formRef,...props});};}export function withCustomFormSubmit2(Component){return props=>{const formRef=useRef(null);const handleSubmit=async e=>{e.preventDefault();const form=formRef.current;const email=form?.querySelector(\"input[type='email']\")?.value||\"\";const formData=new FormData(form);try{// Submit the form data using fetch to the form's action (Framer handles this behind the scenes)\nawait fetch(form.action,{method:\"POST\",body:formData,headers:{Accept:\"application/json\"}});}catch(err){console.error(\"Failed to submit form to sheet\",err);}// Redirect after submission\nconst utms=new URLSearchParams(window.location.search).toString();const redirectUrl=`https://app.materio.co/signup?email=${encodeURIComponent(email)}${utms?\"&\"+utms:\"\"}`;window.location.href=redirectUrl;};useEffect(()=>{const form=formRef.current;if(form){form.addEventListener(\"submit\",handleSubmit);return()=>form.removeEventListener(\"submit\",handleSubmit);}},[]);return /*#__PURE__*/_jsx(Component,{ref:formRef,...props});};}export function withCustomFormSubmit3(Component){return props=>{const formRef=useRef(null);const handleSubmit=e=>{// Don't prevent default — we want native submission\nconst form=formRef.current;if(!form)return;const email=form.querySelector(\"input[type='email']\")?.value||\"\";const utms=new URLSearchParams(window.location.search).toString();const redirectUrl=`https://app.materio.co/signup?email=${encodeURIComponent(email)}${utms?\"&\"+utms:\"\"}`;// Delay the redirect slightly to let form submission complete\nsetTimeout(()=>{window.location.href=redirectUrl;},500)// Adjust delay if needed (300–600ms is usually safe)\n;};useEffect(()=>{const form=formRef.current;if(form){form.addEventListener(\"submit\",handleSubmit);return()=>form.removeEventListener(\"submit\",handleSubmit);}else{console.warn(\"No form element found\");}},[]);return /*#__PURE__*/_jsx(Component,{ref:formRef,...props});};}export function withCustomFormSubmitSimple(Component){return props=>{const formRef=useRef(null);const handleSubmit=e=>{// Don't prevent default - let Framer's native submission happen\nconst form=formRef.current;if(!form)return;const email=form.querySelector(\"input[type='email']\")?.value||\"\";// Wait longer and check for completion indicators\nsetTimeout(()=>{const utms=new URLSearchParams(window.location.search).toString();const redirectUrl=`https://app.materio.co/signup?email=${encodeURIComponent(email)}${utms?\"&\"+utms:\"\"}`;window.location.href=redirectUrl;},1e3)// Increased to 1.5 seconds\n;};useEffect(()=>{const form=formRef.current;if(form){form.addEventListener(\"submit\",handleSubmit);return()=>form.removeEventListener(\"submit\",handleSubmit);}else{console.warn(\"No form element found\");}},[]);return /*#__PURE__*/_jsx(Component,{ref:formRef,...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withCustomFormSubmit2\":{\"type\":\"reactHoc\",\"name\":\"withCustomFormSubmit2\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCustomFormSubmit\":{\"type\":\"reactHoc\",\"name\":\"withCustomFormSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCustomFormSubmit3\":{\"type\":\"reactHoc\",\"name\":\"withCustomFormSubmit3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCustomFormSubmitSimple\":{\"type\":\"reactHoc\",\"name\":\"withCustomFormSubmitSimple\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./formSubmit.map"],"mappings":"uMAEA,SAAgB,GAAY,CAAC,MAAM,CAAC,YAAY,CAAC,EAAK,UAAU,IAAO,WAAW,CAAC,EAAK,UAAU,IAAQ,MAAM,CAAC,OAAO,oBAAoB,QAAQ,OAAO,UAAU,OAAO,WAAW,yBAAyB,WAAW,OAAO,CAAC,CAAqJ,SAAgB,EAAe,EAAE,CAAC,MAAO,KAAQ,EAA+BA,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAW,EAAM,CAAC,CAAC,qBAFpf,IAAyB,IAEiO,CAD/R,EAAK,EAAK,CAAC,UAAU,GAAM,CAAC,CACigB,EAAe,YAAY,gBCGhT,SAAgB,EAA2B,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAQC,EAAO,KAAK,CAAO,EAAa,GAAG,CACpY,IAAM,EAAK,EAAQ,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,EAAM,EAAK,cAAc,sBAAsB,EAAE,OAAO,GACzG,eAAe,CAAC,IAAM,EAAK,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAC,UAAU,CAAO,EAAY,uCAAuC,mBAAmB,EAAM,GAAG,EAAK,IAAI,EAAK,KAAK,EAAO,SAAS,KAAK,GAAc,IAAI,EACjB,OAA7M,MAAc,CAAC,IAAM,EAAK,EAAQ,QAAQ,GAAG,EAAmD,OAA7C,EAAK,iBAAiB,SAAS,EAAa,KAAW,EAAK,oBAAoB,SAAS,EAAa,CAAO,QAAQ,KAAK,wBAAwB,EAAI,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,IAAI,EAAQ,GAAG,EAAM,CAAC,uBAR/N,IAAoC"}