{"version":3,"file":"SignUp.DHF5sbvY.mjs","names":[],"sources":["https:/framerusercontent.com/modules/t9b70OtY1SB2qSiJkdYl/PyXsEXPgOcmdQqM6xpH0/SignUp.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useMemo}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const useStore=createStore({baseApiUrl:\"https://api-prod-63687937246.europe-west2.run.app\",name:\"\",email:\"\",linkedin_url:\"\",submitted:false,loading:false,success:false,failed:false,touched:false});const isValid=store=>{const valid=/.+@.+\\..+/.test(store.email)&&store.name.length>0&&/https?:\\/\\/(www\\.)?linkedin\\.com\\/in\\/.+\\/?/.test(store.linkedin_url);return valid;};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://api-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});fetch(`${store.baseApiUrl}/users/v1/signup`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({email:store.email,linkedin_url:store.linkedin_url,name:store.name})}).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();const variant=useMemo(()=>{return store.success?\"Success\":store.submitted||store.loading?\"Loading\":store.touched&&!isValid(store)?\"Disabled\":store.failed?\"Error\":\"Default\";},[store]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,variant:variant,onClick:()=>setStore({...store,submitted:true})});};}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})});});}export function withSignUpName(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,value:store.name,onChange:event=>setStore({...store,name:event.target.value,failed:false,touched:true})});});}export function withSignUpLinkedInURL(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,value:store.linkedin_url,onChange:event=>setStore({...store,linkedin_url:event.target.value,failed:false,touched:true})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withSignUpForm\":{\"type\":\"reactHoc\",\"name\":\"withSignUpForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSignUpEmail\":{\"type\":\"reactHoc\",\"name\":\"withSignUpEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSignUpName\":{\"type\":\"reactHoc\",\"name\":\"withSignUpName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSignUpSubmit\":{\"type\":\"reactHoc\",\"name\":\"withSignUpSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSignUpLinkedInURL\":{\"type\":\"reactHoc\",\"name\":\"withSignUpLinkedInURL\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SignUp.map"],"mappings":"qSAAihB,SAAgB,EAAe,EAAU,CAAC,MAAM,CAAC,EAAM,IAAM,CAAC,GAAK,CAAC,EAAM,EAAS,CAAC,GAAU,CAA+zB,MAA9zB,GAAU,IAAI,CAAC,IAAM,EAAS,EAAO,SAAS,SAAS,CAAG,EAAS,SAAS,cAAc,EAAE,EAAS,SAAS,oBAAoB,GAAE,EAAS,CAAC,GAAG,EAAM,WAAW,kDAAmD,EAAC,AAAG,EAAC,CAAE,EAAC,CA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