{"version":3,"file":"NewSignUp.ClyFyjwp.mjs","names":[],"sources":["https:/framerusercontent.com/modules/NjWuKpqbsHrgXZ4AHyJQ/rCNH4dOq6l9kby9EimOx/NewSignUp.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const useStore=createStore({baseApiUrl:\"https://app.meetdex.ai\",email:\"\",submitted:false,loading:false,success:false,failed:false,touched:false});const isValid=store=>{return/.+@.+\\..+/.test(store.email);};export function withSignUpForm(Component){return(props,ref)=>{const[store,setStore]=useStore();useEffect(()=>{const hostname=window.location.hostname;if(hostname.endsWith(\".framer.app\")||hostname.endsWith(\".framercanvas.com\")){setStore({...store,baseApiUrl:\"https://candidate-portal-frontend-dev-63687937246.europe-west2.run.app\"});}},[]);useEffect(()=>{if(!store.submitted||store.loading||store.success){return;}if(!isValid(store)){setStore({...store,submitted:false,failed:true});return;}setStore({...store,loading:true,failed:false});const urlParams=new URLSearchParams(window.location.search);const referrerCode=urlParams.get(\"referrer_code\");fetch(`${store.baseApiUrl}/api/user`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({email:store.email,...referrerCode&&{referrer_code:referrerCode}})}).then(response=>response.json()).then(async data=>{setStore({...store,submitted:false,loading:false,success:true});}).catch(err=>{setStore({...store,submitted:false,loading:false,failed:true});throw err;});},[store]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});};}export function withSignUpSubmit(Component){return(props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:async()=>{setStore({...store,submitted:true});const urlParams=new URLSearchParams(window.location.search);const referrerCode=urlParams.get(\"referrer_code\");console.log(\"body\",JSON.stringify({email:store.email,...referrerCode&&{referrer_code:referrerCode}}));try{const result=await fetch(`${store.baseApiUrl}/api/user`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({email:store.email,...referrerCode&&{referrer_code:referrerCode}})});}catch(error){console.error(error);}const baseUrl=window.location.origin;console.log(\"baseUrl\",baseUrl);window.location.href=baseUrl+\"/onboarding\";}});};}export function withSignUpEmail(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,value:store.email,onChange:event=>setStore({...store,email:event.target.value,failed:false,touched:true})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withSignUpEmail\":{\"type\":\"reactHoc\",\"name\":\"withSignUpEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSignUpForm\":{\"type\":\"reactHoc\",\"name\":\"withSignUpForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSignUpSubmit\":{\"type\":\"reactHoc\",\"name\":\"withSignUpSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NewSignUp.map"],"mappings":"6RAAsW,SAAgB,EAAe,EAAU,CAAC,OAAO,EAAM,IAAM,CAAC,GAAK,CAAC,EAAM,GAAU,GAAU,CAA07B,OAAz7B,MAAc,CAAC,IAAM,EAAS,EAAO,SAAS,UAAY,EAAS,SAAS,cAAc,EAAE,EAAS,SAAS,oBAAoB,GAAE,EAAS,CAAC,GAAG,EAAM,WAAW,yEAAyE,CAAC,EAAI,EAAE,CAAC,CAAC,MAAc,CAAC,GAAG,CAAC,EAAM,WAAW,EAAM,SAAS,EAAM,QAAS,OAAQ,GAAG,CAAC,EAAQ,EAAM,CAAC,CAAC,EAAS,CAAC,GAAG,EAAM,UAAU,GAAM,OAAO,GAAK,CAAC,CAAC,OAAQ,EAAS,CAAC,GAAG,EAAM,QAAQ,GAAK,OAAO,GAAM,CAAC,CAA6D,IAAM,EAAlD,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAA8B,IAAI,gBAAgB,CAAC,MAAM,GAAG,EAAM,WAAW,WAAW,CAAC,OAAO,OAAO,QAAQ,C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