{"version":3,"file":"CalendlyUTM.BLfddJM2.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/2UBZMLRLxyid3EfsoPo7/pJhueMrFUNabUt7uqD79/CalendlyUTM.js"],"sourcesContent":["// /code/CalendlyPatchGlobal.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";const UTM_KEYS=[\"utm_source\",\"utm_medium\",\"utm_campaign\",\"utm_term\",\"utm_content\",\"utm_id\"];function getParentUtms(){const qs=new URLSearchParams(window.location.search);const utms={};for(const k of UTM_KEYS){const v=qs.get(k);if(v)utms[k]=v;}// --- Map utm_id -> utm_content (carry cid invisibly) ---\n// If utm_content already exists, append the id; else use the id as content.\nif(utms.utm_id){utms.utm_content=utms.utm_content?`${utms.utm_content}|${utms.utm_id}`:utms.utm_id;delete utms.utm_id;}return utms;}function patchCalendlyIframe(iframe,utms){const src=iframe.getAttribute(\"src\")||\"\";console.log(\"[CalendlyPatchGlobal] Candidate iframe src:\",src);// Only touch calendly iframes\nif(!/calendly\\.com/.test(src)){console.log(\"[CalendlyPatchGlobal] Not a Calendly iframe, skipping.\");return false;}if(!Object.keys(utms).length){console.log(\"[CalendlyPatchGlobal] No UTMs in parent URL; not modifying src.\");return false;}// Build new URL, stripping existing utm_* and a1..a6 first\nlet url;try{url=new URL(src,window.location.origin);}catch{url=new URL(src.startsWith(\"//\")?`https:${src}`:src);}const sp=url.searchParams;const before=Object.fromEntries(sp.entries());console.log(\"[CalendlyPatchGlobal] BEFORE params:\",before);// Remove existing utm_* and a1..a6 so we can overwrite cleanly\nfor(const key of Array.from(sp.keys())){if(key.startsWith(\"utm_\")||/^a[1-6]$/.test(key))sp.delete(key);}// Add mapped UTMs (note: utm_id has been removed; content includes cid)\nfor(const[k,v]of Object.entries(utms))sp.set(k,v);const after=Object.fromEntries(sp.entries());console.log(\"[CalendlyPatchGlobal] AFTER params:\",after);const newSrc=url.toString();if(newSrc!==src){console.log(\"[CalendlyPatchGlobal] Updating iframe src →\",newSrc);iframe.setAttribute(\"src\",newSrc);return true;}console.log(\"[CalendlyPatchGlobal] Src unchanged.\");return false;}export function CalendlyPatchGlobal(){console.log(\"[CalendlyPatchGlobal] Override attached and running!\");// Repeatedly scan because Framer->Embed->Calendly may inject late\nconst utms=getParentUtms();console.log(\"[CalendlyPatchGlobal] Parent UTMs:\",utms);let attempts=0;const maxAttempts=40// ~4s total\n;const interval=100;const timer=window.setInterval(()=>{attempts++;const iframes=Array.from(document.querySelectorAll(\"iframe\"));console.log(`[CalendlyPatchGlobal] Scan #${attempts} — found ${iframes.length} iframes`);let patched=false;for(const iframe of iframes){try{// We cannot inspect iframe.contentWindow for cross-origin; stick to src only\nif(patchCalendlyIframe(iframe,utms))patched=true;}catch(e){console.warn(\"[CalendlyPatchGlobal] Error patching iframe:\",e);}}if(patched||attempts>=maxAttempts){console.log(`[CalendlyPatchGlobal] Done (patched=${patched}, attempts=${attempts}/${maxAttempts})`);clearInterval(timer);}},interval);// Also try once on window load just in case\nconst onLoad=()=>{console.log(\"[CalendlyPatchGlobal] window.load fired — extra scan.\");const iframes=Array.from(document.querySelectorAll(\"iframe\"));for(const iframe of iframes){try{patchCalendlyIframe(iframe,utms);}catch{}}};window.addEventListener(\"load\",onLoad);return{// Ensure cleanup on unmount\nref(){return()=>{clearInterval(timer);window.removeEventListener(\"load\",onLoad);console.log(\"[CalendlyPatchGlobal] Cleanup.\");};}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withCalendlyPatchGlobal(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...CalendlyPatchGlobal(props)});};}withCalendlyPatchGlobal.displayName=\"CalendlyPatchGlobal\";\nexport const __FramerMetadata__ = {\"exports\":{\"withCalendlyPatchGlobal\":{\"type\":\"reactHoc\",\"name\":\"withCalendlyPatchGlobal\",\"annotations\":{\"framerContractVersion\":\"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