{"version":3,"file":"ExitIntentModal2.CNouUIe6.mjs","names":["_Fragment","useState","useRef"],"sources":["https:/framerusercontent.com/modules/E1uTbpPuSbbXp6TDKrXo/PA3aifq64JoZFzFZc9Tn/ExitIntentModal2.js"],"sourcesContent":["// GigLogic — Framer exit-intent email capture modal\n// ---------------------------------------------------------------------------\n// Where this lives:  Framer → Assets → Code → New Code File → paste this in.\n// How to use it:     Drag <ExitIntentModal> onto any landing page. It renders\n//                    nothing until it fires, so placement on the canvas does\n//                    not matter. All copy is editable per page in the right-hand\n//                    properties panel — no code changes needed for A/B variants.\n//\n// What it does:\n//   1. Detects exit intent (cursor leaving the top of the viewport on desktop,\n//      dwell timer on mobile) and shows a branded overlay.\n//   2. Submits the email to ActiveCampaign form #3 (\"Lead Magnet [Framer]\")\n//      using the same JSONP GET their own embed uses. No API key, no backend,\n//      no CORS. AC's response invokes _show_thank_you / _show_error, so we get\n//      real success and failure callbacks.\n//   3. On confirmed success, pushes `generate_lead` to the GTM dataLayer.\n//      GTM owns all Meta Pixel delivery and consent gating (ad_storage) — this\n//      file NEVER calls fbq directly.\n//      See decisions/2026-08-10_meta_pixel_configuration.md.\n//\n// PII policy: the dataLayer push carries NO email and NO name. GA4 and Meta\n// only need to know a lead occurred, not who it was. Do not add contact\n// details to the push.\n//\n// AC form actions (configured in ActiveCampaign, not here):\n//   - Subscribe to a list\n//   - Add tag `lead-magnet-pdf-framer`  <- Craig's PDF automation triggers on this\n// ---------------------------------------------------------------------------\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// -- CONFIG ------------------------------------------------------------------\nconst AC_ACCOUNT=\"giglogic\";const AC_FORM_ID=\"3\";const AC_FIELDS={u:\"3\",f:\"3\",s:\"\",c:\"0\",m:\"0\",act:\"sub\",v:\"2\",or:\"58e1525a-5f02-4972-8d63-d32b83237c28\"};const STORAGE_KEY=\"gl_exit_modal_seen\";const ARM_DELAY_MS=8e3;const SUBMIT_TIMEOUT_MS=8e3;// -- BRAND TOKENS ------------------------------------------------------------\nconst COLOR={midnight:\"#091830\",midnightSecondary:\"#0d1f3a\",midnightTertiary:\"#132847\",violet:\"#7c5cfc\",violetLight:\"#a587ff\",cyan:\"#20dbf6\",snow:\"#f4f0fc\",charcoal:\"#252525\"};// Splits `heading` on the first occurrence of `accentText` and wraps that\n// substring in a span colored `accentColor`. Falls back to the plain string\n// if accentText is empty or not found — always safe to leave blank.\nfunction renderHeading(heading,accentText,accentColor){if(!accentText)return heading;const idx=heading.indexOf(accentText);if(idx===-1)return heading;return /*#__PURE__*/_jsxs(_Fragment,{children:[heading.slice(0,idx),/*#__PURE__*/_jsx(\"span\",{style:{color:accentColor},children:accentText}),heading.slice(idx+accentText.length)]});}export default function ExitIntentModal(props){const[open,setOpen]=useState(false);const[state,setState]=useState(\"idle\");const[email,setEmail]=useState(\"\");const settled=useRef(false);// -- Exit-intent detection ------------------------------------------------\nuseEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;let seen=0;try{seen=Number(localStorage.getItem(STORAGE_KEY)||0);}catch(e){/* private mode */}if(seen&&Date.now()-seen<props.cooldownDays*864e5)return;let armed=false;const armTimer=setTimeout(()=>armed=true,ARM_DELAY_MS);const onMouseOut=e=>{if(armed&&!e.relatedTarget&&e.clientY<=0)fire();};const mobileTimer=setTimeout(()=>{if(window.matchMedia(\"(max-width: 809px)\").matches)fire();},props.mobileDelaySeconds*1e3);function fire(){setOpen(true);try{localStorage.setItem(STORAGE_KEY,String(Date.now()));}catch(e){/* no-op */}cleanup();}function cleanup(){document.removeEventListener(\"mouseout\",onMouseOut);clearTimeout(armTimer);clearTimeout(mobileTimer);}document.addEventListener(\"mouseout\",onMouseOut);return cleanup;},[]);// -- Submit ---------------------------------------------------------------\nfunction submit(e){e.preventDefault();if(state===\"sending\")return;setState(\"sending\");settled.current=false;window.cfields=window.cfields||[];window._show_thank_you=function(){if(settled.current)return;settled.current=true;setState(\"done\");window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"generate_lead\",lead_source:\"exit_modal\",lead_magnet:props.leadMagnetName,page_path:window.location.pathname});};window._show_error=function(){if(settled.current)return;settled.current=true;setState(\"error\");};const params=new URLSearchParams({...AC_FIELDS,email,jsonp:\"true\"});const script=document.createElement(\"script\");script.charset=\"utf-8\";script.src=`https://${AC_ACCOUNT}.activehosted.com/proc.php?${params.toString()}`;script.onerror=()=>window._show_error?.();document.head.appendChild(script);setTimeout(()=>{if(!settled.current){settled.current=true;setState(\"error\");}},SUBMIT_TIMEOUT_MS);}if(!open)return null;return /*#__PURE__*/_jsx(\"div\",{style:overlay,onClick:()=>setOpen(false),role:\"dialog\",\"aria-modal\":\"true\",children:/*#__PURE__*/_jsxs(\"div\",{style:card,onClick:e=>e.stopPropagation(),children:[/*#__PURE__*/_jsx(\"button\",{style:closeBtn,onClick:()=>setOpen(false),\"aria-label\":\"Close\",children:\"\\xd7\"}),state===\"done\"?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"h2\",{style:h2,children:props.successHeading}),/*#__PURE__*/_jsx(\"p\",{style:body,children:props.successBody})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"h2\",{style:h2,children:renderHeading(props.heading,props.accentText,props.accentColor)}),/*#__PURE__*/_jsx(\"p\",{style:{...body,marginBottom:20},children:props.subheading}),/*#__PURE__*/_jsxs(\"form\",{onSubmit:submit,style:{display:\"flex\",gap:10,flexWrap:\"wrap\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:\"email\",required:true,autoFocus:true,value:email,onChange:e=>setEmail(e.target.value),placeholder:props.placeholder,style:input}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:cta,disabled:state===\"sending\",children:state===\"sending\"?\"...\":props.buttonLabel})]}),state===\"error\"&&/*#__PURE__*/_jsx(\"p\",{style:{color:\"#f87171\",fontSize:13,fontFamily:\"Satoshi, system-ui, sans-serif\",marginTop:10},children:\"That didn't go through. Try again in a moment.\"}),/*#__PURE__*/_jsxs(\"p\",{style:fine,children:[props.consentText,\" \",/*#__PURE__*/_jsx(\"a\",{href:\"https://app.giglogic.com/privacy\",style:{color:COLOR.violetLight},children:\"Privacy Policy\"}),\".\"]})]})]})});}// -- STYLES ------------------------------------------------------------------\nconst overlay={position:\"fixed\",inset:0,background:\"rgba(9, 24, 48, 0.78)\",backdropFilter:\"blur(16px)\",WebkitBackdropFilter:\"blur(16px)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:9999,padding:20};const card={position:\"relative\",background:COLOR.midnightSecondary,color:COLOR.snow,borderRadius:16,border:\"1px solid rgba(255, 255, 255, 0.08)\",padding:\"36px 32px\",maxWidth:480,width:\"100%\",fontFamily:\"Satoshi, system-ui, sans-serif\",boxShadow:\"0 1px 3px rgba(9, 24, 48, 0.04), 0 4px 16px rgba(9, 24, 48, 0.06), 0 24px 64px rgba(0, 0, 0, 0.4)\"};const h2={margin:\"0 0 8px\",fontSize:26,lineHeight:1.2,fontFamily:\"Gilroy, system-ui, sans-serif\",fontWeight:600,whiteSpace:\"pre-line\"};const body={margin:0,opacity:.75,lineHeight:1.55,fontSize:16,fontFamily:\"Satoshi, system-ui, sans-serif\"};const closeBtn={position:\"absolute\",top:12,right:14,background:\"none\",border:0,color:COLOR.snow,fontSize:24,lineHeight:1,cursor:\"pointer\",opacity:.5};const input={flex:1,minWidth:180,padding:\"12px 14px\",borderRadius:999,border:\"1px solid rgba(255, 255, 255, 0.08)\",background:COLOR.midnightTertiary,color:COLOR.snow,fontSize:15,fontFamily:\"Satoshi, system-ui, sans-serif\",outline:\"none\"};const cta={padding:\"12px 24px\",borderRadius:999,border:0,background:COLOR.cyan,color:COLOR.midnight,fontFamily:\"Gilroy, system-ui, sans-serif\",fontWeight:700,fontSize:15,cursor:\"pointer\",whiteSpace:\"nowrap\"};const fine={fontSize:12,opacity:.5,marginTop:16,lineHeight:1.55,fontFamily:\"Satoshi, system-ui, sans-serif\"};// -- FRAMER PROPERTY CONTROLS ------------------------------------------------\nExitIntentModal.defaultProps={heading:\"Get the FREE Guide:\\nBEFORE YOU SAY YES\",subheading:\"Five questions to ask before accepting your next gig.\",placeholder:\"EMAIL ADDRESS\",buttonLabel:\"SEND ME THE FREE GUIDE\",leadMagnetName:\"Lead Magnet PDF\",successHeading:\"Check your inbox.\",successBody:\"Your guide is on its way. Give it a minute.\",consentText:\"We'll send the guide plus occasional GigLogic insights for making better professional decisions. Unsubscribe anytime.\",cooldownDays:30,mobileDelaySeconds:45,// Accent word colored inside the heading — leave accentText blank to\n// disable. Defaults target the word Craig asked to highlight.\naccentText:\"FREE\",accentColor:COLOR.cyan};addPropertyControls(ExitIntentModal,{heading:{type:ControlType.String,title:\"Heading\",displayTextArea:true,description:\"Press Enter for a line break — the heading stacks onto a new line.\"},accentText:{type:ControlType.String,title:\"Accent Word\",description:\"Word inside the Heading to color differently. Leave blank for none.\"},accentColor:{type:ControlType.Color,title:\"Accent Color\"},subheading:{type:ControlType.String,title:\"Subheading\"},placeholder:{type:ControlType.String,title:\"Placeholder\"},buttonLabel:{type:ControlType.String,title:\"Button\"},leadMagnetName:{type:ControlType.String,title:\"Lead Magnet\"},successHeading:{type:ControlType.String,title:\"Success Heading\"},successBody:{type:ControlType.String,title:\"Success Body\"},consentText:{type:ControlType.String,title:\"Consent Text\",displayTextArea:true},cooldownDays:{type:ControlType.Number,title:\"Cooldown (days)\",min:0,max:365,step:1},mobileDelaySeconds:{type:ControlType.Number,title:\"Mobile Delay (s)\",min:10,max:180,step:5}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ExitIntentModal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ExitIntentModal2.map"],"mappings":"2NAiCA,SAAS,EAAc,EAAQ,EAAW,E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