{"version":3,"file":"WhatsAppTracking.2iyVd4c7.mjs","names":["__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","init_jsx_runtime","c","ce","detectAdsVisit","p","src","med","fromAds","SESSION_KEY","addRef","url","href","text","REF_TAG","fireEvents","w","ADS_SEND_TO","withWhatsAppTracking","a","Component","props","init_WhatsAppTracking"],"sources":["https:/framerusercontent.com/modules/onNmgtNLefZmcUdrTKa5/wVbbRqUtwJAjFjiZc5Sz/WhatsAppTracking.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";// Google Ads conversion target. Paste the \"send_to\" value from the WhatsApp\n// conversion action, e.g. \"AW-18196354607/AbCdEfGhIjK\". Empty = GA4 event only.\nconst ADS_SEND_TO=\"AW-18196354607/ztJRCI-IjLUdEK-s2eRD\";const SESSION_KEY=\"zaest_ads_session\";const REF_TAG=\"(ref: GA)\";function detectAdsVisit(){if(typeof window===\"undefined\")return false;try{const p=new URLSearchParams(window.location.search);const src=(p.get(\"utm_source\")||\"\").toLowerCase();const med=(p.get(\"utm_medium\")||\"\").toLowerCase();const fromAds=p.has(\"gclid\")||p.has(\"gbraid\")||p.has(\"wbraid\")||(src===\"adwords\"||src===\"google\")&&(med===\"ppc\"||med===\"cpc\");if(fromAds)window.sessionStorage.setItem(SESSION_KEY,\"1\");return fromAds||window.sessionStorage.getItem(SESSION_KEY)===\"1\";}catch{return false;}}function addRef(href){try{const url=new URL(href);const text=url.searchParams.get(\"text\")||\"\";if(text.includes(REF_TAG))return href;url.searchParams.set(\"text\",text+\"\\n\\n\"+REF_TAG);return url.toString();}catch{return href;}}function fireEvents(fromAds){const w=window;if(typeof w.gtag!==\"function\")return;w.gtag(\"event\",\"whatsapp_click\",{page_path:window.location.pathname,from_ads:fromAds,transport_type:\"beacon\"});if(ADS_SEND_TO){w.gtag(\"event\",\"conversion\",{send_to:ADS_SEND_TO,value:1,currency:\"EUR\",transport_type:\"beacon\"});}}/**\n * Tracks WhatsApp clicks as a GA4 event (and a Google Ads conversion once\n * ADS_SEND_TO is set). For visitors who arrived from Google Ads, appends\n * \"(ref: GA)\" to the prefilled WhatsApp message so the chat shows its source.\n */export function withWhatsAppTracking(Component){return props=>{React.useEffect(()=>{detectAdsVisit();},[]);const onClickCapture=e=>{const target=e.target;const a=target?.closest?.(\"a[href]\");if(!a||!/wa\\.me|whatsapp\\.com/i.test(a.href))return;const fromAds=detectAdsVisit();fireEvents(fromAds);if(fromAds){e.preventDefault();window.open(addRef(a.href),a.target||\"_self\",\"noopener\");}};return /*#__PURE__*/_jsx(\"div\",{style:{display:\"contents\"},onClickCapture:onClickCapture,children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withWhatsAppTracking\":{\"type\":\"reactHoc\",\"name\":\"withWhatsAppTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WhatsAppTracking.map"],"mappings":"A,gIAEwH,SAASO,GAAgB,CAAC,GAAUN,IAAS,OAAY,MAAO,GAAM,GAAG,CAAC,IAAMO,EAAE,IAAI,gBAAgBP,EAAO,SAAS,MAAM,EAAQQ,GAAKD,EAAE,IAAI,YAAY,GAAG,GAAA,CAAI,YAAY,EAAQE,GAAKF,EAAE,IAAI,YAAY,GAAG,GAAA,CAAI,YAAY,EAAQG,EAAQH,EAAE,IAAI,OAAO,GAAGA,EAAE,IAAI,QAAQ,GAAGA,EAAE,IAAI,QAAQ,IAAIC,IAAM,WAAWA,IAAM,YAAYC,IAAM,OAAOA,IAAM,OAAiE,OAAvDC,GAAQV,EAAO,eAAe,QAAQW,EAAY,GAAG,EAASD,GAASV,EAAO,eAAe,QAAQW,CAAW,IAAI,GAAI,MAAM,CAAC,MAAO,EAAM,CAAC,CAAC,SAASC,EAAO,EAAK,CAAC,GAAG,CAAC,IAAMC,EAAI,IAAI,IAAIC,CAAI,EAAQC,EAAKF,EAAI,aAAa,IAAI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