{"version":3,"file":"Auth.CF14IqNy.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/vBkuuhMNueannTfHrKsD/OMS6LyV4NAEnWc6GIZZZ/Auth.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";function MyComponent(){const defaultFormData={fullName:\"\",email:\"\",message:\"\"};const[formData,setFormData]=useState(defaultFormData);const handleChange=e=>{const{name,value}=e.target;setFormData({...formData,[name]:value});};const[isLoading,setIsLoading]=useState(false);const[showSuccessMessage,setShowSuccessMessage]=useState(false)// State to control success message visibility\n;const[errorMessage,setErrorMessage]=useState(null);const[showForm,setShowForm]=useState(true);const handleSubmit=async e=>{setIsLoading(true);function splitFullName(fullName){const parts=fullName.split(\" \");if(parts.length===2){const[firstName,lastName]=parts;return{firstName,lastName};}else if(parts.length>2){const firstName=parts[0];const lastName=parts.slice(1).join(\" \");return{firstName,lastName};}else{return{firstName:fullName,lastName:\"\"};}}e.preventDefault();console.log(\"Form data submitted:\",formData);var authHeaders=new Headers;authHeaders.append(\"Content-Type\",\"application/json\");// Matomo Tracking\nif(window._paq){window._paq.push([\"trackEvent\",\"prayer-partner-event\",\"click\",`prayer-partner`]);}// const { firstName, lastName } = splitFullName(formData?.fullName)\ntry{// API Request\nvar apiHeaders=new Headers;apiHeaders.append(\"Content-Type\",\"application/json\");apiHeaders.append(\"x-api-key\",\"XY1yrTW5nCTiwXh0DVaq926QV9ddI3QU\");const searchParams=new URLSearchParams(window.location.search);const ref=searchParams.get(\"ref\");var apiRaw=JSON.stringify({email:formData===null||formData===void 0?void 0:formData.email,message:formData===null||formData===void 0?void 0:formData.message,fullName:formData===null||formData===void 0?void 0:formData.fullName,portal:\"HOPEFORME\",page:window.location.href,ref});var apiRequestOptions={method:\"POST\",headers:apiHeaders,body:apiRaw,redirect:\"follow\"};// const requestId = `support-group-${new Date().getTime()}`\nconst apiResponse=await fetch(`https://hope4america-rest-server.cpptl.co/send-email`,apiRequestOptions);if((apiResponse===null||apiResponse===void 0?void 0:apiResponse.status)!==200){setErrorMessage(\"Something went wrong!!\");return;}setIsLoading(false)// Clear loading state\n;// setShowForm(false);\nsetShowSuccessMessage(true);setErrorMessage(null);setFormData(defaultFormData);setTimeout(()=>{window.location.href=\"https://hopeforme.us/resources\";},500);}catch(error){console.log(\"Error:\",error);setIsLoading(false)// Clear loading state\n;setErrorMessage(\"Something went wrong\");setShowSuccessMessage(false);}};return /*#__PURE__*/_jsx(\"div\",{style:{backgroundColor:\"#131720\"},children:showForm&&/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"column\",rowGap:\"24px\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"text\",id:\"fullName\",name:\"fullName\",value:formData.fullName,onChange:handleChange,required:true,placeholder:\"First Name\",style:{fontFamily:\"Poppins!important\",fontSize:\"1rem\",fontStyle:\"normal\",color:\"#E2BBA0\",borderRadius:\"0.25rem\",border:\"1px solid #E2BBA0\",backgroundColor:\"#131720\",width:\"100%\",height:\"100%\",padding:\"0.625rem 1rem\",alignItems:\"center\"}}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",id:\"email\",name:\"email\",value:formData.email,onChange:handleChange,required:true,placeholder:\"Email\",style:{fontFamily:\"Poppins!important\",fontSize:\"1rem\",fontStyle:\"normal\",color:\"#E2BBA0\",borderRadius:\"0.25rem\",border:\"1px solid #E2BBA0\",backgroundColor:\"#131720\",width:\"100%\",height:\"100%\",padding:\"0.625rem 1rem\",alignItems:\"center\"}}),/*#__PURE__*/_jsx(\"textarea\",{id:\"message\",name:\"message\",value:formData.message,onChange:handleChange,required:true,placeholder:\"Message\",style:{fontFamily:\"Poppins!important\",fontSize:\"1rem\",fontStyle:\"normal\",color:\"#E2BBA0\",borderRadius:\"0.25rem\",border:\"1px solid #E2BBA0\",backgroundColor:\"#131720\",width:\"100%\",height:\"100px\",padding:\"0.625rem 1rem\",alignItems:\"center\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{color:\"#E2BBA0\",borderRadius:\"0.25rem\",border:\"1px solid #E2BBA0\",backgroundColor:\"#E2BBA0\",width:\"100%\",padding:\"0.625rem 1rem\",alignItems:\"center\",cursor:\"pointer\"},children:/*#__PURE__*/_jsx(\"span\",{style:{color:\"#000\",textAlign:\"center\",fontFamily:\"Poppins!important\",fontSize:\"1rem\",fontStyle:\"normal\",fontWeight:\"bold\",lineHeight:\"normal\",textTransform:\"uppercase\"},children:isLoading?\"Success! Your form was submitted\":\"Send your message to a prayer partner\"})}),errorMessage&&/*#__PURE__*/_jsxs(\"p\",{style:{color:\"red\",fontSize:\"1rem\",fontStyle:\"normal\",fontWeight:\"bold\",lineHeight:\"normal\"},children:[\"Error: \",errorMessage]}),showSuccessMessage&&/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",color:\"#000000\",fontSize:\"1rem\",fontStyle:\"normal\",fontWeight:\"bold\",lineHeight:\"normal\",borderRadius:\"0.25rem\",border:\"1px solid #E2BBA0\",backgroundColor:\"#E2BBA0\",width:\"100%\",textAlign:\"center!important\"},children:/*#__PURE__*/_jsx(\"a\",{style:{color:\"#000000\",display:\"flex\",width:\"100%\",justifyContent:\"center\",alignItems:\"center\",textDecoration:\"none\"},href:\"https://hopeforme.us/\",children:/*#__PURE__*/_jsx(\"button\",{type:\"button\",style:{color:\"#000000\",borderRadius:\"0.25rem\",border:\"1px solid #E2BBA0\",backgroundColor:\"#E2BBA0\",fontSize:\"1rem\",fontStyle:\"normal\",fontWeight:\"bold\",lineHeight:\"normal\",padding:\"0.625rem 1rem\",alignItems:\"center\"},children:\"Back to Home\"})})})]})});}/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight fixed\n */export default MyComponent;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MyComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"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