{"version":3,"file":"PopupOverride.DBVle5sm.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/IfJeoqtcJxv1dGWwwHFD/XJUJVcz7VTuA9csHXzXV/PopupController.js","https:/framerusercontent.com/modules/WaPIgKBO2xt3cBuaQrP6/OU5GgCe8FZN19rltbgkP/PopupOverride.js"],"sourcesContent":["// PopupController.tsx — Framer Code Component\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect}from\"react\";const POPUP_WEBHOOK_URL=\"https://script.google.com/macros/s/AKfycbzxb3J9UgkXthS-XBRLwFLN-lPm8W5C7O-rkYRJPJsALsXmmspcoyqaqvcq20YbbTk3/exec\";function getUtms(){try{const p=new URLSearchParams(window.location.search);const fromUrl={utm_source:p.get(\"utm_source\")||\"\",utm_medium:p.get(\"utm_medium\")||\"\",utm_campaign:p.get(\"utm_campaign\")||\"\",utm_content:p.get(\"utm_content\")||\"\",utm_term:p.get(\"utm_term\")||\"\"};if(fromUrl.utm_source){localStorage.setItem(\"ufvfx_utms\",JSON.stringify(fromUrl));return fromUrl;}const saved=localStorage.getItem(\"ufvfx_utms\");return saved?JSON.parse(saved):fromUrl;}catch(_){return{utm_source:\"\",utm_medium:\"\",utm_campaign:\"\",utm_content:\"\",utm_term:\"\"};}}export default function PopupController({popupId=\"fundamentals-crash-course\",minTimeOnPageSec=45,exitIntent=true,mobileScrollTrigger=true,scrollDepthPercent=0,cooldownDays=7,leadMagnetName=\"CrashCourse\",pageSlug=\"/fundamentals\",testMode=false}){useEffect(()=>{if(!testMode){const cooldownKey=`popup_cooldown_${popupId}`;const lastShown=localStorage.getItem(cooldownKey);if(lastShown){const daysSince=(Date.now()-parseInt(lastShown,10))/(1e3*60*60*24);if(daysSince<cooldownDays)return;}}let shown=false;let exitEligible=false;setTimeout(()=>{exitEligible=true;},1e4);let lastScrollY=window.scrollY;let scrollDepthReached=false;const log=(eventName,email=\"\")=>{const utms=getUtms();fetch(POPUP_WEBHOOK_URL,{method:\"POST\",mode:\"no-cors\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({timestamp:new Date().toISOString(),event:eventName,popup_id:popupId,lead_magnet:leadMagnetName,page:pageSlug,trigger:window.__popupTrigger||\"unknown\",email,utm_source:utms.utm_source,utm_medium:utms.utm_medium,utm_campaign:utms.utm_campaign,utm_content:utms.utm_content,utm_term:utms.utm_term})}).catch(()=>{});};const showPopup=trigger=>{if(shown)return;shown=true;window.__popupTrigger=trigger;if(!testMode){localStorage.setItem(`popup_cooldown_${popupId}`,Date.now().toString());}log(\"popup_shown\");window.__logPopupSubmit=email=>{log(\"popup_submitted\",email);};if(typeof window.__showLeadPopup===\"function\"){window.__showLeadPopup();}else{console.warn(\"[PopupController] __showLeadPopup not registered.\");}};if(testMode){const testTimer=setTimeout(()=>showPopup(\"test_mode\"),500);return()=>clearTimeout(testTimer);}// ── Trigger 1: Time delay ──────────────────────────────────────\nconst timer=minTimeOnPageSec>0?setTimeout(()=>showPopup(\"time_delay\"),minTimeOnPageSec*1e3):null;// ── Trigger 2: Exit intent ─────────────────────────────────────\nconst onMouseLeave=e=>{if(!exitIntent||!exitEligible)return;if(e.clientY<=0)showPopup(\"exit_intent\");};// ── Trigger 3: Scroll ──────────────────────────────────────────\nconst onScroll=()=>{const currentY=window.scrollY;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const scrolled=docHeight>0?currentY/docHeight*100:0;if(scrollDepthPercent>0&&!scrollDepthReached&&scrolled>=scrollDepthPercent){scrollDepthReached=true;showPopup(\"scroll_depth\");}if(mobileScrollTrigger){const delta=lastScrollY-currentY;if(delta>80)showPopup(\"mobile_scroll_up\");}lastScrollY=currentY;};if(exitIntent)document.addEventListener(\"mouseleave\",onMouseLeave);window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>{if(timer)clearTimeout(timer);document.removeEventListener(\"mouseleave\",onMouseLeave);window.removeEventListener(\"scroll\",onScroll);};},[popupId,minTimeOnPageSec,exitIntent,mobileScrollTrigger,scrollDepthPercent,cooldownDays,leadMagnetName,pageSlug,testMode]);return /*#__PURE__*/_jsx(\"div\",{style:{width:0,height:0,overflow:\"hidden\",position:\"absolute\",pointerEvents:\"none\"}});}addPropertyControls(PopupController,{testMode:{type:ControlType.Boolean,title:\"🧪 Test Mode\",defaultValue:false,description:\"Fires immediately. Skips cooldown.\"},popupId:{type:ControlType.String,title:\"Popup ID\",defaultValue:\"fundamentals-crash-course\"},minTimeOnPageSec:{type:ControlType.Number,title:\"Min Time (sec)\",defaultValue:45,min:0,max:300,step:5,description:\"Fires popup after this many seconds. 0 = disabled.\"},exitIntent:{type:ControlType.Boolean,title:\"Exit Intent\",defaultValue:true,description:\"Fire when cursor leaves top of viewport.\"},mobileScrollTrigger:{type:ControlType.Boolean,title:\"Mobile Scroll Trigger\",defaultValue:true,description:\"Fire on rapid upward scroll.\"},scrollDepthPercent:{type:ControlType.Number,title:\"Scroll Depth %\",defaultValue:0,min:0,max:100,step:5,description:\"Fire when user scrolls this % down the page. 0 = disabled.\"},cooldownDays:{type:ControlType.Number,title:\"Cooldown (days)\",defaultValue:7,min:0,max:90,step:1},leadMagnetName:{type:ControlType.String,title:\"Lead Magnet Name\",defaultValue:\"CrashCourse\"},pageSlug:{type:ControlType.String,title:\"Page Slug\",defaultValue:\"/fundamentals\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PopupController\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PopupController.map","// PopupOverride.tsx\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";function createPopupControl(mobileInstance){return function(Component){return props=>{const[visible,setVisible]=useState(false);useEffect(()=>{const mq=window.matchMedia(\"(max-width: 768px)\");const shouldControl=mobileInstance===mq.matches;if(!shouldControl)return;window.__showLeadPopup=()=>setVisible(true);window.__hideLeadPopup=()=>setVisible(false);// Re-evaluate if screen resizes across breakpoint\nconst onChange=e=>{const stillShouldControl=mobileInstance===e.matches;if(stillShouldControl){window.__showLeadPopup=()=>setVisible(true);window.__hideLeadPopup=()=>setVisible(false);}};mq.addEventListener(\"change\",onChange);return()=>mq.removeEventListener(\"change\",onChange);},[]);if(!visible)return null;// Use CSS to show/hide based on actual breakpoint\nreturn /*#__PURE__*/_jsxs(\"div\",{style:{display:\"contents\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                        .popup-desktop-overlay { display: flex; }\n                        .popup-mobile-overlay { display: none; }\n                        @media (max-width: 768px) {\n                            .popup-desktop-overlay { display: none; }\n                            .popup-mobile-overlay { display: flex; }\n                        }\n                    `}),/*#__PURE__*/_jsx(\"div\",{className:mobileInstance?\"popup-mobile-overlay\":\"popup-desktop-overlay\",style:{position:\"fixed\",inset:0,zIndex:9999,alignItems:\"center\",justifyContent:\"center\",background:\"rgba(0,0,0,0.75)\"},onClick:()=>setVisible(false),children:/*#__PURE__*/_jsx(\"div\",{onClick:e=>e.stopPropagation(),children:/*#__PURE__*/_jsx(Component,{...props})})})]});};};}export function withPopupControlDesktop(Component){return createPopupControl(false)(Component);}export function withPopupControlMobile(Component){return createPopupControl(true)(Component);}\nexport const __FramerMetadata__ = {\"exports\":{\"withPopupControlMobile\":{\"type\":\"reactHoc\",\"name\":\"withPopupControlMobile\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPopupControlDesktop\":{\"type\":\"reactHoc\",\"name\":\"withPopupControlDesktop\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PopupOverride.map"],"mappings":"kMACuQ,SAAS,GAAS,CAAC,GAAG,CAAC,IAAM,EAAE,IAAI,gBAAgB,EAAO,SAAS,MAAM,EAAQ,EAAQ,CAAC,WAAW,EAAE,IAAI,YAAY,GAAG,GAAG,WAAW,EAAE,IAAI,YAAY,GAAG,GAAG,aAAa,EAAE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