{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/uvGnzrlzKukloLMz9bHa/wGDZRUZ8jwMdgnStboOA/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);console.log(utmParams);const 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\":{\"withLinkClick\":{\"type\":\"override\",\"name\":\"withLinkClick\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLinkClickAndIPhoneFix\":{\"type\":\"reactHoc\",\"name\":\"withLinkClickAndIPhoneFix\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withwithLinkClick\":{\"type\":\"reactHoc\",\"name\":\"withwithLinkClick\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AddUTMParamsToLink.map"],
  "mappings": "kIACA,SAASA,GAAc,CAAC,IAAMC,EAAO,IAAI,gBAAgBC,EAAO,SAAS,MAAM,EAAQC,EAAU,CAAC,EAAE,OAAAF,EAAO,QAAQ,CAACG,EAAMC,IAAM,CAAIA,EAAI,WAAW,MAAM,IAAGF,EAAUE,CAAG,EAAED,EAAO,CAAC,EAASD,CAAU,CACtM,SAASG,EAAcC,EAAgBJ,EAAU,CAAC,QAAQ,IAAII,CAAe,EAAE,QAAQ,IAAIJ,CAAS,EAAE,IAAMK,EAAI,IAAI,IAAID,CAAe,EAAE,cAAO,KAAKJ,CAAS,EAAE,QAAQE,GAAKG,EAAI,aAAa,OAAOH,EAAIF,EAAUE,CAAG,CAAC,CAAC,EAASG,EAAI,SAAS,CAAE,CACzO,SAASC,GAAe,CAAC,MAAM,CAAC,QAAQC,GAAO,CACtD,IAAMH,EAAgBG,EAAM,cAAc,aAAa,MAAM,EAAQC,EAAOD,EAAM,cAAc,aAAa,QAAQ,EACrH,GAAG,CAACH,GAAiBA,EAAgB,WAAW,IAAI,EAAE,CAAC,QAAQ,MAAM,gDAAgD,EAAE,OAAQG,EAAM,eAAe,EACnJ,IAAMP,EAAUH,EAAa,EAAQY,EAAQN,EAAcC,EAAgBJ,CAAS,EAClFQ,IAAS,SAAUT,EAAO,KAAKU,EAAQ,QAAQ,EAAQV,EAAO,SAAS,KAAKU,CAC7E,CAAC,CAAE,CAwCqJ,SAASC,EAAkBC,EAAE,CAAC,OAAOC,IAAQC,EAA+BC,CAAuC,EAASC,EAAKJ,EAAE,CAAC,GAAGC,EAAM,GAAGI,EAAcJ,CAAK,CAAC,CAAC,EAAI,CAACF,EAAkB,YAAY",
  "names": ["getUTMParams", "params", "window", "utmParams", "value", "key", "createFullUrl", "baseExternalUrl", "url", "withLinkClick", "event", "target", "fullUrl", "withwithLinkClick", "C", "props", "re", "DataObserverContext", "p", "withLinkClick"]
}
