{"version":3,"file":"PosthogLandingPageTracker.DxCLEf1_.mjs","names":[],"sources":["https:/framerusercontent.com/modules/x0BcMiNpIdHfmvMeduji/T3faRcbzBmwzeXO1wtnh/PosthogLandingPageTracker.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 40\n */export default function PosthogLandingPageTracker({formSelector=\"form:has(input[name='form_type'])\",debug=false}){useEffect(()=>{const log=(...args)=>debug&&console.log(\"[PH Landing Page Tracker]\",...args);const fire=()=>{const ph=window.posthog;if(!ph?.capture){log(\"PostHog not available\");return false;}const form=document.querySelector(formSelector);if(!form){log(\"Form not found\",{formSelector});return false;}const get=name=>form.querySelector(`[name=\"${name}\"]`)?.value?.trim()||\"\";const urlParams=new URLSearchParams(window.location.search);const props={form_name:get(\"form_type\")===\"webinar\"?\"Webinar Form\":get(\"form_type\")===\"whitepaper\"?\"Whitepaper Form\":get(\"form_type\")===\"demo\"?\"Demo Booking\":get(\"form_type\")||\"Generic Form\",$current_url:window.location.href,page_path:window.location.pathname};const fields=[[\"webinar_title\",get(\"webinar_title\")],[\"webinar_date\",get(\"webinar_date\")],[\"whitepaper_title\",get(\"whitepaper_title\")],[\"utm_source\",urlParams.get(\"utm_source\")||\"\"],[\"utm_medium\",urlParams.get(\"utm_medium\")||\"\"],[\"utm_campaign\",urlParams.get(\"utm_campaign\")||\"\"]];for(const[key,val]of fields){if(val)props[key]=val;}ph.capture(\"Landing Page Viewed\",props);log(\"Landing Page Viewed fired\",props);return true;};// Retry until PostHog ready AND form in DOM\nlet attempts=0;const interval=setInterval(()=>{attempts++;if(fire()){clearInterval(interval);}else if(attempts>=40){clearInterval(interval);log(\"Gave up after 10s\");}},250);return()=>clearInterval(interval);},[formSelector,debug]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",opacity:0,pointerEvents:\"none\"}});}addPropertyControls(PosthogLandingPageTracker,{formSelector:{type:ControlType.String,title:\"Form Selector\",defaultValue:\"form:has(input[name='form_type'])\"},debug:{type:ControlType.Boolean,title:\"Debug Logs\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PosthogLandingPageTracker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"40\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PosthogLandingPageTracker.map"],"mappings":"yLAKG,SAAwB,EAA0B,CAAC,eAAa,oCAAoC,QAAM,IAAO,CACmH,OADlH,MAAc,CAAC,IAAM,GAAK,GAAG,IAAO,GAAO,QAAQ,IAAI,4BAA4B,GAAG,EAAK,CAAO,MAAS,CAAC,IAAM,EAAG,EAAO,QAAQ,GAAG,CAAC,GAAI,QAAsC,OAA7B,EAAI,wBAAwB,CAAQ,GAAO,IAAM,EAAK,SAAS,cAAc,EAAa,CAAC,GAAG,CAAC,EAA2C,OAArC,EAAI,iBAAiB,CAAC,eAAa,CAAC,CAAQ,GAAO,IAAM,EAAI,GAAM,EAAK,cAAc,UAAU,EAAK,IAAI,EAAE,OAAO,MAAM,EAAE,GAAS,EAAU,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAO,EAAM,CAAC,UAAU,EAAI,YAAY,GAAG,UAAU,eAAe,EAAI,YAAY,GAAG,aAAa,kBAAkB,EAAI,YAAY,GAAG,OAAO,eAAe,EAAI,YAAY,EAAE,eAAe,aAAa,EAAO,SAAS,KAAK,UAAU,EAAO,SAAS,SAAS,CAAO,EAAO,CAAC,CAAC,gBAAgB,EAAI,gBAAgB,CAAC,CAAC,CAAC,eAAe,EAAI,eAAe,CAAC,CAAC,CAAC,mBAAmB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