{"version":3,"file":"AddUTMParamsToLink.CSMetn6i.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":"iLACA,SAAS,GAAc,CAAC,IAAM,EAAO,IAAI,gBAAgB,EAAO,SAAS,MAAM,EAAQ,EAAU,CAAC,EAAmF,OAAjF,EAAO,SAAS,EAAM,IAAM,CAAI,EAAI,WAAW,MAAM,IAAG,EAAU,GAAK,EAAO,CAAC,EAAS,CAAU,CACtM,SAAS,EAAc,EAAgB,EAAU,CAEjD,IAAM,EAAI,IAAI,IAAI,CAAe,EAAmF,OAAjF,OAAO,KAAK,CAAS,CAAC,CAAC,QAAQ,GAAK,EAAI,aAAa,OAAO,EAAI,EAAU,EAAI,CAAC,EAAS,EAAI,SAAS,CAAE,CAC1I,SAAgB,GAAe,CAAC,MAAM,CAAC,QAAQ,GAAO,CACtD,IAAM,EAAgB,EAAM,cAAc,aAAa,MAAM,EAAQ,EAAO,EAAM,cAAc,aAAa,QAAQ,EACrH,GAAG,CAAC,GAAiB,EAAgB,WAAW,IAAI,EAAE,CAAC,QAAQ,MAAM,gDAAgD,EAAE,MAAO,CAAC,EAAM,eAAe,EACpH,IAAM,EAAQ,EAAc,EAA3C,EAAmE,CAAC,EAClF,IAAS,SAAU,EAAO,KAAK,EAAQ,QAAQ,EAAQ,EAAO,SAAS,KAAK,CAC7E,CAAC,CAAE,CAwC8I,SAAgB,EAAkB,EAAE,CAAC,MAAO,KAAQ,EAA+BA,CAAuC,EAASC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAc,CAAK,CAAC,CAAC,EAAI,qBAlDzR,IAAyB,IAkD+E,EAAkL,EAAkB,YAAY"}