{"version":3,"file":"UseScreenNavigationCodeComponent.BCRnTE_T.mjs","names":["_Fragment"],"sources":["https:/framerusercontent.com/modules/kj5QJCfSocwWa3cXQ1mi/9FBk1Jy6lVFvUcgPqcr2/UseScreenNavigationCodeComponent.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect}from\"react\";export default function useScreenNavigationCodeComponent(props){useEffect(()=>{console.log(props.pageName);console.log(window.document.referrer);window.history.state;// On component mount, check if there is a saved scroll position in localStorage\nconst savedPosition=localStorage.getItem(`${props.pageName}-scrollPosition`);if(savedPosition){// If a saved scroll position exists, scroll to that position and then remove it from localStorage\nwindow.scrollTo(0,parseInt(savedPosition,10));localStorage.removeItem(`${props.pageName}-scrollPosition`);}// Function to handle clicks on specific links/buttons\nconst handleLinkClick=()=>{// Save the current scroll position before navigating away\nlocalStorage.setItem(`${props.pageName}-scrollPosition`,`${window.scrollY}`);console.log(\"Link clicked, scrollPosition:\",window.scrollY);};// Select all anchor tags pointing to the contact page and buttons\n// You can modify this selector to fit your project's needs\nconst contactLinks=document.querySelectorAll(`a[href=\"${props.buttonLinkToTarget}\"], button`);console.log(\"Contact links/buttons found:\",contactLinks);// Attach click event listeners to the selected links/buttons\ncontactLinks.forEach(link=>link.addEventListener(\"click\",handleLinkClick));// Cleanup function: remove the event listeners when the component is unmounted\nreturn()=>{contactLinks.forEach(link=>link.removeEventListener(\"click\",handleLinkClick));};},[])// Empty dependency array ensures this effect only runs on mount and unmount\n;return /*#__PURE__*/_jsx(_Fragment,{})// No visual output\n;}const propertyControls={pageName:{type:ControlType.String,title:\"Page Name\",defaultValue:\"\"},buttonLinkToTarget:{type:ControlType.String,title:\"Button Link To Target\",defaultValue:\"\"}};addPropertyControls(useScreenNavigationCodeComponent,propertyControls);\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"useScreenNavigationCodeComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./UseScreenNavigationCodeComponent.map"],"mappings":"+LAAkJ,SAAwB,EAAiC,EAAM,CAShN,OATiN,MAAc,CAAC,QAAQ,IAAI,EAAM,QAAQ,EAAE,QAAQ,IAAI,EAAO,SAAS,QAAQ,EAAE,EAAO,QAAQ,MAClT,IAAM,EAAc,aAAa,QAAQ,GAAG,EAAM,SAAS,gBAAgB,EAAK,IAChF,EAAO,SAAS,EAAE,SAAS,EAAc,EAAE,CAAC,EAAE,aAAa,WAAW,GAAG,EAAM,SAAS,gBAAgB,GACxG,IAAM,MAAoB,CAC1B,aAAa,QAAQ,GAAG,EAAM,SAAS,iBAAiB,GAAG,EAAO,SAAS,EAAE,QAAQ,IAAI,gCAAgC,EAAO,OAAO,CAAE,EAEnI,EAAa,SAAS,iBAAiB,WAAW,EAAM,mBAAmB,WAAW,EAE5F,OAF8F,QAAQ,IAAI,+BAA+B,CAAY,EACrJ,EAAa,QAAQ,GAAM,EAAK,iBAAiB,QAAQ,CAAe,CAAC,MAC/D,CAAC,EAAa,QAAQ,GAAM,EAAK,oBAAoB,QAAQ,CAAe,CAAC,CAAE,CAAE,EAAE,CAAC,CAAC,EAC1E,EAAKA,EAAU,CAAC,CAAC,CACrC,qBAV+D,IAAoD,IAA6B,EAU0C,EAAoB,EAAiC,CAAtN,SAAS,CAAC,KAAK,EAAY,OAAO,MAAM,YAAY,aAAa,EAAE,EAAE,mBAAmB,CAAC,KAAK,EAAY,OAAO,MAAM,wBAAwB,aAAa,EAAE,CAAuE,CAAC"}