{"version":3,"file":"TrackingCapture.C0yW0n3f.mjs","names":["useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/xA268PifDE4VSFKFKJhx/VyGbfyCANTSKCCQtUyMr/CoordinatorBooking.js","https:/framerusercontent.com/modules/P1tNtjz8QryAoqn3eGFI/r3CnpyvkC2YzgdRrfQyk/TrackingCapture.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";const SCRIPT_ID=\"calendly-widget-script\";const SCRIPT_SRC=\"https://assets.calendly.com/assets/external/widget.js\";const BOOKING_URL=\"https://calendly.com/medicalnavigator/free-call-with-your-coordinator\";// Calendly posts its booking events to the parent window from this origin.\nconst CALENDLY_ORIGIN=\"https://calendly.com\";// Where we send the invitee ourselves once the booking is confirmed.\nconst NEXT_PAGE=\"/get-started/questions\";// The only prefill parameters Calendly accepts. Everything else is ignored.\nconst UTM_KEYS=[\"utm_source\",\"utm_medium\",\"utm_campaign\",\"utm_content\",\"utm_term\"];function buildBookingUrl(){const params=[\"hide_gdpr_banner=1\"];if(typeof window!==\"undefined\"){try{const search=new URLSearchParams(window.location.search);for(const key of UTM_KEYS){const value=search.get(key);if(typeof value!==\"string\")continue;const trimmed=value.trim();if(trimmed===\"\")continue;params.push(key+\"=\"+encodeURIComponent(trimmed));}}catch(e){// Keep the bare booking URL rather than breaking the page.\n}}return BOOKING_URL+\"?\"+params.join(\"&\");}// Calendly identifies the invitee with a URI such as\n// https://api.calendly.com/scheduled_events/AAA/invitees/BBB\n// The UUID is the last non-empty path segment.\nfunction lastPathSegment(uri){if(typeof uri!==\"string\")return\"\";const parts=uri.split(\"/\");for(let i=parts.length-1;i>=0;i--){const part=parts[i].trim();if(part!==\"\")return part;}return\"\";}export default function CoordinatorBooking({style}){// Built during the first render pass so data-url is already on the div\n// when widget.js scans the page for .calendly-inline-widget elements.\nconst urlRef=useRef(null);if(urlRef.current===null)urlRef.current=buildBookingUrl();const url=urlRef.current;const containerRef=useRef(null);useEffect(()=>{const init=()=>{const el=containerRef.current;if(!el)return;// widget.js auto-initialises .calendly-inline-widget on load.\n// Only initialise by hand if that has not already happened.\nif(el.childElementCount>0)return;const w=window;if(typeof w.Calendly?.initInlineWidget!==\"function\")return;w.Calendly.initInlineWidget({url,parentElement:el});};if(document.getElementById(SCRIPT_ID)){init();return;}const s=document.createElement(\"script\");s.id=SCRIPT_ID;s.src=SCRIPT_SRC;s.async=true;s.onload=init;document.body.appendChild(s);},[url]);// Calendly reports the completed booking to the parent window. We take\n// the invitee UUID from that message, keep it in sessionStorage and\n// navigate ourselves, so no personal data is ever put into a URL.\nuseEffect(()=>{if(typeof window===\"undefined\")return;const handler=event=>{if(event.origin!==CALENDLY_ORIGIN)return;const data=event.data;if(!data||typeof data!==\"object\")return;if(typeof data.event!==\"string\")return;if(data.event.indexOf(\"calendly.\")!==0)return;if(data.event!==\"calendly.event_scheduled\")return;const uuid=lastPathSegment(data.payload?.invitee?.uri);if(uuid!==\"\"){try{window.sessionStorage.setItem(\"invitee_uuid\",uuid);}catch(e){// Private browsing throws. Navigate anyway.\n}}window.location.assign(NEXT_PAGE);};window.addEventListener(\"message\",handler);return()=>window.removeEventListener(\"message\",handler);},[]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,className:\"calendly-inline-widget\",\"data-url\":url,style:{width:\"100%\",height:700,minWidth:280,...style}});}CoordinatorBooking.displayName=\"Coordinator Booking\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CoordinatorBooking\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CoordinatorBooking.map","import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect}from\"react\";// Tracking parameters that must survive a redirect through Calendly.\n// Calendly only forwards the five UTM parameters, so everything here is\n// stashed in sessionStorage before the visitor leaves for the booking page.\nconst TRACKING_PARAMS=[\"fbclid\",\"gclid\",\"tm_evid\",\"tm_fbp\",\"tm_fbc\",\"tm_fbclid\",\"tm_gclid\",\"tm_gbraid\",\"tm_wbraid\",\"tm_ttclid\",// UTMs captured as a fallback in case Calendly ever changes behaviour.\n\"utm_source\",\"utm_medium\",\"utm_campaign\",\"utm_content\",\"utm_term\"];/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TrackingCapture(){useEffect(()=>{// Guard against server-side rendering during publish.\nif(typeof window===\"undefined\")return;let params;try{params=new URLSearchParams(window.location.search);}catch(error){return;}for(const name of TRACKING_PARAMS){let value=null;try{value=params.get(name);}catch(error){continue;}if(typeof value!==\"string\")continue;const trimmed=value.trim();// Only write when present and non-empty, so an existing stored\n// value is never overwritten with a blank.\nif(trimmed.length===0)continue;try{window.sessionStorage.setItem(name,trimmed);}catch(error){// Private browsing and some embedded browsers throw on\n// sessionStorage access. Swallow it so the page keeps working.\n}}},[]);// Nothing visible, no layout impact.\nreturn /*#__PURE__*/_jsx(_Fragment,{});}TrackingCapture.displayName=\"Tracking Capture\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TrackingCapture\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrackingCapture.map"],"mappings":"8IAGmF,SAAS,GAAiB,CAAC,IAAM,EAAO,CAAC,oBAAoB,EAAE,GAAU,IAAS,OAAa,GAAG,CAAC,IAAM,EAAO,IAAI,gBAAgB,EAAO,SAAS,MAAM,EAAE,IAAI,IAAM,KAAO,EAAS,CAAC,IAAM,EAAM,EAAO,IAAI,CAAG,EAAE,GAAG,OAAO,GAAQ,SAAS,SAAS,IAAM,EAAQ,EAAM,KAAK,EAAK,IAAU,IAAY,EAAO,KAAK,EAAI,IAAI,mBAAmB,CAAO,CAAC,C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