@perevorot/shop 2.0.159 → 2.0.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/shop/cart/CartAdd.js +1 -1
- package/dist/components/shop/cart/CartAdd.js.map +1 -1
- package/dist/components/shop/cart/CartItem.js +1 -1
- package/dist/components/shop/cart/CartItem.js.map +1 -1
- package/dist/components/shop/order/Checkout.js +1 -1
- package/dist/components/shop/order/Checkout.js.map +1 -1
- package/dist/components/shop/viewed/Viewer.js +1 -1
- package/dist/components/shop/viewed/Viewer.js.map +1 -1
- package/dist/components/shop/wishlist/WishlistAdd.js +1 -1
- package/dist/components/shop/wishlist/WishlistAdd.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=e.defineComponent({name:"viewer",props:{slug:String,code:String,brand:String,category:String,property:String,id:Number},setup:function(r){var i=t.useStore(),o=e.ref(null),c=e.computed((function(){return i.getters["cart/product"](r.id)}));return $http.post($ziggy("api.viewed"),{action:"view",slug:r.slug}),e.onMounted((function(){var e=o.value.closest("[shop-product]"),t
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=e.defineComponent({name:"viewer",props:{slug:String,code:String,brand:String,category:String,property:String,id:Number},setup:function(r){var i=t.useStore(),o=e.ref(null),c=e.computed((function(){return i.getters["cart/product"](r.id)}));return $http.post($ziggy("api.viewed"),{action:"view",slug:r.slug}),e.onMounted((function(){var e,t=o.value.closest("[shop-product]"),i=t.querySelector("[shop-product-name]").textContent,n=t.querySelector("[shop-product-price]")?t.querySelector("[shop-product-price]").childNodes[0].nodeValue.replace(/ /g,""):null,m=r.code,a=document.referrer,u={ecommerce:{currency:null!==(e=$env.locale)&&void 0!==e&&e.currency?$env.locale.currency:"UAH",value:parseFloat(n),items:[{item_name:i,item_id:m,item_list_name:a.includes("/post")?"Новини":"Direct",index:1}]},event:"view_item"};if("undefined"!=typeof Storage){var s=sessionStorage.getItem("productIndex");s&&(s=JSON.parse(s),u.ecommerce.items[0].item_list_name=s.item_list_name,u.ecommerce.items[0].index=s.index)}c.value&&c.value.attributes.index&&(u.ecommerce.items[0].index=c.value.attributes.index),c.value&&c.value.attributes.itemListName&&(u.ecommerce.items[0].item_list_name=c.value.attributes.itemListName),n&&(u.ecommerce.items[0].price=parseFloat(n)),r.brand&&(u.ecommerce.items[0].item_brand=r.brand),r.category&&(-1!==r.category.indexOf("/")?r.category.split("/").forEach((function(e,t){u.ecommerce.items[0]["item_category"+(t?t+1:"")]=e.trim()})):u.ecommerce.items[0].item_category=r.category),r.property&&(u.ecommerce.items[0].item_variant=r.property),$env.debug.ecommerce&&console.log(u),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(u))})),{viewer:o}}}),i={class:"is-hidden",ref:"viewer"};r.render=function(t,r,o,c,n,m){return e.openBlock(),e.createElementBlock("span",i,null,512)},module.exports=r;
|
|
2
2
|
//# sourceMappingURL=Viewer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewer.js","sources":["../../../../src/components/shop/viewed/Viewer.vue","../../../../src/components/shop/viewed/Viewer.vue?vue&type=template&id=1eaede6a&lang.js"],"sourcesContent":["<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>","<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>"],"names":["script","defineComponent","name","props","slug","String","code","brand","category","property","id","Number","setup","store","useStore","viewer","ref","productInCart","computed","getters","$http","post","$ziggy","action","onMounted","product","value","closest","querySelector","textContent","price","childNodes","nodeValue","replace","referer","document","referrer","object","ecommerce","currency","parseFloat","items","item_name","item_id","item_list_name","includes","index","event","Storage","productIndex","sessionStorage","getItem","JSON","parse","attributes","itemListName","item_brand","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","class","_openBlock","_createElementBlock","_hoisted_1"],"mappings":"oDAOeA,EAAcC,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,MAAOF,OACPG,SAAUH,OACVI,SAAUJ,OACVK,GAAIC,QAERC,MAAK,SAACT,GACF,IAAMU,EAAQC,EAAAA,WACRC,EAASC,MAAI,MACbC,EAAgBC,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,gBAAgBhB,EAAMO,OAoFzE,OAlFAU,MAAMC,KAAKC,OAAO,cAAe,CAC7BC,OAAQ,OACRnB,KAAMD,EAAMC,OAGhBoB,EAAAA,WAAU,WACN,IAAMC,EAAUV,EAAOW,MAAMC,QAAQ,kBAC/BzB,EAAOuB,EAAQG,cAAc,uBAAuBC,YACpDC,EAAQL,EAAQG,cAAc,wBAA0BH,EAAQG,cAAc,wBAAwBG,WAAW,GAAGC,UAAUC,QAAQ,KAAM,IAAM,KAClJ3B,EAAOH,EAAMG,KACb4B,EAAUC,SAASC,SAErBC,EAAS,CACTC,UAAW,CACPC,SAAU,MACVb,MAAOc,WAAWV,GAClBW,MAAO,CACH,CACIC,UAAWxC,EACXyC,QAASrC,EACTsC,eAAgBV,EAAQW,SAAS,SAAW,SAAW,SACvDC,MAAO,KAInBC,MAAO,aAGX,GAAuB,oBAAZC,QAAyB,CAChC,IAAIC,EAAeC,eAAeC,QAAQ,gBAEtCF,IACAA,EAAeG,KAAKC,MAAMJ,GAE1BZ,EAAOC,UAAUG,MAAM,GAAGG,eAAiBK,EAAaL,eACxDP,EAAOC,UAAUG,MAAM,GAAGK,MAAQG,EAAaH,OAInD7B,EAAcS,OAAST,EAAcS,MAAM4B,WAAWR,QACtDT,EAAOC,UAAUG,MAAM,GAAGK,MAAQ7B,EAAcS,MAAM4B,WAAWR,OAGjE7B,EAAcS,OAAST,EAAcS,MAAM4B,WAAWC,eACtDlB,EAAOC,UAAUG,MAAM,GAAGG,eAAiB3B,EAAcS,MAAM4B,WAAWC,cAG1EzB,IACAO,EAAOC,UAAUG,MAAM,GAAGX,MAAQU,WAAWV,IAG7C3B,EAAMI,QACN8B,EAAOC,UAAUG,MAAM,GAAGe,WAAarD,EAAMI,OAG7CJ,EAAMK,YAC+B,IAAjCL,EAAMK,SAASiD,QAAQ,KACvBtD,EAAMK,SAASkD,MAAM,KAAKC,SAAQ,SAACC,EAASd,GACxCT,EAAOC,UAAUG,MAAM,GAAG,iBAAmBK,EAAQA,EAAQ,EAAI,KAAOc,EAAQC,UAGpFxB,EAAOC,UAAUG,MAAM,GAAGqB,cAAgB3D,EAAMK,UAIpDL,EAAMM,WACN4B,EAAOC,UAAUG,MAAM,GAAGsB,aAAe5D,EAAMM,UAG/CuD,KAAKC,MAAM3B,WACX4B,QAAQC,IAAI9B,IAGX2B,KAAKC,MAAM3B,WAAa8B,OAAOC,YAChCD,OAAOC,UAAUC,KAAK,CAClBhC,UAAW,OAGf8B,OAAOC,UAAUC,KAAKjC,OAIvB,CACHtB,OAAAA,SCxGFwD,MAAM,YAAYvD,IAAI,yCAA5B,OAAAwD,EAAAA,YAAAC,qBAA2C,OAA3CC,EAA2C,KAAA"}
|
|
1
|
+
{"version":3,"file":"Viewer.js","sources":["../../../../src/components/shop/viewed/Viewer.vue","../../../../src/components/shop/viewed/Viewer.vue?vue&type=template&id=b64dab0c&lang.js"],"sourcesContent":["<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: $env.locale?.currency ? $env.locale.currency : 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>","<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: $env.locale?.currency ? $env.locale.currency : 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>"],"names":["script","defineComponent","name","props","slug","String","code","brand","category","property","id","Number","setup","store","useStore","viewer","ref","productInCart","computed","getters","$http","post","$ziggy","action","onMounted","_$env$locale","product","value","closest","querySelector","textContent","price","childNodes","nodeValue","replace","referer","document","referrer","object","ecommerce","currency","$env","locale","parseFloat","items","item_name","item_id","item_list_name","includes","index","event","Storage","productIndex","sessionStorage","getItem","JSON","parse","attributes","itemListName","item_brand","indexOf","split","forEach","segment","trim","item_category","item_variant","debug","console","log","window","dataLayer","push","class","_openBlock","_createElementBlock","_hoisted_1"],"mappings":"oDAOeA,EAAcC,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,MAAOF,OACPG,SAAUH,OACVI,SAAUJ,OACVK,GAAIC,QAERC,MAAK,SAACT,GACF,IAAMU,EAAQC,EAAAA,WACRC,EAASC,MAAI,MACbC,EAAgBC,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,gBAAgBhB,EAAMO,OAoFzE,OAlFAU,MAAMC,KAAKC,OAAO,cAAe,CAC7BC,OAAQ,OACRnB,KAAMD,EAAMC,OAGhBoB,EAAAA,WAAU,WAAM,IAAAC,EACNC,EAAUX,EAAOY,MAAMC,QAAQ,kBAC/B1B,EAAOwB,EAAQG,cAAc,uBAAuBC,YACpDC,EAAQL,EAAQG,cAAc,wBAA0BH,EAAQG,cAAc,wBAAwBG,WAAW,GAAGC,UAAUC,QAAQ,KAAM,IAAM,KAClJ5B,EAAOH,EAAMG,KACb6B,EAAUC,SAASC,SAErBC,EAAS,CACTC,UAAW,CACPC,iBAAUf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KAAKlC,OAIvB,CACHvB,OAAAA,SCxGF0D,MAAM,YAAYzD,IAAI,yCAA5B,OAAA0D,EAAAA,YAAAC,qBAA2C,OAA3CC,EAA2C,KAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=require("vue-toastification"),i={props:{last:null},setup:function(){return{translate:window.__}}},o={class:"shop-wishlist-success-message"},s=["href"];i.render=function(t,r,i,n,c,
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=require("vue-toastification"),i={props:{last:null},setup:function(){return{translate:window.__}}},o={class:"shop-wishlist-success-message"},s=["href"];i.render=function(t,r,i,n,c,l){return e.openBlock(),e.createElementBlock("div",o,[e.createElementVNode("div",null,e.toDisplayString(n.translate("shop.wishlist.product_added_named",{product:i.last.name})),1),e.createElementVNode("a",{href:i.last.url,class:"mt-2 is-size-7",style:{color:"#fff","border-bottom":"1px solid #fff"}},e.toDisplayString(n.translate("shop.wishlist.goto")),9,s)])};var n=e.defineComponent({props:{id:Number,code:{type:String,default:null},property:{type:String,default:null},item:{type:Object,default:null}},setup:function(o){var s=e.ref(!1),n=r.useToast(),c=t.useStore(),l=e.computed((function(){return c.getters["wishlist/item"](o.id)})),a=e.computed((function(){return c.getters["auth/is"]})),u=e.computed((function(){return c.getters["wishlist/last"]})),m=e.ref(null);return{item:l,action:function(){if(!s.value)if(a.value){s.value=!0;var e={};window.getTrackingIndexProductsList&&"function"==typeof window.getTrackingIndexProductsList&&(e=window.getTrackingIndexProductsList(m.value));var t=m.value.closest("[shop-product]"),r=t.querySelector("[shop-product-name]")?t.querySelector("[shop-product-name]").textContent:null,d=t.querySelector(".cart-prices > .prices.is-active [shop-product-price]")?t.querySelector(".cart-prices > .prices.is-active [shop-product-price]").childNodes[0].nodeValue.replace(/ /g,""):null,p=!d&&t.querySelector("[shop-product-price]")?t.querySelector("[shop-product-price]").childNodes[0].nodeValue.replace(/ /g,""):d,h=o.code?o.code:t.dataset.code,f=t.querySelector("[shop-product-category]")?t.querySelector("[shop-product-category]").textContent:null,y=t.querySelector("[shop-product-brand]")?t.querySelector("[shop-product-brand]").textContent:null;c.dispatch("wishlist/toggle",{id:o.id,finally:function(){var t,c="";if(l.value){var a={component:i,props:{last:{name:u,url:$ziggy("account.wish")}}};n(a,{type:"success"}),c="add_to_wishlist"}else n(__("shop.wishlist.product_deleted"),{type:"warning"}),c="remove_from_wish_list";var m={ecommerce:{currency:null!==(t=$env.locale)&&void 0!==t&&t.currency?$env.locale.currency:"UAH",value:parseFloat(p),items:[{item_name:r,item_id:h,price:parseFloat(p),quantity:1}]},event:c};o.item&&o.item.attributes.index?m.ecommerce.items[0].index=o.item.attributes.index:e.index&&(m.ecommerce.items[0].index=e.index),o.item&&o.item.attributes.itemListName?m.ecommerce.items[0].item_list_name=o.item.attributes.itemListName:e.item_list_name&&(m.ecommerce.items[0].item_list_name=e.item_list_name),y&&(m.ecommerce.items[0].item_brand=y),o.item&&o.item.attributes.property?m.ecommerce.items[0].item_variant=o.item.attributes.property:o.property&&(m.ecommerce.items[0].item_variant=o.property),f&&(-1!==f.indexOf("/")?f.split("/").forEach((function(e,t){m.ecommerce.items[0]["item_category"+(t?t+1:"")]=e.trim()})):m.ecommerce.items[0].item_category=f),$env.debug.ecommerce&&console.log(m),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(m)),s.value=!1}})}else c.commit("auth/modal","login")},loading:s,button:m}}}),c=["title"],l=e.createElementVNode("svg",{class:"icon wishlist"},[e.createElementVNode("use",{"xlink:href":"#wishlist"})],-1);n.render=function(t,r,i,o,s,n){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["button wishlist",{"is-loading":t.loading,"is-transparent":!t.item}]),onClick:r[0]||(r[0]=function(){return t.action&&t.action.apply(t,arguments)}),title:t.__("shop.wishlist.add"),ref:"button"},[e.renderSlot(t.$slots,"default",{product:t.item},(function(){return[l]}))],10,c)},module.exports=n;
|
|
2
2
|
//# sourceMappingURL=WishlistAdd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WishlistAdd.js","sources":["../../../../src/components/shop/wishlist/SuccessMessage.vue","../../../../src/components/shop/wishlist/SuccessMessage.vue?vue&type=template&id=2780632f&lang.js","../../../../src/components/shop/wishlist/WishlistAdd.vue","../../../../src/components/shop/wishlist/WishlistAdd.vue?vue&type=template&id=84562dca&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-wishlist-success-message\">\n <div>\n {{\n translate(\"shop.wishlist.product_added_named\", {\n product: last.name,\n })\n }}\n </div>\n <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.wishlist.goto\") }}</a\n >\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"shop-wishlist-success-message\">\n <div>\n {{\n translate(\"shop.wishlist.product_added_named\", {\n product: last.name,\n })\n }}\n </div>\n <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.wishlist.goto\") }}</a\n >\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <button class=\"button wishlist\" @click=\"action\" v-bind:class=\"{ 'is-loading': loading, 'is-transparent': !item }\" :title=\"__('shop.wishlist.add')\" ref=\"button\">\n <slot :product=\"item\">\n <svg class=\"icon wishlist\">\n <use xlink:href=\"#wishlist\" />\n </svg>\n </slot>\n </button>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport SuccessMessage from \"./SuccessMessage.vue\";\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number,\n code: {\n type: String,\n default: null\n },\n property: {\n type: String,\n default: null\n },\n item: {\n type: Object,\n default: null\n }\n },\n setup(props) {\n const loading = ref(false);\n const toast = useToast();\n const store = useStore();\n const item = computed(() => store.getters[\"wishlist/item\"](props.id));\n const auth = computed(() => store.getters[\"auth/is\"]);\n const last = computed(() => store.getters[\"wishlist/last\"]);\n const button = ref(null);\n\n const action = () => {\n if (!loading.value) {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n loading.value = true;\n\n let trackingIndex = {};\n\n if (window.getTrackingIndexProductsList && typeof window.getTrackingIndexProductsList === 'function') {\n trackingIndex = window.getTrackingIndexProductsList(button.value);\n }\n\n const product = button.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]') ? product.querySelector('[shop-product-name]').textContent : null;\n const priceActive = product.querySelector('.cart-prices > .prices.is-active [shop-product-price]') ? product.querySelector('.cart-prices > .prices.is-active [shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const price = !priceActive && product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : priceActive;\n const code = props.code ? props.code : product.dataset.code;\n const category = product.querySelector('[shop-product-category]') ? product.querySelector('[shop-product-category]').textContent : null;\n const brand = product.querySelector('[shop-product-brand]') ? product.querySelector('[shop-product-brand]').textContent : null;\n\n store.dispatch(\"wishlist/toggle\", {\n id: props.id,\n finally: () => {\n let eventName = '';\n\n if (item.value) {\n const component = {\n component: SuccessMessage,\n props: {\n last: {\n name: last,\n url: $ziggy(\"account.wish\"),\n },\n },\n };\n\n toast(component, {\n type: \"success\",\n });\n\n eventName = 'add_to_wishlist';\n } else {\n toast(__(\"shop.wishlist.product_deleted\"), {\n type: \"warning\",\n });\n\n eventName = 'remove_from_wish_list';\n }\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: 1,\n }\n ]\n },\n event: eventName\n };\n\n if (props.item && props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n } else if (trackingIndex.index) {\n object.ecommerce.items[0].index = trackingIndex.index;\n }\n\n if (props.item && props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n } else if (trackingIndex.item_list_name) {\n object.ecommerce.items[0].item_list_name = trackingIndex.item_list_name;\n }\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item && props.item.attributes.property) {\n object.ecommerce.items[0].item_variant = props.item.attributes.property;\n } else if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n\n loading.value = false;\n },\n });\n }\n }\n };\n\n return {\n item,\n action,\n loading,\n button,\n };\n },\n});\n</script>","<template>\n <button class=\"button wishlist\" @click=\"action\" v-bind:class=\"{ 'is-loading': loading, 'is-transparent': !item }\" :title=\"__('shop.wishlist.add')\" ref=\"button\">\n <slot :product=\"item\">\n <svg class=\"icon wishlist\">\n <use xlink:href=\"#wishlist\" />\n </svg>\n </slot>\n </button>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport SuccessMessage from \"./SuccessMessage.vue\";\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number,\n code: {\n type: String,\n default: null\n },\n property: {\n type: String,\n default: null\n },\n item: {\n type: Object,\n default: null\n }\n },\n setup(props) {\n const loading = ref(false);\n const toast = useToast();\n const store = useStore();\n const item = computed(() => store.getters[\"wishlist/item\"](props.id));\n const auth = computed(() => store.getters[\"auth/is\"]);\n const last = computed(() => store.getters[\"wishlist/last\"]);\n const button = ref(null);\n\n const action = () => {\n if (!loading.value) {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n loading.value = true;\n\n let trackingIndex = {};\n\n if (window.getTrackingIndexProductsList && typeof window.getTrackingIndexProductsList === 'function') {\n trackingIndex = window.getTrackingIndexProductsList(button.value);\n }\n\n const product = button.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]') ? product.querySelector('[shop-product-name]').textContent : null;\n const priceActive = product.querySelector('.cart-prices > .prices.is-active [shop-product-price]') ? product.querySelector('.cart-prices > .prices.is-active [shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const price = !priceActive && product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : priceActive;\n const code = props.code ? props.code : product.dataset.code;\n const category = product.querySelector('[shop-product-category]') ? product.querySelector('[shop-product-category]').textContent : null;\n const brand = product.querySelector('[shop-product-brand]') ? product.querySelector('[shop-product-brand]').textContent : null;\n\n store.dispatch(\"wishlist/toggle\", {\n id: props.id,\n finally: () => {\n let eventName = '';\n\n if (item.value) {\n const component = {\n component: SuccessMessage,\n props: {\n last: {\n name: last,\n url: $ziggy(\"account.wish\"),\n },\n },\n };\n\n toast(component, {\n type: \"success\",\n });\n\n eventName = 'add_to_wishlist';\n } else {\n toast(__(\"shop.wishlist.product_deleted\"), {\n type: \"warning\",\n });\n\n eventName = 'remove_from_wish_list';\n }\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: 1,\n }\n ]\n },\n event: eventName\n };\n\n if (props.item && props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n } else if (trackingIndex.index) {\n object.ecommerce.items[0].index = trackingIndex.index;\n }\n\n if (props.item && props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n } else if (trackingIndex.item_list_name) {\n object.ecommerce.items[0].item_list_name = trackingIndex.item_list_name;\n }\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item && props.item.attributes.property) {\n object.ecommerce.items[0].item_variant = props.item.attributes.property;\n } else if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n\n loading.value = false;\n },\n });\n }\n }\n };\n\n return {\n item,\n action,\n loading,\n button,\n };\n },\n});\n</script>"],"names":["script$1","props","last","setup","translate","window","__","_hoisted_1","class","_openBlock","openBlock","_createElementBlock","_createElementVNode","$setup","product","$props","name","href","url","style","color","border-bottom","_hoisted_2","script","defineComponent","id","Number","code","type","String","default","property","item","Object","loading","ref","toast","useToast","store","useStore","computed","getters","auth","button","action","value","trackingIndex","getTrackingIndexProductsList","closest","querySelector","textContent","priceActive","childNodes","nodeValue","replace","price","dataset","category","brand","dispatch","finally","eventName","component","SuccessMessage","$ziggy","object","ecommerce","currency","parseFloat","items","item_name","item_id","quantity","event","attributes","index","itemListName","item_list_name","item_brand","item_variant","indexOf","split","forEach","segment","trim","item_category","$env","debug","console","log","dataLayer","push","commit","createElementVNode","xlink:href","createElementBlock","_normalizeClass","is-loading","_ctx","onClick","apply","arguments","title","_renderSlot","renderSlot","$slots"],"mappings":"oFAkBeA,EAAA,CACXC,MAAO,CACHC,KAAM,MAEVC,MAAK,WAGD,MAAO,CACHC,UAHcC,OAAOC,MCtBxBC,EAAA,CAAAC,MAAM,2EAAX,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AAM+B,MAAQ/B,EAAM+B,KAAK0C,WAAW3C,SACpCkC,EAAOC,UAAUG,MAAM,GAAGU,aAAe9E,EAAM+B,KAAK0C,WAAW3C,SACxD9B,EAAM8B,WACbkC,EAAOC,UAAUG,MAAM,GAAGU,aAAe9E,EAAM8B,UAG/C0B,KAC+B,IAA3BA,EAASuB,QAAQ,KACjBvB,EAASwB,MAAM,KAAKC,SAAQ,SAACC,EAASR,GAClCV,EAAOC,UAAUG,MAAM,GAAG,iBAAmBM,EAAQA,EAAQ,EAAI,KAAOQ,EAAQC,UAGpFnB,EAAOC,UAAUG,MAAM,GAAGgB,cAAgB5B,GAI9C6B,KAAKC,MAAMrB,WACXsB,QAAQC,IAAIxB,IAGXqB,KAAKC,MAAMrB,WAAa7D,OAAOqF,YAChCrF,OAAOqF,UAAUC,KAAK,CAClBzB,UAAW,OAGf7D,OAAOqF,UAAUC,KAAK1B,IAG1B/B,EAAQW,OAAQ,UA3GxBP,EAAMsD,OAAO,aAAc,UAqHnC1D,QAAAA,EACAS,OAAAA,oBC9JA/B,EAEKiF,mBAAA,MAAA,CAFArF,MAAM,iBAAe,CACtBI,EAA6BiF,mBAAA,MAAA,CAAxBC,aAAW,uEAH5BnF,EAMQoF,mBAAA,SAAA,CANAvF,MAAMwF,EAAAA,eAAA,CAAA,kBAAgE,CAAAC,aAAAC,EAAAhE,0BAA4BgE,EAAKlE,QAA9EmE,sCAAOD,EAAMtD,QAAAsD,EAAAtD,OAAAwD,MAAAF,EAAAG,aAAqEC,MAAOJ,EAAE5F,GAAA,qBAAuB6B,IAAI,WACnJoE,EAAAC,WAIMN,EAJCO,OAAA,UAAA,CAAA3F,QAASoF,EAAAlE,OAAhB,WAAA,MAIM,CAHFV"}
|
|
1
|
+
{"version":3,"file":"WishlistAdd.js","sources":["../../../../src/components/shop/wishlist/SuccessMessage.vue","../../../../src/components/shop/wishlist/SuccessMessage.vue?vue&type=template&id=2780632f&lang.js","../../../../src/components/shop/wishlist/WishlistAdd.vue","../../../../src/components/shop/wishlist/WishlistAdd.vue?vue&type=template&id=1eb83072&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-wishlist-success-message\">\n <div>\n {{\n translate(\"shop.wishlist.product_added_named\", {\n product: last.name,\n })\n }}\n </div>\n <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.wishlist.goto\") }}</a\n >\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"shop-wishlist-success-message\">\n <div>\n {{\n translate(\"shop.wishlist.product_added_named\", {\n product: last.name,\n })\n }}\n </div>\n <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.wishlist.goto\") }}</a\n >\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <button class=\"button wishlist\" @click=\"action\" v-bind:class=\"{ 'is-loading': loading, 'is-transparent': !item }\" :title=\"__('shop.wishlist.add')\" ref=\"button\">\n <slot :product=\"item\">\n <svg class=\"icon wishlist\">\n <use xlink:href=\"#wishlist\" />\n </svg>\n </slot>\n </button>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport SuccessMessage from \"./SuccessMessage.vue\";\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number,\n code: {\n type: String,\n default: null\n },\n property: {\n type: String,\n default: null\n },\n item: {\n type: Object,\n default: null\n }\n },\n setup(props) {\n const loading = ref(false);\n const toast = useToast();\n const store = useStore();\n const item = computed(() => store.getters[\"wishlist/item\"](props.id));\n const auth = computed(() => store.getters[\"auth/is\"]);\n const last = computed(() => store.getters[\"wishlist/last\"]);\n const button = ref(null);\n\n const action = () => {\n if (!loading.value) {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n loading.value = true;\n\n let trackingIndex = {};\n\n if (window.getTrackingIndexProductsList && typeof window.getTrackingIndexProductsList === 'function') {\n trackingIndex = window.getTrackingIndexProductsList(button.value);\n }\n\n const product = button.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]') ? product.querySelector('[shop-product-name]').textContent : null;\n const priceActive = product.querySelector('.cart-prices > .prices.is-active [shop-product-price]') ? product.querySelector('.cart-prices > .prices.is-active [shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const price = !priceActive && product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : priceActive;\n const code = props.code ? props.code : product.dataset.code;\n const category = product.querySelector('[shop-product-category]') ? product.querySelector('[shop-product-category]').textContent : null;\n const brand = product.querySelector('[shop-product-brand]') ? product.querySelector('[shop-product-brand]').textContent : null;\n\n store.dispatch(\"wishlist/toggle\", {\n id: props.id,\n finally: () => {\n let eventName = '';\n\n if (item.value) {\n const component = {\n component: SuccessMessage,\n props: {\n last: {\n name: last,\n url: $ziggy(\"account.wish\"),\n },\n },\n };\n\n toast(component, {\n type: \"success\",\n });\n\n eventName = 'add_to_wishlist';\n } else {\n toast(__(\"shop.wishlist.product_deleted\"), {\n type: \"warning\",\n });\n\n eventName = 'remove_from_wish_list';\n }\n\n const object = {\n ecommerce: {\n currency: $env.locale?.currency ? $env.locale.currency : 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: 1,\n }\n ]\n },\n event: eventName\n };\n\n if (props.item && props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n } else if (trackingIndex.index) {\n object.ecommerce.items[0].index = trackingIndex.index;\n }\n\n if (props.item && props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n } else if (trackingIndex.item_list_name) {\n object.ecommerce.items[0].item_list_name = trackingIndex.item_list_name;\n }\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item && props.item.attributes.property) {\n object.ecommerce.items[0].item_variant = props.item.attributes.property;\n } else if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n\n loading.value = false;\n },\n });\n }\n }\n };\n\n return {\n item,\n action,\n loading,\n button,\n };\n },\n});\n</script>","<template>\n <button class=\"button wishlist\" @click=\"action\" v-bind:class=\"{ 'is-loading': loading, 'is-transparent': !item }\" :title=\"__('shop.wishlist.add')\" ref=\"button\">\n <slot :product=\"item\">\n <svg class=\"icon wishlist\">\n <use xlink:href=\"#wishlist\" />\n </svg>\n </slot>\n </button>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport SuccessMessage from \"./SuccessMessage.vue\";\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number,\n code: {\n type: String,\n default: null\n },\n property: {\n type: String,\n default: null\n },\n item: {\n type: Object,\n default: null\n }\n },\n setup(props) {\n const loading = ref(false);\n const toast = useToast();\n const store = useStore();\n const item = computed(() => store.getters[\"wishlist/item\"](props.id));\n const auth = computed(() => store.getters[\"auth/is\"]);\n const last = computed(() => store.getters[\"wishlist/last\"]);\n const button = ref(null);\n\n const action = () => {\n if (!loading.value) {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n loading.value = true;\n\n let trackingIndex = {};\n\n if (window.getTrackingIndexProductsList && typeof window.getTrackingIndexProductsList === 'function') {\n trackingIndex = window.getTrackingIndexProductsList(button.value);\n }\n\n const product = button.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]') ? product.querySelector('[shop-product-name]').textContent : null;\n const priceActive = product.querySelector('.cart-prices > .prices.is-active [shop-product-price]') ? product.querySelector('.cart-prices > .prices.is-active [shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const price = !priceActive && product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : priceActive;\n const code = props.code ? props.code : product.dataset.code;\n const category = product.querySelector('[shop-product-category]') ? product.querySelector('[shop-product-category]').textContent : null;\n const brand = product.querySelector('[shop-product-brand]') ? product.querySelector('[shop-product-brand]').textContent : null;\n\n store.dispatch(\"wishlist/toggle\", {\n id: props.id,\n finally: () => {\n let eventName = '';\n\n if (item.value) {\n const component = {\n component: SuccessMessage,\n props: {\n last: {\n name: last,\n url: $ziggy(\"account.wish\"),\n },\n },\n };\n\n toast(component, {\n type: \"success\",\n });\n\n eventName = 'add_to_wishlist';\n } else {\n toast(__(\"shop.wishlist.product_deleted\"), {\n type: \"warning\",\n });\n\n eventName = 'remove_from_wish_list';\n }\n\n const object = {\n ecommerce: {\n currency: $env.locale?.currency ? $env.locale.currency : 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: 1,\n }\n ]\n },\n event: eventName\n };\n\n if (props.item && props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n } else if (trackingIndex.index) {\n object.ecommerce.items[0].index = trackingIndex.index;\n }\n\n if (props.item && props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n } else if (trackingIndex.item_list_name) {\n object.ecommerce.items[0].item_list_name = trackingIndex.item_list_name;\n }\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item && props.item.attributes.property) {\n object.ecommerce.items[0].item_variant = props.item.attributes.property;\n } else if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n\n loading.value = false;\n },\n });\n }\n }\n };\n\n return {\n item,\n action,\n loading,\n button,\n };\n },\n});\n</script>"],"names":["script$1","props","last","setup","translate","window","__","_hoisted_1","class","_openBlock","openBlock","_createElementBlock","_createElementVNode","$setup","product","$props","name","href","url","style","color","border-bottom","_hoisted_2","script","defineComponent","id","Number","code","type","String","default","property","item","Object","loading","ref","toast","useToast","store","useStore","computed","getters","auth","button","action","value","trackingIndex","getTrackingIndexProductsList","closest","querySelector","textContent","priceActive","childNodes","nodeValue","replace","price","dataset","category","brand","dispatch","finally","_$env$locale","eventName","component","SuccessMessage","$ziggy","object","ecommerce","currency","$env","locale","parseFloat","items","item_name","item_id","quantity","event","attributes","index","itemListName","item_list_name","item_brand","item_variant","indexOf","split","forEach","segment","trim","item_category","debug","console","log","dataLayer","push","commit","createElementVNode","xlink:href","createElementBlock","_normalizeClass","is-loading","_ctx","onClick","apply","arguments","title","_renderSlot","renderSlot","$slots"],"mappings":"oFAkBeA,EAAA,CACXC,MAAO,CACHC,KAAM,MAEVC,MAAK,WAGD,MAAO,CACHC,UAHcC,OAAOC,MCtBxBC,EAAA,CAAAC,MAAM,2EAAX,OAAAC,EAAAC,YAAAC,EAAAA,mBAcK,MAdLJ,EAcK,CAbDK,EAAAA,mBAMK,6BAJGC,EAAST,UAAA,oCAAA,CAAsCU,QAAAC,EAAAb,KAAAc,WAKvDJ,EAAAA,mBAKA,IAA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