{"version":3,"file":"Zapier_Form.CmbIOeSJ.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/Runr3SwtD5M48ncpmQTU/Mz39LIV9xXtqOht0UHVq/Zapier_Form.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// HEAVYT brand colors\nconst COLORS={paper:\"#F2F0EA\",coral:\"#EC5840\",ink:\"#1A2238\",blue:\"#3A4C7E\"};/**\n * Newsletter signup form that posts directly to a Zapier \"Catch Hook\" webhook.\n *\n * Why this avoids the CORS problem that broke the MailChimp classic-embed\n * integration: we send the body as URLSearchParams and do NOT manually set\n * a Content-Type header. The browser sets it to\n * \"application/x-www-form-urlencoded\" automatically, which qualifies as a\n * CORS \"simple request\" — no preflight OPTIONS call, no block. If you set\n * Content-Type: application/json yourself, Zapier's webhook will reject the\n * preflight and the request never lands.\n *\n * Success state: inline helper text that fades in, holds, then fades back\n * out to a reset form — no modal. Keeps the confirmation quiet instead of\n * interrupting, and lets you fire off repeat test submissions without a\n * page reload.\n */export default function NewsletterSignup(props){const{webhookUrl,successMessage,buttonLabel,placeholder,inputRadius,buttonRadius,buttonWidth,successDuration}=props;const[email,setEmail]=useState(\"\");const[status,setStatus]=useState(\"idle\")// idle | loading | success | error\n;const[helperVisible,setHelperVisible]=useState(false);const timers=useRef([]);useEffect(()=>{return()=>timers.current.forEach(clearTimeout);},[]);async function handleSubmit(e){e.preventDefault();if(!email||!email.includes(\"@\")){setStatus(\"error\");return;}setStatus(\"loading\");try{// Field name must be uppercase EMAIL — this is the exact key\n// the shared Zap's Mailchimp step is already mapped to (same\n// Zap the teaser site form uses). Do not change this without\n// checking the Zap's trigger step first.\nconst body=new URLSearchParams({EMAIL:email});const response=await fetch(webhookUrl,{method:\"POST\",body});if(response.ok){setEmail(\"\");setStatus(\"success\");setHelperVisible(true);// Hold, then fade out, then reset to a clean idle form.\nconst fadeTimer=setTimeout(()=>setHelperVisible(false),successDuration);const resetTimer=setTimeout(()=>setStatus(\"idle\"),successDuration+400);timers.current.push(fadeTimer,resetTimer);}else{setStatus(\"error\");}}catch(err){setStatus(\"error\");}}return /*#__PURE__*/_jsxs(\"div\",{style:styles.container,children:[/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:styles.wrapper,children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>{setEmail(e.target.value);if(status===\"error\")setStatus(\"idle\");},placeholder:placeholder,style:{...styles.input,borderRadius:inputRadius,borderColor:status===\"error\"?COLORS.coral:\"transparent\"},disabled:status===\"loading\"}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{...styles.button,borderRadius:buttonRadius,width:buttonWidth,opacity:status===\"loading\"?.7:1},disabled:status===\"loading\",children:status===\"loading\"?\"...\":buttonLabel})]}),/*#__PURE__*/_jsx(\"p\",{style:{...styles.helperText,opacity:status===\"success\"&&helperVisible?1:0},children:successMessage})]});}const styles={container:{display:\"flex\",flexDirection:\"column\",gap:8,width:\"100%\",minWidth:0,boxSizing:\"border-box\"},wrapper:{display:\"flex\",gap:10,alignItems:\"center\",width:\"100%\",minWidth:0,boxSizing:\"border-box\"},input:{flex:\"1 1 0%\",width:\"100%\",minWidth:0,height:47,padding:\"0 16px\",border:\"1px solid transparent\",background:\"#ffffff\",color:COLORS.ink,fontSize:15,fontFamily:\"Acumin Pro, sans-serif\",outline:\"none\"},button:{height:47,padding:\"0 24px\",border:\"none\",background:COLORS.coral,color:\"#ffffff\",fontWeight:600,fontSize:15,fontFamily:\"Acumin Pro, sans-serif\",cursor:\"pointer\",whiteSpace:\"nowrap\",flexShrink:0},helperText:{margin:0,fontSize:13,color:COLORS.ink,fontFamily:\"Acumin Pro, sans-serif\",transition:\"opacity 400ms ease\",minHeight:16}};addPropertyControls(NewsletterSignup,{webhookUrl:{type:ControlType.String,title:\"Webhook URL\",defaultValue:\"https://hooks.zapier.com/hooks/catch/27463379/uvcz31h/\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"name@email.com\"},buttonLabel:{type:ControlType.String,title:\"Button Label\",defaultValue:\"Subscribe\"},successMessage:{type:ControlType.String,title:\"Success Message\",defaultValue:\"You're in. Check your inbox.\"},successDuration:{type:ControlType.Number,title:\"Success Duration\",defaultValue:4e3,min:1e3,max:1e4,step:500,unit:\"ms\",displayStepper:true},inputRadius:{type:ControlType.Number,title:\"Input Radius\",defaultValue:6,min:0,max:50,step:1},buttonRadius:{type:ControlType.Number,title:\"Button Radius\",defaultValue:6,min:0,max:50,step:1},buttonWidth:{type:ControlType.String,title:\"Button Width\",defaultValue:\"auto\",placeholder:\"auto, 120px, 30%...\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NewsletterSignup\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Zapier_Form.map"],"mappings":"+LAgBG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,aAAW,iBAAe,cAAY,cAAY,cAAY,eAAa,cAAY,mBAAiB,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAE,EAAO,CAAC,EAAO,GAAWA,EAAS,MAAM,EAC3O,CAAC,EAAc,GAAkBA,EAAS,EAAK,EAAQ,EAAOC,EAAO,CAAC,CAAC,EAAE,UAAyB,EAAO,QAAQ,QAAQ,YAAY,EAAI,CAAC,CAAC,EAAE,eAAe,EAAa,EAAE,CAAoB,GAAnB,EAAE,eAAe,EAAK,CAAC,GAAO,CAAC,EAAM,SAAS,GAAG,EAAE,CAAC,EAAU,OAAO,EAAE,MAAO,CAAC,EAAU,SAAS,EAAE,GAAG,CAIzR,IAAM,EAAK,IAAI,gBAAgB,CAAC,MAAM,CAAK,CAAC,EAA8D,IAAG,MAA1C,MAAM,EAAW,CAAC,OAAO,OAAO,MAAI,CAAC,EAAA,CAAc,GA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