@perevorot/shop 2.0.146 → 2.0.148
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=e.defineComponent({name:"catalog",setup:function(){var t=e.ref(null),n=[],o=function(){document.querySelectorAll("#subcategory > div").forEach((function(e){e.remove()}))},a=function(){window.disableScrollTopAfterCatalogLoad||window.scrollTo({top:0,left:0,behavior:"smooth"}),window.lazyImages&&window.lazyImages.update(),window.catalogFilterCallback&&window.catalogFilterCallback(),document.documentElement.classList.remove("is-catalog-loading"),r()},c=function(c,r){var i=function(e){var t=e.hash?e.hash.substring(1):"",n=e.pathname.replace(/\/$/,"");return n=t?-1!==e.pathname.indexOf(":")?n+";"+t:n+"/"+t:n,$env.shop.isTrailingSlash&&(n+="/"),e.origin+n+(e.search?e.search+"&filter":"?filter")}(c),l=function(e){return e.replace(/[^a-z0-9]/g,"")}(i);-1===n.indexOf(l)?(document.documentElement.classList.add("is-catalog-loading"),$http.get(i).then((function(i){var u=document.createElement("html");u.innerHTML=i.data.page,window.app.component(l,{template:u.querySelector("#subcategory").innerHTML}),o(),n.push(l),t.value=l,r||history.pushState({urlPath:c.href,source:"catalog"},document.title,c.href),e.nextTick(a)})).catch((function(e){console.error(e)})).finally((function(){document.documentElement.classList.remove("is-catalog-loading")}))):(o(),t.value=l,r||history.pushState({urlPath:c.href,source:"catalog"},document.title,c.href),e.nextTick(a))},r=function(){document.querySelectorAll("[shop-filter] a").forEach((function(e){e.addEventListener("click",(function(t){t.preventDefault(),c(e)}))}))},i=function(){var e=document.createElement("a");e.href=window.location.href,c(e,!0)};return window.onpageshow=function(e){e.persisted&&window.location.reload()},window.addEventListener("DOMContentLoaded",(function(){r(),window.addEventListener("popstate",(function(e){e.state&&"catalog"==e.state.source&&i()})),window.location.hash&&i()})),{page:t}}});t.render=function(t,n,o,a,c,r){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.page))},module.exports=t;
|
|
1
|
+
"use strict";var e=require("vue"),t=e.defineComponent({name:"catalog",setup:function(){var t=e.ref(null),n=[],o=function(){document.querySelectorAll("#subcategory > div").forEach((function(e){e.remove()}))},a=function(){window.disableScrollTopAfterCatalogLoad||window.scrollTo({top:0,left:0,behavior:"smooth"}),window.lazyImages&&window.lazyImages.update(),window.catalogFilterCallback&&window.catalogFilterCallback(),document.documentElement.classList.remove("is-catalog-loading"),r()},c=function(c,r){var i=function(e){var t=e.hash?e.hash.substring(1):"",n=e.pathname.replace(/\/$/,"");return n=t?-1!==e.pathname.indexOf(":")?n+";"+t:n+"/"+t:n,$env.shop.isTrailingSlash&&(n+="/"),e.origin+n+(e.search?e.search+"&filter":"?filter")}(c),l=function(e){return e.replace(/[^a-z0-9]/g,"")}(i);-1===n.indexOf(l)?(document.documentElement.classList.add("is-catalog-loading"),$http.get(i).then((function(i){var u=document.createElement("html");u.innerHTML=i.data.page,window.app.component(l,{template:u.querySelector("#subcategory").innerHTML}),o(),n.push(l),t.value=l;var d={event:"applied_filter"};window.custom_page_type&&(d.custom_page_type=window.custom_page_type),$env.debug.ecommerce&&console.log(d),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(d)),r||history.pushState({urlPath:c.href,source:"catalog"},document.title,c.href),e.nextTick(a)})).catch((function(e){console.error(e)})).finally((function(){document.documentElement.classList.remove("is-catalog-loading")}))):(o(),t.value=l,r||history.pushState({urlPath:c.href,source:"catalog"},document.title,c.href),e.nextTick(a))},r=function(){document.querySelectorAll("[shop-filter] a").forEach((function(e){e.addEventListener("click",(function(t){t.preventDefault(),c(e)}))}))},i=function(){var e=document.createElement("a");e.href=window.location.href,c(e,!0)};return window.onpageshow=function(e){e.persisted&&window.location.reload()},window.addEventListener("DOMContentLoaded",(function(){r(),window.addEventListener("popstate",(function(e){e.state&&"catalog"==e.state.source&&i()})),window.location.hash&&i()})),{page:t}}});t.render=function(t,n,o,a,c,r){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.page))},module.exports=t;
|
|
2
2
|
//# sourceMappingURL=Catalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Catalog.js","sources":["../../../src/components/shop/Catalog.vue","../../../src/components/shop/Catalog.vue?vue&type=template&id=0ad7de5a&lang.js"],"sourcesContent":["<template>\n <component :is=\"page\"></component>\n</template>\n<script>\nimport { ref, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n name: 'catalog',\n setup() {\n const page = ref(null);\n const pages = [];\n\n const getPageName = (href) => {\n return href.replace(/[^a-z0-9]/g, '');\n };\n\n const clearContainer = () => {\n document.querySelectorAll('#subcategory > div').forEach((element) => {\n element.remove();\n });\n };\n\n const after = () => {\n if (!window.disableScrollTopAfterCatalogLoad) {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n if (window.catalogFilterCallback) {\n window.catalogFilterCallback();\n }\n\n document.documentElement.classList.remove('is-catalog-loading');\n\n init();\n };\n\n const parseFilterHref = (a) => {\n const hash = a.hash ? a.hash.substring(1) : '';\n\n let pathname = a.pathname.replace(/\\/$/, '');\n\n pathname = hash ? (a.pathname.indexOf(':') !== -1 ? pathname + ';' + hash : pathname + '/' + hash) : pathname;\n\n if ($env.shop.isTrailingSlash) {\n pathname = pathname + '/';\n }\n\n const href = a.origin + pathname + (a.search ? a.search + '&filter' : '?filter');\n\n return href;\n };\n\n const get = (a, ignoreHistory) => {\n const href = parseFilterHref(a);\n\n const componentName = getPageName(href);\n\n if (pages.indexOf(componentName) === -1) {\n document.documentElement.classList.add('is-catalog-loading');\n\n $http\n .get(href)\n .then((response) => {\n let html = document.createElement('html');\n\n html.innerHTML = response.data.page;\n\n window.app.component(componentName, {\n template: html.querySelector('#subcategory').innerHTML\n });\n\n clearContainer();\n\n pages.push(componentName);\n\n page.value = componentName;\n\n if (!ignoreHistory) {\n history.pushState({ urlPath: a.href, source: 'catalog' }, document.title, a.href);\n }\n\n nextTick(after);\n })\n .catch((error) => {\n console.error(error);\n })\n .finally(() => {\n document.documentElement.classList.remove('is-catalog-loading');\n });\n } else {\n clearContainer();\n\n page.value = componentName;\n\n if (!ignoreHistory) {\n history.pushState({ urlPath: a.href, source: 'catalog' }, document.title, a.href);\n }\n\n nextTick(after);\n }\n };\n\n const init = () => {\n document.querySelectorAll('[shop-filter] a').forEach((a) => {\n a.addEventListener('click', (e) => {\n e.preventDefault();\n\n get(a);\n });\n });\n };\n\n const refresh = () => {\n const a = document.createElement('a');\n a.href = window.location.href;\n\n get(a, true);\n };\n\n window.onpageshow = function (event) {\n if (event.persisted) {\n window.location.reload();\n }\n };\n\n window.addEventListener('DOMContentLoaded', () => {\n init();\n\n window.addEventListener('popstate', (e) => {\n if (e.state && e.state.source == 'catalog') {\n refresh();\n }\n });\n\n if (window.location.hash) {\n refresh();\n }\n });\n\n return {\n page\n };\n }\n});\n</script>","<template>\n <component :is=\"page\"></component>\n</template>\n<script>\nimport { ref, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n name: 'catalog',\n setup() {\n const page = ref(null);\n const pages = [];\n\n const getPageName = (href) => {\n return href.replace(/[^a-z0-9]/g, '');\n };\n\n const clearContainer = () => {\n document.querySelectorAll('#subcategory > div').forEach((element) => {\n element.remove();\n });\n };\n\n const after = () => {\n if (!window.disableScrollTopAfterCatalogLoad) {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n if (window.catalogFilterCallback) {\n window.catalogFilterCallback();\n }\n\n document.documentElement.classList.remove('is-catalog-loading');\n\n init();\n };\n\n const parseFilterHref = (a) => {\n const hash = a.hash ? a.hash.substring(1) : '';\n\n let pathname = a.pathname.replace(/\\/$/, '');\n\n pathname = hash ? (a.pathname.indexOf(':') !== -1 ? pathname + ';' + hash : pathname + '/' + hash) : pathname;\n\n if ($env.shop.isTrailingSlash) {\n pathname = pathname + '/';\n }\n\n const href = a.origin + pathname + (a.search ? a.search + '&filter' : '?filter');\n\n return href;\n };\n\n const get = (a, ignoreHistory) => {\n const href = parseFilterHref(a);\n\n const componentName = getPageName(href);\n\n if (pages.indexOf(componentName) === -1) {\n document.documentElement.classList.add('is-catalog-loading');\n\n $http\n .get(href)\n .then((response) => {\n let html = document.createElement('html');\n\n html.innerHTML = response.data.page;\n\n window.app.component(componentName, {\n template: html.querySelector('#subcategory').innerHTML\n });\n\n clearContainer();\n\n pages.push(componentName);\n\n page.value = componentName;\n\n if (!ignoreHistory) {\n history.pushState({ urlPath: a.href, source: 'catalog' }, document.title, a.href);\n }\n\n nextTick(after);\n })\n .catch((error) => {\n console.error(error);\n })\n .finally(() => {\n document.documentElement.classList.remove('is-catalog-loading');\n });\n } else {\n clearContainer();\n\n page.value = componentName;\n\n if (!ignoreHistory) {\n history.pushState({ urlPath: a.href, source: 'catalog' }, document.title, a.href);\n }\n\n nextTick(after);\n }\n };\n\n const init = () => {\n document.querySelectorAll('[shop-filter] a').forEach((a) => {\n a.addEventListener('click', (e) => {\n e.preventDefault();\n\n get(a);\n });\n });\n };\n\n const refresh = () => {\n const a = document.createElement('a');\n a.href = window.location.href;\n\n get(a, true);\n };\n\n window.onpageshow = function (event) {\n if (event.persisted) {\n window.location.reload();\n }\n };\n\n window.addEventListener('DOMContentLoaded', () => {\n init();\n\n window.addEventListener('popstate', (e) => {\n if (e.state && e.state.source == 'catalog') {\n refresh();\n }\n });\n\n if (window.location.hash) {\n refresh();\n }\n });\n\n return {\n page\n };\n }\n});\n</script>"],"names":["defineComponent","name","setup","page","ref","pages","clearContainer","document","querySelectorAll","forEach","element","remove","after","window","disableScrollTopAfterCatalogLoad","scrollTo","top","left","behavior","lazyImages","update","catalogFilterCallback","documentElement","classList","init","get","a","ignoreHistory","href","hash","substring","pathname","replace","indexOf","$env","shop","isTrailingSlash","origin","search","parseFilterHref","componentName","getPageName","add","$http","then","response","html","createElement","innerHTML","data","app","component","template","querySelector","push","value","history","pushState","urlPath","source","title","nextTick","error","console","addEventListener","e","preventDefault","refresh","location","onpageshow","event","persisted","reload","state","_createBlock","_ctx"],"mappings":"oCAMeA,kBAAgB,CAC3BC,KAAM,UACNC,qBACUC,EAAOC,MAAI,MACXC,EAAQ,GAMRC,EAAiB,WACnBC,SAASC,iBAAiB,sBAAsBC,SAAQ,SAACC,GACrDA,EAAQC,aAIVC,EAAQ,WACLC,OAAOC,kCACRD,OAAOE,SAAS,CACZC,IAAK,EACLC,KAAM,EACNC,SAAU,WAIdL,OAAOM,YACPN,OAAOM,WAAWC,SAGlBP,OAAOQ,uBACPR,OAAOQ,wBAGXd,SAASe,gBAAgBC,UAAUZ,OAAO,sBAE1Ca,KAmBEC,EAAM,SAACC,EAAGC,OACNC,EAjBc,SAACF,OACfG,EAAOH,EAAEG,KAAOH,EAAEG,KAAKC,UAAU,GAAK,GAExCC,EAAWL,EAAEK,SAASC,QAAQ,MAAO,WAEzCD,EAAWF,GAAqC,IAA7BH,EAAEK,SAASE,QAAQ,KAAcF,EAAW,IAAMF,EAAOE,EAAW,IAAMF,EAAQE,EAEjGG,KAAKC,KAAKC,kBACVL,GAAsB,KAGbL,EAAEW,OAASN,GAAYL,EAAEY,OAASZ,EAAEY,OAAS,UAAY,WAMzDC,CAAgBb,GAEvBc,EAnDU,SAACZ,UACVA,EAAKI,QAAQ,aAAc,IAkDZS,CAAYb,IAEI,IAAlCvB,EAAM4B,QAAQO,IACdjC,SAASe,gBAAgBC,UAAUmB,IAAI,sBAEvCC,MACKlB,IAAIG,GACJgB,MAAK,SAACC,OACCC,EAAOvC,SAASwC,cAAc,QAElCD,EAAKE,UAAYH,EAASI,KAAK9C,KAE/BU,OAAOqC,IAAIC,UAAUX,EAAe,CAChCY,SAAUN,EAAKO,cAAc,gBAAgBL,YAGjD1C,IAEAD,EAAMiD,KAAKd,GAEXrC,EAAKoD,MAAQf,EAERb,GACD6B,QAAQC,UAAU,CAAEC,QAAShC,EAAEE,KAAM+B,OAAQ,WAAapD,SAASqD,MAAOlC,EAAEE,MAGhFiC,WAASjD,aAEN,SAACkD,GACJC,QAAQD,MAAMA,eAET,WACLvD,SAASe,gBAAgBC,UAAUZ,OAAO,2BAGlDL,IAEAH,EAAKoD,MAAQf,EAERb,GACD6B,QAAQC,UAAU,CAAEC,QAAShC,EAAEE,KAAM+B,OAAQ,WAAapD,SAASqD,MAAOlC,EAAEE,MAGhFiC,WAASjD,KAIXY,EAAO,WACTjB,SAASC,iBAAiB,mBAAmBC,SAAQ,SAACiB,GAClDA,EAAEsC,iBAAiB,SAAS,SAACC,GACzBA,EAAEC,iBAEFzC,EAAIC,UAKVyC,EAAU,eACNzC,EAAInB,SAASwC,cAAc,KACjCrB,EAAEE,KAAOf,OAAOuD,SAASxC,KAEzBH,EAAIC,GAAG,WAGXb,OAAOwD,WAAa,SAAUC,GACtBA,EAAMC,WACN1D,OAAOuD,SAASI,UAIxB3D,OAAOmD,iBAAiB,oBAAoB,WACxCxC,IAEAX,OAAOmD,iBAAiB,YAAY,SAACC,GAC7BA,EAAEQ,OAA2B,WAAlBR,EAAEQ,MAAMd,QACnBQ,OAIJtD,OAAOuD,SAASvC,MAChBsC,OAID,CACHhE,KAAAA,0DCnJRuE,wCAAgBC"}
|
|
1
|
+
{"version":3,"file":"Catalog.js","sources":["../../../src/components/shop/Catalog.vue","../../../src/components/shop/Catalog.vue?vue&type=template&id=e2a58212&lang.js"],"sourcesContent":["<template>\n <component :is=\"page\"></component>\n</template>\n<script>\nimport { ref, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n name: 'catalog',\n setup() {\n const page = ref(null);\n const pages = [];\n\n const getPageName = (href) => {\n return href.replace(/[^a-z0-9]/g, '');\n };\n\n const clearContainer = () => {\n document.querySelectorAll('#subcategory > div').forEach((element) => {\n element.remove();\n });\n };\n\n const after = () => {\n if (!window.disableScrollTopAfterCatalogLoad) {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n if (window.catalogFilterCallback) {\n window.catalogFilterCallback();\n }\n\n document.documentElement.classList.remove('is-catalog-loading');\n\n init();\n };\n\n const parseFilterHref = (a) => {\n const hash = a.hash ? a.hash.substring(1) : '';\n\n let pathname = a.pathname.replace(/\\/$/, '');\n\n pathname = hash ? (a.pathname.indexOf(':') !== -1 ? pathname + ';' + hash : pathname + '/' + hash) : pathname;\n\n if ($env.shop.isTrailingSlash) {\n pathname = pathname + '/';\n }\n\n const href = a.origin + pathname + (a.search ? a.search + '&filter' : '?filter');\n\n return href;\n };\n\n const get = (a, ignoreHistory) => {\n const href = parseFilterHref(a);\n\n const componentName = getPageName(href);\n\n if (pages.indexOf(componentName) === -1) {\n document.documentElement.classList.add('is-catalog-loading');\n\n $http\n .get(href)\n .then((response) => {\n let html = document.createElement('html');\n\n html.innerHTML = response.data.page;\n\n window.app.component(componentName, {\n template: html.querySelector('#subcategory').innerHTML\n });\n\n clearContainer();\n\n pages.push(componentName);\n\n page.value = componentName;\n\n let object = {\n 'event': 'applied_filter',\n };\n\n if (window.custom_page_type) {\n object.custom_page_type = window.custom_page_type;\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 if (!ignoreHistory) {\n history.pushState({ urlPath: a.href, source: 'catalog' }, document.title, a.href);\n }\n\n nextTick(after);\n })\n .catch((error) => {\n console.error(error);\n })\n .finally(() => {\n document.documentElement.classList.remove('is-catalog-loading');\n });\n } else {\n clearContainer();\n\n page.value = componentName;\n\n if (!ignoreHistory) {\n history.pushState({ urlPath: a.href, source: 'catalog' }, document.title, a.href);\n }\n\n nextTick(after);\n }\n };\n\n const init = () => {\n document.querySelectorAll('[shop-filter] a').forEach((a) => {\n a.addEventListener('click', (e) => {\n e.preventDefault();\n\n get(a);\n });\n });\n };\n\n const refresh = () => {\n const a = document.createElement('a');\n a.href = window.location.href;\n\n get(a, true);\n };\n\n window.onpageshow = function (event) {\n if (event.persisted) {\n window.location.reload();\n }\n };\n\n window.addEventListener('DOMContentLoaded', () => {\n init();\n\n window.addEventListener('popstate', (e) => {\n if (e.state && e.state.source == 'catalog') {\n refresh();\n }\n });\n\n if (window.location.hash) {\n refresh();\n }\n });\n\n return {\n page\n };\n }\n});\n</script>","<template>\n <component :is=\"page\"></component>\n</template>\n<script>\nimport { ref, defineComponent, nextTick } from 'vue';\n\nexport default defineComponent({\n name: 'catalog',\n setup() {\n const page = ref(null);\n const pages = [];\n\n const getPageName = (href) => {\n return href.replace(/[^a-z0-9]/g, '');\n };\n\n const clearContainer = () => {\n document.querySelectorAll('#subcategory > div').forEach((element) => {\n element.remove();\n });\n };\n\n const after = () => {\n if (!window.disableScrollTopAfterCatalogLoad) {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n if (window.catalogFilterCallback) {\n window.catalogFilterCallback();\n }\n\n document.documentElement.classList.remove('is-catalog-loading');\n\n init();\n };\n\n const parseFilterHref = (a) => {\n const hash = a.hash ? a.hash.substring(1) : '';\n\n let pathname = a.pathname.replace(/\\/$/, '');\n\n pathname = hash ? (a.pathname.indexOf(':') !== -1 ? pathname + ';' + hash : pathname + '/' + hash) : pathname;\n\n if ($env.shop.isTrailingSlash) {\n pathname = pathname + '/';\n }\n\n const href = a.origin + pathname + (a.search ? a.search + '&filter' : '?filter');\n\n return href;\n };\n\n const get = (a, ignoreHistory) => {\n const href = parseFilterHref(a);\n\n const componentName = getPageName(href);\n\n if (pages.indexOf(componentName) === -1) {\n document.documentElement.classList.add('is-catalog-loading');\n\n $http\n .get(href)\n .then((response) => {\n let html = document.createElement('html');\n\n html.innerHTML = response.data.page;\n\n window.app.component(componentName, {\n template: html.querySelector('#subcategory').innerHTML\n });\n\n clearContainer();\n\n pages.push(componentName);\n\n page.value = componentName;\n\n let object = {\n 'event': 'applied_filter',\n };\n\n if (window.custom_page_type) {\n object.custom_page_type = window.custom_page_type;\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 if (!ignoreHistory) {\n history.pushState({ urlPath: a.href, source: 'catalog' }, document.title, a.href);\n }\n\n nextTick(after);\n })\n .catch((error) => {\n console.error(error);\n })\n .finally(() => {\n document.documentElement.classList.remove('is-catalog-loading');\n });\n } else {\n clearContainer();\n\n page.value = componentName;\n\n if (!ignoreHistory) {\n history.pushState({ urlPath: a.href, source: 'catalog' }, document.title, a.href);\n }\n\n nextTick(after);\n }\n };\n\n const init = () => {\n document.querySelectorAll('[shop-filter] a').forEach((a) => {\n a.addEventListener('click', (e) => {\n e.preventDefault();\n\n get(a);\n });\n });\n };\n\n const refresh = () => {\n const a = document.createElement('a');\n a.href = window.location.href;\n\n get(a, true);\n };\n\n window.onpageshow = function (event) {\n if (event.persisted) {\n window.location.reload();\n }\n };\n\n window.addEventListener('DOMContentLoaded', () => {\n init();\n\n window.addEventListener('popstate', (e) => {\n if (e.state && e.state.source == 'catalog') {\n refresh();\n }\n });\n\n if (window.location.hash) {\n refresh();\n }\n });\n\n return {\n page\n };\n }\n});\n</script>"],"names":["defineComponent","name","setup","page","ref","pages","clearContainer","document","querySelectorAll","forEach","element","remove","after","window","disableScrollTopAfterCatalogLoad","scrollTo","top","left","behavior","lazyImages","update","catalogFilterCallback","documentElement","classList","init","get","a","ignoreHistory","href","hash","substring","pathname","replace","indexOf","$env","shop","isTrailingSlash","origin","search","parseFilterHref","componentName","getPageName","add","$http","then","response","html","createElement","innerHTML","data","app","component","template","querySelector","push","value","object","custom_page_type","debug","ecommerce","console","log","dataLayer","history","pushState","urlPath","source","title","nextTick","error","addEventListener","e","preventDefault","refresh","location","onpagesh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XtB,KAAKwB,MAAMC,WAAa9C,OAAOiD,YAChCjD,OAAOiD,UAAUR,KAAK,CAClBK,UAAW,OAGf9C,OAAOiD,UAAUR,KAAKE,IAGrB7B,GACDoC,QAAQC,UAAU,CAAEC,QAASvC,EAAEE,KAAMsC,OAAQ,WAAa3D,SAAS4D,MAAOzC,EAAEE,MAGhFwC,WAASxD,aAEN,SAACyD,GACJT,QAAQS,MAAMA,eAET,WACL9D,SAASe,gBAAgBC,UAAUZ,OAAO,2BAGlDL,IAEAH,EAAKoD,MAAQf,EAERb,GACDoC,QAAQC,UAAU,CAAEC,QAASvC,EAAEE,KAAMsC,OAAQ,WAAa3D,SAAS4D,MAAOzC,EAAEE,MAGhFwC,WAASxD,KAIXY,EAAO,WACTjB,SAASC,iBAAiB,mBAAmBC,SAAQ,SAACiB,GAClDA,EAAE4C,iBAAiB,SAAS,SAACC,GACzBA,EAAEC,iBAEF/C,EAAIC,UAKV+C,EAAU,eACN/C,EAAInB,SAASwC,cAAc,KACjCrB,EAAEE,KAAOf,OAAO6D,SAAS9C,KAEzBH,EAAIC,GAAG,WAGXb,OAAO8D,WAAa,SAAUC,GACtBA,EAAMC,WACNhE,OAAO6D,SAASI,UAIxBjE,OAAOyD,iBAAiB,oBAAoB,WACxC9C,IAEAX,OAAOyD,iBAAiB,YAAY,SAACC,GAC7BA,EAAEQ,OAA2B,WAAlBR,EAAEQ,MAAMb,QACnBO,OAIJ5D,OAAO6D,SAAS7C,MAChB4C,OAID,CACHtE,KAAAA,0DCvKR6E,wCAAgBC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),i={name:"CartItem",props:{item:Object},setup:function(i){var o=e.inject("cartStorage"),n=t.useStore(),a=e.ref(!1),r=e.ref(),c=e.ref(i.item.attributes.options&&i.item.attributes.options.length?i.item.attributes.options:[]),l=e.ref(!1),s=e.computed((function(){return n.getters["auth/is"]}));i.item.attributes.options&&i.item.attributes.options.length&&(l.value=!0);var m=i.item.name,d=i.item.attributes.price,u=i.item.attributes.code,p=i.item.attributes.categoryFull?i.item.attributes.categoryFull:i.item.attributes.category,b=i.item.attributes.brand,v=i.item.attributes.property,g=i.item.attributes.index,k=i.item.attributes.itemListName,f=function(e){a.value=!0,n.dispatch(o+"/add",{cart:o,product:{id:i.item.id,quantity:e},finally:function(){a.value=!1},callback:function(){if(e>0){i.item.quantity;var t={ecommerce:{currency:"UAH",value:parseFloat(d),items:[{item_name:m,item_id:u,price:parseFloat(d),quantity:1}]},event:"add_to_cart"};b&&(t.ecommerce.items[0].item_brand=b),i.item.attributes.index&&(t.ecommerce.items[0].index=i.item.attributes.index),i.item.attributes.itemListName&&(t.ecommerce.items[0].item_list_name=i.item.attributes.itemListName),p&&(-1!==p.indexOf("/")?p.split("/").forEach((function(e,i){t.ecommerce.items[0]["item_category"+(i?i+1:"")]=e.trim()})):t.ecommerce.items[0].item_category=p),v&&(t.ecommerce.items[0].item_variant=v),$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}}})};i.item.options&&i.item.options.length&&e.watch(c,(function(e){a.value=!0,n.dispatch(o+"/options",{product:{id:i.item.id,options:Object.values(e)},finally:function(){a.value=!1}})}));return{loading:a,increase:function(){f(1)},decrease:function(){f(-1)},remove:function(){a.value=!0,n.dispatch(o+"/remove",{id:i.item.id,cart:o,finally:function(){a.value=!1},callback:function(){var e=i.item.quantity,t={ecommerce:{currency:"UAH",value:parseFloat(d)*e,items:[{item_name:m,item_id:u,price:parseFloat(d),quantity:e}]},event:"remove_from_cart"};p&&(-1!==p.indexOf("/")?p.split("/").forEach((function(e,i){t.ecommerce.items[0]["item_category"+(i?i+1:"")]=e.trim()})):t.ecommerce.items[0].item_category=p),g&&(t.ecommerce.items[0].index=g),k&&(t.ecommerce.items[0].item_list_name=k),v&&(t.ecommerce.items[0].item_variant=v),$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}})},options:c,optionsToggled:l,input:r,gotoProduct:function(e){window.addEventListener("beforeunload",(function(){n.commit(o+"/modal",null)})),window.addEventListener("pagehide",(function(){n.commit(o+"/modal",null)})),window.location.href=e},auth:s}}},o=["data-code"],n={key:0,class:"column is-12"},a={class:"bundle-title"},r={class:"column name"},c={class:"column is-narrow cart-actions-parent"},l={class:"cart-actions"},s=["disabled"],m=[e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#cart-remove"})],-1)],d={class:"column is-narrow image-parent"},u=["src"],p={key:1},b=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],v={class:"column"},g={class:"columns is-gapless mb-0"},k={class:"column"},f={key:0,class:"code"},E={class:"is-hidden","shop-product-category":""},y={class:"title"},N={key:0,"shop-product-name":""},V={key:0,class:"column is-narrow has-text-right is-relative quantity-parent"},h={class:"quantity"},B=["disabled"],w=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-minus"})],-1)],C=["disabled"],_=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-plus"})],-1)],x={key:0,class:"quantity-price"},L=["innerHTML"],S={class:"column is-2 has-text-right"},q=["innerHTML"],D=["innerHTML"],T=["innerHTML"],H=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),M={class:"wrapper"},$={class:"column is-narrow"},P=["value","id"],z={class:"column"},F=["for"],O={key:0,class:"option-description"},U={class:"column is-2 has-text-right"},j=["innerHTML"],I={key:0,class:"bundle columns"},A=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),G={class:"column is-narrow"},J=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),K=["src"],Q={key:1},R=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],W={class:"column"},X={key:0,class:"code"},Y={class:"title"},Z={key:1,class:"bundle columns"},ee=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),te={class:"column is-narrow"},ie=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),oe=["src"],ne={key:1},ae=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],re={class:"column"},ce={key:0,class:"code"},le={class:"title"};i.render=function(t,i,se,me,de,ue){var pe=e.resolveComponent("wishlist-add");return se.item.deleted?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["columns is-multiline shop-cart-item",{inactive:!1===se.item.attributes.active,"is-bundle":se.item.attributes.bundle}]),"data-code":se.item.attributes.code,"shop-product":""},[se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",a,e.toDisplayString(t.__("shop.cart.bundle")),1)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",r,[e.createElementVNode("div",{class:e.normalizeClass(["columns",{"mb-0":se.item.attributes.bundle}])},[e.createElementVNode("div",c,[e.createElementVNode("div",l,[e.createElementVNode("button",{class:"remove",onClick:i[0]||(i[0]=function(){return me.remove&&me.remove.apply(me,arguments)}),disabled:me.loading},m,8,s),me.auth&&!se.item.attributes.bundle?(e.openBlock(),e.createBlock(pe,{key:0,id:se.item.attributes.productId?se.item.attributes.productId:se.item.id,item:se.item},null,8,["id","item"])):e.createCommentVNode("v-if",!0)])]),e.createElementVNode("div",d,[e.createElementVNode("a",{onClick:i[1]||(i[1]=function(e){return me.gotoProduct(se.item.attributes.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.image}])},[se.item.attributes.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.image},null,8,u)):(e.openBlock(),e.createElementBlock("svg",p,b))],2)])]),e.createElementVNode("div",v,[e.createElementVNode("div",g,[e.createElementVNode("div",k,[e.renderSlot(t.$slots,"item-name",{item:se.item,gotoProduct:me.gotoProduct},(function(){return[se.item.attributes.code?(e.openBlock(),e.createElementBlock("div",f,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",E,e.toDisplayString(se.item.attributes.categoryFull),1),e.createElementVNode("div",y,[!1===se.item.attributes.active?(e.openBlock(),e.createElementBlock("span",N,e.toDisplayString(se.item.name),1)):(e.openBlock(),e.createElementBlock("a",{key:1,onClick:i[2]||(i[2]=function(e){return me.gotoProduct(se.item.attributes.href)})},e.toDisplayString(se.item.name),1))])]}))]),(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",h,[e.createElementVNode("button",{class:"button decrease",onClick:i[3]||(i[3]=function(){return me.decrease&&me.decrease.apply(me,arguments)}),disabled:me.loading||1==se.item.quantity},w,8,B),e.withDirectives(e.createElementVNode("input",{class:"input is-small",type:"number",min:"1","onUpdate:modelValue":i[4]||(i[4]=function(e){return se.item.quantity=e}),disabled:""},null,512),[[e.vModelText,se.item.quantity]]),e.createElementVNode("button",{class:"button increase",onClick:i[5]||(i[5]=function(){return me.increase&&me.increase.apply(me,arguments)}),disabled:me.loading},_,8,C)]),se.item.quantity>1?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("span",{innerHTML:t.$filters.price(se.item.attributes.price)},null,8,L),e.createTextVNode(" / "+e.toDisplayString(t.__("shop.cart.q")),1)])):e.createCommentVNode("v-if",!0)])),e.createElementVNode("div",S,[e.renderSlot(t.$slots,"item-price",{item:se.item,filters:t.$filters},(function(){return[e.createElementVNode("div",{class:e.normalizeClass(["price",{"bundle-price":se.item.attributes.bundle}])},[se.item.attributes.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(se.item.attributes.priceOld*se.item.quantity)},null,8,q)):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.amount?(e.openBlock(),e.createElementBlock("div",{key:1,class:"bundle-amount",innerHTML:t.__("shop.cart.bundle_amount")+(se.item.attributes.amount.percent?se.item.attributes.amount.percent+"%":t.$filters.price(se.item.attributes.amount.sum*se.item.quantity))},null,8,D)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{innerHTML:t.$filters.price(se.item.attributes.price*se.item.quantity),"shop-product-price":""},null,8,T)],2)]}))])]),se.item.options&&se.item.options.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["options",{"is-toggled":me.optionsToggled}])},[e.createElementVNode("div",{class:"toggler",onClick:i[6]||(i[6]=function(e){return me.optionsToggled=!me.optionsToggled})},[e.createElementVNode("span",null,e.toDisplayString(t.__("shop.cart.additional"))+" "+e.toDisplayString(se.item.options.length),1),H]),e.withDirectives(e.createElementVNode("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.item.options,(function(o,n){return e.openBlock(),e.createElementBlock("div",{key:n,class:e.normalizeClass(["columns",{"is-checked":-1!==me.options.indexOf(o.id)}])},[e.createElementVNode("div",$,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"checkbox","onUpdate:modelValue":i[7]||(i[7]=function(e){return me.options=e}),value:o.id,id:"option-"+se.item.id+"-"+o.id},null,8,P),[[e.vModelCheckbox,me.options]])]),e.createElementVNode("div",z,[e.createElementVNode("label",{class:"option-title is-clickable",for:"option-"+se.item.id+"-"+o.id},e.toDisplayString(o.name),9,F),o.description?(e.openBlock(),e.createElementBlock("div",O,e.toDisplayString(o.description),1)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",U,[e.createTextVNode("+"),e.createElementVNode("span",{innerHTML:t.$filters.price(o.price)},null,8,j)])],2)})),128))],512),[[e.vShow,me.optionsToggled]])],2)):e.createCommentVNode("v-if",!0)])],2),se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",I,[A,e.createElementVNode("div",G,[J,e.createElementVNode("a",{onClick:i[8]||(i[8]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.second.image}])},[se.item.attributes.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.second.image},null,8,K)):(e.openBlock(),e.createElementBlock("svg",Q,R))],2)])]),e.createElementVNode("div",W,[se.item.attributes.second.code?(e.openBlock(),e.createElementBlock("div",X,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.second.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Y,[e.createElementVNode("a",{onClick:i[9]||(i[9]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},e.toDisplayString(se.item.attributes.second.name),1)])])])):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.third?(e.openBlock(),e.createElementBlock("div",Z,[ee,e.createElementVNode("div",te,[ie,e.createElementVNode("a",{onClick:i[10]||(i[10]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.third.image}])},[se.item.attributes.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.third.image},null,8,oe)):(e.openBlock(),e.createElementBlock("svg",ne,ae))],2)])]),e.createElementVNode("div",re,[se.item.attributes.third.code?(e.openBlock(),e.createElementBlock("div",ce,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.third.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",le,[e.createElementVNode("a",{onClick:i[11]||(i[11]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},e.toDisplayString(se.item.attributes.third.name),1)])])])):e.createCommentVNode("v-if",!0)])],10,o))},module.exports=i;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),i={name:"CartItem",props:{item:Object},setup:function(i){var o=e.inject("cartStorage");o=o||"cart";var n=t.useStore(),a=e.ref(!1),r=e.ref(),c=e.ref(i.item.attributes.options&&i.item.attributes.options.length?i.item.attributes.options:[]),l=e.ref(!1),s=e.computed((function(){return n.getters["auth/is"]}));i.item.attributes.options&&i.item.attributes.options.length&&(l.value=!0);var m=i.item.name,d=i.item.attributes.price,u=i.item.attributes.code,p=i.item.attributes.categoryFull?i.item.attributes.categoryFull:i.item.attributes.category,b=i.item.attributes.brand,v=i.item.attributes.property,g=i.item.attributes.index,k=i.item.attributes.itemListName,f=function(e){a.value=!0,n.dispatch(o+"/add",{cart:o,product:{id:i.item.id,quantity:e},finally:function(){a.value=!1},callback:function(){if(e>0){i.item.quantity;var t={ecommerce:{currency:"UAH",value:parseFloat(d),items:[{item_name:m,item_id:u,price:parseFloat(d),quantity:1}]},event:"add_to_cart"};b&&(t.ecommerce.items[0].item_brand=b),i.item.attributes.index&&(t.ecommerce.items[0].index=i.item.attributes.index),i.item.attributes.itemListName&&(t.ecommerce.items[0].item_list_name=i.item.attributes.itemListName),p&&(-1!==p.indexOf("/")?p.split("/").forEach((function(e,i){t.ecommerce.items[0]["item_category"+(i?i+1:"")]=e.trim()})):t.ecommerce.items[0].item_category=p),v&&(t.ecommerce.items[0].item_variant=v),$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}}})};i.item.options&&i.item.options.length&&e.watch(c,(function(e){a.value=!0,n.dispatch(o+"/options",{product:{id:i.item.id,options:Object.values(e)},finally:function(){a.value=!1}})}));return{loading:a,increase:function(){f(1)},decrease:function(){f(-1)},remove:function(){a.value=!0,n.dispatch(o+"/remove",{id:i.item.id,cart:o,finally:function(){a.value=!1},callback:function(){var e=i.item.quantity,t={ecommerce:{currency:"UAH",value:parseFloat(d)*e,items:[{item_name:m,item_id:u,price:parseFloat(d),quantity:e}]},event:"remove_from_cart"};p&&(-1!==p.indexOf("/")?p.split("/").forEach((function(e,i){t.ecommerce.items[0]["item_category"+(i?i+1:"")]=e.trim()})):t.ecommerce.items[0].item_category=p),g&&(t.ecommerce.items[0].index=g),k&&(t.ecommerce.items[0].item_list_name=k),v&&(t.ecommerce.items[0].item_variant=v),$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}})},options:c,optionsToggled:l,input:r,gotoProduct:function(e){window.addEventListener("beforeunload",(function(){n.commit(o+"/modal",null)})),window.addEventListener("pagehide",(function(){n.commit(o+"/modal",null)})),window.location.href=e},auth:s}}},o=["data-code"],n={key:0,class:"column is-12"},a={class:"bundle-title"},r={class:"column name"},c={class:"column is-narrow cart-actions-parent"},l={class:"cart-actions"},s=["disabled"],m=[e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#cart-remove"})],-1)],d={class:"column is-narrow image-parent"},u=["src"],p={key:1},b=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],v={class:"column"},g={class:"columns is-gapless mb-0"},k={class:"column"},f={key:0,class:"code"},E={class:"is-hidden","shop-product-category":""},y={class:"title"},N={key:0,"shop-product-name":""},V={key:0,class:"column is-narrow has-text-right is-relative quantity-parent"},h={class:"quantity"},B=["disabled"],w=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-minus"})],-1)],C=["disabled"],_=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-plus"})],-1)],x={key:0,class:"quantity-price"},L=["innerHTML"],S={class:"column is-2 has-text-right"},q=["innerHTML"],D=["innerHTML"],T=["innerHTML"],H=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),M={class:"wrapper"},$={class:"column is-narrow"},P=["value","id"],z={class:"column"},F=["for"],O={key:0,class:"option-description"},U={class:"column is-2 has-text-right"},j=["innerHTML"],I={key:0,class:"bundle columns"},A=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),G={class:"column is-narrow"},J=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),K=["src"],Q={key:1},R=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],W={class:"column"},X={key:0,class:"code"},Y={class:"title"},Z={key:1,class:"bundle columns"},ee=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),te={class:"column is-narrow"},ie=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),oe=["src"],ne={key:1},ae=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],re={class:"column"},ce={key:0,class:"code"},le={class:"title"};i.render=function(t,i,se,me,de,ue){var pe=e.resolveComponent("wishlist-add");return se.item.deleted?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["columns is-multiline shop-cart-item",{inactive:!1===se.item.attributes.active,"is-bundle":se.item.attributes.bundle}]),"data-code":se.item.attributes.code,"shop-product":""},[se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",a,e.toDisplayString(t.__("shop.cart.bundle")),1)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",r,[e.createElementVNode("div",{class:e.normalizeClass(["columns",{"mb-0":se.item.attributes.bundle}])},[e.createElementVNode("div",c,[e.createElementVNode("div",l,[e.createElementVNode("button",{class:"remove",onClick:i[0]||(i[0]=function(){return me.remove&&me.remove.apply(me,arguments)}),disabled:me.loading},m,8,s),me.auth&&!se.item.attributes.bundle?(e.openBlock(),e.createBlock(pe,{key:0,id:se.item.attributes.productId?se.item.attributes.productId:se.item.id,item:se.item},null,8,["id","item"])):e.createCommentVNode("v-if",!0)])]),e.createElementVNode("div",d,[e.createElementVNode("a",{onClick:i[1]||(i[1]=function(e){return me.gotoProduct(se.item.attributes.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.image}])},[se.item.attributes.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.image},null,8,u)):(e.openBlock(),e.createElementBlock("svg",p,b))],2)])]),e.createElementVNode("div",v,[e.createElementVNode("div",g,[e.createElementVNode("div",k,[e.renderSlot(t.$slots,"item-name",{item:se.item,gotoProduct:me.gotoProduct},(function(){return[se.item.attributes.code?(e.openBlock(),e.createElementBlock("div",f,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",E,e.toDisplayString(se.item.attributes.categoryFull),1),e.createElementVNode("div",y,[!1===se.item.attributes.active?(e.openBlock(),e.createElementBlock("span",N,e.toDisplayString(se.item.name),1)):(e.openBlock(),e.createElementBlock("a",{key:1,onClick:i[2]||(i[2]=function(e){return me.gotoProduct(se.item.attributes.href)})},e.toDisplayString(se.item.name),1))])]}))]),(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",h,[e.createElementVNode("button",{class:"button decrease",onClick:i[3]||(i[3]=function(){return me.decrease&&me.decrease.apply(me,arguments)}),disabled:me.loading||1==se.item.quantity},w,8,B),e.withDirectives(e.createElementVNode("input",{class:"input is-small",type:"number",min:"1","onUpdate:modelValue":i[4]||(i[4]=function(e){return se.item.quantity=e}),disabled:""},null,512),[[e.vModelText,se.item.quantity]]),e.createElementVNode("button",{class:"button increase",onClick:i[5]||(i[5]=function(){return me.increase&&me.increase.apply(me,arguments)}),disabled:me.loading},_,8,C)]),se.item.quantity>1?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("span",{innerHTML:t.$filters.price(se.item.attributes.price)},null,8,L),e.createTextVNode(" / "+e.toDisplayString(t.__("shop.cart.q")),1)])):e.createCommentVNode("v-if",!0)])),e.createElementVNode("div",S,[e.renderSlot(t.$slots,"item-price",{item:se.item,filters:t.$filters},(function(){return[e.createElementVNode("div",{class:e.normalizeClass(["price",{"bundle-price":se.item.attributes.bundle}])},[se.item.attributes.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(se.item.attributes.priceOld*se.item.quantity)},null,8,q)):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.amount?(e.openBlock(),e.createElementBlock("div",{key:1,class:"bundle-amount",innerHTML:t.__("shop.cart.bundle_amount")+(se.item.attributes.amount.percent?se.item.attributes.amount.percent+"%":t.$filters.price(se.item.attributes.amount.sum*se.item.quantity))},null,8,D)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{innerHTML:t.$filters.price(se.item.attributes.price*se.item.quantity),"shop-product-price":""},null,8,T)],2)]}))])]),se.item.options&&se.item.options.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["options",{"is-toggled":me.optionsToggled}])},[e.createElementVNode("div",{class:"toggler",onClick:i[6]||(i[6]=function(e){return me.optionsToggled=!me.optionsToggled})},[e.createElementVNode("span",null,e.toDisplayString(t.__("shop.cart.additional"))+" "+e.toDisplayString(se.item.options.length),1),H]),e.withDirectives(e.createElementVNode("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.item.options,(function(o,n){return e.openBlock(),e.createElementBlock("div",{key:n,class:e.normalizeClass(["columns",{"is-checked":-1!==me.options.indexOf(o.id)}])},[e.createElementVNode("div",$,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"checkbox","onUpdate:modelValue":i[7]||(i[7]=function(e){return me.options=e}),value:o.id,id:"option-"+se.item.id+"-"+o.id},null,8,P),[[e.vModelCheckbox,me.options]])]),e.createElementVNode("div",z,[e.createElementVNode("label",{class:"option-title is-clickable",for:"option-"+se.item.id+"-"+o.id},e.toDisplayString(o.name),9,F),o.description?(e.openBlock(),e.createElementBlock("div",O,e.toDisplayString(o.description),1)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",U,[e.createTextVNode("+"),e.createElementVNode("span",{innerHTML:t.$filters.price(o.price)},null,8,j)])],2)})),128))],512),[[e.vShow,me.optionsToggled]])],2)):e.createCommentVNode("v-if",!0)])],2),se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",I,[A,e.createElementVNode("div",G,[J,e.createElementVNode("a",{onClick:i[8]||(i[8]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.second.image}])},[se.item.attributes.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.second.image},null,8,K)):(e.openBlock(),e.createElementBlock("svg",Q,R))],2)])]),e.createElementVNode("div",W,[se.item.attributes.second.code?(e.openBlock(),e.createElementBlock("div",X,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.second.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Y,[e.createElementVNode("a",{onClick:i[9]||(i[9]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},e.toDisplayString(se.item.attributes.second.name),1)])])])):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.third?(e.openBlock(),e.createElementBlock("div",Z,[ee,e.createElementVNode("div",te,[ie,e.createElementVNode("a",{onClick:i[10]||(i[10]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.third.image}])},[se.item.attributes.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.third.image},null,8,oe)):(e.openBlock(),e.createElementBlock("svg",ne,ae))],2)])]),e.createElementVNode("div",re,[se.item.attributes.third.code?(e.openBlock(),e.createElementBlock("div",ce,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.third.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",le,[e.createElementVNode("a",{onClick:i[11]||(i[11]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},e.toDisplayString(se.item.attributes.third.name),1)])])])):e.createCommentVNode("v-if",!0)])],10,o))},module.exports=i;
|
|
2
2
|
//# sourceMappingURL=CartItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartItem.js","sources":["../../../../src/components/shop/cart/CartItem.vue","../../../../src/components/shop/cart/CartItem.vue?vue&type=template&id=532fea16&lang.js"],"sourcesContent":["<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\" :data-code=\"item.attributes.code\" shop-product>\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.attributes.productId ? item.attributes.productId : item.id\" :item=\"item\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"is-hidden\" shop-product-category>{{ item.attributes.categoryFull }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\" shop-product-name>\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\" shop-product-price></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, inject } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n const cartStorage = inject('cartStorage');\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n const index = props.item.attributes.index;\n const itemListName = props.item.attributes.itemListName;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/remove', {\n id: props.item.id,\n cart: cartStorage,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\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 (index) {\n object.ecommerce.items[0].index = index;\n }\n\n if (itemListName) {\n object.ecommerce.items[0].item_list_name = itemListName;\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = 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 };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/add', {\n cart: cartStorage,\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n if (difference > 0) {\n const q = props.item.quantity;\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: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\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 (property) {\n object.ecommerce.items[0].item_variant = 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 });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>","<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\" :data-code=\"item.attributes.code\" shop-product>\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.attributes.productId ? item.attributes.productId : item.id\" :item=\"item\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"is-hidden\" shop-product-category>{{ item.attributes.categoryFull }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\" shop-product-name>\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\" shop-product-price></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, inject } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n const cartStorage = inject('cartStorage');\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n const index = props.item.attributes.index;\n const itemListName = props.item.attributes.itemListName;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/remove', {\n id: props.item.id,\n cart: cartStorage,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\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 (index) {\n object.ecommerce.items[0].index = index;\n }\n\n if (itemListName) {\n object.ecommerce.items[0].item_list_name = itemListName;\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = 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 };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/add', {\n cart: cartStorage,\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n if (difference > 0) {\n const q = props.item.quantity;\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: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\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 (property) {\n object.ecommerce.items[0].item_variant = 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 });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>"],"names":["name","props","item","Object","setup","cartStorage","inject","store","useStore","loading","ref","input","options","attributes","length","optionsToggled","auth","computed","getters","value","price","code","category","categoryFull","brand","property","index","itemListName","quantity","difference","dispatch","cart","product","id","callback","object","ecommerce","currency","parseFloat","items","item_name","item_id","event","item_brand","item_list_name","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","watch","values","increase","decrease","remove","q","gotoProduct","href","addEventListener","commit","location","_createElementVNode","$props","deleted","_createElementBlock","active","bundle","_hoisted_2","_hoisted_3","_ctx","_hoisted_4","_hoisted_5","_hoisted_6","onClick","$setup","disabled","_createBlock","productId","_hoisted_10","image","src","_hoisted_15","_hoisted_16","_hoisted_17","_renderSlot","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","type","min","_hoisted_30","innerHTML","_hoisted_33","filters","priceOld","amount","percent","sum","_hoisted_37","_hoisted_38","option","key","_hoisted_39","_hoisted_41","description","_hoisted_43","_hoisted_44","_hoisted_46","_hoisted_47","_hoisted_48","_hoisted_49","second","_hoisted_54","_hoisted_55","_hoisted_56","third","_hoisted_57","_hoisted_58","_hoisted_59","_hoisted_60","_hoisted_65","_hoisted_66","_hoisted_67"],"mappings":"sDAiJe,CACXA,KAAM,WACNC,MAAO,CACHC,KAAMC,QAEVC,eAAMH,OACII,EAAcC,SAAO,eACrBC,EAAQC,aACRC,EAAUC,OAAI,GACdC,EAAQD,QACRE,EAAUF,MAAIT,EAAMC,KAAKW,WAAWD,SAAWX,EAAMC,KAAKW,WAAWD,QAAQE,OAASb,EAAMC,KAAKW,WAAWD,QAAU,IACtHG,EAAiBL,OAAI,GACrBM,EAAOC,YAAS,kBAAMV,EAAMW,QAAQ,cAEtCjB,EAAMC,KAAKW,WAAWD,SAAWX,EAAMC,KAAKW,WAAWD,QAAQE,SAC/DC,EAAeI,OAAQ,OAGrBnB,EAAOC,EAAMC,KAAKF,KAClBoB,EAAQnB,EAAMC,KAAKW,WAAW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MgB,IAAKlB,QAAK1D,WAAW8G,OAAOnC,iCAClCf,yCAMZH,2BAAAsD,GAC4BrD,QAAK1D,WAAW8G,OAAOtG,oBAA/CoD,2BAAAoD,oBAAwD/C,8CAA2BP,QAAK1D,WAAW8G,OAAOtG,0CAC1GiD,2BAAAwD,GACIxD,0BAAIY,uCAAOC,eAAYZ,QAAK1D,WAAW8G,OAAOzD,2BAAUK,QAAK1D,WAAW8G,OAAO3H,gDAIzDuE,QAAK1D,WAAW8D,QAAUJ,QAAK1D,WAAWkH,qBAA5EtD,2BAAAuD,GACIC,GAGA3D,2BAAA4D,IACIC,GAGA7D,0BAAIY,yCAAOC,eAAYZ,QAAK1D,WAAWkH,MAAM7D,UACzCI,uDAAc,+BAA+CC,QAAK1D,WAAWkH,MAAMvC,WACjCjB,QAAK1D,WAAWkH,MAAMvC,qBAApEf,kCAAMgB,IAAKlB,QAAK1D,WAAWkH,MAAMvC,kCACjCf,2CAMZH,2BAAA8D,IAC4B7D,QAAK1D,WAAWkH,MAAM1G,oBAA9CoD,2BAAA4D,qBAAuDvD,8CAA2BP,QAAK1D,WAAWkH,MAAM1G,0CACxGiD,2BAAAgE,IACIhE,0BAAIY,yCAAOC,eAAYZ,QAAK1D,WAAWkH,MAAM7D,2BAAUK,QAAK1D,WAAWkH,MAAM/H"}
|
|
1
|
+
{"version":3,"file":"CartItem.js","sources":["../../../../src/components/shop/cart/CartItem.vue","../../../../src/components/shop/cart/CartItem.vue?vue&type=template&id=30ed1a56&lang.js"],"sourcesContent":["<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\" :data-code=\"item.attributes.code\" shop-product>\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.attributes.productId ? item.attributes.productId : item.id\" :item=\"item\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"is-hidden\" shop-product-category>{{ item.attributes.categoryFull }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\" shop-product-name>\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\" shop-product-price></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, inject } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n let cartStorage = inject('cartStorage');\n cartStorage = cartStorage ? cartStorage : 'cart';\n\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n const index = props.item.attributes.index;\n const itemListName = props.item.attributes.itemListName;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/remove', {\n id: props.item.id,\n cart: cartStorage,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\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 (index) {\n object.ecommerce.items[0].index = index;\n }\n\n if (itemListName) {\n object.ecommerce.items[0].item_list_name = itemListName;\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = 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 };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/add', {\n cart: cartStorage,\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n if (difference > 0) {\n const q = props.item.quantity;\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: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\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 (property) {\n object.ecommerce.items[0].item_variant = 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 });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>","<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\" :data-code=\"item.attributes.code\" shop-product>\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.attributes.productId ? item.attributes.productId : item.id\" :item=\"item\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"is-hidden\" shop-product-category>{{ item.attributes.categoryFull }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\" shop-product-name>\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\" shop-product-price></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, inject } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n let cartStorage = inject('cartStorage');\n cartStorage = cartStorage ? cartStorage : 'cart';\n\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n const index = props.item.attributes.index;\n const itemListName = props.item.attributes.itemListName;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/remove', {\n id: props.item.id,\n cart: cartStorage,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\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 (index) {\n object.ecommerce.items[0].index = index;\n }\n\n if (itemListName) {\n object.ecommerce.items[0].item_list_name = itemListName;\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = 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 };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/add', {\n cart: cartStorage,\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n if (difference > 0) {\n const q = props.item.quantity;\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: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\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 (property) {\n object.ecommerce.items[0].item_variant = 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 });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>"],"names":["name","props","item","Object","setup","cartStorage","inject","store","useStore","loading","ref","input","options","attributes","length","optionsToggled","auth","computed","getters","value","price","code","category","categoryFull","brand","property","index","itemListName","quantity","difference","dispatch","cart","product","id","callback","object","ecommerce","currency","parseFloat","items","item_name","item_id","event","item_brand","item_list_name","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","watch","values","increase","decrease","remove","q","gotoProduct","href","addEventListener","commit","location","_createElementVNode","$props","deleted","_createElementBlock","active","bundle","_hoisted_2","_hoisted_3","_ctx","_hoisted_4","_hoisted_5","_hoisted_6","onClick","$setup","disabled","_createBlock","productId","_hoisted_10","image","src","_hoisted_15","_hoisted_16","_hoisted_17","_renderSlot","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","type","min","_hoisted_30","innerHTML","_hoisted_33","filters","priceOld","amount","percent","sum","_hoisted_37","_hoisted_38","option","key","_hoisted_39","_hoisted_41","description","_hoisted_43","_hoisted_44","_hoisted_46","_hoisted_47","_hoisted_48","_hoisted_49","second","_hoisted_54","_hoisted_55","_hoisted_56","third","_hoisted_57","_hoisted_58","_hoisted_59","_hoisted_60","_hoisted_65","_hoisted_66","_hoisted_67"],"mappings":"sDAiJe,CACXA,KAAM,WACNC,MAAO,CACHC,KAAMC,QAEVC,eAAMH,OACEI,EAAcC,SAAO,eACzBD,EAAcA,GAA4B,WAEpCE,EAAQC,aACRC,EAAUC,OAAI,GACdC,EAAQD,QACRE,EAAUF,MAAIT,EAAMC,KAAKW,WAAWD,SAAWX,EAAMC,KAAKW,WAAWD,QAAQE,OAASb,EAAMC,KAAKW,WAAWD,QAAU,IACtHG,EAAiBL,OAAI,GACrBM,EAAOC,YAAS,kBAAMV,EAAMW,QAAQ,cAEtCjB,EAAMC,KAAKW,WAAWD,SAAWX,EAAMC,KAAKW,WAAWD,QAAQE,SAC/DC,EAAeI,OAAQ,OAGrBnB,EAAOC,EAAMC,KAAKF,KAClBoB,EAAQnB,EAAMC,KAAKW,WAAWO,MAC9BC,EAAOpB,EAAMC,KAAKW,WAAWQ,KAC7BC,EAAWrB,EAAMC,KAAKW,WAAWU,aAAetB,EAAMC,KAAKW,WAAWU,aAAetB,EAAMC,KAAKW,WAAWS,SAC3GE,EAAQvB,EAAMC,KAAKW,WAAWW,MAC9BC,EAAWxB,EAAMC,KAAKW,WAAWY,SACjCC,EAAQzB,EAAMC,KAAKW,WAAWa,MAC9BC,EAAe1B,EAAMC,KAAKW,WAAWc,aA2ErCC,EAAW,SAACC,GACdpB,EAAQU,OAAQ,EAEhBZ,EAAMuB,SAASzB,EAAc,OAAQ,CACjC0B,KA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