{"version":3,"file":"LeadMagnetFormPosts.CIk9AxZe.mjs","names":["useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/umrpsK34oI3EGzWg9bqm/WZXEXGOYF9YyopGXKVUI/LeadMagnetFormPosts.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";export default function SubscribePostModule(props){const formUrl=\"https://api.callblitz.com/user/lead-magnet\";const[email,setEmail]=useState(\"\");const inputEmailRef=useRef(null);const[linkedURL,setlinkedURL]=useState(\"\");const inputLinkedURLRef=useRef(null);const[phone,setPhone]=useState(\"\");const inputPhoneRef=useRef(null);const[hovered,setHovered]=useState(false);const[formStatus,setFormStatus]=useState(\"unsubmitted\");const[errorMessage,setErrorMessage]=useState(\"\");const[currentPageUrl,setCurrentPageUrl]=useState(\"\");useEffect(()=>{setCurrentPageUrl(window.location.href);},[]);const onSubmit=async event=>{event.preventDefault();try{const response=await fetch(formUrl,{method:\"POST\",body:JSON.stringify({email,phone,linkedin_url:linkedURL,url:currentPageUrl,resource:\"lead-magnet\"}),headers:{\"Content-Type\":\"application/json\"}});if(!response.ok){const errorText=await response.text();throw new Error(`Network response was not ok: ${errorText}`);}await response.json();setFormStatus(\"submitted\");setEmail(\"\");setlinkedURL(\"\");setPhone(\"\");if(inputLinkedURLRef.current){inputLinkedURLRef.current.classList.add(\"empty\");}// redirect\nwindow.location.href=\"https://callblitz.com/lead-magnet-confirmation\";}catch(error){console.error(\"Error during form submission: \",error);setErrorMessage(error.message);setFormStatus(\"error\");}};const handleEmailChange=event=>{setEmail(event.target.value);};const handlePhoneChange=event=>{setPhone(event.target.value);};const handleLinkedURLChange=event=>{const newValue=event.target.value;setlinkedURL(newValue);if(inputLinkedURLRef.current){if(newValue===\"\"){inputLinkedURLRef.current.classList.add(\"empty\");}else{inputLinkedURLRef.current.classList.remove(\"empty\");}}};const inputStyle={width:\"100%\",fontSize:\"16px\",lineHeight:\"24px\",padding:\"8px 16px\",height:\"40px\",margin:\"0\",border:\"1px solid white\",backgroundColor:\"transparent\",fontFamily:'\"Poppins\", \"Poppins Placeholder\", sans-serif',borderRadius:\"4px\",color:\"white\",marginBottom:\"16px\",fontWeight:\"400\"};const submitButtonStyle={fontSize:\"16px\",lineHeight:\"1.5\",fontWeight:\"600\",backgroundColor:\"#00A0F7\",color:\"#F0F0F0\",border:\"none\",cursor:\"pointer\",padding:\"8px 13px\",fontFamily:'\"Poppins\", \"Poppins Placeholder\", sans-serif',borderRadius:\"4px\",width:\"100%\",gridColumn:\"1 / -1\",transition:\"background-color 0.3s ease, color 0.3s ease\"};const h3SuccessStyle={fontFamily:'\"Poppins\", \"Poppins Placeholder\", sans-serif',fontSize:\"24px\",fontWeight:\"700\",lineHeight:\"36px\",marginBottom:\"16px\",textAlign:\"center\",marginTop:\"24px\",color:\"white\"};return /*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(\"form\",{onSubmit:onSubmit,\"data-resource\":\"newsletter\",children:/*#__PURE__*/_jsx(\"div\",{children:/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"input\",{className:\"miniFormInput\",type:\"email\",value:email,onChange:handleEmailChange,placeholder:\"Email*\",required:true,style:inputStyle}),/*#__PURE__*/_jsx(\"input\",{className:\"miniFormInput\",type:\"text\",value:linkedURL,onChange:handleLinkedURLChange,placeholder:\"Linkedln URL\",required:true,style:inputStyle}),/*#__PURE__*/_jsx(\"input\",{className:\"miniFormInput\",type:\"tel\",value:phone,onChange:handlePhoneChange,placeholder:\"Phone Number\",required:true,style:inputStyle}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",value:\"Get my free guide\",style:{...submitButtonStyle,backgroundColor:hovered?\"#F9FF00\":\"#00A0F7\",color:hovered?\"#000\":\"#FFF\"},onMouseEnter:()=>setHovered(true),onMouseLeave:()=>setHovered(false),children:\"Get my free guide\"})]})})})});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SubscribePostModule\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LeadMagnetFormPosts.map"],"mappings":"4JAA4H,SAAwB,EAAoB,EAAM,CAAC,GAAgE,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAqB,EAAO,KAAK,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,GAAG,CAAO,EAAkBC,EAAO,KAAK,CAAM,CAAC,EAAM,GAAUD,EAAS,GAAG,CAAqB,EAAO,KAAK,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAW,GAAeA,EAAS,cAAc,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAG,CAAM,CAAC,EAAe,GAAmBA,EAAS,GAAG,CAAC,MAAc,CAAC,EAAkB,EAAO,SAAS,KAAK,EAAG,EAAE,CAAC,CAAC,IAAM,EAAS,KAAM,IAAO,CAAC,EAAM,gBAAgB,CAAC,GAAG,CAAC,IAAM,EAAS,MAAM,MAAM,6CAAQ,CAAC,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,QAAM,QAAM,aAAa,EAAU,IAAI,EAAe,SAAS,cAAc,CAAC,CAAC,QAAQ,CAAC,eAAe,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAS,GAAG,CAAC,IAAM,EAAU,MAAM,EAAS,MAAM,CAAC,MAAU,MAAM,gCAAgC,IAAY,CAAE,MAAM,EAAS,MAAM,CAAC,EAAc,YAAY,CAAC,EAAS,GAAG,CAAC,EAAa,GAAG,CAAC,EAAS,GAAG,CAAI,EAAkB,SAAS,EAAkB,QAAQ,UAAU,IAAI,QAAQ,CACluC,EAAO,SAAS,KAAK,uDAAwD,EAAM,CAAC,QAAQ,MAAM,iCAAiC,EAAM,CAAC,EAAgB,EAAM,QAAQ,CAAC,EAAc,QAAQ,GAAU,EAAkB,GAAO,CA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