{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/bXGhJgHWV7t5GE2I9VQ3/0N0Q32sEFm941HTfbDp9/CustomVideo.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState,useRef}from\"react\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/components/auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */function CustomVideo(props){const videoRef=useRef(null);const popupRef=useRef(null);const[showPopup,setShowPopup]=useState(false);const savedDate=localStorage.getItem(\"user_email_date\");console.log(props);const isEmailCollectedToday=()=>{if(!savedDate)return false;const savedDay=new Date(savedDate).toDateString();const today=new Date().toDateString();return savedDay===today;};const movePopupToFullScreen=()=>{setTimeout(()=>{if(document.fullscreenElement){if(document.exitFullscreen){document.exitFullscreen();}}if(videoRef.current.webkitExitFullscreen){videoRef.current.webkitExitFullscreen();}},100);};useEffect(()=>{const video=videoRef.current;if(!video)return;const handleTimeUpdate=()=>{if(video.currentTime>=600&&!isEmailCollectedToday()){video.pause();setShowPopup(true);movePopupToFullScreen();}};video.addEventListener(\"timeupdate\",handleTimeUpdate);return()=>video.removeEventListener(\"timeupdate\",handleTimeUpdate);},[isEmailCollectedToday]);const handleFormSubmit=()=>{setTimeout(()=>{setShowPopup(false);localStorage.setItem(\"user_email_date\",new Date().toISOString());videoRef.current.play();},1e3);};useEffect(()=>{if(showPopup){const portalId=\"46657045\";const formId=\"1c18e026-6868-4687-805f-61770d669c9d\";const script=document.createElement(\"script\");script.src=\"https://js.hsforms.net/forms/v2.js\";script.async=true;script.onload=()=>{if(window.hbspt){window.hbspt.forms.create({region:\"na1\",portalId:portalId,formId:formId,target:\"#hubspot-form\",onFormSubmitted:()=>handleFormSubmit()});}};document.body.appendChild(script);}},[showPopup]);return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsxs(\"video\",{ref:videoRef,width:\"100%\",controls:true,children:[/*#__PURE__*/_jsx(\"source\",{src:props.link,type:\"video/mp4\"}),\"Your browser does not support the video tag.\"]}),/*#__PURE__*/_jsx(\"div\",{ref:popupRef,children:showPopup&&/*#__PURE__*/_jsx(\"div\",{style:popupStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:formContainerStyle,children:[/*#__PURE__*/_jsx(\"h3\",{children:\"Enter Your Email to Continue\"}),/*#__PURE__*/_jsx(\"div\",{id:\"hubspot-form\"})]})})})]});}addPropertyControls(CustomVideo,{link:{type:ControlType.Link,defaultValue:\"https://www.framer.com\"}});// Styles are written in object syntax\n// Learn more: https://reactjs.org/docs/dom-elements.html#style\nconst containerStyle={width:\"100%\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",position:\"relative\"};const popupStyle={position:\"fixed\",top:0,left:0,width:\"100%\",height:\"100%\",background:\"#fff\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",zIndex:1e3};const formContainerStyle={textAlign:\"center\"};export default CustomVideo;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomVideo.map"],
  "mappings": "8JAMG,SAASA,EAAYC,EAAM,CAAC,IAAMC,EAASC,EAAO,IAAI,EAAQC,EAASD,EAAO,IAAI,EAAO,CAACE,EAAUC,CAAY,EAAEC,EAAS,EAAK,EAAQC,EAAU,aAAa,QAAQ,iBAAiB,EAAE,QAAQ,IAAIP,CAAK,EAAE,IAAMQ,EAAsB,IAAI,CAAC,GAAG,CAACD,EAAU,MAAO,GAAM,IAAME,EAAS,IAAI,KAAKF,CAAS,EAAE,aAAa,EAAQG,EAAM,IAAI,KAAK,EAAE,aAAa,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,CAAC,EAAE,8CAA8C,CAAC,CAAC,EAAesB,EAAK,MAAM,CAAC,IAAInB,EAAS,SAASC,GAAwBkB,EAAK,MAAM,CAAC,MAAMC,EAAW,SAAsBH,EAAM,MAAM,CAAC,MAAMI,EAAmB,SAAS,CAAcF,EAAK,KAAK,CAAC,SAAS,8BAA8B,CAAC,EAAeA,EAAK,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,CAACG,EAAoB1B,EAAY,CAAC,KAAK,CAAC,KAAK2B,EAAY,KAAK,aAAa,wBAAwB,CAAC,CAAC,EAEpqE,IAAML,EAAe,CAAC,MAAM,OAAO,QAAQ,OAAO,cAAc,SAAS,WAAW,SAAS,eAAe,SAAS,SAAS,UAAU,EAAQE,EAAW,CAAC,SAAS,QAAQ,IAAI,EAAE,KAAK,EAAE,MAAM,OAAO,OAAO,OAAO,WAAW,OAAO,QAAQ,OAAO,eAAe,SAAS,WAAW,SAAS,OAAO,GAAG,EAAQC,EAAmB,CAAC,UAAU,QAAQ,EAASG,EAAQ5B",
  "names": ["CustomVideo", "props", "videoRef", "pe", "popupRef", "showPopup", "setShowPopup", "ye", "savedDate", "isEmailCollectedToday", "savedDay", "today", "movePopupToFullScreen", "ue", "video", "handleTimeUpdate", "handleFormSubmit", "portalId", "formId", "script", "window", "u", "containerStyle", "p", "popupStyle", "formContainerStyle", "addPropertyControls", "ControlType", "CustomVideo_default"]
}
