{"version":3,"file":"EmailCaptureModal.CKOadWMI.mjs","names":["useState","_Fragment","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/J3WiLd64Ick7pjxHF60T/o26vV0QWysgKfp3VzwQv/EmailCaptureModal.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType}from\"framer\";// ─── Global modal state ────────────────────────────────────────────────────────\nconst listeners=new Set;let isOpen=false;export const openModal=()=>{isOpen=true;listeners.forEach(fn=>fn());};export const closeModal=()=>{isOpen=false;listeners.forEach(fn=>fn());};function useModalState(){const[open,setOpen]=useState(isOpen);useEffect(()=>{const fn=()=>setOpen(isOpen);listeners.add(fn);return()=>{listeners.delete(fn);};},[]);return open;}// ─── Override: apply to any CTA button ────────────────────────────────────────\nexport function JoinCTA(){return{onClick:openModal,style:{cursor:\"pointer\"}};}// ─── Modal UI ─────────────────────────────────────────────────────────────────\nfunction Modal({appId}){const[email,setEmail]=useState(\"\");const[status,setStatus]=useState(\"idle\");const submit=async()=>{if(!email.includes(\"@\"))return;setStatus(\"loading\");try{const res=await fetch(\"https://onesignal.com/api/v1/players\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({app_id:appId,device_type:11,identifier:email})});if(res.ok){setStatus(\"success\");setTimeout(closeModal,2200);}else{setStatus(\"error\");}}catch{setStatus(\"error\");}};return /*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{onClick:closeModal,style:{position:\"fixed\",inset:0,background:\"rgba(26, 26, 26, 0.6)\",backdropFilter:\"blur(4px)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:9999,fontFamily:\"Inter, sans-serif\"},children:/*#__PURE__*/_jsxs(\"div\",{onClick:e=>e.stopPropagation(),style:{background:\"rgb(244, 242, 236)\",borderRadius:16,padding:\"48px 40px 40px\",width:420,maxWidth:\"90vw\",position:\"relative\",boxShadow:\"0 24px 64px rgba(26,26,26,0.18)\"},children:[/*#__PURE__*/_jsx(\"button\",{onClick:closeModal,style:{position:\"absolute\",top:16,right:20,background:\"none\",border:\"none\",fontSize:20,cursor:\"pointer\",color:\"#8A8680\",lineHeight:1,padding:4},children:\"✕\"}),/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"'JetBrains Mono', monospace\",fontSize:11,letterSpacing:\"0.08em\",color:\"#8A8680\",margin:\"0 0 12px\",textTransform:\"uppercase\"},children:\"Early Access\"}),/*#__PURE__*/_jsx(\"h2\",{style:{fontFamily:\"Fraunces, serif\",fontSize:28,fontWeight:400,color:\"#1A1A1A\",margin:\"0 0 10px\",lineHeight:1.2},children:\"Get your body on protocol.\"}),/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"Inter, sans-serif\",fontSize:14,color:\"#5A5855\",margin:\"0 0 28px\",lineHeight:1.5},children:\"Be first in. We'll notify you the moment HumOS opens its doors.\"}),status===\"success\"?/*#__PURE__*/_jsxs(\"div\",{style:{background:\"rgba(47, 106, 58, 0.1)\",borderRadius:8,padding:\"16px 20px\",textAlign:\"center\"},children:[/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"Fraunces, serif\",fontSize:18,color:\"#2F6A3A\",margin:0},children:\"You're in ✓\"}),/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"Inter, sans-serif\",fontSize:13,color:\"#5A5855\",margin:\"6px 0 0\"},children:\"We'll be in touch soon.\"})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",placeholder:\"your@email.com\",value:email,onChange:e=>setEmail(e.target.value),onKeyDown:e=>e.key===\"Enter\"&&submit(),style:{width:\"100%\",padding:\"13px 16px\",borderRadius:8,border:\"1px solid rgba(26,26,26,0.15)\",fontSize:14,fontFamily:\"Inter, sans-serif\",background:\"#fff\",color:\"#1A1A1A\",marginBottom:10,boxSizing:\"border-box\",outline:\"none\"}}),/*#__PURE__*/_jsx(\"button\",{onClick:submit,disabled:status===\"loading\",style:{width:\"100%\",padding:14,borderRadius:8,background:\"#1A1A1A\",color:\"#F4F2EC\",fontSize:14,fontWeight:600,fontFamily:\"Inter, sans-serif\",border:\"none\",cursor:status===\"loading\"?\"wait\":\"pointer\",letterSpacing:\"0.01em\"},children:status===\"loading\"?\"Submitting…\":\"Join For Early Access →\"}),status===\"error\"&&/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"Inter, sans-serif\",fontSize:12,color:\"#c0392b\",margin:\"8px 0 0\",textAlign:\"center\"},children:\"Something went wrong. Please try again.\"}),/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"'JetBrains Mono', monospace\",fontSize:10,color:\"#8A8680\",margin:\"14px 0 0\",textAlign:\"center\",letterSpacing:\"0.04em\"},children:\"NO ADS \\xb7 PRIVATE BY DEFAULT \\xb7 UNSUBSCRIBE ANYTIME\"})]})]})}),document.body);}// ─── Portal Host Component ─────────────────────────────────────────────────────\n// Drop this invisible component anywhere on the page.\n// It renders the modal via a portal so it always sits above everything.\nexport function EmailCaptureModal({oneSignalAppId}){const open=useModalState();if(!open)return null;return /*#__PURE__*/_jsx(Modal,{appId:oneSignalAppId});}addPropertyControls(EmailCaptureModal,{oneSignalAppId:{type:ControlType.String,title:\"OneSignal App ID\",defaultValue:\"\",placeholder:\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"}});import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withJoinCTA(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...JoinCTA(props)});};}withJoinCTA.displayName=\"JoinCTA\";\nexport const __FramerMetadata__ = {\"exports\":{\"JoinCTA\":{\"type\":\"override\",\"name\":\"JoinCTA\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"openModal\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"EmailCaptureModal\":{\"type\":\"reactComponent\",\"name\":\"EmailCaptureModal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"closeModal\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withJoinCTA\":{\"type\":\"reactHoc\",\"name\":\"withJoinCTA\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EmailCaptureModal.map"],"mappings":"2NACuL,SAAS,GAAe,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,EAAO,CAAuG,OAAtG,MAAc,CAAC,IAAM,MAAO,EAAQ,EAAO,CAAmB,OAAlB,EAAU,IAAI,EAAG,KAAW,CAAC,EAAU,OAAO,EAAG,GAAK,EAAE,CAAC,CAAQ,EAClW,SAAgB,GAAS,CAAC,MAAM,CAAC,QAAQ,EAAU,MAAM,CAAC,OAAO,UAAU,CAAC,CAC5E,SAAS,EAAM,CAAC,SAAO,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAO,GAAWA,EAAS,OAAO,CAAO,EAAO,SAAS,CAAK,KAAM,SAAS,IAAI,CAAQ,GAAU,UAAU,CAAC,GAAG,EAAW,MAAM,MAAM,uCAAuC,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,mBAAmB,CAAC,KAAK,KAAK,UAAU,CAAC,OAAO,EAAM,YAAY,GAAG,WAAW,EAAM,CAAC,CAAC,CAAC,EAAQ,IAAI,EAAU,UAAU,CAAC,WAAW,EAAW,KAAK,EAAO,EAAU,QAAQ,MAAQ,CAAC,EAAU,QAAQ,IAAI,OAAoB,EAA0B,EAAK,MAAM,CAAC,QAAQ,EAAW,MAAM,CAAC,SAAS,QAAQ,MAAM,EAAE,WAAW,wBAAwB,eAAe,YAAY,QAAQ,OAAO,WAAW,SAAS,eAAe,SAAS,OAAO,KAAK,WAAW,oBAAo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