{"version":3,"file":"NewsletterSignup.EXe-Rbdn.mjs","names":["React.useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/Rd6z7widBbc1TX0mGBcW/Yhl4bm5IuKNqaba5i0jA/NewsletterSignup.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const WEBHOOK_URL=\"https://gnhzxaofdxwbkvruuixc.supabase.co/functions/v1/subscribe-newsletter\";const copy={en:{firstName:\"First name\",email:\"Email address\",button:\"Keep Me Updated\",loading:\"Joining...\",consent:\"By subscribing, you'll receive occasional emails about the Complex Mind Blueprint. You can unsubscribe at any time.\",error:\"Something went wrong. Please try again.\",thankYou:\"Thank you!\",success:\"You're subscribed. We'll keep you updated as the Complex Mind Blueprint continues to grow.\"},fi:{firstName:\"Etunimi\",email:\"S\\xe4hk\\xf6postiosoite\",button:\"Pid\\xe4 minut ajan tasalla\",loading:\"Liityt\\xe4\\xe4n...\",consent:\"Tilaamalla saat ajoittain s\\xe4hk\\xf6posteja Complex Mind Blueprintista. Voit peruuttaa tilauksen milloin tahansa.\",error:\"Jotain meni pieleen. Yrit\\xe4 uudelleen.\",thankYou:\"Kiitos!\",success:\"Tilauksesi on vahvistettu. Pid\\xe4mme sinut ajan tasalla Complex Mind Blueprintin kehittyess\\xe4.\"}};export default function NewsletterSignup({language=\"en\",source=\"website_newsletter\"}){const[firstName,setFirstName]=React.useState(\"\");const[email,setEmail]=React.useState(\"\");const[status,setStatus]=React.useState(\"idle\");const text=copy[language];const handleSubmit=async event=>{event.preventDefault();if(!email.trim())return;try{setStatus(\"loading\");const response=await fetch(WEBHOOK_URL,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({first_name:firstName.trim(),email:email.trim(),language:language,source:source})});if(!response.ok){throw new Error(\"Subscription failed\");}setFirstName(\"\");setEmail(\"\");setStatus(\"success\");}catch(error){console.error(error);setStatus(\"error\");}};return /*#__PURE__*/_jsx(\"form\",{onSubmit:handleSubmit,style:{width:\"100%\",maxWidth:\"430px\",margin:\"0 auto\",display:\"flex\",flexDirection:\"column\",gap:\"12px\",fontFamily:\"Inter, sans-serif\"},children:status!==\"success\"?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"input\",{type:\"text\",value:firstName,onChange:e=>setFirstName(e.target.value),placeholder:text.firstName,autoComplete:\"given-name\",style:{width:\"100%\",height:\"54px\",padding:\"0 20px\",boxSizing:\"border-box\",borderRadius:\"16px\",border:\"1px solid #C8C2B8\",background:\"#FFFFFF\",color:\"#1F2A44\",fontSize:\"18px\",outline:\"none\"}}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>setEmail(e.target.value),placeholder:text.email,autoComplete:\"email\",required:true,style:{width:\"100%\",height:\"54px\",padding:\"0 20px\",boxSizing:\"border-box\",borderRadius:\"16px\",border:\"1px solid #C8C2B8\",background:\"#FFFFFF\",color:\"#1F2A44\",fontSize:\"18px\",outline:\"none\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:status===\"loading\",style:{width:\"100%\",height:\"54px\",border:\"none\",borderRadius:\"16px\",background:\"#E6D6A8\",color:\"#1F2A44\",fontSize:\"18px\",fontWeight:500,cursor:status===\"loading\"?\"default\":\"pointer\"},children:status===\"loading\"?text.loading:text.button}),/*#__PURE__*/_jsx(\"p\",{style:{margin:\"14px 0 0\",textAlign:\"center\",fontSize:\"12px\",lineHeight:1.45,color:\"#5F6772\"},children:text.consent}),status===\"error\"&&/*#__PURE__*/_jsx(\"p\",{style:{margin:\"8px 0 0\",textAlign:\"center\",fontSize:\"14px\",lineHeight:1.5,color:\"#7A5A55\"},children:text.error})]}):/*#__PURE__*/_jsxs(\"div\",{style:{padding:\"18px 0 8px\",textAlign:\"center\",maxWidth:\"430px\",margin:\"0 auto\"},children:[/*#__PURE__*/_jsx(\"p\",{style:{margin:\"0 0 8px\",color:\"#1F2A44\",fontSize:\"22px\",fontWeight:600},children:text.thankYou}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,color:\"#5F6772\",fontSize:\"16px\",lineHeight:1.6},children:text.success})]})});}addPropertyControls(NewsletterSignup,{language:{type:ControlType.Enum,title:\"Language\",options:[\"en\",\"fi\"],optionTitles:[\"English\",\"Finnish\"],defaultValue:\"en\"},source:{type:ControlType.Enum,title:\"Source\",options:[\"website_newsletter\",\"email_invitation\",\"full_blueprint\"],optionTitles:[\"Website\",\"Email invitation\",\"Full Blueprint\"],defaultValue:\"website_newsletter\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NewsletterSignup\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NewsletterSignup.map"],"mappings":"wLAA0jC,SAAwB,EAAiB,CAAC,WAAS,KAAK,SAAO,sBAAsB,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAe,EAAE,EAAO,CAAC,EAAM,GAAUA,EAAe,EAAE,EAAO,CAAC,EAAO,GAAWA,EAAe,MAAM,EAAQ,EAAK,EAAK,GAAke,OAAoB,EAAK,OAAO,CAAC,SAAS,KAAze,IAAO,CAAC,KAAM,eAAe,EAAM,EAAM,KAAK,EAAS,GAAG,CAAgO,GAA/N,EAAU,SAAS,EAA+M,EAAC,MAAzL,MAAM,EAAY,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,kBAAkB,EAAE,KAAK,KAAK,UAAU,CAAC,WAAW,EAAU,KAAK,EAAE,MAAM,EAAM,KAAK,EAAW,WAAgB,QAAM,CAAC,CAAC,CAAC,EAAA,CAAe,GAAI,MAAU,MAAM,qBAAqB,EAAG,EAAa,EAAE,EAAE,EAAS,EAAE,EAAE,EAAU,SAAS,CAAE,OAAO,EAAM,CAAC,QAAQ,MAAM,CAAK,EAAE,EAAU,OAAO,CAAE,CAAC,EAAyD,MAAM,CA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