{"version":3,"file":"EmailFormV2.RT4dz3ED.mjs","names":["useState","useCallback","startTransition"],"sources":["https:/framerusercontent.com/modules/wU6eKY7SN3HGlkBbLfW1/wEjdELovyHekdcdKmGQv/EmailFormV2.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{startTransition,useCallback,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * User request: add an optional editable link control named successRedirectUrl and redirect after successful webhook submission when it has a value.\n *//**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function EmailForm({webhookUrl,successRedirectUrl,labelText,placeholder,successMessage,errorMessage,width,backgroundColor,textColor,headingFontSize,inputFontSize,titleToInputGap,inputPadding,boxPadding,arrowSize}){const[email,setEmail]=useState(\"\");const[status,setStatus]=useState(\"idle\");const handleSubmit=useCallback(async()=>{if(!email||!webhookUrl)return;startTransition(()=>setStatus(\"loading\"));try{const formData=new URLSearchParams;formData.append(\"email\",email);const res=await fetch(webhookUrl,{method:\"POST\",headers:{\"Content-Type\":\"application/x-www-form-urlencoded\"},body:formData.toString()});if(!res.ok)throw new Error(\"Webhook failed\");startTransition(()=>setEmail(\"\"));startTransition(()=>setStatus(\"success\"));const hasRedirect=typeof successRedirectUrl===\"string\"&&successRedirectUrl.trim().length>0;if(hasRedirect){if(typeof window!==\"undefined\"){window.location.assign(successRedirectUrl);}return;}setTimeout(()=>startTransition(()=>setStatus(\"idle\")),6e3);}catch{startTransition(()=>setStatus(\"error\"));setTimeout(()=>startTransition(()=>setStatus(\"idle\")),6e3);}},[email,webhookUrl,successRedirectUrl]);const isLoading=status===\"loading\";return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",maxWidth:width,minWidth:0,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n  .email-input::placeholder {\n      color: ${textColor};\n      font-size: ${inputFontSize}px;\n  }\n`}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",backgroundColor,padding:boxPadding,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{opacity:status===\"idle\"?1:0,pointerEvents:status===\"idle\"?\"auto\":\"none\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontSize:`clamp(18px, 3vw, ${headingFontSize}px)`,fontFamily:\"'Denim Medium', 'Denim Medium Placeholder', sans-serif\",fontWeight:550,letterSpacing:1,marginBottom:titleToInputGap,color:textColor},children:labelText}),/*#__PURE__*/_jsxs(\"form\",{onSubmit:e=>{e.preventDefault();handleSubmit();},style:{display:\"flex\",alignItems:\"stretch\",width:\"100%\",minWidth:0,backgroundColor:\"#FDFCF7\",height:\"auto\",minHeight:0,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:\"email\",className:\"email-input\",placeholder:placeholder,value:email,disabled:isLoading,required:true,onChange:e=>startTransition(()=>setEmail(e.target.value)),style:{flex:1,minWidth:0,minHeight:0,height:\"auto\",border:\"none\",outline:\"none\",backgroundColor:\"#FDFCF7\",fontSize:inputFontSize,color:textColor,padding:inputPadding,boxSizing:\"border-box\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:isLoading,style:{border:\"none\",background:\"#FDFCF7\",cursor:isLoading?\"not-allowed\":\"pointer\",color:textColor,padding:\"12px 16px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",flexShrink:0,height:\"auto\",minHeight:0,boxSizing:\"border-box\"},children:/*#__PURE__*/_jsx(\"svg\",{width:arrowSize,height:arrowSize,viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M5 12H19M19 12L13 6M19 12L13 18\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})})]}),/*#__PURE__*/_jsx(\"div\",{style:{borderTop:\"1px solid\",marginTop:0}})]}),status!==\"idle\"&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",inset:0,fontSize:20,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",textAlign:\"center\",padding:24,color:status===\"success\"?\"black\":status===\"error\"?\"red\":textColor},children:[status===\"loading\"&&\"Sending…\",status===\"success\"&&successMessage,status===\"error\"&&errorMessage]})]})]});}addPropertyControls(EmailForm,{webhookUrl:{type:ControlType.String,title:\"Webhook URL\"},labelText:{type:ControlType.String,title:\"Label Text\",defaultValue:\"GET ON THE WAITLIST\"},placeholder:{type:ControlType.String,defaultValue:\"YOUR EMAIL\"},successMessage:{type:ControlType.String,defaultValue:\"Thank you for joining the waitlist! We will contact you when enrolment is open.\"},successRedirectUrl:{type:ControlType.Link,title:\"Success Redirect\",defaultValue:\"\"},errorMessage:{type:ControlType.String,defaultValue:\"Something went wrong.\"},backgroundColor:{type:ControlType.Color,defaultValue:\"#D4BE3D\"},textColor:{type:ControlType.Color,defaultValue:\"#000000\"},width:{type:ControlType.Number,defaultValue:850},headingFontSize:{type:ControlType.Number,defaultValue:38,min:12,max:120,step:1},inputFontSize:{type:ControlType.Number,defaultValue:16,min:10,max:40,step:1},titleToInputGap:{type:ControlType.Number,defaultValue:6,min:0,max:64,step:1},inputPadding:{type:ControlType.Padding,title:\"Input Padding\",defaultValue:\"12px 16px 12px 16px\"},boxPadding:{type:ControlType.Padding,title:\"Box Padding\",defaultValue:\"24px\"},arrowSize:{type:ControlType.Number,title:\"Arrow Size\",defaultValue:50,min:12,max:120,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EmailForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EmailFormV2.map"],"mappings":"6MAKG,SAAwB,EAAU,CAAC,aAAW,qBAAmB,YAAU,cAAY,iBAAe,eAAa,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