{"version":3,"file":"TrackEvent.DX23Pf07.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/MOHoUpaVpiY5tOIfl40R/vpTIWh1xXwMMukWBfQHt/TrackEvent.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef}from\"react\";/**\n * Track Event — self-contained click tracking marker.\n *\n * Drop this inside any repeating component (an FAQ entry, a card) and set\n * Event Name. It attaches a click listener to the layer that contains it and\n * emits the event itself. Because it travels inside the component, every\n * instance on every page is instrumented automatically — currently 119 FAQ\n * questions across 14 pages, in two different page layouts.\n *\n * HISTORY — why it works this way (2026-08-04):\n * This used to render only hidden data-* attributes, and a delegated listener\n * in Site Settings > Custom Code did the work with:\n *     el.querySelector(\":scope > [data-track-event]\")\n * Framer wraps every code-component instance in a framer-<hash>-container div,\n * so the marker was a GRANDCHILD of the clickable layer and \":scope >\" (direct\n * child only) never matched. Every event using this component was silently dead\n * for months. Rather than hard-code a deeper selector — which the next wrapper\n * change would break again — the component now walks up past however many\n * Framer containers exist and owns its own listener.\n *\n * The head-script listener is now superseded and can be deleted from Site\n * Settings. This component no longer renders the data-* attributes it read, so\n * the two cannot double-count.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TrackEvent(props){const{eventName,contentType,contentId,label,location}=props;const ref=useRef(null);useEffect(()=>{const el=ref.current;if(!el||!eventName)return;// Skip Framer's generated instance wrappers to reach the authored layer\n// that holds both this marker and the clickable content.\nlet host=el.parentElement;while(host&&typeof host.className===\"string\"&&/(^|\\s)framer-[\\w-]*container(\\s|$)/.test(host.className)){host=host.parentElement;}if(!host)return;const slug=s=>s.toLowerCase().replace(/[^a-z0-9]+/g,\"-\").replace(/^-|-$/g,\"\");const onClick=()=>{const w=window;const eventProps={};if(contentType)eventProps.content_type=contentType;if(label)eventProps.label=label;// content_id is authored on the /services pages but blank on the\n// homepage FAQ, so fall back to a slug of the label. The head\n// script did the same; keep it or homepage clicks arrive with no id.\nconst cid=contentId||(label?slug(label):\"\");if(cid)eventProps.content_id=cid;if(location)eventProps.location=location;// Prefer window.trackEvent: it merges window.__heraPageContext set\n// by PageTracking.tsx. Fall back to a direct push so this keeps\n// working if the head script is ever removed.\nif(typeof w.trackEvent===\"function\"){w.trackEvent(eventName,eventProps);}else{w.dataLayer=w.dataLayer||[];w.dataLayer.push(Object.assign({event:\"track_event\",event_name:eventName},eventProps));}};host.addEventListener(\"click\",onClick);return()=>host.removeEventListener(\"click\",onClick);},[eventName,contentType,contentId,label,location]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{display:\"none\"}});}TrackEvent.displayName=\"Track Event\";addPropertyControls(TrackEvent,{eventName:{type:ControlType.String,title:\"Event Name\",description:\"e.g. select_content\"},label:{type:ControlType.String,title:\"Label\",description:\"Human-readable, e.g. the question text\"},location:{type:ControlType.String,title:\"Location\",description:\"e.g. hero, nav, footer\"},contentType:{type:ControlType.String,title:\"Content Type\",description:\"e.g. faq, testimonial\"},contentId:{type:ControlType.String,title:\"Content ID\",description:\"Slug; falls back to a slug of Label\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TrackEvent\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrackEvent.map"],"mappings":"+LA0BG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,YAAU,cAAY,YAAU,QAAM,YAAU,EAAY,EAAIA,EAAO,IAAI,EAQqN,OARnN,MAAc,CAAC,IAAM,EAAG,EAAI,QAAQ,GAAG,CAAC,GAAI,CAAC,EAAU,OAEvL,IAAI,EAAK,EAAG,cAAc,KAAM,GAAM,OAAO,EAAK,WAAY,UAAU,qCAAqC,KAAK,EAAK,SAAS,GAAG,EAAK,EAAK,cAA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