{"version":3,"file":"AddUTMParamsToLink.BcfdffRe.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/uvGnzrlzKukloLMz9bHa/y7G1c29hMr2CSgA4opP8/AddUTMParamsToLink.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import React from\"react\";// Helper function to extract UTM parameters from the URL\nfunction getUTMParams(){const params=new URLSearchParams(window.location.search);const utmParams={};params.forEach((value,key)=>{if(key.startsWith(\"utm_\")){utmParams[key]=value;}});return utmParams;}// Function to create the full URL with UTM parameters\nfunction createFullUrl(baseExternalUrl,utmParams){// console.log(baseExternalUrl)\n// console.log(utmParams)\nconst url=new URL(baseExternalUrl);Object.keys(utmParams).forEach(key=>url.searchParams.append(key,utmParams[key]));return url.toString();}// Code override to modify the behavior of an element\nexport function withLinkClick(){return{onClick:event=>{// Get the href and target attributes from the clicked element\nconst baseExternalUrl=event.currentTarget.getAttribute(\"href\");const target=event.currentTarget.getAttribute(\"target\");// Do nothing if href is not given or link is an internal URL\nif(!baseExternalUrl||baseExternalUrl.startsWith(\"./\")){console.error(\"Href attribute is missing or link is internal.\");return;}event.preventDefault()// Prevent the default click behavior\n;const utmParams=getUTMParams();const fullUrl=createFullUrl(baseExternalUrl,utmParams);// Check if the link should open in a new tab\nif(target===\"_blank\"){window.open(fullUrl,\"_blank\");}else{window.location.href=fullUrl// Navigate to the external link in the same tab\n;}}};}export function withLinkClickAndIPhoneFix(Component){return /*#__PURE__*/React.forwardRef((props,ref)=>{const linkClickProps=withLinkClick()// Get override properties\n;return /*#__PURE__*/_jsx(Component,{...props,ref:ref,...linkClickProps});});}// import { Override } from \"framer\"\n// // Helper function to extract UTM parameters from the URL\n// function getUTMParams() {\n//     const params = new URLSearchParams(window.location.search)\n//     const utmParams = {}\n//     params.forEach((value, key) => {\n//         if (key.startsWith(\"utm_\")) {\n//             utmParams[key] = value\n//         }\n//     })\n//     return utmParams\n// }\n// // Function to create the full URL with UTM parameters\n// function createFullUrl(baseExternalUrl, utmParams) {\n//     const url = new URL(baseExternalUrl)\n//     Object.keys(utmParams).forEach((key) =>\n//         url.searchParams.append(key, utmParams[key])\n//     )\n//     return url.toString()\n// }\n// // Code override to modify the behavior of an element\n// export function withLinkClick(): Override {\n//     return {\n//         onClick: (event) => {\n//             event.preventDefault() // Prevent the default click behavior\n//             // Get the href attribute from the clicked element\n//             const baseExternalUrl = event.currentTarget.getAttribute(\"href\")\n//             if (!baseExternalUrl) {\n//                 console.error(\n//                     \"Base URL is not provided or href attribute is missing.\"\n//                 )\n//                 return\n//             }\n//             const utmParams = getUTMParams()\n//             const fullUrl = createFullUrl(baseExternalUrl, utmParams)\n//             window.location.href = fullUrl // Navigate to the external link in the same tab\n//         },\n//     }\n// }\nimport{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withwithLinkClick(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...withLinkClick(props)});};}withwithLinkClick.displayName=\"withLinkClick\";\nexport const __FramerMetadata__ = {\"exports\":{\"withLinkClickAndIPhoneFix\":{\"type\":\"reactHoc\",\"name\":\"withLinkClickAndIPhoneFix\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withwithLinkClick\":{\"type\":\"reactHoc\",\"name\":\"withwithLinkClick\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLinkClick\":{\"type\":\"override\",\"name\":\"withLinkClick\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AddUTMParamsToLink.map"],"mappings":"4KACA,SAAS,GAAc,CAAC,IAAM,EAAO,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAO,EAAU,EAAE,CAAkF,OAAjF,EAAO,SAAS,EAAM,IAAM,CAAI,EAAI,WAAW,OAAO,GAAE,EAAU,GAAK,IAAS,CAAQ,EAC5L,SAAS,EAAc,EAAgB,EAAU,CAEjD,IAAM,EAAI,IAAI,IAAI,EAAgB,CAAkF,OAAjF,OAAO,KAAK,EAAU,CAAC,QAAQ,GAAK,EAAI,aAAa,OAAO,EAAI,EAAU,GAAK,CAAC,CAAQ,EAAI,UAAU,CACzI,SAAgB,GAAe,CAAC,MAAM,CAAC,QAAQ,GAAO,CACtD,IAAM,EAAgB,EAAM,cAAc,aAAa,OAAO,CAAO,EAAO,EAAM,cAAc,aAAa,SAAS,CACtH,GAAG,CAAC,GAAiB,EAAgB,WAAW,KAAK,CAAC,CAAC,QAAQ,MAAM,iDAAiD,CAAC,OAAQ,EAAM,gBAAgB,CACrH,IAAM,EAAQ,EAAc,EAA3C,GAAc,CAAuD,CACnF,IAAS,SAAU,EAAO,KAAK,EAAQ,SAAS,CAAO,EAAO,SAAS,KAAK,GAC3E,CAwC+I,SAAgB,EAAkB,EAAE,CAAC,MAAO,KAAQ,EAA+BA,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAc,EAAM,CAAC,CAAC,uBAlDrR,IAAyB,IAkD+E,CAAiL,EAAkB,YAAY"}