{"version":3,"file":"AppLinkForm.C_CSKc-g.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/oxUk2Vxxf7yVNlb4O5je/Uy6yOgQsJpUMemww3gMC/AppLinkForm.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback,cloneElement}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";const mockEnabled=false;function getSubmitUrl(){const isProd=window.location.host.includes(\"elevatepay.co\");const baseUrl=isProd?\"https://api.elevatepay.co\":\"https://staging-api.elevatepay.co\";return`${baseUrl}/api/v1/customerOutreach/getAppLink`;}const Events={SUBMITTED:\"(Website) Valid Email Sent\"};function logError(message,error,extra){console.error(error);if(!window.Sentry){return;}window.Sentry.captureException(error);window.Sentry.captureMessage(message,{extra});}function storageGetSafe(key){try{const value=sessionStorage.getItem(key);if(!value){return;}return JSON.parse(value);}catch(error){logError(\"storageGetSafe/failed\",error,{key});return;}}function filterEmpty(object){if(!object){return;}return Object.assign({},...Object.entries(object).filter(([_,v])=>Boolean(v)).map(([k,v])=>({[k]:v})));}function trackEvent(event){try{gtag(\"event\",event);}catch(error){logError(\"appLinkForm/trackEvent/failed\",error,{event});}}/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function AppLinkForm({style,SuccessMessageComponent,SubmitButton,SubmitButtonLoading,utm_source,utm_medium,utm_campaign,utm_term,utm_content}){const[submitting,setSubmitting]=useState(false);const[submitted,setSubmitted]=useState(false);const submit=useCallback(data=>{setSubmitting(true);const call=mockEnabled?new Promise(resolve=>setTimeout(resolve,2e3)):fetch(getSubmitUrl(),{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(data)});return call.finally(()=>setSubmitting(false));},[setSubmitting,setSubmitted]);const handleFormSubmit=useCallback(async event=>{try{event.preventDefault();if(submitting){return;}const formData=new FormData(event.target);const data=Object.fromEntries(formData);if(!data||!data.email){throw new Error(\"Can't retrive email\");}// Allow to pass as props (e.g. blog cta button), but override if came from affiliated source\nconst utm=filterEmpty({source:utm_source?utm_source.trim():undefined,medium:utm_medium?utm_medium.trim():undefined,campaign:utm_campaign?utm_campaign.trim():undefined,term:utm_term?utm_term.trim():undefined,content:utm_content?utm_content.trim():undefined,...storageGetSafe(\"visit_data\")||{}});const visitorDataAdditional=filterEmpty(storageGetSafe(\"visit_data_additional\"));const body=Object.assign({utm},data,visitorDataAdditional);await submit(body);}catch(_error){logError(\"appLinkForm/submit/failed\",_error);}finally{trackEvent(Events.SUBMITTED);setSubmitted(true);}},[submitting,submit,utm_source,utm_medium,utm_campaign,utm_term,utm_content]);const[focused,setFocused]=useState(false);return submitted?/*#__PURE__*/_jsx(motion.div,{style:Object.assign({},styles.submitted),children:SuccessMessageComponent&&SuccessMessageComponent.length>0?/*#__PURE__*/cloneElement(SuccessMessageComponent[0],{style:Object.assign({},SuccessMessageComponent[0].props.style,styles.successMessage)}):undefined}):/*#__PURE__*/_jsxs(motion.form,{onSubmit:handleFormSubmit,style:Object.assign({},styles.container,focused&&styles.containerFocused),children:[/*#__PURE__*/_jsx(\"input\",{onFocus:()=>setFocused(true),onBlur:()=>setFocused(false),minLength:4,required:true,style:styles.input,type:\"email\",inputMode:\"email\",autoComplete:\"email\",name:\"email\",placeholder:\"Enter your email\",disabled:submitting}),submitting&&SubmitButtonLoading&&SubmitButtonLoading.length>0?/*#__PURE__*/cloneElement(SubmitButtonLoading[0],{disabled:true}):null,!submitting&&SubmitButton&&SubmitButton.length>0?/*#__PURE__*/cloneElement(SubmitButton[0],{type:\"submit\"}):null]});}const fontDefault={fontFamily:'\"S\\xf6hne Buch\"',fontSize:\"18px\",lineHeight:\"21.6px\",fontWeight:400};const styles={submitted:{display:\"flex\",alignItems:\"center\"},container:{display:\"flex\",alignItems:\"center\",backgroundColor:\"#282847\",borderRadius:\"500px\",padding:\"0 3px\",borderWidth:\"1px\",borderStyle:\"solid\",borderColor:\"#3536fd\",height:\"56px\"},containerFocused:{borderColor:\"#0099ff\"},input:{...fontDefault,width:\"100%\",padding:\"14px 21px\",color:\"#c4c4ce\",backgroundColor:\"transparent\",outline:\"none\",border:\"none\"},successMessage:{width:\"100%\"}};addPropertyControls(AppLinkForm,{SuccessMessageComponent:{type:ControlType.ComponentInstance},SubmitButton:{type:ControlType.ComponentInstance},SubmitButtonLoading:{type:ControlType.ComponentInstance},utm_source:{type:ControlType.String},utm_medium:{type:ControlType.String},utm_campaign:{type:ControlType.String},utm_term:{type:ControlType.String},utm_content:{type:ControlType.String}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AppLinkForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AppLinkForm.map"],"mappings":"+PAE4N,SAAS,GAAc,CAAkJ,MAAM,GAA1I,EAAO,SAAS,KAAK,SAAS,gBAAgB,CAAsB,4BAA4B,oCAAqD,qCAA4F,SAAS,EAAS,EAAQ,EAAM,EAAM,CAAC,QAAQ,MAAM,EAAM,CAAK,EAAO,SAAgB,EAAO,OAAO,iBAAiB,EAAM,CAAC,EAAO,OAAO,eAAe,EAAQ,CAAC,QAAM,CAAC,EAAE,SAAS,EAAe,EAAI,CAAC,GAAG,CAAC,IAAM,EAAM,eAAe,QAAQ,EAAI,CAAoB,OAAf,EAAsB,KAAK,MAAM,EAAM,CAAhC,aAAwC,EAAM,CAAC,EAAS,wBAAwB,EAAM,CAAC,MAAI,CAAC,CAAC,QAAS,SAAS,EAAY,EAAO,CAAK,KAAgB,OAAO,OAAO,OAAO,EAAE,CAAC,GAAG,OAAO,QAAQ,EAAO,CAAC,QAAQ,CAAC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