{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/LmyZm4UbIHkH67HqFe6s/KjlqtMlbpJWm7Ss5KYT7/Loops_Form3.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const INIT=\"INIT\";const SUBMITTING=\"SUBMITTING\";const ERROR=\"ERROR\";const SUCCESS=\"SUCCESS\";const formStates=[INIT,SUBMITTING,ERROR,SUCCESS];const formStyles={id:\"clgv6cfdj0074l60fogqms9gc\",name:\"Default\",formStyle:\"inline\",placeholderText:\"you@example.com\",formFont:\"Inter\",formFontColor:\"#FFFFFF\",formFontSizePx:14,buttonFont:\"Inter\",buttonFontColor:\"#000000\",buttonColor:\"#FFD500\",buttonFontSizePx:14,successMessage:\"Thanks! We'll be in touch!\",successFont:\"Inter\",successFontColor:\"#000000\",successFontSizePx:14,userGroup:\"API Users\"};const domain=\"app.loops.so\";export default function SignUpFormReact(props){const[email,setEmail]=useState(\"\");const[formState,setFormState]=useState(INIT);const[errorMessage,setErrorMessage]=useState(\"\");const resetForm=()=>{setEmail(\"\");setFormState(INIT);setErrorMessage(\"\");};const hasRecentSubmission=()=>{const time=new Date;const timestamp=time.valueOf();const previousTimestamp=localStorage.getItem(\"loops-form-timestamp\");if(previousTimestamp&&Number(previousTimestamp)+60*1e3>timestamp){setFormState(ERROR);setErrorMessage(\"Too many signups, please try again in a little while\");return true;}localStorage.setItem(\"loops-form-timestamp\",timestamp.toString());return false;};const handleSubmit=event=>{event.preventDefault();if(formState!==INIT)return;if(!isValidEmail(email)){setFormState(ERROR);setErrorMessage(\"Please enter a valid email\");return;}if(hasRecentSubmission())return;setFormState(SUBMITTING);const formBody=`userGroup=${encodeURIComponent(formStyles.userGroup)}&email=${encodeURIComponent(email)}`;fetch(`https://${domain}/api/newsletter-form/${formStyles.id}`,{method:\"POST\",body:formBody,headers:{\"Content-Type\":\"application/x-www-form-urlencoded\"}}).then(res=>[res.ok,res.json(),res]).then(([ok,dataPromise,res])=>{if(ok){resetForm();setFormState(SUCCESS);window.open(\"https://docs.prodia.com\",\"_blank\");}else{dataPromise.then(data=>{setFormState(ERROR);setErrorMessage(data.message||res.statusText);localStorage.setItem(\"loops-form-timestamp\",\"\");});}}).catch(error=>{setFormState(ERROR);if(error.message===\"Failed to fetch\"){setErrorMessage(\"Too many signups, please try again in a little while\");}else if(error.message){setErrorMessage(error.message);}localStorage.setItem(\"loops-form-timestamp\",\"\");});};const isInline=formStyles.formStyle===\"inline\";switch(formState){case SUCCESS:return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",width:\"100%\"},children:/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:`'${formStyles.successFont}', sans-serif`,color:formStyles.successFontColor,fontSize:`${formStyles.successFontSizePx}px`},children:formStyles.successMessage})});case ERROR:return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(SignUpFormError,{}),/*#__PURE__*/_jsx(BackButton,{})]});default:return /*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:isInline?\"row\":\"column\",alignItems:\"center\",justifyContent:\"center\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"text\",name:\"email\",placeholder:formStyles.placeholderText,value:email,onChange:e=>setEmail(e.target.value),required:true,style:{color:formStyles.formFontColor,fontFamily:`'${formStyles.formFont}', sans-serif`,fontSize:`${formStyles.formFontSizePx}px`,margin:isInline?\"0px 10px 0px 0px\":\"0px 0px 10px\",width:\"100%\",minWidth:\"100px\",background:\"#131313\",border:\"1px solid #33333C\",boxSizing:\"border-box\",boxShadow:\"rgba(0, 0, 0, 0.05) 0px 1px 2px\",borderRadius:\"6px\",padding:\"12px 12px\",outline:\"none\"}}),/*#__PURE__*/_jsx(SignUpFormButton,{buttonText:props.buttonText})]})});}function SignUpFormError(){return /*#__PURE__*/_jsx(\"div\",{style:{alignItems:\"center\",justifyContent:\"center\",width:\"100%\"},children:/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"Inter, sans-serif\",color:\"rgb(185, 28, 28)\",fontSize:\"14px\"},children:errorMessage||\"Oops! Something went wrong, please try again\"})});}function BackButton(){const[isHovered,setIsHovered]=useState(false);return /*#__PURE__*/_jsx(\"button\",{style:{color:\"#6b7280\",font:\"14px, Inter, sans-serif\",margin:\"10px auto\",textAlign:\"center\",background:\"transparent\",border:\"none\",cursor:\"pointer\",textDecoration:isHovered?\"underline\":\"none\"},onMouseOut:()=>setIsHovered(false),onMouseOver:()=>setIsHovered(true),onClick:resetForm,children:\"\u2190 Back\"});}function SignUpFormButton({buttonText}){return /*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{background:formStyles.buttonColor,fontSize:`${formStyles.buttonFontSizePx}px`,color:formStyles.buttonFontColor,fontFamily:`'${formStyles.buttonFont}', sans-serif`,width:isInline?\"min-content\":\"100%\",// maxWidth: \"100px\",\nwhiteSpace:isInline?\"nowrap\":\"normal\",height:\"42px\",alignItems:\"center\",justifyContent:\"center\",flexDirection:\"row\",padding:\"9px 12px\",boxShadow:\"0px 1px 2px rgba(0, 0, 0, 0.05)\",borderRadius:\"6px\",textAlign:\"center\",fontStyle:\"normal\",fontWeight:500,lineHeight:\"20px\",border:\"none\",cursor:\"pointer\"},children:formState===SUBMITTING?\"Please wait...\":buttonText||formStyles.buttonText});}}SignUpFormReact.displayName=\"Sign Up Form React\";addPropertyControls(SignUpFormReact,{buttonText:{type:ControlType.String,defaultValue:\"Start Now\",displayTextArea:false}});function isValidEmail(email){return/.+@.+/.test(email);}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SignUpFormReact\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Loops_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A,EAAS,SAAS,SAAS,OAAO,OAAO,WAAW,SAAS,eAAe,SAAS,cAAc,MAAM,QAAQ,WAAW,UAAU,kCAAkC,aAAa,MAAM,UAAU,SAAS,UAAU,SAAS,WAAW,IAAI,WAAW,OAAO,OAAO,OAAO,OAAO,SAAS,EAAE,SAAStB,IAAYa,EAAW,iBAAiBmB,GAAYvC,EAAW,UAAU,CAAC,CAAE,CAAC,CAACE,EAAgB,YAAY,qBAAqBsC,EAAoBtC,EAAgB,CAAC,WAAW,CAAC,KAAKuC,EAAY,OAAO,aAAa,YAAY,gBAAgB,EAAK,CAAC,CAAC,EAAE,SAAStB,EAAaf,EAAM,CAAC,MAAM,QAAQ,KAAKA,CAAK,CAAE",
  "names": ["INIT", "SUBMITTING", "ERROR", "SUCCESS", "formStyles", "domain", "SignUpFormReact", "props", "email", "setEmail", "ye", "formState", "setFormState", "INIT", "errorMessage", "setErrorMessage", "resetForm", "hasRecentSubmission", "timestamp", "previousTimestamp", "ERROR", "handleSubmit", "event", "isValidEmail", "SUBMITTING", "formBody", "res", "ok", "dataPromise", "SUCCESS", "window", "data", "error", "isInline", "p", "u", "l", "SignUpFormError", "BackButton", "e", "SignUpFormButton", "isHovered", "setIsHovered", "buttonText", "addPropertyControls", "ControlType"]
}
