{"version":3,"file":"VideoAnalytics.No_3SN0t.mjs","names":["_Fragment"],"sources":["https:/framerusercontent.com/modules/MuD2NxEvvfLD62XytRrk/AafpsnI5QZSKqOom8wLE/VideoAnalytics.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function VideoAnalytics({videoId,analyticsVideoTitle=\"unknown\"}){useEffect(()=>{if(!videoId)return;const video=document.getElementById(videoId)?.querySelector(\"video\");if(!video){console.log(`[VideoAnalytics] video ${videoId} not found`);return;}window.dataLayer=window.dataLayer||[];const checkpoints=[.25,.5,.75,1];const sentProgress=new Set;const onTimeUpdate=()=>{const pct=video.currentTime/video.duration;for(let i=0;i<checkpoints.length;i++){const threshold=checkpoints[i];if(pct>=threshold&&!sentProgress.has(threshold)){sentProgress.add(threshold);window.dataLayer.push({event:\"video_progress\",video:analyticsVideoTitle,progress:`${threshold*100}%`});}}};video.addEventListener(\"timeupdate\",onTimeUpdate);return()=>{video.removeEventListener(\"timeupdate\",onTimeUpdate);};},[videoId]);return /*#__PURE__*/_jsx(_Fragment,{});}addPropertyControls(VideoAnalytics,{videoId:{type:ControlType.String,title:\"Video ID\"},analyticsVideoTitle:{type:ControlType.String,title:\"Analytics video ID\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoAnalytics\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoAnalytics.map"],"mappings":"+LAAkJ,SAAwB,EAAe,CAAC,UAAQ,sBAAoB,WAAW,CAAytB,OAAxtB,MAAc,CAAC,GAAG,CAAC,EAAQ,OAAO,IAAM,EAAM,SAAS,eAAe,EAAQ,EAAE,cAAc,QAAQ,CAAC,GAAG,CAAC,EAAM,CAAC,QAAQ,IAAI,0BAA0B,EAAQ,YAAY,CAAC,OAAQ,EAAO,UAAU,EAAO,WAAW,EAAE,CAAC,IAAM,EAAY,CAAC,IAAI,GAAG,IAAI,EAAE,CAAO,EAAa,IAAI,IAAU,MAAiB,CAAC,IAAM,EAAI,EAAM,YAAY,EAAM,SAAS,IAAI,IAAI,EAAE,EAAE,EAAE,EAAY,OAAO,IAAI,CAAC,IAAM,EAAU,EAAY,GAAM,GAAK,GAAW,CAAC,EAAa,IAAI,EAAU,GAAE,EAAa,IAAI,EAAU,CAAC,EAAO,UAAU,KAAK,CAAC,MAAM,iBAAiB,MAAM,EAAoB,SAAS,GAAG,EAAU,IAAI,GAAG,CAAC,IAAuD,OAAlD,EAAM,iBAAiB,aAAa,EAAa,KAAW,CAAC,EAAM,oBAAoB,aAAa,EAAa,GAAK,CAAC,EAAQ,CAAC,CAAqB,EAAKA,EAAU,EAAE,CAAC,sBAA/5B,IAA6B,IAAoD,CAAg1B,EAAoB,EAAe,CAAC,QAAQ,CAAC,KAAK,EAAY,OAAO,MAAM,WAAW,CAAC,oBAAoB,CAAC,KAAK,EAAY,OAAO,MAAM,qBAAqB,CAAC,CAAC"}