{"version":3,"file":"Tracking.uhEDqVPL.mjs","names":[],"sources":["https:/framerusercontent.com/modules/WKIzUAZRi1ly0gUNJfDt/n30djQyaIEkFj10xWvQ6/Tracking.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";// ===== VIEW ITEM (apply to FC_ProductVariants) =====\nexport function withViewItemTracking(Component){return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{const productId=props?.shopifyProductID||\"\";if(!productId)return;window.__currentProductId=String(productId);const w=window;if(w.__viewItemPushed===productId)return;w.__viewItemPushed=productId;const t=setTimeout(()=>{const title=document.querySelector(\"h1\")?.innerText?.trim()||\"\";let price=0;const matches=document.body.innerText.match(/\\$\\s?([\\d,]+\\.\\d{2})/g);if(matches&&matches.length){price=parseFloat(matches[0].replace(/[^0-9.]/g,\"\"));}window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"view_item\",ecommerce:{currency:\"USD\",value:price,items:[{item_id:String(productId),item_name:title,price:price,quantity:1}]}});console.log(\"[view_item pushed]\",{productId,title,price});},600);return()=>clearTimeout(t);},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}// ===== ADD TO CART (apply to FC Purchase Button) =====\nexport function withAddToCartTracking(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const handleClick=e=>{const productId=props?.productID||props?.shopifyProductID||props?.productId||window.__currentProductId||\"\";const title=document.querySelector(\"h1\")?.innerText?.trim()||\"\";let price=0;const matches=document.body.innerText.match(/\\$\\s?([\\d,]+\\.\\d{2})/g);if(matches&&matches.length){price=parseFloat(matches[0].replace(/[^0-9.]/g,\"\"));}window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"add_to_cart\",ecommerce:{currency:\"USD\",value:price,items:[{item_id:String(productId),item_name:title,price:price,quantity:1}]}});console.log(\"[add_to_cart pushed]\",{productId,title,price});if(typeof props.onClick===\"function\")props.onClick(e);};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick});});}export function withDebugProps(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const handleClick=e=>{console.log(\"=== CHECKOUT BUTTON PROPS ===\",props);debugger;// pauses execution so you can inspect before redirect\n// (remove debugger and the line below once done)\n};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withAddToCartTracking\":{\"type\":\"reactHoc\",\"name\":\"withAddToCartTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withViewItemTracking\":{\"type\":\"reactHoc\",\"name\":\"withViewItemTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDebugProps\":{\"type\":\"reactHoc\",\"name\":\"withDebugProps\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Tracking.map"],"mappings":"kIACA,SAAgB,EAAqB,EAAU,CAAC,OAAoB,GAAY,EAAM,KAAO,MAAc,CAAC,IAAM,EAAU,GAAO,kBAAkB,GAAG,GAAG,CAAC,EAAU,OAAO,EAAO,mBAAmB,OAAO,EAAU,CAAC,IAAM,EAAE,EAAO,GAAG,EAAE,mBAAmB,EAAU,OAAO,EAAE,iBAAiB,EAAU,IAAM,EAAE,eAAe,CAAC,IAAM,EAAM,SAAS,cAAc,KAAK,EAAE,WAAW,MAAM,EAAE,GAAO,EAAM,EAAQ,EAAQ,SAAS,KAAK,UAAU,MAAM,wBAAwB,CAAI,GAAS,EAAQ,SAAQ,EAAM,WAAW,EAAQ,GAAG,QAAQ,WAAW,GAAG,CAAC,EAAE,EAAO,UAAU,EAAO,WAAW,EAAE,CAAC,EAAO,UAAU,KAAK,CAAC,MAAM,YAAY,UAAU,CAAC,SAAS,MAAM,MAAM,EAAM,MAAM,CAAC,CAAC,QAAQ,OAAO,EAAU,CAAC,UAAU,EAAY,QAAM,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,qBAAqB,CAAC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