{"version":3,"file":"Webhook_Form_One_Click.CuMMHTiv.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/fVnJObegeKgBShwpM4vY/KCtVB9YwIz3KzgCwy3qt/Webhook_Form_One_Click.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";export default function WebhookFormOneClick(){const[isSubmitting,setIsSubmitting]=useState(false);const[message,setMessage]=useState(\"\");const[email,setEmail]=useState(\"\");const handleSubmit=async e=>{e.preventDefault();setIsSubmitting(true);setMessage(\"\");// Fire GTM event (updated for GTM compatibility)\nif(typeof window!==\"undefined\"&&window.dataLayer){window.dataLayer.push({event:\"form_submit\",form_name:\"Try One Click\",form_type:\"email_capture\",page_location:window.location.href,page_title:document.title,page_path:window.location.pathname});console.log(\"📊 GTM Event: form_submit | Form: Try One Click\");}const formData=new FormData(e.target);const data=Object.fromEntries(formData.entries());try{const response=await fetch(\"https://try.upvio.com/api/try\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\",Accept:\"application/json\"},body:JSON.stringify(data),mode:\"cors\",credentials:\"include\"});if(!response.ok){throw new Error(\"Network response was not ok\");}const result=await response.json();if(result.url){// Fire successful form submission event before redirect\nif(typeof window!==\"undefined\"&&window.dataLayer){window.dataLayer.push({event:\"form_submit_success\",form_name:\"Try One Click\",form_type:\"email_capture\",redirect_url:result.url});}// Small delay to ensure event sends before navigation\nsetTimeout(()=>{window.location.href=result.url;},300);}else if(result.emailSent===true){// Fire email sent event\nif(typeof window!==\"undefined\"&&window.dataLayer){window.dataLayer.push({event:\"form_submit_success\",form_name:\"Try One Click\",form_type:\"email_capture\",result:\"email_sent\"});}setMessage(\"Please check your email for a link to continue.\");setIsSubmitting(false);}}catch(error){console.error(\"Error submitting form:\",error);// Fire form error event\nif(typeof window!==\"undefined\"&&window.dataLayer){window.dataLayer.push({event:\"form_submit_error\",form_name:\"Try One Click\",form_type:\"email_capture\",error_message:error.message});}setMessage(\"Something went wrong. Please try again.\");setIsSubmitting(false);}};return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",maxWidth:\"600px\"},children:[/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",gap:\"0\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:\"email\",value:email,onChange:e=>setEmail(e.target.value),placeholder:\"youremail@domain.com\",required:true,disabled:isSubmitting,style:{flex:\"2\",padding:\"16px 20px\",backgroundColor:\"rgba(17, 17, 17, 0.8)\",border:\"1px solid rgb(91, 83, 255)\",borderRight:\"none\",borderRadius:\"4px 0 0 4px\",color:\"white\",fontSize:\"16px\",outline:\"none\",fontFamily:\"Outfit\",boxShadow:\"0 0 20px rgba(91, 83, 255, 0.3)\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:isSubmitting,style:{flex:\"1\",padding:\"16px 24px\",backgroundColor:isSubmitting?\"rgba(91, 83, 255, 0.5)\":\"rgb(91, 83, 255)\",color:\"white\",border:\"1px solid rgb(91, 83, 255)\",borderRadius:\"0 4px 4px 0\",fontSize:\"16px\",fontWeight:\"600\",cursor:isSubmitting?\"not-allowed\":\"pointer\",whiteSpace:\"nowrap\",fontFamily:\"Outfit\",transition:\"all 0.2s ease\",boxShadow:\"0 0 20px rgba(91, 83, 255, 0.3)\"},onMouseEnter:e=>{if(!isSubmitting){e.currentTarget.style.backgroundColor=\"rgb(75, 65, 235)\";e.currentTarget.style.boxShadow=\"0 0 30px rgba(91, 83, 255, 0.5)\";}},onMouseLeave:e=>{if(!isSubmitting){e.currentTarget.style.backgroundColor=\"rgb(91, 83, 255)\";e.currentTarget.style.boxShadow=\"0 0 20px rgba(91, 83, 255, 0.3)\";}},children:isSubmitting?\"Processing...\":\"Try a Scan\"})]}),message&&/*#__PURE__*/_jsx(\"div\",{style:{marginTop:\"20px\",padding:\"16px 20px\",backgroundColor:\"rgba(17, 17, 17, 0.8)\",border:\"1px solid rgb(91, 83, 255)\",borderRadius:\"4px\",color:\"white\",fontSize:\"14px\",fontFamily:\"Outfit\",textAlign:\"center\",boxShadow:\"0 0 20px rgba(91, 83, 255, 0.3)\"},children:message})]});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WebhookFormOneClick\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Webhook_Form_One_Click.map"],"mappings":"uIAAqF,SAAwB,GAAqB,CAAC,GAAK,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAKM,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,SAAS,QAAQ,CAAC,SAAS,CAAc,EAAM,OAAO,CAAC,SAL9F,KAAM,IAAG,CAAC,EAAE,gBAAgB,CAAC,EAAgB,GAAK,CAAC,EAAW,GAAG,CAC3U,IAAS,QAAa,EAAO,YAAW,EAAO,UAAU,KAAK,CAAC,MAAM,cAAc,UAAU,gBAAgB,UAAU,gBAAgB,cAAc,EAAO,SAAS,KAAK,WAAW,SAAS,MAAM,UAAU,EAAO,SAAS,SAAS,CAAC,CAAC,QAAQ,IAAI,kDAAkD,EAAE,IAAM,EAAS,IAAI,SAAS,EAAE,OAAO,CAAO,EAAK,OAAO,YAAY,EAAS,SAAS,CAAC,CAAC,GAAG,CAAC,IAAM,EAAS,MAAM,MAAM,gCAAgC,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,mBAAmB,OAAO,mBAAmB,CAAC,KAAK,KAAK,UAAU,EAAK,CAAC,KAAK,OAAO,YAAY,UAAU,CAAC,CAAC,GAAG,CAAC,EAAS,GAAI,MAAU,MAAM,8BAA8B,CAAE,IAAM,EAAO,MAAM,EAAS,MAAM,CAAI,EAAO,KACjsB,IAAS,QAAa,EAAO,WAAW,EAAO,UAAU,KAAK,C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