@perevorot/shop 2.0.151 → 2.0.152

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/dist/components/account/OrderItem.js +1 -1
  2. package/dist/components/account/OrderItem.js.map +1 -1
  3. package/dist/components/account/User.js +1 -1
  4. package/dist/components/account/User.js.map +1 -1
  5. package/dist/components/auth/Forget.js +1 -1
  6. package/dist/components/auth/Forget.js.map +1 -1
  7. package/dist/components/auth/Login.js +1 -1
  8. package/dist/components/auth/Login.js.map +1 -1
  9. package/dist/components/auth/Registration.js +1 -1
  10. package/dist/components/auth/Registration.js.map +1 -1
  11. package/dist/components/auth/Reset.js +1 -1
  12. package/dist/components/auth/Reset.js.map +1 -1
  13. package/dist/components/shop/Catalog.js +1 -1
  14. package/dist/components/shop/Catalog.js.map +1 -1
  15. package/dist/components/shop/PromoProducts.js +1 -1
  16. package/dist/components/shop/PromoProducts.js.map +1 -1
  17. package/dist/components/shop/Search.js +1 -1
  18. package/dist/components/shop/Search.js.map +1 -1
  19. package/dist/components/shop/cart/Cart.js +1 -1
  20. package/dist/components/shop/cart/Cart.js.map +1 -1
  21. package/dist/components/shop/cart/CartItem.js +1 -1
  22. package/dist/components/shop/cart/CartItem.js.map +1 -1
  23. package/dist/components/shop/filters/Price.js +1 -1
  24. package/dist/components/shop/filters/Price.js.map +1 -1
  25. package/dist/components/shop/order/Checkout.js +1 -1
  26. package/dist/components/shop/order/Checkout.js.map +1 -1
  27. package/dist/components/shop/order/CheckoutItem.js +1 -1
  28. package/dist/components/shop/order/CheckoutItem.js.map +1 -1
  29. package/dist/components/shop/order/OneClick.js +1 -1
  30. package/dist/components/shop/order/OneClick.js.map +1 -1
  31. package/dist/components/shop/reviews/Question.js +1 -1
  32. package/dist/components/shop/reviews/Question.js.map +1 -1
  33. package/dist/components/shop/reviews/Review.js +1 -1
  34. package/dist/components/shop/reviews/Review.js.map +1 -1
  35. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Search.js","sources":["../../../src/components/shop/Search.vue","../../../src/components/shop/Search.vue?vue&type=template&id=40fa931c&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"opener(null, 'results_page', open)\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\" @click.prevent=\"opener(item.href, 'category')\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\" :opener=\"opener\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\" @click.prevent=\"opener(item.href + searchHrefWithParameter, 'category')\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\" ref=\"productsListElement\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\" :opener=\"opener\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\" @click.prevent=\"opener(item.href, 'product')\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed, nextTick } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const productsListElement = ref(null);\n\n let refs = [];\n let timeout;\n\n let isTrackingStartSend = false;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n\n if (!isTrackingStartSend && isDropdown.value) {\n isTrackingStartSend = true;\n\n let object = {\n event: 'search_start'\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 if (!results.value.length && !categories.value.length && isDropdown.value) {\n let object = {\n event: 'search_no_results',\n search_query: term.value,\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 nextTick(() => {\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(productsListElement.value, '.dropdown-item:not(.products-list-title)');\n }\n });\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n }, 300);\n }\n };\n\n const trackSuccessSearch = (type) => {\n let object = {\n event: !results.value.length && !categories.value.length ? 'search_no_results' : 'search_success',\n search_query: term.value,\n search_type: 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 (type == 'category') {\n trackCatalogEvent();\n }\n }\n\n const trackCatalogEvent = () => {\n let object = {\n event: 'catalog',\n location: 'search'\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 const opener = (href, type, callback) => {\n trackSuccessSearch(type);\n\n if (typeof callback === 'function') {\n callback();\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n const out = props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n\n return out.replace(/\\//g, '-');\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n if (props.htmlClass) {\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n\n if (props.htmlClass) {\n document.querySelector('html').classList.add(props.htmlClass);\n }\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder, { passive: true });\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n opener,\n productsListElement,\n };\n }\n});\n</script>","<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"opener(null, 'results_page', open)\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\" @click.prevent=\"opener(item.href, 'category')\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\" :opener=\"opener\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\" @click.prevent=\"opener(item.href + searchHrefWithParameter, 'category')\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\" ref=\"productsListElement\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\" :opener=\"opener\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\" @click.prevent=\"opener(item.href, 'product')\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed, nextTick } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const productsListElement = ref(null);\n\n let refs = [];\n let timeout;\n\n let isTrackingStartSend = false;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n\n if (!isTrackingStartSend && isDropdown.value) {\n isTrackingStartSend = true;\n\n let object = {\n event: 'search_start'\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 if (!results.value.length && !categories.value.length && isDropdown.value) {\n let object = {\n event: 'search_no_results',\n search_query: term.value,\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 nextTick(() => {\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(productsListElement.value, '.dropdown-item:not(.products-list-title)');\n }\n });\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n }, 300);\n }\n };\n\n const trackSuccessSearch = (type) => {\n let object = {\n event: !results.value.length && !categories.value.length ? 'search_no_results' : 'search_success',\n search_query: term.value,\n search_type: 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 (type == 'category') {\n trackCatalogEvent();\n }\n }\n\n const trackCatalogEvent = () => {\n let object = {\n event: 'catalog',\n location: 'search'\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 const opener = (href, type, callback) => {\n trackSuccessSearch(type);\n\n if (typeof callback === 'function') {\n callback();\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n const out = props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n\n return out.replace(/\\//g, '-');\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n if (props.htmlClass) {\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n\n if (props.htmlClass) {\n document.querySelector('html').classList.add(props.htmlClass);\n }\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder, { passive: true });\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n opener,\n productsListElement,\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","q","type","String","placeholder","placeholderMobile","parameter","isHistory","Boolean","isToggleDropdownOnClose","htmlClass","setup","ls","SecureLS","isCompression","encoder","document","createElement","innerHTML","value","timeout","isLoading","ref","term","results","byCategory","total","current","isDropdown","input","separator","dropdownContent","history","get","menu","store","useStore","user","computed","getters","productsListElement","refs","isTrackingStartSend","search","clearTimeout","trim","setTimeout","api","then","response","data","saveSearch","products","SimpleBar","object","event","$env","debug","ecommerce","console","log","window","dataLayer","push","length","categories","search_query","nextTick","promoCodeCallback","trackCatalogEvent","location","indexOf","filter","item","slice","unshift","set","onBeforeUpdate","watch","searchUrl","locale","url","searchHrefWithParameter","replace","toLowerCase","close","target","closest","querySelector","classList","remove","addEventListener","load","direct","menuElement","getElementById","querySelectorAll","forEach","element","textContent","dataset","href","i","resolve","f","apply","reject","e","placeholderMobilized","switchPlaceholder","isMobile","matchMedia","matches","passive","next","prev","add","preventDefault","cartRefs","el","preventCaret","which","esc","blur","dropdown","open","clearSearchHistory","focus","setSearchHistory","clear","opener","callback","search_type","trackSuccessSearch","_createElementVNode","style","_createElementBlock","onClick","$event","stopPropagation","_ctx","_hoisted_1","onKeyup","onKeydown","_renderSlot","_hoisted_3","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","index","key","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","_hoisted_18","count","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_24","_hoisted_25","id","_hoisted_26","_hoisted_27","_hoisted_28","price","price_old","_hoisted_31","_hoisted_33","code","quantity","_hoisted_34","_hoisted_35","is_eol","_hoisted_37","_hoisted_36","_createVNode","_hoisted_38","_hoisted_39"],"mappings":"kOA0HA,MAA6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,EAAG,CACCC,KAAMC,eACG,IAEbC,YAAa,CACTF,KAAMC,eACG,IAEbE,kBAAmB,CACfH,KAAMC,eACG,IAEbG,UAAW,CACPJ,KAAMC,eACG,iBAEbI,UAAW,CACPL,KAAMM,iBACG,GAEbC,wBAAyB,CACrBP,KAAMM,iBACG,GAEbE,UAAW,CACPR,KAAMC,eACG,KAGjBQ,eAAMX,OACIY,EAAK,IAAIC,UAAS,CACpBC,eAAe,IAGfb,EAAID,EAAMC,KAEVA,EAAG,KACCc,EAAUC,SAASC,cAAc,YACrCF,EAAQG,UAAYjB,EACpBA,EAAIc,EAAQI,UAoBZC,EAjBEC,EAAYC,OAAI,GAChBC,EAAOD,MAAIrB,GACXuB,EAAUF,MAAI,IACdG,EAAaH,MAAI,IACjBI,EAAQJ,MAAI,GACZK,EAAUL,OAAK,GACfM,EAAaN,OAAI,GACjBO,EAAQP,QACRQ,EAAYR,MAAI,IAChBS,EAAkBT,QAClBU,EAAUV,MAAIV,EAAGqB,IAAI,WACrBC,EAAOZ,MAAI,IACXa,EAAQC,aACRC,EAAOC,YAAS,kBAAMH,EAAMI,QAAQ,cACpCC,EAAsBlB,MAAI,MAE5BmB,EAAO,GAGPC,GAAsB,EAEpBC,EAAS,WACXC,aAAaxB,GAEbO,EAAQR,OAAS,EAEZI,EAAKJ,MAAM0B,QAIZxB,EAAUF,OAAQ,EAElBC,EAAU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sF,8DAK5BnB,uBAAtCJ,2BAAAwB,GACI1B,yBAAA2B,uCAEIrB,wDAIAsB,EACA5B,0BAAIjC,KAAMuC,+BAAcA,4EAGCA,UAAQ5E,sBAAzCwE,2BAAA2B,GACI7B,2BAAA8B,oBACOxB,kDAEPJ,kDAAmDI,oBAAhBnE,EAAM6E,wBAAzCd,oDAAW,6BAAmGI,WAAWU,KAAtDC,IAAK9E,EAAK4F,KACzErB,8BAAmB3G,KAAMuG,OAAOnE,KAAMA,EAAO6C,SAAWsB,WAAWV,OAAQU,WAA3E,kBACIN,2BAAAgC,GACIhC,2BAAAiC,GACIjC,2BAAAkC,GACIlC,0BAAIjC,KAAM5B,EAAK4B,KAAOoC,4CAAeG,SAAOnE,EAAK4B,kDAC1C5B,EAAK1E,aAGhBuI,kCAAW,QAAQpH,UAAQuD,EAAKgG,iBACHhG,EAAKiG,yBAAlClC,2BAAAmC,GACIrC,6BAAMpH,UAAQuD,EAAKiG,wDAEvBpC,2BAAAsC,oBAAqBnG,EAAKoG,SACEpG,EAAKqG,wBAAjCtC,2BAAAuC,oBACOnC,iDAEPJ,4BAAAwC,oBACOpC,qCAG0BnE,EAAKwG,sBAG1CzC,2BAAA0C,oBACOtC,4CAJPJ,2BAAA2C,GACIC,iBAAWf,GAAI5F,EAAK4F,yBAAyB,wBAA4B,aAAQ/I,IAAKsH,wGA9DxEA,UAAQ5E,QAAU4E,aAAW5E,UAwE9B4E,aAAcA,UAAQ5E,QAAW4E,aAAW5E,sDAAjFwE,2BAAA6C,GACI/C,2BAAAgD,GACIhD,kCAAW,aAAapH,UAAQ0H,+DA3ETA,UAAQ5E,QAAU4E"}
