{"version":3,"file":"NerdConNewsletterSignup.F96hitHV.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/vOVMmuen0LYJ8Wpo7pGv/RZEHK2i7Nd6VlnVk1mna/NerdConNewsletterSignup.js"],"sourcesContent":["// NerdCon Newsletter Signup → HubSpot (direct, no middleman)\n// =============================================================\n// A Framer CODE COMPONENT that renders the \"STAY IN THE LOOP. NOT THE SPAM.\"\n// design and submits straight to HubSpot's Forms API from the browser.\n// No Zapier, no Make, no Clay, no Cloudflare, no Google Sheets — nothing\n// external. Everything lives inside your Framer project.\n//\n// WHY THIS WORKS WHERE THE WEBHOOK DIDN'T:\n// Framer's native Webhook sends a FLAT payload that HubSpot rejects. This\n// component builds the exact structure HubSpot's /submissions/v3 endpoint\n// requires (a `fields` array + `legalConsentOptions`), so submissions land.\n// (Requires reCAPTCHA to be OFF on the HubSpot form — already done.)\n//\n// ---------------------------------------------------------------\n// HOW TO INSTALL (one time, ~3 minutes):\n// 1. In Framer: Assets panel (left) → Code → \"+\" → New Code File.\n// 2. Name it \"NerdConNewsletterSignup\" and paste this whole file in.\n// 3. On the Home page, select Annie's current \"Stay in the Loop\" form\n//    frame (the one inside \"nerdcon-email-capture\") and DELETE it — or\n//    just hide it. We're replacing it with this component.\n// 4. From the Assets → Code section, drag \"NerdConNewsletterSignup\" into\n//    that same spot in the layout.\n// 5. It already has all your IDs baked in. Publish.\n// 6. Test on the LIVE site (not preview) — webhooks/API calls never fire\n//    from the Framer editor.\n//\n// OPTIONAL: to auto-enrol signups into your \"Marketing Information\" email\n// subscription, set SUBSCRIPTION_TYPE_ID below to its numeric ID (find it\n// later via HubSpot → Settings → Marketing → Email → Subscription Types,\n// or leave 0 — submissions still succeed and contacts are still created).\n// ---------------------------------------------------------------\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const PORTAL_ID=\"244887422\";const FORM_GUID=\"3492f0e8-180e-4c0a-8aab-1b349035da7b\";const REGION=\"na2\"// informational; endpoint host is region-agnostic\n;/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function NerdConNewsletterSignup(props){const{consentText,subscriptionTypeId,placeholder,buttonLabel,successMessage,accentColor,inputBg,inputText,mutedColor,errorColor,fontFamily}=props;const[email,setEmail]=useState(\"\");const[consent,setConsent]=useState(false);const[status,setStatus]=useState(\"idle\")// idle | loading | success | error\n;const[errorMsg,setErrorMsg]=useState(\"\");const getHutk=()=>{const m=typeof document!==\"undefined\"&&document.cookie.match(/hubspotutk=([^;]+)/);return m?m[1]:undefined;};const submit=useCallback(async()=>{setErrorMsg(\"\");const emailOk=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email.trim());if(!emailOk){setStatus(\"error\");setErrorMsg(\"Enter a valid work email.\");return;}if(!consent){setStatus(\"error\");setErrorMsg(\"Please tick the consent box first.\");return;}setStatus(\"loading\");// Build the consent block HubSpot's GDPR-enabled form requires.\nconst communications=subscriptionTypeId&&subscriptionTypeId>0?[{value:true,subscriptionTypeId:subscriptionTypeId,text:consentText}]:[];const body={fields:[{objectTypeId:\"0-1\",name:\"email\",value:email.trim()}],context:{hutk:getHutk(),pageUri:typeof window!==\"undefined\"?window.location.href:\"\",pageName:typeof document!==\"undefined\"?document.title:\"\"},legalConsentOptions:{consent:{consentToProcess:true,text:consentText,communications}}};try{const res=await fetch(`https://api.hsforms.com/submissions/v3/integration/submit/${PORTAL_ID}/${FORM_GUID}`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(body)});if(res.ok){setStatus(\"success\");setEmail(\"\");setConsent(false);}else{let msg=\"Something glitched. Try again in a sec.\";try{const err=await res.json();if(err?.errors?.[0]?.message)msg=err.errors[0].message;}catch(_){}setStatus(\"error\");setErrorMsg(msg);}}catch(_){setStatus(\"error\");setErrorMsg(\"Network error. Try again in a sec.\");}},[email,consent,subscriptionTypeId,consentText]);const mono=fontFamily||\"'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace\";const S={wrap:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",gap:14,fontFamily:mono,boxSizing:\"border-box\"},label:{fontSize:12,letterSpacing:\"0.04em\",color:mutedColor,margin:0},input:{width:\"100%\",boxSizing:\"border-box\",padding:\"13px 15px\",fontSize:14,fontFamily:mono,color:inputText,background:inputBg,border:\"none\",borderRadius:2,outline:\"none\"},consentRow:{display:\"flex\",alignItems:\"flex-start\",gap:9,cursor:\"pointer\",userSelect:\"none\"},checkbox:{width:14,height:14,marginTop:2,accentColor:accentColor,cursor:\"pointer\",flexShrink:0},consentText:{fontSize:11,lineHeight:1.5,color:mutedColor,margin:0},button:{alignSelf:\"flex-end\",padding:\"11px 30px\",fontSize:14,fontWeight:700,fontFamily:mono,color:\"#04110A\",background:accentColor,border:\"none\",borderRadius:8,cursor:status===\"loading\"?\"wait\":\"pointer\",boxShadow:\"3px 3px 0 rgba(0,0,0,0.45)\",opacity:status===\"loading\"?.7:1,transition:\"transform 80ms ease\"},success:{fontSize:14,color:accentColor,padding:\"20px 0\",margin:0},error:{fontSize:12,color:errorColor,margin:0}};if(status===\"success\"){return /*#__PURE__*/_jsx(\"div\",{style:S.wrap,children:/*#__PURE__*/_jsx(\"p\",{style:S.success,children:successMessage})});}return /*#__PURE__*/_jsxs(\"div\",{style:S.wrap,children:[/*#__PURE__*/_jsx(\"p\",{style:S.label,children:\"Work Email\"}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,placeholder:placeholder,onChange:e=>setEmail(e.target.value),onKeyDown:e=>e.key===\"Enter\"&&submit(),style:S.input}),/*#__PURE__*/_jsxs(\"div\",{style:S.consentRow,onClick:()=>setConsent(!consent),children:[/*#__PURE__*/_jsx(\"input\",{type:\"checkbox\",checked:consent,onChange:e=>setConsent(e.target.checked),onClick:e=>e.stopPropagation(),style:S.checkbox}),/*#__PURE__*/_jsx(\"p\",{style:S.consentText,children:consentText})]}),status===\"error\"&&/*#__PURE__*/_jsx(\"p\",{style:S.error,children:errorMsg}),/*#__PURE__*/_jsx(\"button\",{style:S.button,onClick:submit,onMouseDown:e=>e.currentTarget.style.transform=\"translate(2px,2px)\",onMouseUp:e=>e.currentTarget.style.transform=\"translate(0,0)\",disabled:status===\"loading\",children:status===\"loading\"?\"Sending...\":buttonLabel})]});}NerdConNewsletterSignup.defaultProps={consentText:\"I agree to receive NerdCon updates + occasional event news.\",subscriptionTypeId:0,placeholder:\"you@company.com\",buttonLabel:\"Submit\",successMessage:\"// You're in. No fluff. One email at a time.\",accentColor:\"#00C26E\",inputBg:\"#CDEBDB\",inputText:\"#0B1220\",mutedColor:\"#8AA0B2\",errorColor:\"#FF6B6B\",fontFamily:\"\"};addPropertyControls(NerdConNewsletterSignup,{consentText:{type:ControlType.String,title:\"Consent Text\"},subscriptionTypeId:{type:ControlType.Number,title:\"Subscription ID\",displayStepper:true},placeholder:{type:ControlType.String,title:\"Placeholder\"},buttonLabel:{type:ControlType.String,title:\"Button Label\"},successMessage:{type:ControlType.String,title:\"Success Msg\"},accentColor:{type:ControlType.Color,title:\"Accent\"},inputBg:{type:ControlType.Color,title:\"Input BG\"},inputText:{type:ControlType.Color,title:\"Input Text\"},mutedColor:{type:ControlType.Color,title:\"Muted Text\"},errorColor:{type:ControlType.Color,title:\"Error Color\"},fontFamily:{type:ControlType.String,title:\"Font Family\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NerdConNewsletterSignup\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NerdConNewsletterSignup.map"],"mappings":"sMAmCG,SAAwB,EAAwB,EAAM,CAAC,GAAK,CAAC,cAAY,qBAAmB,cAAY,cAAY,iBAAe,cAAY,UAAQ,YAAU,aAAW,aAAW,cAAY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