{"version":3,"file":"UseScreenNavigationCodeComponent.ByVpUlSJ.mjs","names":["_Fragment","__esmMin","init_ssg_sandbox_shims","l","c","init_jsx_runtime","ce","init_npm_react_18_3_1","window","addPropertyControls","init_framer_BWFVvmND","ControlType","useScreenNavigationCodeComponent","props","savedPosition","handleLinkClick","contactLinks","link","propertyControls","init_UseScreenNavigationCodeComponent"],"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":"A,+LAAkJ,SAAwBY,EAAiC,EAAM,CAShN,OATiNN,MAAc,CAAC,QAAQ,IAAIO,EAAM,QAAQ,EAAE,QAAQ,IAAIL,EAAO,SAAS,QAAQ,EAAEA,EAAO,QAAQ,MAClT,IAAMM,EAAc,aAAa,QAAQ,GAAGD,EAAM,SAAS,gBAAgB,EAAKC,IAChFN,EAAO,SAAS,EAAE,SAASM,EAAc,EAAE,CAAC,EAAE,aAAa,WAAW,GAAGD,EAAM,SAAS,gBAAgB,GACxG,IAAME,MAAoB,CAC1B,aAAa,QAAQ,GAAGF,EAAM,SAAS,iBAAiB,GAAGL,EAAO,SAAS,EAAE,QAAQ,IAAI,gCAAgCA,EAAO,OAAO,CAAE,EAEnIQ,EAAa,SAAS,iBAAiB,WAAWH,EAAM,mBAAmB,WAAW,EAE5F,OAF8F,QAAQ,IAAI,+BAA+BG,CAAY,EACrJA,EAAa,QAAQ,GAAMC,EAAK,iBAAiB,QAAQF,CAAe,CAAC,MAC/D,CAACC,EAAa,QAAQ,GAAMC,EAAK,oBAAoB,QAAQF,CAAe,CAAC,CAAE,CAAE,EAAE,CAAC,CAAC,EAC1E,gBAAKf,EAAU,CAAC,CAAC,CACrC,C,oDAAO,EAAiB,CAAC,SAAS,CAAC,KAAKW,EAAY,OAAO,MAAM,YAAY,aAAa,EAAE,EAAE,mBAAmB,CAAC,KAAKA,EAAY,OAAO,MAAM,wBAAwB,aAAa,EAAE,CAAC,EAAEF,EAAoBG,EAAiCM,CAAgB,C"}