{"version":3,"file":"NewsletterWidget.x2fleGeN.mjs","names":["useState","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","window","p","c","init_jsx_runtime","ce","_e","init_framer_B1b760uK","addPropertyControls","ControlType","NewsletterWidget","props","stacked","setStacked","query","stackBelow","sync","event","inputStyle","brandColor","bgColor","textColor","buttonStyle","publicationUrl","publicationSlug","buttonText","init_NewsletterWidget"],"sources":["https:/framerusercontent.com/modules/Gb0UAaVC9Ek8gavXZUMK/KixvlhWb8eQCMUloaXNv/NewsletterWidget.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState}from\"react\";// The form posts natively to Substack's no-JavaScript endpoint. A form POST is a\n// navigation, not a fetch, so no CORS rule applies and the visitor sees\n// Substack's own answer rather than one we guessed.\n//\n// The previous version used fetch with mode:\"no-cors\". Under no-cors the browser\n// drops a Content-Type of application/json and substitutes text/plain, and\n// Substack parses no email out of a JSON body sent as text/plain, so every\n// signup from 25 May 2026 was discarded. An opaque response also carries no\n// status, so the widget reported success either way.\nexport default function NewsletterWidget(props){const{publicationUrl,publicationSlug,placeholder,buttonText,brandColor,textColor,bgColor,stackBelow}=props;const[stacked,setStacked]=useState(false);useEffect(()=>{const query=window.matchMedia(`(max-width: ${stackBelow||480}px)`);const sync=event=>setStacked(event.matches);sync(query);query.addEventListener(\"change\",sync);return()=>query.removeEventListener(\"change\",sync);},[stackBelow]);const inputStyle={flex:1,minWidth:0,width:\"100%\",padding:\"14px 18px\",fontSize:16,fontFamily:\"Public Sans, sans-serif\",border:`2px solid ${brandColor}`,borderRight:stacked?`2px solid ${brandColor}`:\"none\",borderRadius:stacked?10:\"10px 0 0 10px\",outline:\"none\",background:bgColor,color:textColor,boxSizing:\"border-box\",minHeight:50};const buttonStyle={padding:\"14px 22px\",fontSize:15,fontWeight:600,fontFamily:\"Public Sans, sans-serif\",color:textColor,background:brandColor,border:\"none\",borderRadius:stacked?10:\"0 10px 10px 0\",cursor:\"pointer\",whiteSpace:\"nowrap\",minHeight:50,width:stacked?\"100%\":\"auto\",boxSizing:\"border-box\"};// Fires as the navigation starts, so it counts submissions rather than\n// confirmed subscriptions. Substack's response does not distinguish the two\n// for anyone, including a server of ours.\nconst track=()=>{window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"newsletter_signup\",substack_publication:publicationSlug});};return /*#__PURE__*/_jsxs(\"form\",{action:`${publicationUrl}/api/v1/free?nojs=true`,method:\"post\",onSubmit:track,style:{display:\"flex\",flexDirection:stacked?\"column\":\"row\",gap:stacked?10:0,width:\"100%\",maxWidth:480,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:\"source\",value:\"cover_page\"}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:\"email\",required:true,placeholder:placeholder,style:inputStyle}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:buttonStyle,children:buttonText})]});}addPropertyControls(NewsletterWidget,{publicationUrl:{type:ControlType.String,title:\"Publication\",defaultValue:\"https://blog.controlai.org\",description:\"Substack's canonical host. ctrlai.substack.com and controlai.news both redirect here.\"},publicationSlug:{type:ControlType.String,title:\"Pub slug (tracking)\",defaultValue:\"ctrlai\",description:\"Sent to dataLayer.substack_publication\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your email\"},buttonText:{type:ControlType.String,title:\"Button\",defaultValue:\"Join the Campaign\"},brandColor:{type:ControlType.Color,title:\"Brand color\",defaultValue:\"#00DEB6\"},textColor:{type:ControlType.Color,title:\"Text color\",defaultValue:\"#222937\"},bgColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFC\"},stackBelow:{type:ControlType.Number,title:\"Stack below (px)\",defaultValue:480,min:320,max:1024,step:10,description:\"Viewport width under which input + button stack vertically\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NewsletterWidget\",\"slots\":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