{"version":3,"file":"utmParams.d7nlMMsE.mjs","names":[],"sources":["https:/framerusercontent.com/modules/w24ELWa2giT3SFaWpV77/FEvjwd8hgxLsRZOnQKKH/utmParams.js"],"sourcesContent":["// Declare the utmParams property on the global window object\nexport function getUTMParameters(){const urlParams=new URLSearchParams(window.location.search);const utmParams={};const utmKeys=[\"utm_source\",\"utm_medium\",\"utm_campaign\",\"utm_term\",\"utm_content\"];utmKeys.forEach(key=>{const value=urlParams.get(key);if(value){utmParams[key]=value;}});// Store UTM params in sessionStorage if we have any\nif(Object.keys(utmParams).length>0){try{sessionStorage.setItem(\"UTM_params\",JSON.stringify(utmParams));window.utmParams=utmParams;// console.log(\"UTM Parameters stored:\", utmParams)\n}catch(error){console.error(\"Error storing UTM parameters:\",error);}}return utmParams;}export function getStoredUTMParameters(){// First try to get from window object (for current session)\nif(window.utmParams&&Object.keys(window.utmParams).length>0){return window.utmParams;}// Then try to get from sessionStorage\ntry{const storedParams=sessionStorage.getItem(\"UTM_params\");if(storedParams){const parsedParams=JSON.parse(storedParams);// Also set on window for easy access\nwindow.utmParams=parsedParams;return parsedParams;}}catch(error){console.error(\"Error retrieving stored UTM parameters:\",error);}return{};}export function appendUTMParamsToUrl(checkoutUrl){if(!checkoutUrl)return checkoutUrl;// Get UTM params from storage instead of current URL\nconst utmParams=getStoredUTMParameters();// If no stored UTM params, check current URL as fallback\nif(Object.keys(utmParams).length===0){getUTMParameters()// This will store them if present\n;}// Get the (potentially) updated UTM params\nconst finalUtmParams=getStoredUTMParameters();if(Object.keys(finalUtmParams).length>0){try{const url=new URL(checkoutUrl);Object.keys(finalUtmParams).forEach(key=>{url.searchParams.append(key,finalUtmParams[key]);});const finalUrl=url.toString();// console.log(\"Final URL with UTM Parameters:\", finalUrl)\nreturn finalUrl;}catch(error){console.error(\"Error appending UTM params to URL:\",error);return checkoutUrl;}}// console.log(\"No UTM Parameters to append.\")\nreturn checkoutUrl;}// Initialize UTM parameters tracking when this module loads\nif(typeof window!==\"undefined\"){// Add a listener for when the DOM is fully loaded\nif(document.readyState===\"complete\"){getUTMParameters()// Document already loaded, capture UTMs now\n;}else{window.addEventListener(\"load\",getUTMParameters);}}\nexport const __FramerMetadata__ = {\"exports\":{\"getStoredUTMParameters\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"appendUTMParamsToUrl\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getUTMParameters\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./utmParams.map"],"mappings":"oGACA,SAAgB,GAAkB,CAAC,IAAM,EAAU,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAO,EAAU,EAAE,CACjH,GADgI,CAAC,aAAa,aAAa,eAAe,WAAW,cAAc,CAAS,QAAQ,GAAK,CAAC,IAAM,EAAM,EAAU,IAAI,EAAI,CAAI,IAAO,EAAU,GAAK,IAAS,CACxR,OAAO,KAAK,EAAU,CAAC,OAAO,EAAG,GAAG,CAAC,eAAe,QAAQ,aAAa,KAAK,UAAU,EAAU,CAAC,CAAC,EAAO,UAAU,QACjH,EAAM,CAAC,QAAQ,MAAM,gCAAgC,EAAM,CAAG,OAAO,EAAW,SAAgB,GAAwB,CAC/H,GAAG,EAAO,WAAW,OAAO,KAAK,EAAO,UAAU,CAAC,OAAO,EAAG,OAAO,EAAO,UAC3E,GAAG,CAAC,IAAM,EAAa,eAAe,QAAQ,aAAa,CAAC,GAAG,EAAa,CAAC,IAAM,EAAa,KAAK,MAAM,EAAa,CAC1F,MAA9B,GAAO,UAAU,EAAoB,SAAqB,EAAM,CAAC,QAAQ,MAAM,0CAA0C,EAAM,CAAE,MAAM,EAAE,CAAE,SAAgB,EAAqB,EAAY,CAAC,GAAG,CAAC,EAAY,OAAO,EACpN,IAAM,EAAU,GAAwB,CACrC,OAAO,KAAK,EAAU,CAAC,SAAS,GAAG,GAAkB,CAExD,IAAM,EA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