1
+ {"version":3,"file":"Search.js","sources":["../../../src/components/shop/Search.vue","../../../src/components/shop/Search.vue?vue&type=template&id=40fa931c&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"opener(null, 'results_page', open)\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\" @click.prevent=\"opener(item.href, 'category')\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\" :opener=\"opener\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\" @click.prevent=\"opener(item.href + searchHrefWithParameter, 'category')\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\" ref=\"productsListElement\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\" :opener=\"opener\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\" @click.prevent=\"opener(item.href, 'product')\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed, nextTick } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const productsListElement = ref(null);\n\n let refs = [];\n let timeout;\n\n let isTrackingStartSend = false;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n\n if (!isTrackingStartSend && isDropdown.value) {\n isTrackingStartSend = true;\n\n let object = {\n event: 'search_start'\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 if (!results.value.length && !categories.value.length && isDropdown.value) {\n let object = {\n event: 'search_no_results',\n search_query: term.value,\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 nextTick(() => {\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(productsListElement.value, '.dropdown-item:not(.products-list-title)');\n }\n });\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n }, 300);\n }\n };\n\n const trackSuccessSearch = (type) => {\n let object = {\n event: !results.value.length && !categories.value.length ? 'search_no_results' : 'search_success',\n search_query: term.value,\n search_type: 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 (type == 'category') {\n trackCatalogEvent();\n }\n }\n\n const trackCatalogEvent = () => {\n let object = {\n event: 'catalog',\n location: 'search'\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 const opener = (href, type, callback) => {\n trackSuccessSearch(type);\n\n if (typeof callback === 'function') {\n callback();\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n const out = props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n\n return out.replace(/\\//g, '-');\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n if (props.htmlClass) {\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n\n if (props.htmlClass) {\n document.querySelector('html').classList.add(props.htmlClass);\n }\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder, { passive: true });\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n opener,\n productsListElement,\n };\n }\n});\n</script>","<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"opener(null, 'results_page', open)\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\" @click.prevent=\"opener(item.href, 'category')\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\" :opener=\"opener\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\" @click.prevent=\"opener(item.href + searchHrefWithParameter, 'category')\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\" ref=\"productsListElement\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\" :opener=\"opener\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\" @click.prevent=\"opener(item.href, 'product')\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed, nextTick } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const productsListElement = ref(null);\n\n let refs = [];\n let timeout;\n\n let isTrackingStartSend = false;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n\n if (!isTrackingStartSend && isDropdown.value) {\n isTrackingStartSend = true;\n\n let object = {\n event: 'search_start'\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 if (!results.value.length && !categories.value.length && isDropdown.value) {\n let object = {\n event: 'search_no_results',\n search_query: term.value,\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 nextTick(() => {\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(productsListElement.value, '.dropdown-item:not(.products-list-title)');\n }\n });\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n }, 300);\n }\n };\n\n const trackSuccessSearch = (type) => {\n let object = {\n event: !results.value.length && !categories.value.length ? 'search_no_results' : 'search_success',\n search_query: term.value,\n search_type: 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 (type == 'category') {\n trackCatalogEvent();\n }\n }\n\n const trackCatalogEvent = () => {\n let object = {\n event: 'catalog',\n location: 'search'\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 const opener = (href, type, callback) => {\n trackSuccessSearch(type);\n\n if (typeof callback === 'function') {\n callback();\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n const out = props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n\n return out.replace(/\\//g, '-');\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n if (props.htmlClass) {\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n\n if (props.htmlClass) {\n document.querySelector('html').classList.add(props.htmlClass);\n }\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder, { passive: true });\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n opener,\n productsListElement,\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","q","type","String","placeholder","placeholderMobile","parameter","isHistory","Boolean","isToggleDropdownOnClose","htmlClass","setup","ls","SecureLS","isCompression","encoder","document","createElement","innerHTML","value","timeout","isLoading","ref","term","results","byCategory","total","current","isDropdown","input","separator","dropdownContent","history","get","menu","store","useStore","user","computed","getters","productsListElement","refs","isTrackingStartSend","search","clearTimeout","trim","setTimeout","api","then","response","data","saveSearch","products","SimpleBar","object","event","$env","debug","ecommerce","console","log","window","dataLayer","push","length","categories","search_query","nextTick","promoCodeCallback","trackCatalogEvent","location","indexOf","filter","item","slice","unshift","set","onBeforeUpdate","watch","searchUrl","locale","url","searchHrefWithParameter","replace","toLowerCase","close","target","closest","querySelector","classList","remove","addEventListener","load","direct","menuElement","getElementById","querySelectorAll","forEach","element","textContent","dataset","href","i","resolve","f","apply","reject","e","placeholderMobilized","switchPlaceholder","isMobile","matchMedia","matches","passive","next","prev","add","preventDefault","cartRefs","el","preventCaret","which","esc","blur","dropdown","open","clearSearchHistory","focus","setSearchHistory","clear","opener","callback","search_type","trackSuccessSearch","_createElementVNode","style","_createElementBlock","onClick","$event","stopPropagation","_ctx","_hoisted_1","onKeyup","onKeydown","_renderSlot","_hoisted_3","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","index","key","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","_hoisted_18","count","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_24","_hoisted_25","id","_hoisted_26","_hoisted_27","_hoisted_28","price","price_old","_hoisted_31","_hoisted_33","code","quantity","_hoisted_34","_hoisted_35","is_eol","_hoisted_37","_hoisted_36","_createVNode","_hoisted_38","_hoisted_39"],"mappings":"kOA0HA,MAA6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,EAAG,CACCC,KAAMC,eACG,IAEbC,YAAa,CACTF,KAAMC,eACG,IAEbE,kBAAmB,CACfH,KAAMC,eACG,IAEbG,UAAW,CACPJ,KAAMC,eACG,iBAEbI,UAAW,CACPL,KAAMM,iBACG,GAEbC,wBAAyB,CACrBP,KAAMM,iBACG,GAEbE,UAAW,CACPR,KAAMC,eACG,KAGjBQ,eAAMX,OACIY,EAAK,IAAIC,UAAS,CACpBC,eAAe,IAGfb,EAAID,EAAMC,KAEVA,EAAG,KACCc,EAAUC,SAASC,cAAc,YACrCF,EAAQG,UAAYjB,EACpBA,EAAIc,EAAQI,UAoBZC,EAjBEC,EAAYC,OAAI,GAChBC,EAAOD,MAAIrB,GACXuB,EAAUF,MAAI,IACdG,EAAaH,MAAI,IACjBI,EAAQJ,MAAI,GACZK,EAAUL,OAAK,GACfM,EAAaN,OAAI,GACjBO,EAAQP,QACRQ,EAAYR,MAAI,IAChBS,EAAkBT,QAClBU,EAAUV,MAAIV,EAAGqB,IAAI,WACrBC,EAAOZ,MAAI,IACXa,EAAQC,aACRC,EAAOC,YAAS,kBAAMH,EAAMI,QAAQ,cACpCC,EAAsBlB,MAAI,MAE5BmB,EAAO,GAGPC,GAAsB,EAEpBC,EAAS,WACXC,aAAaxB,GAEbO,EAAQR,OAAS,EAEZI,EAAKJ,MAAM0B,QAIZxB,EAAUF,OAAQ,EAElBC,EAAU0B,YAAW,WACbvB,EAAKJ,MAAM0B,QACXE,OAAIJ,OAAOpB,EAAKJ,OACX6B,MAAK,SAACC,MACCA,EAASC,KAAM,IACfC,IAEA3B,EAAQL,MAAQ8B,EAASC,KAAKE,SAC9B1B,EAAMP,M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xB,kDAEPJ,kDAAmDI,oBAAhBnE,EAAM6E,wBAAzCd,oDAAW,6BAAmGI,WAAWU,KAAtDC,IAAK9E,EAAK4F,KACzErB,8BAAmB3G,KAAMuG,OAAOnE,KAAMA,EAAO6C,SAAWsB,WAAWV,OAAQU,WAA3E,kBACIN,2BAAAgC,GACIhC,2BAAAiC,GACIjC,2BAAAkC,GACIlC,0BAAIjC,KAAM5B,EAAK4B,KAAOoC,4CAAeG,SAAOnE,EAAK4B,kDAC1C5B,EAAK1E,aAGhBuI,kCAAW,QAAQpH,UAAQuD,EAAKgG,iBACHhG,EAAKiG,yBAAlClC,2BAAAmC,GACIrC,6BAAMpH,UAAQuD,EAAKiG,wDAEvBpC,2BAAAsC,oBAAqBnG,EAAKoG,SACEpG,EAAKqG,wBAAjCtC,2BAAAuC,oBACOnC,iDAEPJ,4BAAAwC,oBACOpC,qCAG0BnE,EAAKwG,sBAG1CzC,2BAAA0C,oBACOtC,4CAJPJ,2BAAA2C,GACIC,iBAAWf,GAAI5F,EAAK4F,yBAAyB,wBAA4B,EAAQ/I,IAAKsH,wGA9DxEA,UAAQ5E,QAAU4E,aAAW5E,UAwE9B4E,aAAcA,UAAQ5E,QAAW4E,aAAW5E,sDAAjFwE,2BAAA6C,GACI/C,2BAAAgD,GACIhD,kCAAW,aAAapH,UAAQ0H,+DA3ETA,UAAQ5E,QAAU4E"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=require("vuex"),n=require("@perevorot/shop/dist/helpers"),l=require("swiper");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(l),c=e.defineComponent({name:"cart",props:{isModal:{type:Boolean,default:!0},cartStorage:{type:String,default:"cart"}},setup:function(o){var c=t.useStore(),a=e.ref(!1),s=o.cartStorage;e.provide("cartStorage",s);var i=e.computed((function(){return c.getters[s+"/items"]})),d=e.computed((function(){return c.getters[s+"/modal"]})),u=e.computed((function(){return c.getters[s+"/total"]})),m=e.computed((function(){return c.getters[s+"/quantity"]})),p=function(){c.commit(s+"/modal",null)};c.dispatch(s+"/get",{cart:s,finally:function(){}}),document.body.addEventListener("click",(function(e){d.value&&!e.target.closest(".cart")&&p()})),window.addEventListener("keyup",(function(e){d.value&&"Escape"===e.key&&p()}));var v,E,k=e.ref(null),N=e.ref(null),V=e.ref(null),f=e.computed((function(){var e=c.getters[s+"/cross"];return k.value&&(v&&v.destroy(),e.length&&(v=new r.default(k.value,{slidesPerView:1,slidesPerGroup:1,breakpoints:{768:{slidesPerView:2,slidesPerGroup:2}},spaceBetween:0,allowTouchMove:!0,modules:[l.Navigation],mousewheel:{forceToAxis:!0},navigation:{nextEl:N.value,prevEl:V.value}}))),e})),g=e.ref(null),h=e.ref(null),y=e.ref(null),w=e.computed((function(){var e=c.getters[s+"/bundles"];return g.value&&(E&&E.destroy(),e.length&&(E=new r.default(g.value,{slidesPerView:1,spaceBetween:0,allowTouchMove:!0,mousewheel:{forceToAxis:!0},navigation:{nextEl:h.value,prevEl:y.value}}))),e}));window.addEventListener("beforeunload",(function(){c.commit(s+"/modal",null)})),window.addEventListener("pagehide",(function(){c.commit(s+"/modal",null)}));var B=e.ref(!1);return{loading:a,items:i,modal:d,total:u,quantity:m,open:function(){c.commit(s+"/modal",d.value?null:"cart")},close:p,clear:function(){a.value=!0,c.dispatch(s+"/clear",{cart:s,finally:function(){a.value=!1}})},pluralize:n.pluralize,goto:function(e){window.addEventListener("beforeunload",(function(){c.commit(s+"/modal",null)})),window.addEventListener("pagehide",(function(){c.commit(s+"/modal",null)})),window.location.href=e},cross:f,crossSlider:k,crossSliderPrev:V,crossSliderNext:N,bundles:w,bundlesSlider:g,bundlesSliderPrev:y,bundlesSliderNext:h,checkout:function(){B.value=!0,window.location.href=$ziggy("shop.checkout")},isLoading:B}}}),a={class:"dropdown is-right is-hoverable"},s={class:"dropdown-trigger"},i=e.createElementVNode("i",{class:"fas fa-shopping-cart"},null,-1),d=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-angle-down","aria-hidden":"true"})],-1),u={class:"dropdown-menu",role:"menu"},m={key:0,class:"dropdown-content"},p={class:"dropdown-item"},v={class:"columns"},E={class:"column"},k=["innerHTML"],N=e.createElementVNode("div",{class:"dropdown-divider"},null,-1),V={class:"dropdown-item has-text-centered"},f={class:"dropdown-item has-text-centered"},g={key:1,class:"dropdown-content"},h={class:"dropdown-item"},y={class:"modal-content"},w=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],B={class:"box"},b={class:"cart-title"},C=["textContent"],S={key:0,class:"items-wrapper"},_={class:"items"},x={class:"columns is-gapless is-vcentered main-actions"},L={class:"column"},T={class:"column has-text-right"},M={class:"totals"},D={class:"title"},H=["innerHTML"],$={class:"column is-narrow"},q={key:0,class:"cross"},z={class:"title"},P={class:"swiper",ref:"crossSlider"},F={class:"swiper-wrapper"},O={class:"columns is-gapless"},A={class:"column is-narrow"},G=["onClick"],j=["src"],R={key:1},I=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],J={class:"column"},K=["data-code"],Q={class:"name"},U=["onClick"],W={class:"columns is-gapless is-vcentered"},X={class:"column is-narrow"},Y={class:"prices"},Z=["innerHTML"],ee=["innerHTML"],te={class:"column"},ne=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-alternate"})],-1),le={class:"swiper-nav prev",ref:"crossSliderPrev"},oe=[e.createElementVNode("use",{"xlink:href":"#arrow-submenu"},null,-1)],re={class:"swiper-nav next",ref:"crossSliderNext"},ce=[e.createElementVNode("use",{"xlink:href":"#arrow-submenu"},null,-1)],ae={key:1,class:"bundles"},se={class:"title"},ie={class:"swiper",ref:"bundlesSlider"},de={class:"swiper-wrapper"},ue={class:"column is-narrow"},me=["onClick"],pe=["src"],ve={key:1},Ee=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],ke={class:"column"},Ne={class:"product"},Ve={class:"name"},fe=["onClick"],ge={class:"columns is-gapless is-vcentered"},he={class:"prices"},ye=["innerHTML"],we=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("svg",{class:"bundle-icon plus"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})])],-1),Be={class:"column is-narrow"},be=["onClick"],Ce=["src"],Se={key:1},_e=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],xe={class:"column"},Le={class:"product"},Te={class:"name"},Me=["onClick"],De={class:"columns is-gapless is-vcentered"},He={class:"prices"},$e=["innerHTML"],qe={key:0,class:"column is-narrow"},ze=[e.createElementVNode("svg",{class:"bundle-icon plus"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1)],Pe={key:1,class:"column is-narrow"},Fe=["onClick"],Oe=["src"],Ae={key:1},Ge=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],je={key:2,class:"column"},Re={class:"product"},Ie={class:"name"},Je=["onClick"],Ke={class:"columns is-gapless is-vcentered"},Qe={class:"prices"},Ue=["innerHTML"],We={class:"columns is-vcentered"},Xe={class:"column"},Ye=["innerHTML"],Ze=["innerHTML"],et={class:"column"},tt={class:"is-flex is-align-items-center"},nt=["innerHTML"],lt={class:"swiper-nav prev",ref:"bundlesSliderPrev"},ot=[e.createElementVNode("use",{"xlink:href":"#arrow-submenu"},null,-1)],rt={class:"swiper-nav next",ref:"bundlesSliderNext"},ct=[e.createElementVNode("use",{"xlink:href":"#arrow-submenu"},null,-1)],at={key:1,class:"empty"},st={class:"title"},it={class:"message"},dt=["href"],ut=e.createElementVNode("br",null,null,-1),mt={class:"viewed-wrapper"};c.render=function(t,n,l,o,r,c){var pt=e.resolveComponent("cart-item"),vt=e.resolveComponent("cart-add"),Et=e.resolveComponent("bundle-add"),kt=e.resolveComponent("viewed");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["cart",{"is-open":t.modal}])},[e.createElementVNode("div",a,[e.createElementVNode("div",s,[e.renderSlot(t.$slots,"default",{total:t.quantity,open:t.open},(function(){return[e.createElementVNode("button",{class:"button",onClick:n[0]||(n[0]=function(){return t.open&&t.open.apply(t,arguments)})},[e.createElementVNode("span",null,[i,e.createTextVNode(" "+e.toDisplayString(t.quantity),1)]),d])]}))]),e.createElementVNode("div",u,[t.items.length?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",p,[e.createElementVNode("div",v,[e.createElementVNode("div",E,e.toDisplayString(t.__("shop.cart.total")),1),e.createElementVNode("div",{class:"column has-text-right",innerHTML:t.$filters.price(t.total)},null,8,k)])]),N,e.createElementVNode("div",V,[e.createElementVNode("a",{onClick:n[1]||(n[1]=function(){return t.checkout&&t.checkout.apply(t,arguments)}),class:e.normalizeClass(["button is-link",{"is-disabled":t.isLoading}])},e.toDisplayString(t.__("shop.cart.checkout")),3)]),e.createElementVNode("div",f,[e.renderSlot(t.$slots,"open",{open:t.open},(function(){return[e.createElementVNode("a",{onClick:n[2]||(n[2]=function(){return t.open&&t.open.apply(t,arguments)})},e.toDisplayString(t.__("shop.cart.open")),1)]}))])])):(e.openBlock(),e.createElementBlock("div",g,[e.renderSlot(t.$slots,"empty",{},(function(){return[e.createElementVNode("div",h,e.toDisplayString(t.__("shop.cart.empty")),1)]}))]))])]),t.isModal?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["modal",{"is-active":t.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:n[3]||(n[3]=function(){return t.close&&t.close.apply(t,arguments)})}),e.createElementVNode("div",y,[e.createElementVNode("button",{class:"modal-close is-large",onClick:n[4]||(n[4]=function(){return t.close&&t.close.apply(t,arguments)})},w),e.createElementVNode("div",B,[e.renderSlot(t.$slots,"cart-title",{quantity:t.quantity},(function(){return[e.createElementVNode("div",b,[e.createTextVNode(e.toDisplayString(t.__("shop.cart.title"))+" ",1),t.quantity?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.pluralize(t.quantity,t.__("shop.pluralize.products")))},null,8,C)):e.createCommentVNode("v-if",!0)])]})),e.renderSlot(t.$slots,"clear",{clear:t.clear,quantity:t.quantity}),t.items.length?(e.openBlock(),e.createElementBlock("div",S,[e.createElementVNode("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(function(n){return e.openBlock(),e.createBlock(pt,{key:n.id,item:n},e.createSlots({_:2},[e.renderList(t.$slots,(function(n,l){return{name:l,fn:e.withCtx((function(n){return[e.renderSlot(t.$slots,l,e.normalizeProps(e.guardReactiveProps(n||{})))]}))}}))]),1032,["item"])})),128))]),e.createElementVNode("div",x,[e.createElementVNode("div",L,[e.createElementVNode("button",{class:"button continue",onClick:n[5]||(n[5]=function(){return t.close&&t.close.apply(t,arguments)})},e.toDisplayString(t.__("shop.cart.continue")),1)]),e.createElementVNode("div",T,[e.createElementVNode("div",M,[e.createElementVNode("div",D,[e.createTextVNode(e.toDisplayString(t.__("shop.cart.total"))+" ",1),e.createElementVNode("span",{innerHTML:t.$filters.price(t.total)},null,8,H)])]),e.renderSlot(t.$slots,"loyalty",{pluralize:t.pluralize,items:t.items})]),e.createElementVNode("div",$,[e.createElementVNode("a",{onClick:n[6]||(n[6]=function(){return t.checkout&&t.checkout.apply(t,arguments)}),class:"button is-link checkout"},e.toDisplayString(t.__("shop.cart.go_checkout")),1)])]),t.cross.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",z,e.toDisplayString(t.__("shop.cart.cross")),1),e.createElementVNode("div",P,[e.createElementVNode("div",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.cross,(function(n){return e.openBlock(),e.createElementBlock("div",{class:"swiper-slide",key:n.id},[e.createElementVNode("div",O,[e.createElementVNode("div",A,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.href)}},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!n.image}])},[n.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.image},null,8,j)):(e.openBlock(),e.createElementBlock("svg",R,I))],2)],8,G)]),e.createElementVNode("div",J,[e.createElementVNode("div",{class:"product","data-code":n.code,"shop-product":""},[e.createElementVNode("div",Q,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.href)},"shop-product-name":""},e.toDisplayString(n.name),9,U)]),e.createElementVNode("div",W,[e.createElementVNode("div",X,[e.createElementVNode("div",Y,[n.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(n.priceOld)},null,8,Z)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{class:"price",innerHTML:t.$filters.price(n.price),"shop-product-price":""},null,8,ee)])]),e.createElementVNode("div",te,[e.createVNode(vt,{id:n.id,"is-simple":!0},{default:e.withCtx((function(){return[ne]})),_:2},1032,["id"])])])],8,K)])])])})),128))]),(e.openBlock(),e.createElementBlock("svg",le,oe,512)),(e.openBlock(),e.createElementBlock("svg",re,ce,512))],512)])):e.createCommentVNode("v-if",!0),t.bundles.length?(e.openBlock(),e.createElementBlock("div",ae,[e.createElementVNode("div",se,e.toDisplayString(t.__("shop.cart.bundle")),1),e.createElementVNode("div",ie,[e.createElementVNode("div",de,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.bundles,(function(n){return e.openBlock(),e.createElementBlock("div",{class:"swiper-slide",key:n.id},[e.createElementVNode("div",{class:e.normalizeClass(["columns is-gapless is-vcentered",{"is-third":n.third}])},[e.createElementVNode("div",ue,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.href)}},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!n.image}])},[n.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.image},null,8,pe)):(e.openBlock(),e.createElementBlock("svg",ve,Ee))],2)],8,me)]),e.createElementVNode("div",ke,[e.createElementVNode("div",Ne,[e.createElementVNode("div",Ve,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.href)}},e.toDisplayString(n.name),9,fe)]),e.createElementVNode("div",ge,[e.createElementVNode("div",he,[e.createElementVNode("div",{class:"price",innerHTML:t.$filters.price(n.price)},null,8,ye)])])])]),we,e.createElementVNode("div",Be,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.second.href)}},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!n.second.image}])},[n.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.second.image},null,8,Ce)):(e.openBlock(),e.createElementBlock("svg",Se,_e))],2)],8,be)]),e.createElementVNode("div",xe,[e.createElementVNode("div",Le,[e.createElementVNode("div",Te,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.second.href)}},e.toDisplayString(n.second.name),9,Me)]),e.createElementVNode("div",De,[e.createElementVNode("div",He,[e.createElementVNode("div",{class:"price",innerHTML:t.$filters.price(n.second.price)},null,8,$e)])])])]),n.third?(e.openBlock(),e.createElementBlock("div",qe,ze)):e.createCommentVNode("v-if",!0),n.third?(e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.third.href)}},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!n.third.image}])},[n.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.third.image},null,8,Oe)):(e.openBlock(),e.createElementBlock("svg",Ae,Ge))],2)],8,Fe)])):e.createCommentVNode("v-if",!0),n.third?(e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",Re,[e.createElementVNode("div",Ie,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.third.href)}},e.toDisplayString(n.third.name),9,Je)]),e.createElementVNode("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("div",{class:"price",innerHTML:t.$filters.price(n.third.price)},null,8,Ue)])])])])):e.createCommentVNode("v-if",!0)],2),e.createElementVNode("div",We,[e.createElementVNode("div",Xe,[e.createElementVNode("span",{class:"total-old",innerHTML:t.$filters.price(n.bundle.priceOld)},null,8,Ye),e.createElementVNode("span",{class:"bundle-amount",innerHTML:t.__("shop.cart.bundle_amount")+n.bundle.amount},null,8,Ze)]),e.createElementVNode("div",et,[e.createElementVNode("div",tt,[e.createElementVNode("span",{class:"total",innerHTML:t.$filters.price(n.bundle.price)},null,8,nt),e.createVNode(Et,{id:n.id,second:n.second.id,third:n.third?n.third.id:null},null,8,["id","second","third"])])])])])})),128))])],512),(e.openBlock(),e.createElementBlock("svg",lt,ot,512)),(e.openBlock(),e.createElementBlock("svg",rt,ct,512))])):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("div",st,e.toDisplayString(t.__("shop.cart.no_no")),1),e.createElementVNode("div",it,[e.createTextVNode(e.toDisplayString(t.__("shop.cart.no_prop"))+" ",1),e.createElementVNode("a",{href:t.$env.locale.url?t.$env.locale.url:"/"},e.toDisplayString(t.__("shop.cart.no_home")),9,dt),e.createTextVNode(", "),ut,e.createTextVNode(e.toDisplayString(t.__("shop.cart.no_search")),1)]),e.createElementVNode("button",{class:"button continue",onClick:n[7]||(n[7]=function(){return t.close&&t.close.apply(t,arguments)})},e.toDisplayString(t.__("shop.cart.continue")),1),e.createElementVNode("div",mt,[e.createVNode(kt,{slider:!0})])]))])])],2)):e.createCommentVNode("v-if",!0)],2)},module.exports=c;
1
+ "use strict";var e=require("vue"),t=require("vuex"),n=require("@perevorot/shop/dist/helpers"),l=require("swiper");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(l),c=e.defineComponent({name:"cart",props:{isModal:{type:Boolean,default:!0},cartStorage:{type:String,default:"cart"}},setup:function(o){var c=t.useStore(),a=e.ref(!1),s=o.cartStorage;e.provide("cartStorage",s);var i=e.computed((function(){return c.getters[s+"/items"]})),d=e.computed((function(){return c.getters[s+"/modal"]})),u=e.computed((function(){return c.getters[s+"/total"]})),m=e.computed((function(){return c.getters[s+"/quantity"]})),p=function(){c.commit(s+"/modal",null)};c.dispatch(s+"/get",{cart:s,finally:function(){}}),document.body.addEventListener("click",(function(e){d.value&&!e.target.closest(".cart")&&p()})),window.addEventListener("keyup",(function(e){d.value&&"Escape"===e.key&&p()}));var v,E,k=e.ref(null),N=e.ref(null),V=e.ref(null),f=e.computed((function(){var e=c.getters[s+"/cross"];return k.value&&(v&&v.destroy(),e.length&&(v=new r.default(k.value,{slidesPerView:1,slidesPerGroup:1,breakpoints:{768:{slidesPerView:2,slidesPerGroup:2}},spaceBetween:0,allowTouchMove:!0,modules:[l.Navigation],mousewheel:{forceToAxis:!0},navigation:{nextEl:N.value,prevEl:V.value}}))),e})),g=e.ref(null),h=e.ref(null),y=e.ref(null),w=e.computed((function(){var e=c.getters[s+"/bundles"];return g.value&&(E&&E.destroy(),e.length&&(E=new r.default(g.value,{slidesPerView:1,spaceBetween:0,allowTouchMove:!0,mousewheel:{forceToAxis:!0},navigation:{nextEl:h.value,prevEl:y.value}}))),e}));window.addEventListener("beforeunload",(function(){c.commit(s+"/modal",null)})),window.addEventListener("pagehide",(function(){c.commit(s+"/modal",null)}));var B=e.ref(!1);return{loading:a,items:i,modal:d,total:u,quantity:m,open:function(){c.commit(s+"/modal",d.value?null:"cart")},close:p,clear:function(){a.value=!0,c.dispatch(s+"/clear",{cart:s,finally:function(){a.value=!1}})},pluralize:n.pluralize,goto:function(e){window.addEventListener("beforeunload",(function(){c.commit(s+"/modal",null)})),window.addEventListener("pagehide",(function(){c.commit(s+"/modal",null)})),window.location.href=e},cross:f,crossSlider:k,crossSliderPrev:V,crossSliderNext:N,bundles:w,bundlesSlider:g,bundlesSliderPrev:y,bundlesSliderNext:h,checkout:function(){B.value=!0,window.location.href=$ziggy("shop.checkout")},isLoading:B}}}),a={class:"dropdown is-right is-hoverable"},s={class:"dropdown-trigger"},i=e.createElementVNode("i",{class:"fas fa-shopping-cart"},null,-1),d=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-angle-down","aria-hidden":"true"})],-1),u={class:"dropdown-menu",role:"menu"},m={key:0,class:"dropdown-content"},p={class:"dropdown-item"},v={class:"columns"},E={class:"column"},k=["innerHTML"],N=e.createElementVNode("div",{class:"dropdown-divider"},null,-1),V={class:"dropdown-item has-text-centered"},f={class:"dropdown-item has-text-centered"},g={key:1,class:"dropdown-content"},h={class:"dropdown-item"},y={class:"modal-content"},w=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],B={class:"box"},b={class:"cart-title"},C=["textContent"],S={key:0,class:"items-wrapper"},_={class:"items"},x={class:"columns is-gapless is-vcentered main-actions"},L={class:"column"},T={class:"column has-text-right"},M={class:"totals"},D={class:"title"},H=["innerHTML"],$={class:"column is-narrow"},q={key:0,class:"cross"},z={class:"title"},P={class:"swiper",ref:"crossSlider"},F={class:"swiper-wrapper"},O={class:"columns is-gapless"},A={class:"column is-narrow"},G=["onClick"],j=["src"],R={key:1},I=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],J={class:"column"},K=["data-code"],Q={class:"name"},U=["onClick"],W={class:"columns is-gapless is-vcentered"},X={class:"column is-narrow"},Y={class:"prices"},Z=["innerHTML"],ee=["innerHTML"],te={class:"column"},ne=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-alternate"})],-1),le={class:"swiper-nav prev",ref:"crossSliderPrev"},oe=[e.createElementVNode("use",{"xlink:href":"#arrow-submenu"},null,-1)],re={class:"swiper-nav next",ref:"crossSliderNext"},ce=[e.createElementVNode("use",{"xlink:href":"#arrow-submenu"},null,-1)],ae={key:1,class:"bundles"},se={class:"title"},ie={class:"swiper",ref:"bundlesSlider"},de={class:"swiper-wrapper"},ue={class:"column is-narrow"},me=["onClick"],pe=["src"],ve={key:1},Ee=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],ke={class:"column"},Ne={class:"product"},Ve={class:"name"},fe=["onClick"],ge={class:"columns is-gapless is-vcentered"},he={class:"prices"},ye=["innerHTML"],we=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("svg",{class:"bundle-icon plus"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})])],-1),Be={class:"column is-narrow"},be=["onClick"],Ce=["src"],Se={key:1},_e=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],xe={class:"column"},Le={class:"product"},Te={class:"name"},Me=["onClick"],De={class:"columns is-gapless is-vcentered"},He={class:"prices"},$e=["innerHTML"],qe={key:0,class:"column is-narrow"},ze=[e.createElementVNode("svg",{class:"bundle-icon plus"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1)],Pe={key:1,class:"column is-narrow"},Fe=["onClick"],Oe=["src"],Ae={key:1},Ge=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],je={key:2,class:"column"},Re={class:"product"},Ie={class:"name"},Je=["onClick"],Ke={class:"columns is-gapless is-vcentered"},Qe={class:"prices"},Ue=["innerHTML"],We={class:"columns is-vcentered"},Xe={class:"column"},Ye=["innerHTML"],Ze=["innerHTML"],et={class:"column"},tt={class:"is-flex is-align-items-center"},nt=["innerHTML"],lt={class:"swiper-nav prev",ref:"bundlesSliderPrev"},ot=[e.createElementVNode("use",{"xlink:href":"#arrow-submenu"},null,-1)],rt={class:"swiper-nav next",ref:"bundlesSliderNext"},ct=[e.createElementVNode("use",{"xlink:href":"#arrow-submenu"},null,-1)],at={key:1,class:"empty"},st={class:"title"},it={class:"message"},dt=["href"],ut=e.createTextVNode(", "),mt=e.createElementVNode("br",null,null,-1),pt={class:"viewed-wrapper"};c.render=function(t,n,l,o,r,c){var vt=e.resolveComponent("cart-item"),Et=e.resolveComponent("cart-add"),kt=e.resolveComponent("bundle-add"),Nt=e.resolveComponent("viewed");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["cart",{"is-open":t.modal}])},[e.createElementVNode("div",a,[e.createElementVNode("div",s,[e.renderSlot(t.$slots,"default",{total:t.quantity,open:t.open},(function(){return[e.createElementVNode("button",{class:"button",onClick:n[0]||(n[0]=function(){return t.open&&t.open.apply(t,arguments)})},[e.createElementVNode("span",null,[i,e.createTextVNode(" "+e.toDisplayString(t.quantity),1)]),d])]}))]),e.createElementVNode("div",u,[t.items.length?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",p,[e.createElementVNode("div",v,[e.createElementVNode("div",E,e.toDisplayString(t.__("shop.cart.total")),1),e.createElementVNode("div",{class:"column has-text-right",innerHTML:t.$filters.price(t.total)},null,8,k)])]),N,e.createElementVNode("div",V,[e.createElementVNode("a",{onClick:n[1]||(n[1]=function(){return t.checkout&&t.checkout.apply(t,arguments)}),class:e.normalizeClass(["button is-link",{"is-disabled":t.isLoading}])},e.toDisplayString(t.__("shop.cart.checkout")),3)]),e.createElementVNode("div",f,[e.renderSlot(t.$slots,"open",{open:t.open},(function(){return[e.createElementVNode("a",{onClick:n[2]||(n[2]=function(){return t.open&&t.open.apply(t,arguments)})},e.toDisplayString(t.__("shop.cart.open")),1)]}))])])):(e.openBlock(),e.createElementBlock("div",g,[e.renderSlot(t.$slots,"empty",{},(function(){return[e.createElementVNode("div",h,e.toDisplayString(t.__("shop.cart.empty")),1)]}))]))])]),t.isModal?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["modal",{"is-active":t.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:n[3]||(n[3]=function(){return t.close&&t.close.apply(t,arguments)})}),e.createElementVNode("div",y,[e.createElementVNode("button",{class:"modal-close is-large",onClick:n[4]||(n[4]=function(){return t.close&&t.close.apply(t,arguments)})},w),e.createElementVNode("div",B,[e.renderSlot(t.$slots,"cart-title",{quantity:t.quantity},(function(){return[e.createElementVNode("div",b,[e.createTextVNode(e.toDisplayString(t.__("shop.cart.title"))+" ",1),t.quantity?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.pluralize(t.quantity,t.__("shop.pluralize.products")))},null,8,C)):e.createCommentVNode("v-if",!0)])]})),e.renderSlot(t.$slots,"clear",{clear:t.clear,quantity:t.quantity}),t.items.length?(e.openBlock(),e.createElementBlock("div",S,[e.createElementVNode("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(function(n){return e.openBlock(),e.createBlock(vt,{key:n.id,item:n},e.createSlots({_:2},[e.renderList(t.$slots,(function(n,l){return{name:l,fn:e.withCtx((function(n){return[e.renderSlot(t.$slots,l,e.normalizeProps(e.guardReactiveProps(n||{})))]}))}}))]),1032,["item"])})),128))]),e.createElementVNode("div",x,[e.createElementVNode("div",L,[e.createElementVNode("button",{class:"button continue",onClick:n[5]||(n[5]=function(){return t.close&&t.close.apply(t,arguments)})},e.toDisplayString(t.__("shop.cart.continue")),1)]),e.createElementVNode("div",T,[e.createElementVNode("div",M,[e.createElementVNode("div",D,[e.createTextVNode(e.toDisplayString(t.__("shop.cart.total"))+" ",1),e.createElementVNode("span",{innerHTML:t.$filters.price(t.total)},null,8,H)])]),e.renderSlot(t.$slots,"loyalty",{pluralize:t.pluralize,items:t.items})]),e.createElementVNode("div",$,[e.createElementVNode("a",{onClick:n[6]||(n[6]=function(){return t.checkout&&t.checkout.apply(t,arguments)}),class:"button is-link checkout"},e.toDisplayString(t.__("shop.cart.go_checkout")),1)])]),t.cross.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",z,e.toDisplayString(t.__("shop.cart.cross")),1),e.createElementVNode("div",P,[e.createElementVNode("div",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.cross,(function(n){return e.openBlock(),e.createElementBlock("div",{class:"swiper-slide",key:n.id},[e.createElementVNode("div",O,[e.createElementVNode("div",A,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.href)}},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!n.image}])},[n.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.image},null,8,j)):(e.openBlock(),e.createElementBlock("svg",R,I))],2)],8,G)]),e.createElementVNode("div",J,[e.createElementVNode("div",{class:"product","data-code":n.code,"shop-product":""},[e.createElementVNode("div",Q,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.href)},"shop-product-name":""},e.toDisplayString(n.name),9,U)]),e.createElementVNode("div",W,[e.createElementVNode("div",X,[e.createElementVNode("div",Y,[n.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(n.priceOld)},null,8,Z)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{class:"price",innerHTML:t.$filters.price(n.price),"shop-product-price":""},null,8,ee)])]),e.createElementVNode("div",te,[e.createVNode(Et,{id:n.id,"is-simple":!0},{default:e.withCtx((function(){return[ne]})),_:2},1032,["id"])])])],8,K)])])])})),128))]),(e.openBlock(),e.createElementBlock("svg",le,oe,512)),(e.openBlock(),e.createElementBlock("svg",re,ce,512))],512)])):e.createCommentVNode("v-if",!0),t.bundles.length?(e.openBlock(),e.createElementBlock("div",ae,[e.createElementVNode("div",se,e.toDisplayString(t.__("shop.cart.bundle")),1),e.createElementVNode("div",ie,[e.createElementVNode("div",de,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.bundles,(function(n){return e.openBlock(),e.createElementBlock("div",{class:"swiper-slide",key:n.id},[e.createElementVNode("div",{class:e.normalizeClass(["columns is-gapless is-vcentered",{"is-third":n.third}])},[e.createElementVNode("div",ue,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.href)}},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!n.image}])},[n.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.image},null,8,pe)):(e.openBlock(),e.createElementBlock("svg",ve,Ee))],2)],8,me)]),e.createElementVNode("div",ke,[e.createElementVNode("div",Ne,[e.createElementVNode("div",Ve,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.href)}},e.toDisplayString(n.name),9,fe)]),e.createElementVNode("div",ge,[e.createElementVNode("div",he,[e.createElementVNode("div",{class:"price",innerHTML:t.$filters.price(n.price)},null,8,ye)])])])]),we,e.createElementVNode("div",Be,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.second.href)}},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!n.second.image}])},[n.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.second.image},null,8,Ce)):(e.openBlock(),e.createElementBlock("svg",Se,_e))],2)],8,be)]),e.createElementVNode("div",xe,[e.createElementVNode("div",Le,[e.createElementVNode("div",Te,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.second.href)}},e.toDisplayString(n.second.name),9,Me)]),e.createElementVNode("div",De,[e.createElementVNode("div",He,[e.createElementVNode("div",{class:"price",innerHTML:t.$filters.price(n.second.price)},null,8,$e)])])])]),n.third?(e.openBlock(),e.createElementBlock("div",qe,ze)):e.createCommentVNode("v-if",!0),n.third?(e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.third.href)}},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!n.third.image}])},[n.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.third.image},null,8,Oe)):(e.openBlock(),e.createElementBlock("svg",Ae,Ge))],2)],8,Fe)])):e.createCommentVNode("v-if",!0),n.third?(e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",Re,[e.createElementVNode("div",Ie,[e.createElementVNode("a",{onClick:function(e){return t.goto(n.third.href)}},e.toDisplayString(n.third.name),9,Je)]),e.createElementVNode("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("div",{class:"price",innerHTML:t.$filters.price(n.third.price)},null,8,Ue)])])])])):e.createCommentVNode("v-if",!0)],2),e.createElementVNode("div",We,[e.createElementVNode("div",Xe,[e.createElementVNode("span",{class:"total-old",innerHTML:t.$filters.price(n.bundle.priceOld)},null,8,Ye),e.createElementVNode("span",{class:"bundle-amount",innerHTML:t.__("shop.cart.bundle_amount")+n.bundle.amount},null,8,Ze)]),e.createElementVNode("div",et,[e.createElementVNode("div",tt,[e.createElementVNode("span",{class:"total",innerHTML:t.$filters.price(n.bundle.price)},null,8,nt),e.createVNode(kt,{id:n.id,second:n.second.id,third:n.third?n.third.id:null},null,8,["id","second","third"])])])])])})),128))])],512),(e.openBlock(),e.createElementBlock("svg",lt,ot,512)),(e.openBlock(),e.createElementBlock("svg",rt,ct,512))])):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("div",st,e.toDisplayString(t.__("shop.cart.no_no")),1),e.createElementVNode("div",it,[e.createTextVNode(e.toDisplayString(t.__("shop.cart.no_prop"))+" ",1),e.createElementVNode("a",{href:t.$env.locale.url?t.$env.locale.url:"/"},e.toDisplayString(t.__("shop.cart.no_home")),9,dt),ut,mt,e.createTextVNode(e.toDisplayString(t.__("shop.cart.no_search")),1)]),e.createElementVNode("button",{class:"button continue",onClick:n[7]||(n[7]=function(){return t.close&&t.close.apply(t,arguments)})},e.toDisplayString(t.__("shop.cart.continue")),1),e.createElementVNode("div",pt,[e.createVNode(Nt,{slider:!0})])]))])])],2)):e.createCommentVNode("v-if",!0)],2)},module.exports=c;
2
2
  //# sourceMappingURL=Cart.js.map