{"version":3,"file":"BHEmailCapture.JSZiNBtz.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/X3lMujOvweft9EEC0qpr/MGjkG1UD7tZJezRHC8uS/BHEmailCapture.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState}from\"react\";// ─── Brand tokens ─────────────────────────────────────────────────\nconst ORANGE=\"rgb(245, 139, 56)\";const SLATE=\"rgb(51, 65, 85)\";const WHITE=\"rgb(255, 255, 255)\";const SS3=\"'Source Sans 3', 'Source Sans Pro', sans-serif\";export default function BHEmailCapture({formEndpoint=\"https://formspree.io/f/mpqbpkro\",label=\"Not ready to talk yet? Stay in the loop.\",placeholder=\"Your email address\",buttonText=\"Keep me posted\",successText=\"You're on the list. We'll be in touch.\",variant=\"onDark\",style}){const[email,setEmail]=useState(\"\");const[status,setStatus]=useState(\"idle\");const[errorMsg,setErrorMsg]=useState(\"\");const isDark=variant===\"onDark\";const handleSubmit=async e=>{e.preventDefault();if(!email||status===\"submitting\")return;setStatus(\"submitting\");setErrorMsg(\"\");try{const res=await fetch(formEndpoint,{method:\"POST\",headers:{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"},body:JSON.stringify({email})});const data=await res.json();if(res.ok){setStatus(\"success\");setEmail(\"\");}else{const msg=data?.errors?.[0]?.message||data?.error||\"Something went wrong. Please try again.\";setErrorMsg(msg);setStatus(\"error\");}}catch{setErrorMsg(\"Network error — please try again.\");setStatus(\"error\");}};// ── Success state ─────────────────────────────────────────────\nif(status===\"success\"){return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:8,padding:\"14px 0\",...style},children:[/*#__PURE__*/_jsx(\"span\",{style:{width:22,height:22,borderRadius:\"50%\",backgroundColor:isDark?\"rgba(255,255,255,0.2)\":\"rgba(78,205,196,0.15)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontSize:13,color:isDark?WHITE:\"rgb(78,205,196)\",flexShrink:0},children:\"✓\"}),/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:SS3,fontSize:15,color:isDark?\"rgba(255,255,255,0.9)\":SLATE},children:successText})]});}// ── Form state ────────────────────────────────────────────────\nreturn /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:8,width:\"100%\",...style},children:[/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:SS3,fontSize:13,lineHeight:\"1.8\",margin:0,color:isDark?\"rgba(255,255,255,0.6)\":\"rgba(51,65,85,0.6)\"},children:label}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:8,flexWrap:\"wrap\",alignItems:\"stretch\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>setEmail(e.target.value),placeholder:placeholder,required:true,disabled:status===\"submitting\",style:{flex:\"1 1 200px\",padding:\"12px 16px\",borderRadius:8,border:isDark?\"1px solid rgba(255,255,255,0.2)\":\"1px solid rgba(51,65,85,0.15)\",fontSize:15,fontFamily:SS3,color:SLATE,backgroundColor:WHITE,outline:\"none\",boxSizing:\"border-box\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:handleSubmit,disabled:status===\"submitting\",style:{padding:\"12px 22px\",borderRadius:8,border:\"none\",backgroundColor:isDark?WHITE:ORANGE,color:isDark?ORANGE:WHITE,fontSize:15,fontWeight:600,fontFamily:SS3,cursor:status===\"submitting\"?\"not-allowed\":\"pointer\",opacity:status===\"submitting\"?.65:1,whiteSpace:\"nowrap\",transition:\"opacity 0.15s ease\",flexShrink:0},children:status===\"submitting\"?\"Sending…\":buttonText})]}),status===\"error\"&&errorMsg&&/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:SS3,fontSize:13,margin:0,color:isDark?\"rgba(255,255,255,0.75)\":\"rgb(185,28,28)\"},children:errorMsg})]});}addPropertyControls(BHEmailCapture,{formEndpoint:{type:ControlType.String,title:\"Form endpoint\",defaultValue:\"https://formspree.io/f/mpqbpkro\"},variant:{type:ControlType.Enum,title:\"Variant\",options:[\"onDark\",\"onLight\"],optionTitles:[\"On dark/orange bg\",\"On light bg\"],defaultValue:\"onDark\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Not ready to talk yet? Stay in the loop.\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Your email address\"},buttonText:{type:ControlType.String,title:\"Button text\",defaultValue:\"Keep me posted\"},successText:{type:ControlType.String,title:\"Success text\",defaultValue:\"You're on the list. We'll be in touch.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BHEmailCapture\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BHEmailCapture.map"],"mappings":"iLAC2J,SAAwB,EAAe,CAAC,eAAa,kCAAkC,QAAM,2CAA2C,cAAY,qBAAqB,aAAW,iBAAiB,cAAY,yCAAyC,UAAQ,SAAS,SAAO,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAO,GAAWA,EAAS,OAAO,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAO,EAAO,IAAU,SAAe,EAAa,KAAM,IAAG,CAAC,KAAE,gBAAgB,CAAI,GAAC,GAAO,IAAS,cAA4C,CAAxB,EAAU,aAAa,CAAC,EAAY,GAAG,CAAC,GAAG,CAAC,IAAM,EAAI,MAAM,MAAM,EAAa,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,mBAAmB,OAAS,mBAAmB,CAAC,KAAK,KAAK,UAAU,CAAC,QAAM,CAAC,CAAC,CAAC,CAAO,EAAK,MAAM,EAAI,MAAM,CAAI,EAAI,IAAI,EAAU,UAAU,CAAC,EAAS,GAAG,GAAoG,EAAnF,GAAM,SAAS,IAAI,SAAS,GAAM,OAAO,0CAA0D,CAAC,EAAU,QAAQ,OAAQ,CAAC,EAAY,oCA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