{"version":3,"file":"addToCart-DF6TO1Le.js","sources":["../../src/js/GA4/utils/addToCart.ts"],"sourcesContent":["export function addToCartEvent(\n addedProduct: Item,\n currency: string = 'GBP',\n value?: number,\n) {\n const object: Item = {\n item_id: addedProduct.item_id,\n item_name: addedProduct.item_name,\n price: addedProduct.price,\n quantity: addedProduct.quantity ?? 1,\n index: addedProduct.index, // Optional\n item_list_name: addedProduct.item_list_name, // Optional\n coupon: addedProduct.coupon, // Optional\n };\n\n if (\n (value === undefined || value === null) &&\n object.price &&\n object.quantity\n ) {\n value = object.price * object.quantity;\n }\n\n gtag('event', 'add_to_cart', {\n currency: currency,\n value: value,\n items: [object],\n });\n}\n"],"names":["addToCartEvent","addedProduct","currency","value","_a","object"],"mappings":"AAAO,SAASA,EACdC,EACAC,EAAmB,MACnBC,EACA,CAJK,IAAAC,EAKL,MAAMC,EAAe,CACnB,QAASJ,EAAa,QACtB,UAAWA,EAAa,UACxB,MAAOA,EAAa,MACpB,UAAUG,EAAAH,EAAa,WAAb,KAAAG,EAAyB,EACnC,MAAOH,EAAa,MACpB,eAAgBA,EAAa,eAC7B,OAAQA,EAAa,MACvB,EAG0BE,GAAU,MAClCE,EAAO,OACPA,EAAO,WAECF,EAAAE,EAAO,MAAQA,EAAO,UAGhC,KAAK,QAAS,cAAe,CAC3B,SAAAH,EACA,MAAAC,EACA,MAAO,CAACE,CAAM,CAAA,CACf,CACH"}