@perevorot/shop 2.0.122 → 2.0.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/auth/User.js +1 -1
- package/dist/components/auth/User.js.map +1 -1
- package/dist/components/shop/Search.js +1 -1
- package/dist/components/shop/Search.js.map +1 -1
- package/dist/components/shop/viewed/Viewer.js +1 -1
- package/dist/components/shop/viewed/Viewer.js.map +1 -1
- package/dist/store.js +1 -1
- package/dist/store.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("
|
|
1
|
+
"use strict";var e=require("js-cookie"),o=require("vue"),t=require("vuex");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(e),r={name:"user",props:{resetToken:{type:String,default:""},resetEmail:{type:String,default:""},tokenValid:{type:Boolean,default:!1},forgetType:{type:String,default:"email"},showPlaceholders:{type:Boolean,default:!1}},setup:function(e){var l=t.useStore(),r=o.computed((function(){return l.getters["auth/me"]})),a=o.computed((function(){return l.getters["auth/modal"]})),c=o.computed((function(){return Object.keys(r.value).length>0})),s=o.ref(!1),i=o.computed((function(){return l.getters["auth/account"]})),d=o.ref(""),u=o.ref("");o.provide("presetedResetToken",d),o.provide("presetedResetEmail",u);var m=function(){l.commit("auth/modal",null),l.dispatch("auth/me")};return l.dispatch("auth/me",{finally:function(){if(s.value=!0,c.value){if(r.value.is_social_registration_tracked){if(!r.value.is_login_tracked){var e={event:"login",user_id:r.value.id,method:r.value.social_provider?r.value.social_provider:"site"};$env.debug.ecommerce&&console.log(e),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(e))}}else{var o={event:"sign_up",user_id:r.value.id,method:r.value.social_provider};$env.debug.ecommerce&&console.log(o),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(o))}n.default.set("user_id",r.value.id)}}}),window.addEventListener("keyup",(function(e){a.value&&"Escape"===e.key&&m()})),e.resetToken&&l.commit("auth/modal","reset"),{mounted:s,user:r,logged:c,modal:a,open:function(){l.commit("auth/modal","login")},close:m,register:function(){l.commit("auth/modal","registration")},logout:function(){l.dispatch("auth/logout")},routes:i}}},a={key:0,class:"auth-user"},c={class:"modal-content"},s=[o.createElementVNode("svg",{class:"icon close"},[o.createElementVNode("use",{"xlink:href":"#close"})],-1)],i={class:"box"},d={class:"tabs"},u={href:"#register"},m={key:1,class:"auth-user is-logged"},p={class:"dropdown is-right is-hoverable"},g={class:"dropdown-trigger"},v=["href"],f=o.createElementVNode("i",{class:"fas fa-user"},null,-1),h=o.createElementVNode("span",{class:"icon is-small"},[o.createElementVNode("i",{class:"fas fa-angle-down","aria-hidden":"true"})],-1),k={class:"dropdown-menu",role:"menu"},y={class:"dropdown-content"},E=["href"],V={key:0,class:"icon"},N=["xlink:href"],w={key:1,class:"badge"},B={key:1,class:"dropdown-divider"},_=o.createElementVNode("hr",{class:"dropdown-divider"},null,-1),b=o.createElementVNode("svg",{class:"icon"},[o.createElementVNode("use",{"xlink:href":"#icon-logout"})],-1);r.render=function(e,t,l,n,r,C){var S=o.resolveComponent("login"),x=o.resolveComponent("registration"),D=o.resolveComponent("reset");return n.mounted&&!n.logged?(o.openBlock(),o.createElementBlock("div",a,[o.renderSlot(e.$slots,"login",{open:n.open,label:e.__("auth.login.login")},(function(){return[o.createElementVNode("a",{href:"#login",class:"button",onClick:t[0]||(t[0]=function(){return n.open&&n.open.apply(n,arguments)})},o.toDisplayString(e.__("auth.login.login")),1)]})),o.createElementVNode("div",{class:o.normalizeClass(["modal",{"is-active":n.modal}])},[o.createElementVNode("div",{class:"modal-background",onClick:t[1]||(t[1]=function(){return n.close&&n.close.apply(n,arguments)})}),o.createElementVNode("div",c,[o.createElementVNode("button",{class:"modal-close is-large",onClick:t[2]||(t[2]=function(){return n.close&&n.close.apply(n,arguments)})},s),o.createElementVNode("div",i,[o.renderSlot(e.$slots,"hero"),o.createElementVNode("div",d,[o.createElementVNode("ul",null,[o.createElementVNode("li",{class:o.normalizeClass({"is-active":"login"==n.modal||"forget"==n.modal})},[o.createElementVNode("a",{href:"#login",onClick:t[3]||(t[3]=function(){return n.open&&n.open.apply(n,arguments)})},o.toDisplayString(e.__("auth.login.login")),1)],2),o.createElementVNode("li",{class:o.normalizeClass({"is-active":"registration"==n.modal}),onClick:t[4]||(t[4]=function(){return n.register&&n.register.apply(n,arguments)})},[o.createElementVNode("a",u,o.toDisplayString(e.__("auth.login.signup")),1)],2)])]),(o.openBlock(),o.createBlock(o.KeepAlive,null,["login"==n.modal||"forget"==n.modal?(o.openBlock(),o.createBlock(S,{key:0,"forget-type":l.forgetType,"show-placeholders":l.showPlaceholders},null,8,["forget-type","show-placeholders"])):o.createCommentVNode("v-if",!0)],1024)),(o.openBlock(),o.createBlock(o.KeepAlive,null,["registration"==n.modal?(o.openBlock(),o.createBlock(x,{key:0})):o.createCommentVNode("v-if",!0)],1024)),o.withDirectives(o.createVNode(D,{"show-placeholders":l.showPlaceholders},null,8,["show-placeholders"]),[[o.vShow,"reset"==n.modal]])])])],2)])):n.mounted?(o.openBlock(),o.createElementBlock("div",m,[o.createElementVNode("div",p,[o.createElementVNode("div",g,[o.createElementVNode("a",{class:"button",href:n.routes[0].path},[o.renderSlot(e.$slots,"user",{user:n.user.name?n.user.name:n.user.email},(function(){return[o.createElementVNode("span",null,[f,o.createTextVNode(" "+o.toDisplayString(n.user.name?n.user.name:n.user.email),1)]),h]}))],8,v)]),o.createElementVNode("div",k,[o.createElementVNode("div",y,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.routes,(function(e,t){return o.openBlock(),o.createElementBlock("div",{key:t},[e.text?(o.openBlock(),o.createElementBlock("a",{key:0,href:e.path,class:"dropdown-item"},[e.icon?(o.openBlock(),o.createElementBlock("svg",V,[o.createElementVNode("use",{"xlink:href":"#"+e.icon},null,8,N)])):o.createCommentVNode("v-if",!0),o.createElementVNode("span",null,o.toDisplayString(e.text),1),e.badge?(o.openBlock(),o.createElementBlock("span",w,o.toDisplayString(e.badge),1)):o.createCommentVNode("v-if",!0)],8,E)):(o.openBlock(),o.createElementBlock("hr",B))])})),128)),_,o.createElementVNode("a",{class:"dropdown-item",onClick:t[5]||(t[5]=function(){return n.logout&&n.logout.apply(n,arguments)})},[b,o.createElementVNode("span",null,o.toDisplayString(e.__("auth.user.menu.logout")),1)])])])])])):o.createCommentVNode("v-if",!0)},module.exports=r;
|
|
2
2
|
//# sourceMappingURL=User.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","sources":["../../../src/components/auth/User.vue","../../../src/components/auth/User.vue?vue&type=template&id=6f339bea&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-user\" v-if=\"mounted && !logged\">\n <slot name=\"login\" :open=\"open\" :label=\"__('auth.login.login')\">\n <a href=\"#login\" class=\"button\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </slot>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <slot name=\"hero\"></slot>\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a href=\"#login\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a href=\"#register\">{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\" :show-placeholders=\"showPlaceholders\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user is-logged\" v-else-if=\"mounted\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <a class=\"button\" :href=\"routes[0].path\">\n <slot name=\"user\" :user=\"user.name ? user.name : user.email\">\n <span>\n <i class=\"fas fa-user\"></i>\n {{ user.name ? user.name : user.email }}\n </span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>\n </span>\n </slot>\n </a>\n </div>\n <div class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" class=\"dropdown-item\">\n <svg class=\"icon\" v-if=\"item.icon\">\n <use :xlink:href=\"'#' + item.icon\" />\n </svg>\n <span>{{ item.text }}</span>\n <span class=\"badge\" v-if=\"item.badge\">{{ item.badge }}</span>\n </a>\n <hr class=\"dropdown-divider\" v-else />\n </div>\n <hr class=\"dropdown-divider\" />\n <a class=\"dropdown-item\" @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { ref, computed, provide, isVNode } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'user',\n props: {\n resetToken: {\n type: String,\n default: ''\n },\n resetEmail: {\n type: String,\n default: ''\n },\n tokenValid: {\n type: Boolean,\n default: false\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const modal = computed(() => store.getters['auth/modal']);\n const logged = computed(() => Object.keys(user.value).length > 0);\n const mounted = ref(false);\n const routes = computed(() => store.getters['auth/account']);\n const presetedResetToken = ref('');\n const presetedResetEmail = ref('');\n\n provide('presetedResetToken', presetedResetToken);\n provide('presetedResetEmail', presetedResetEmail);\n\n const open = () => {\n store.commit('auth/modal', 'login');\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n store.dispatch('auth/me', {\n finally: () => {\n mounted.value = true;\n\n if (logged.value) {\n if (!user.value.is_social_registration_tracked) {\n let object = {\n event: 'sign_up',\n user_id: user.value.id,\n method: user.value.social_provider\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 } else if (!user.value.is_login_tracked) {\n let object = {\n event: 'login',\n user_id: user.value.id,\n method: user.value.social_provider ? user.value.social_provider : 'site'\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 } else {\n let object = {\n user_id: user.value.id\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n }\n }\n });\n\n window.addEventListener('keyup', (e) => {\n if (modal.value && e.key === 'Escape') {\n close();\n }\n });\n\n if (props.resetToken) {\n store.commit('auth/modal', 'reset');\n }\n\n return {\n mounted,\n user,\n logged,\n modal,\n open,\n close,\n register,\n logout,\n routes\n };\n }\n};\n</script>","<template>\n <div class=\"auth-user\" v-if=\"mounted && !logged\">\n <slot name=\"login\" :open=\"open\" :label=\"__('auth.login.login')\">\n <a href=\"#login\" class=\"button\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </slot>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <slot name=\"hero\"></slot>\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a href=\"#login\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a href=\"#register\">{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\" :show-placeholders=\"showPlaceholders\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user is-logged\" v-else-if=\"mounted\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <a class=\"button\" :href=\"routes[0].path\">\n <slot name=\"user\" :user=\"user.name ? user.name : user.email\">\n <span>\n <i class=\"fas fa-user\"></i>\n {{ user.name ? user.name : user.email }}\n </span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>\n </span>\n </slot>\n </a>\n </div>\n <div class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" class=\"dropdown-item\">\n <svg class=\"icon\" v-if=\"item.icon\">\n <use :xlink:href=\"'#' + item.icon\" />\n </svg>\n <span>{{ item.text }}</span>\n <span class=\"badge\" v-if=\"item.badge\">{{ item.badge }}</span>\n </a>\n <hr class=\"dropdown-divider\" v-else />\n </div>\n <hr class=\"dropdown-divider\" />\n <a class=\"dropdown-item\" @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { ref, computed, provide, isVNode } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'user',\n props: {\n resetToken: {\n type: String,\n default: ''\n },\n resetEmail: {\n type: String,\n default: ''\n },\n tokenValid: {\n type: Boolean,\n default: false\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const modal = computed(() => store.getters['auth/modal']);\n const logged = computed(() => Object.keys(user.value).length > 0);\n const mounted = ref(false);\n const routes = computed(() => store.getters['auth/account']);\n const presetedResetToken = ref('');\n const presetedResetEmail = ref('');\n\n provide('presetedResetToken', presetedResetToken);\n provide('presetedResetEmail', presetedResetEmail);\n\n const open = () => {\n store.commit('auth/modal', 'login');\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n store.dispatch('auth/me', {\n finally: () => {\n mounted.value = true;\n\n if (logged.value) {\n if (!user.value.is_social_registration_tracked) {\n let object = {\n event: 'sign_up',\n user_id: user.value.id,\n method: user.value.social_provider\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 } else if (!user.value.is_login_tracked) {\n let object = {\n event: 'login',\n user_id: user.value.id,\n method: user.value.social_provider ? user.value.social_provider : 'site'\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 } else {\n let object = {\n user_id: user.value.id\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n }\n }\n });\n\n window.addEventListener('keyup', (e) => {\n if (modal.value && e.key === 'Escape') {\n close();\n }\n });\n\n if (props.resetToken) {\n store.commit('auth/modal', 'reset');\n }\n\n return {\n mounted,\n user,\n logged,\n modal,\n open,\n close,\n register,\n logout,\n routes\n };\n }\n};\n</script>"],"names":["name","props","resetToken","type","String","resetEmail","tokenValid","Boolean","forgetType","showPlaceholders","setup","store","useStore","user","computed","getters","modal","logged","Object","keys","value","length","mounted","ref","routes","presetedResetToken","presetedResetEmail","provide","close","commit","dispatch","is_social_registration_tracked","is_login_tracked","object","user_id","id","$env","debug","ecommerce","console","log","window","dataLayer","push","event","method","social_provider","addEventListener","e","key","open","register","logout","_createElementVNode","href","role","$setup","_createElementBlock","_hoisted_1","_renderSlot","label","_ctx","onClick","_hoisted_2","_hoisted_5","_hoisted_6","_hoisted_7","_createBlock","$props","_createVNode","_hoisted_8","_hoisted_9","_hoisted_10","path","email","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","item","text","icon","_hoisted_17","badge","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22"],"mappings":"sDAoFe,CACXA,KAAM,OACNC,MAAO,CACHC,WAAY,CACRC,KAAMC,eACG,IAEbC,WAAY,CACRF,KAAMC,eACG,IAEbE,WAAY,CACRH,KAAMI,iBACG,GAEbC,WAAY,CACRL,KAAMC,eACG,SAEbK,iBAAkB,CACdN,KAAMI,iBACG,IAGjBG,eAAMT,OACIU,EAAQC,aACRC,EAAOC,YAAS,kBAAMH,EAAMI,QAAQ,cACpCC,EAAQF,YAAS,kBAAMH,EAAMI,QAAQ,iBACrCE,EAASH,YAAS,kBAAMI,OAAOC,KAAKN,EAAKO,OAAOC,OAAS,KACzDC,EAAUC,OAAI,GACd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A0CR,IAAKA,IAChB8B,EAAKC,oBAAhCvB,gCAAIH,KAAMyB,EAAKN,WAA6B,kBAChBM,EAAKE,oBAA7BxB,2BAAAyB,GACI7B,6CAAwB0B,EAAKE,mDAEjC5B,mDAAS0B,EAAKC,SACYD,EAAKI,qBAA/B1B,4BAAA2B,oBAAyCL,EAAKI,iEAElD1B,0BAAA4B,eAEJC,EACAjC,gCAAS,gBAAiBS,sCAAON,0CAC7B+B,EAGAlC,mDAASQ"}
|
|
1
|
+
{"version":3,"file":"User.js","sources":["../../../src/components/auth/User.vue","../../../src/components/auth/User.vue?vue&type=template&id=50d28da8&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-user\" v-if=\"mounted && !logged\">\n <slot name=\"login\" :open=\"open\" :label=\"__('auth.login.login')\">\n <a href=\"#login\" class=\"button\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </slot>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <slot name=\"hero\"></slot>\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a href=\"#login\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a href=\"#register\">{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\" :show-placeholders=\"showPlaceholders\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user is-logged\" v-else-if=\"mounted\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <a class=\"button\" :href=\"routes[0].path\">\n <slot name=\"user\" :user=\"user.name ? user.name : user.email\">\n <span>\n <i class=\"fas fa-user\"></i>\n {{ user.name ? user.name : user.email }}\n </span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>\n </span>\n </slot>\n </a>\n </div>\n <div class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" class=\"dropdown-item\">\n <svg class=\"icon\" v-if=\"item.icon\">\n <use :xlink:href=\"'#' + item.icon\" />\n </svg>\n <span>{{ item.text }}</span>\n <span class=\"badge\" v-if=\"item.badge\">{{ item.badge }}</span>\n </a>\n <hr class=\"dropdown-divider\" v-else />\n </div>\n <hr class=\"dropdown-divider\" />\n <a class=\"dropdown-item\" @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport Cookies from 'js-cookie';\nimport { ref, computed, provide, isVNode } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'user',\n props: {\n resetToken: {\n type: String,\n default: ''\n },\n resetEmail: {\n type: String,\n default: ''\n },\n tokenValid: {\n type: Boolean,\n default: false\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const modal = computed(() => store.getters['auth/modal']);\n const logged = computed(() => Object.keys(user.value).length > 0);\n const mounted = ref(false);\n const routes = computed(() => store.getters['auth/account']);\n const presetedResetToken = ref('');\n const presetedResetEmail = ref('');\n\n provide('presetedResetToken', presetedResetToken);\n provide('presetedResetEmail', presetedResetEmail);\n\n const open = () => {\n store.commit('auth/modal', 'login');\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n store.dispatch('auth/me', {\n finally: () => {\n mounted.value = true;\n\n if (logged.value) {\n if (!user.value.is_social_registration_tracked) {\n let object = {\n event: 'sign_up',\n user_id: user.value.id,\n method: user.value.social_provider\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 } else if (!user.value.is_login_tracked) {\n let object = {\n event: 'login',\n user_id: user.value.id,\n method: user.value.social_provider ? user.value.social_provider : 'site'\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 Cookies.set('user_id', user.value.id);\n }\n }\n });\n\n window.addEventListener('keyup', (e) => {\n if (modal.value && e.key === 'Escape') {\n close();\n }\n });\n\n if (props.resetToken) {\n store.commit('auth/modal', 'reset');\n }\n\n return {\n mounted,\n user,\n logged,\n modal,\n open,\n close,\n register,\n logout,\n routes\n };\n }\n};\n</script>","<template>\n <div class=\"auth-user\" v-if=\"mounted && !logged\">\n <slot name=\"login\" :open=\"open\" :label=\"__('auth.login.login')\">\n <a href=\"#login\" class=\"button\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </slot>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <slot name=\"hero\"></slot>\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a href=\"#login\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a href=\"#register\">{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\" :show-placeholders=\"showPlaceholders\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user is-logged\" v-else-if=\"mounted\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <a class=\"button\" :href=\"routes[0].path\">\n <slot name=\"user\" :user=\"user.name ? user.name : user.email\">\n <span>\n <i class=\"fas fa-user\"></i>\n {{ user.name ? user.name : user.email }}\n </span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>\n </span>\n </slot>\n </a>\n </div>\n <div class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" class=\"dropdown-item\">\n <svg class=\"icon\" v-if=\"item.icon\">\n <use :xlink:href=\"'#' + item.icon\" />\n </svg>\n <span>{{ item.text }}</span>\n <span class=\"badge\" v-if=\"item.badge\">{{ item.badge }}</span>\n </a>\n <hr class=\"dropdown-divider\" v-else />\n </div>\n <hr class=\"dropdown-divider\" />\n <a class=\"dropdown-item\" @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport Cookies from 'js-cookie';\nimport { ref, computed, provide, isVNode } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'user',\n props: {\n resetToken: {\n type: String,\n default: ''\n },\n resetEmail: {\n type: String,\n default: ''\n },\n tokenValid: {\n type: Boolean,\n default: false\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const modal = computed(() => store.getters['auth/modal']);\n const logged = computed(() => Object.keys(user.value).length > 0);\n const mounted = ref(false);\n const routes = computed(() => store.getters['auth/account']);\n const presetedResetToken = ref('');\n const presetedResetEmail = ref('');\n\n provide('presetedResetToken', presetedResetToken);\n provide('presetedResetEmail', presetedResetEmail);\n\n const open = () => {\n store.commit('auth/modal', 'login');\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n store.dispatch('auth/me', {\n finally: () => {\n mounted.value = true;\n\n if (logged.value) {\n if (!user.value.is_social_registration_tracked) {\n let object = {\n event: 'sign_up',\n user_id: user.value.id,\n method: user.value.social_provider\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 } else if (!user.value.is_login_tracked) {\n let object = {\n event: 'login',\n user_id: user.value.id,\n method: user.value.social_provider ? user.value.social_provider : 'site'\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 Cookies.set('user_id', user.value.id);\n }\n }\n });\n\n window.addEventListener('keyup', (e) => {\n if (modal.value && e.key === 'Escape') {\n close();\n }\n });\n\n if (props.resetToken) {\n store.commit('auth/modal', 'reset');\n }\n\n return {\n mounted,\n user,\n logged,\n modal,\n open,\n close,\n register,\n logout,\n routes\n };\n }\n};\n</script>"],"names":["name","props","resetToken","type","String","resetEmail","tokenValid","Boolean","forgetType","showPlaceholders","setup","store","useStore","user","computed","getters","modal","logged","Object","keys","value","length","mounted","ref","routes","presetedResetToken","presetedResetEmail","provide","close","commit","dispatch","is_social_registration_tracked","is_login_tracked","object","event","user_id","id","method","social_provider","$env","debug","ecommerce","console","log","window","dataLayer","push","Cookies","set","addEventListener","e","key","open","register","logout","_createElementVNode","href","role","$setup","_createElementBlock","_hoisted_1","_renderSlot","label","_ctx","onClick","_hoisted_2","_hoisted_5","_hoisted_6","_hoisted_7","_createBlock","$props","_createVNode","_hoisted_8","_hoisted_9","_hoisted_10","path","email","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","item","text","icon","_hoisted_17","badge","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22"],"mappings":"gKAqFe,CACXA,KAAM,OACNC,MAAO,CACHC,WAAY,CACRC,KAAMC,eACG,IAEbC,WAAY,CACRF,KAAMC,eACG,IAEbE,WAAY,CACRH,KAAMI,iBACG,GAEbC,WAAY,CACRL,KAAMC,eACG,SAEbK,iBAAkB,CACdN,KAAMI,iBACG,IAGjBG,eAAMT,OACIU,EAAQC,aACRC,EAAOC,YAAS,kBAAMH,EAAMI,QAAQ,cACpCC,EAAQF,YAAS,kBAAMH,EAAMI,QAAQ,iBACrCE,EAASH,YAAS,kBAAMI,OAAOC,KAAKN,EAAKO,OAAOC,OAAS,KACzDC,EAAUC,OAAI,GACdC,EAASV,YAAS,kBAAMH,EAAMI,QAAQ,mBACtCU,EAAqBF,MAAI,IACzBG,EAAqBH,MAAI,IAE/BI,UAAQ,qBAAsBF,GAC9BE,UAAQ,qBAAsBD,OAMxBE,EAAQ,WACVjB,EAAMkB,OAAO,aAAc,MAC3BlB,EAAMmB,SAAS,mBAWnBnB,EAAMmB,SAAS,UAAW,SACb,cACLR,EAAQF,OAAQ,EAEZH,EAAO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YAAYA,wBAAzCC,2BAAAC,GACIC,+BAAoBT,KAAMM,OAAOI,MAAOC,2BAAxC,kBACIR,0BAAGC,KAAK,eAAe,SAAUQ,sCAAON,uDAASK,iCAErDR,oDAAW,qBAAqCG,aAC5CH,kCAAW,mBAAoBS,sCAAON,wCACtCH,2BAAAU,GACIV,qCAAc,uBAAwBS,sCAAON,0CAK7CH,2BAAAW,GACIL,8BACAN,2BAAAY,GACIZ,gCACIA,uGAGIA,0BAAGC,KAAK,SAAUQ,sCAAON,uDAASK,iCAEtCR,yFAEIS,sCAAON,8CACPH,yBAAAa,oBAAuBL,qDAInCM,yCACiBX,mBAAoBA,uBAAjCW,qCAAkEC,iCAAgCA,wHAEtGD,gDACwBX,uBAApBW,mFAEJE,qCAAqDD,qEAAtCZ,sBAKaA,yBAA5CC,2BAAAa,GACIjB,2BAAAkB,GACIlB,2BAAAmB,GACInB,gCAAS,SAAUC,KAAME,YAAUiB,OAC/Bd,8BAAmBhD,KAAM6C,OAAK1D,KAAO0D,OAAK1D,KAAO0D,OAAKkB,QAAtD,kBACIrB,kCACIsB,0CACGnB,OAAK1D,KAAO0D,OAAK1D,KAAO0D,OAAKkB,YAEpCE,cAMZvB,2BAAAwB,GACIxB,2BAAAyB,oBACIrB,kDAA2BD,mBAAduB,EAAM9B,wBAAnBQ,4BAA0CR,IAAKA,IAChB8B,EAAKC,oBAAhCvB,gCAAIH,KAAMyB,EAAKN,WAA6B,kBAChBM,EAAKE,oBAA7BxB,2BAAAyB,GACI7B,6CAAwB0B,EAAKE,mDAEjC5B,mDAAS0B,EAAKC,SACYD,EAAKI,qBAA/B1B,4BAAA2B,oBAAyCL,EAAKI,iEAElD1B,0BAAA4B,eAEJC,EACAjC,gCAAS,gBAAiBS,sCAAON,0CAC7B+B,EAGAlC,mDAASQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(o),c=l(n);var i=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},placeholderMobile:{type:String,default:""},parameter:{type:String,default:"/q{separator}"},isHistory:{type:Boolean,default:!0},isToggleDropdownOnClose:{type:Boolean,default:!0},htmlClass:{type:String,default:""}},setup:function(o){var n=new c.default({isCompression:!1}),l=o.q;if(l){var i=document.createElement("textarea");i.innerHTML=l,l=i.value}var s=e.ref(!1),u=e.ref(l),d=e.ref([]),p=e.ref([]),m=e.ref(0),h=e.ref(-1),v=e.ref(!1),f=e.ref(),y=e.ref(""),g=e.ref(),w=e.ref(n.get("search")),k=e.ref([]),E=t.useStore(),C=e.computed((function(){return E.getters["auth/me"]})),B=e.ref(null),V=[],N=!1,_=function(){clearTimeout(void 0),h.value=-1,u.value.trim()?(s.value=!0,u.value.trim()&&r.shop.search(u.value).then((function(t){if(t.data){if(L(),d.value=t.data.products,m.value=t.data.total,y.value=t.data.separator,p.value=t.data.byCategory,new a.default(g.value),!N&&v.value){N=!0;var r={event:"search_start"};$env.debug.ecommerce&&console.log(r),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(r))}if(!d.value.length&&!M.value.length&&v.value){var o={event:"search_no_results",search_query:u.value};$env.debug.ecommerce&&console.log(o),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(o))}e.nextTick((function(){window.promoCodeCallback&&"function"==typeof window.promoCodeCallback&&window.promoCodeCallback(B.value,".dropdown-item:not(.products-list-title)")}))}})).finally((function(){s.value=!1}))):(d.value=[],s.value=!1)},L=function(){if(u.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(u.value)&&(e=e.filter((function(e){return e!==u.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(u.value),n.set("search",e),w.value=e}};e.onBeforeUpdate((function(){V=[]})),e.watch((function(){return u.value}),(function(){v.value=!0,h.value=-1,_()}));var S=e.computed((function(){return u.value?$env.locale.url+"/search"+D.value:$env.locale.url+"/search"})),D=e.computed((function(){return o.parameter.replace("{separator}",y.value)+u.value.toLowerCase()})),b=function(e){e.target.closest(".cart")||(o.isToggleDropdownOnClose&&(v.value=!1,o.htmlClass&&document.querySelector("html").classList.remove(o.htmlClass)),h.value=-1)};window.addEventListener("click",b);var q,M=e.computed((function(){return u.value.length>3?k.value.filter((function(e){return-1!==e.search.indexOf(u.value)})):[]})),x=(q=function(){var e,t,r,n=document.getElementById("menu");return n&&n.querySelectorAll("[data-search]").forEach((function(e){var t=e.textContent.trim(),r=e.dataset.search;k.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&_(),r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(q.apply(this,e))}catch(e){return Promise.reject(e)}});document.addEventListener("DOMContentLoaded",x,!1);var H=e.ref(o.placeholder);if(o.placeholderMobile){var T=function(){var e=window.matchMedia("(max-width: 768px)").matches;H.value=e?o.placeholderMobile:o.placeholder};window.addEventListener("resize",T,{passive:!0}),T()}return{isLoading:s,term:u,results:d,next:function(){h.value<d.value.length-1&&h.value++},prev:function(){h.value>=0&&h.value--},current:h,add:function(e){h.value>=0&&(e.preventDefault(),V[h.value].add())},cartRefs:function(e){e&&V.push(e)},isDropdown:v,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&h.value>=0)&&e.preventDefault()},esc:function(e){f.value.blur(),b(e)},input:f,dropdown:function(){v.value=!0,h.value=-1,o.htmlClass&&document.querySelector("html").classList.add(o.htmlClass)},total:m,searchUrl:S,searchHrefWithParameter:D,open:function(){h.value>=0?window.location.href=d.value[h.value].href:window.location.href=S.value},categories:M,byCategory:p,dropdownContent:g,history:w,clearSearchHistory:function(e){n.remove("search"),w.value=[],f.value.focus()},setSearchHistory:function(e){e.value=e},user:C,clear:function(){u.value="",f.value.focus()},placeholderMobilized:H,opener:function(e,t,r){!function(e){var t={event:d.value.length||M.value.length?"search_success":"search_no_results",search_query:u.value,search_type:e};$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}(t),"function"==typeof r&&r()},productsListElement:B}}}),s={class:"dropdown-trigger"},u=["placeholder"],d={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:1,class:"dropdown-menu"},h={class:"dropdown-content"},v={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},w={class:"dropdown-menu"},k={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},E={key:0,class:"results-list"},C=["href","onClick"],B={key:0,class:"dropdown-divider"},V={key:1,class:"results-list-category"},N={class:"dropdown-item categories-list-title"},_=["href","onClick"],L={key:2,class:"results-list-total"},S={class:"dropdown-item mb-3 mt-2"},D=e.createElementVNode("br",null,null,-1),b=["href"],q={key:3,class:"products-list",ref:"productsListElement"},M={class:"dropdown-item products-list-title"},x={class:"columns"},H={class:"column"},T={class:"title"},$=["href","onClick"],P=["innerHTML"],K={key:0,class:"price_old"},z=["innerHTML"],O={class:"code"},W={key:1,class:"quantity"},F={key:2,class:"no-quantity"},R={key:0,class:"column is-narrow"},U={key:1,class:"column is-eol"},j={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I=["innerHTML"];i.render=function(t,r,o,n,l,a){var c=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=function(e){return e.stopPropagation()})},[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isDropdown,"is-dropdown-visible":t.isDropdown&&(t.history.length&&!t.term||t.results.length||t.categories.length||t.term&&!t.isLoading&&!t.results.length&&!t.categories.length)}])},[t.htmlClass?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})})),e.createElementVNode("div",s,[e.createElementVNode("div",{class:e.normalizeClass(["control has-icons-right",{"is-loading":t.isLoading}])},[e.withDirectives(e.createElementVNode("input",{class:"input",type:"text","onUpdate:modelValue":r[1]||(r[1]=function(e){return t.term=e}),ref:"input",placeholder:t.placeholderMobilized,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next.apply(t,arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev.apply(t,arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys((function(e){return t.add(e)}),["space"])),r[5]||(r[5]=e.withKeys((function(e){return t.opener(null,"results_page",t.open)}),["enter"])),r[6]||(r[6]=e.withKeys((function(e){return t.esc(e)}),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown.apply(t,arguments)}),onKeydown:r[8]||(r[8]=function(e){return t.preventCaret(e)})},null,40,u),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"clear",{clear:t.clear,term:t.term}),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",d,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isHistory&&t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:function(e){return t.term=r}},e.toDisplayString(r),9,y)])})),128)),e.createElementVNode("div",g,[e.createElementVNode("a",{onClick:r[9]||(r[9]=function(e){return t.clearSearchHistory(e)})},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",w,[e.withDirectives(e.createElementVNode("div",k,[e.renderSlot(t.$slots,"results-header"),t.categories.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href,onClick:e.withModifiers((function(e){return t.opener(r.href,"category")}),["prevent"])},e.toDisplayString(r.name),9,C)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",B)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",N,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.renderSlot(t.$slots,"item-category",{item:r,searchHrefWithParameter:t.searchHrefWithParameter,opener:t.opener},(function(){return[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter,onClick:e.withModifiers((function(e){return t.opener(r.href+t.searchHrefWithParameter,"category")}),["prevent"])},e.toDisplayString(r.name),9,_)]),e.createElementVNode("div",null,e.toDisplayString(t.__("shop.search.category_found",{count:r.count})),1)]}))])})),128))])):e.createCommentVNode("v-if",!0),t.total?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("p",S,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),D,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,b)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",M,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dropdown-item",{"is-active":t.current==o}]),key:r.id},[e.renderSlot(t.$slots,"item",{user:t.user,item:r,cartRefs:t.cartRefs,opener:t.opener},(function(){return[e.createElementVNode("div",x,[e.createElementVNode("div",H,[e.createElementVNode("div",T,[e.createElementVNode("a",{href:r.href,onClick:e.withModifiers((function(e){return t.opener(r.href,"product")}),["prevent"])},e.toDisplayString(r.name),9,$)]),e.createElementVNode("div",{class:"price",innerHTML:r.price},null,8,P),r.price_old?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,z)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",O,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",W,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,ref_for:!0,ref:t.cartRefs},null,8,["id"])]))])]}))],2)})),128))],512)):e.createCommentVNode("v-if",!0)],512),[[e.vShow,t.results.length||t.categories.length]]),t.isLoading||t.results.length||t.categories.length?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",{class:"no-results",innerHTML:t.__("shop.search.no_results")},null,8,I)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=i;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(o),c=l(n);var i=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},placeholderMobile:{type:String,default:""},parameter:{type:String,default:"/q{separator}"},isHistory:{type:Boolean,default:!0},isToggleDropdownOnClose:{type:Boolean,default:!0},htmlClass:{type:String,default:""}},setup:function(o){var n=new c.default({isCompression:!1}),l=o.q;if(l){var i=document.createElement("textarea");i.innerHTML=l,l=i.value}var s,u=e.ref(!1),d=e.ref(l),p=e.ref([]),m=e.ref([]),h=e.ref(0),v=e.ref(-1),f=e.ref(!1),y=e.ref(),g=e.ref(""),w=e.ref(),k=e.ref(n.get("search")),E=e.ref([]),C=t.useStore(),B=e.computed((function(){return C.getters["auth/me"]})),V=e.ref(null),N=[],_=!1,L=function(){clearTimeout(s),v.value=-1,d.value.trim()?(u.value=!0,s=setTimeout((function(){d.value.trim()&&r.shop.search(d.value).then((function(t){if(t.data){if(S(),p.value=t.data.products,h.value=t.data.total,g.value=t.data.separator,m.value=t.data.byCategory,new a.default(w.value),!_&&f.value){_=!0;var r={event:"search_start"};$env.debug.ecommerce&&console.log(r),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(r))}if(!p.value.length&&!x.value.length&&f.value){var o={event:"search_no_results",search_query:d.value};$env.debug.ecommerce&&console.log(o),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(o))}e.nextTick((function(){window.promoCodeCallback&&"function"==typeof window.promoCodeCallback&&window.promoCodeCallback(V.value,".dropdown-item:not(.products-list-title)")}))}})).finally((function(){u.value=!1}))}),300)):(p.value=[],u.value=!1)},S=function(){if(d.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(d.value)&&(e=e.filter((function(e){return e!==d.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(d.value),n.set("search",e),k.value=e}};e.onBeforeUpdate((function(){N=[]})),e.watch((function(){return d.value}),(function(){f.value=!0,v.value=-1,L()}));var D=e.computed((function(){return d.value?$env.locale.url+"/search"+b.value:$env.locale.url+"/search"})),b=e.computed((function(){return o.parameter.replace("{separator}",g.value)+d.value.toLowerCase()})),q=function(e){e.target.closest(".cart")||(o.isToggleDropdownOnClose&&(f.value=!1,o.htmlClass&&document.querySelector("html").classList.remove(o.htmlClass)),v.value=-1)};window.addEventListener("click",q);var M,x=e.computed((function(){return d.value.length>3?E.value.filter((function(e){return-1!==e.search.indexOf(d.value)})):[]})),H=(M=function(){var e,t,r,n=document.getElementById("menu");return n&&n.querySelectorAll("[data-search]").forEach((function(e){var t=e.textContent.trim(),r=e.dataset.search;E.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&L(),r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(M.apply(this,e))}catch(e){return Promise.reject(e)}});document.addEventListener("DOMContentLoaded",H,!1);var T=e.ref(o.placeholder);if(o.placeholderMobile){var $=function(){var e=window.matchMedia("(max-width: 768px)").matches;T.value=e?o.placeholderMobile:o.placeholder};window.addEventListener("resize",$,{passive:!0}),$()}return{isLoading:u,term:d,results:p,next:function(){v.value<p.value.length-1&&v.value++},prev:function(){v.value>=0&&v.value--},current:v,add:function(e){v.value>=0&&(e.preventDefault(),N[v.value].add())},cartRefs:function(e){e&&N.push(e)},isDropdown:f,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&v.value>=0)&&e.preventDefault()},esc:function(e){y.value.blur(),q(e)},input:y,dropdown:function(){f.value=!0,v.value=-1,o.htmlClass&&document.querySelector("html").classList.add(o.htmlClass)},total:h,searchUrl:D,searchHrefWithParameter:b,open:function(){v.value>=0?window.location.href=p.value[v.value].href:window.location.href=D.value},categories:x,byCategory:m,dropdownContent:w,history:k,clearSearchHistory:function(e){n.remove("search"),k.value=[],y.value.focus()},setSearchHistory:function(e){e.value=e},user:B,clear:function(){d.value="",y.value.focus()},placeholderMobilized:T,opener:function(e,t,r){!function(e){var t={event:p.value.length||x.value.length?"search_success":"search_no_results",search_query:d.value,search_type:e};$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}(t),"function"==typeof r&&r()},productsListElement:V}}}),s={class:"dropdown-trigger"},u=["placeholder"],d={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:1,class:"dropdown-menu"},h={class:"dropdown-content"},v={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},w={class:"dropdown-menu"},k={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},E={key:0,class:"results-list"},C=["href","onClick"],B={key:0,class:"dropdown-divider"},V={key:1,class:"results-list-category"},N={class:"dropdown-item categories-list-title"},_=["href","onClick"],L={key:2,class:"results-list-total"},S={class:"dropdown-item mb-3 mt-2"},D=e.createElementVNode("br",null,null,-1),b=["href"],q={key:3,class:"products-list",ref:"productsListElement"},M={class:"dropdown-item products-list-title"},x={class:"columns"},H={class:"column"},T={class:"title"},$=["href","onClick"],P=["innerHTML"],K={key:0,class:"price_old"},z=["innerHTML"],O={class:"code"},W={key:1,class:"quantity"},F={key:2,class:"no-quantity"},R={key:0,class:"column is-narrow"},U={key:1,class:"column is-eol"},j={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I=["innerHTML"];i.render=function(t,r,o,n,l,a){var c=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=function(e){return e.stopPropagation()})},[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isDropdown,"is-dropdown-visible":t.isDropdown&&(t.history.length&&!t.term||t.results.length||t.categories.length||t.term&&!t.isLoading&&!t.results.length&&!t.categories.length)}])},[t.htmlClass?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})})),e.createElementVNode("div",s,[e.createElementVNode("div",{class:e.normalizeClass(["control has-icons-right",{"is-loading":t.isLoading}])},[e.withDirectives(e.createElementVNode("input",{class:"input",type:"text","onUpdate:modelValue":r[1]||(r[1]=function(e){return t.term=e}),ref:"input",placeholder:t.placeholderMobilized,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next.apply(t,arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev.apply(t,arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys((function(e){return t.add(e)}),["space"])),r[5]||(r[5]=e.withKeys((function(e){return t.opener(null,"results_page",t.open)}),["enter"])),r[6]||(r[6]=e.withKeys((function(e){return t.esc(e)}),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown.apply(t,arguments)}),onKeydown:r[8]||(r[8]=function(e){return t.preventCaret(e)})},null,40,u),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"clear",{clear:t.clear,term:t.term}),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",d,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isHistory&&t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:function(e){return t.term=r}},e.toDisplayString(r),9,y)])})),128)),e.createElementVNode("div",g,[e.createElementVNode("a",{onClick:r[9]||(r[9]=function(e){return t.clearSearchHistory(e)})},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",w,[e.withDirectives(e.createElementVNode("div",k,[e.renderSlot(t.$slots,"results-header"),t.categories.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href,onClick:e.withModifiers((function(e){return t.opener(r.href,"category")}),["prevent"])},e.toDisplayString(r.name),9,C)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",B)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",N,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.renderSlot(t.$slots,"item-category",{item:r,searchHrefWithParameter:t.searchHrefWithParameter,opener:t.opener},(function(){return[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter,onClick:e.withModifiers((function(e){return t.opener(r.href+t.searchHrefWithParameter,"category")}),["prevent"])},e.toDisplayString(r.name),9,_)]),e.createElementVNode("div",null,e.toDisplayString(t.__("shop.search.category_found",{count:r.count})),1)]}))])})),128))])):e.createCommentVNode("v-if",!0),t.total?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("p",S,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),D,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,b)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",M,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dropdown-item",{"is-active":t.current==o}]),key:r.id},[e.renderSlot(t.$slots,"item",{user:t.user,item:r,cartRefs:t.cartRefs,opener:t.opener},(function(){return[e.createElementVNode("div",x,[e.createElementVNode("div",H,[e.createElementVNode("div",T,[e.createElementVNode("a",{href:r.href,onClick:e.withModifiers((function(e){return t.opener(r.href,"product")}),["prevent"])},e.toDisplayString(r.name),9,$)]),e.createElementVNode("div",{class:"price",innerHTML:r.price},null,8,P),r.price_old?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,z)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",O,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",W,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,ref_for:!0,ref:t.cartRefs},null,8,["id"])]))])]}))],2)})),128))],512)):e.createCommentVNode("v-if",!0)],512),[[e.vShow,t.results.length||t.categories.length]]),t.isLoading||t.results.length||t.categories.length?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",{class:"no-results",innerHTML:t.__("shop.search.no_results")},null,8,I)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=i;
|
|
2
2
|
//# sourceMappingURL=Search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","sources":["../../../src/components/shop/Search.vue","../../../src/components/shop/Search.vue?vue&type=template&id=94d89cb6&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 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 }\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\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 return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\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 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 }\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\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 return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\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","isLoading","ref","term","results","byCategory","total","current","isDropdown","input","separator","dropdownContent","history","get","menu","store","useStore","user","computed","getters","productsListElement","refs","isTrackingStartSend","search","clearTimeout","timeout","trim","api","then","response","data","saveSearch","products","SimpleBar","object","event","$env","debug","ecommerce","console","log","window","dataLayer","push","length","categories","search_query","nextTick","promoCodeCallback","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","location","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,EACp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U2E"}
|
|
1
|
+
{"version":3,"file":"Search.js","sources":["../../../src/components/shop/Search.vue","../../../src/components/shop/Search.vue?vue&type=template&id=7b117d41&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\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 return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\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\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 return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\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","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","location","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,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AuC,oBACOnC,iDAEPJ,4BAAAwC,oBACOpC,qCAG0BpE,EAAKyG,sBAG1CzC,2BAAA0C,oBACOtC,4CAJPJ,2BAAA2C,GACIC,iBAAWf,GAAI7F,EAAK6F,yBAAyB,wBAA4B,aAAQ9I,IAAKqH,wGA9DxEA,UAAQ3E,QAAU2E,aAAW3E,UAwE9B2E,aAAcA,UAAQ3E,QAAW2E,aAAW3E,sDAAjFuE,2BAAA6C,GACI/C,2BAAAgD,GACIhD,kCAAW,aAAanH,UAAQyH,+DA3ETA,UAAQ3E,QAAU2E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),r=e.defineComponent({name:"viewer",props:{slug:String,code:String,brand:String,category:String,property:String},setup:function(r){var t=e.ref(null);return $http.post($ziggy("api.viewed"),{action:"view",slug:r.slug}),e.onMounted((function(){var e=
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=e.defineComponent({name:"viewer",props:{slug:String,code:String,brand:String,category:String,property:String,id:Number},setup:function(r){var i=t.useStore(),o=e.ref(null),c=e.computed((function(){return i.getters["cart/product"](r.id)}));return $http.post($ziggy("api.viewed"),{action:"view",slug:r.slug}),e.onMounted((function(){var e=o.value.closest("[shop-product]"),t=e.querySelector("[shop-product-name]").textContent,i=e.querySelector("[shop-product-price]")?e.querySelector("[shop-product-price]").childNodes[0].nodeValue.replace(/ /g,""):null,n=r.code,m=document.referrer,a={ecommerce:{currency:"UAH",value:parseFloat(i),items:[{item_name:t,item_id:n,item_list_name:m.includes("/post")?"Новини":"Direct",index:1}]},event:"view_item"};if("undefined"!=typeof Storage){var u=sessionStorage.getItem("productIndex");u&&(u=JSON.parse(u),a.ecommerce.items[0].item_list_name=u.item_list_name,a.ecommerce.items[0].index=u.index)}c.value&&c.value.attributes.index&&(a.ecommerce.items[0].index=c.value.attributes.index),c.value&&c.value.attributes.itemListName&&(a.ecommerce.items[0].item_list_name=c.value.attributes.itemListName),i&&(a.ecommerce.items[0].price=parseFloat(i)),r.brand&&(a.ecommerce.items[0].item_brand=r.brand),r.category&&(-1!==r.category.indexOf("/")?r.category.split("/").forEach((function(e,t){a.ecommerce.items[0]["item_category"+(t?t+1:"")]=e.trim()})):a.ecommerce.items[0].item_category=r.category),r.property&&(a.ecommerce.items[0].item_variant=r.property),$env.debug.ecommerce&&console.log(a),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(a))})),{viewer:o}}}),i={class:"is-hidden",ref:"viewer"};r.render=function(t,r,o,c,n,m){return e.openBlock(),e.createElementBlock("span",i,null,512)},module.exports=r;
|
|
2
2
|
//# sourceMappingURL=Viewer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewer.js","sources":["../../../../src/components/shop/viewed/Viewer.vue","../../../../src/components/shop/viewed/Viewer.vue?vue&type=template&id=d2d3d3a4&lang.js"],"sourcesContent":["<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n },\n setup(props) {\n const viewer = ref(null);\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>","<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n },\n setup(props) {\n const viewer = ref(null);\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","slug","String","code","brand","category","property","setup","viewer","ref","$http","post","$ziggy","action","onMounted","product","value","closest","querySelector","textContent","price","childNodes","nodeValue","replace","referer","document","referrer","object","ecommerce","currency","parseFloat","items","item_name","item_id","item_list_name","includes","index","event","Storage","productIndex","sessionStorage","getItem","JSON","parse","item_brand","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","_createElementBlock","_hoisted_1"],"mappings":"oCAM6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,MAAOF,OACPG,SAAUH,OACVI,SAAUJ,QAEdK,eAAMP,OACIQ,EAASC,MAAI,aAEnBC,MAAMC,KAAKC,OAAO,cAAe,CAC7BC,OAAQ,OACRZ,KAAMD,EAAMC,OAGhBa,aAAU,eACAC,EAAUP,EAAOQ,MAAMC,QAAQ,kBAC/BlB,EAAOgB,EAAQG,cAAc,uBAAuBC,YACpDC,EAAQL,EAAQG,cAAc,wBAA0BH,EAAQG,cAAc,wBAAwBG,WAAW,GAAGC,UAAUC,QAAQ,KAAM,IAAM,KAClJpB,EAAOH,EAAMG,KACbqB,EAAUC,SAASC,SAErBC,EAAS,CACTC,UAAW,CACPC,SAAU,MACVb,MAAOc,WAAWV,GAClBW,MAAO,CACH,CACIC,UAAWjC,EACXkC,QAAS9B,EACT+B,eAAgBV,EAAQW,SAAS,SAAW,SAAW,SACvDC,MAAO,KAInBC,MAAO,gBAGY,oBAAZC,QAAyB,KAC5BC,EAAeC,eAAeC,QAAQ,gBAEtCF,IACAA,EAAeG,KAAKC,MAAMJ,GAE1BZ,EAAOC,UAAUG,MAAM,GAAGG,eAAiBK,EAAaL,eACxDP,EAAOC,UAAUG,MAAM,GAAGK,MAAQG,EAAaH,OAInDhB,IACAO,EAAOC,UAAUG,MAAM,GAAGX,MAAQU,WAAWV,IAG7CpB,EAAMI,QACNuB,EAAOC,UAAUG,MAAM,GAAGa,WAAa5C,EAAMI,OAG7CJ,EAAMK,YAC+B,IAAjCL,EAAMK,SAASwC,QAAQ,KACvB7C,EAAMK,SAASyC,MAAM,KAAKC,SAAQ,SAACC,EAASZ,GACxCT,EAAOC,UAAUG,MAAM,GAAG,iBAAmBK,EAAQA,EAAQ,EAAI,KAAOY,EAAQC,UAGpFtB,EAAOC,UAAUG,MAAM,GAAGmB,cAAgBlD,EAAMK,UAIpDL,EAAMM,WACNqB,EAAOC,UAAUG,MAAM,GAAGoB,aAAenD,EAAMM,UAG/C8C,KAAKC,MAAMzB,WACX0B,QAAQC,IAAI5B,IAGXyB,KAAKC,MAAMzB,WAAa4B,OAAOC,YAChCD,OAAOC,UAAUC,KAAK,CAClB9B,UAAW,OAGf4B,OAAOC,UAAUC,KAAK/B,OAIvB,CACHnB,OAAAA,eC5FI,YAAYC,IAAI,8DAA5BkD,4BAAAC"}
|
|
1
|
+
{"version":3,"file":"Viewer.js","sources":["../../../../src/components/shop/viewed/Viewer.vue","../../../../src/components/shop/viewed/Viewer.vue?vue&type=template&id=1eaede6a&lang.js"],"sourcesContent":["<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>","<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","slug","String","code","brand","category","property","id","Number","setup","store","useStore","viewer","ref","productInCart","computed","getters","$http","post","$ziggy","action","onMounted","product","value","closest","querySelector","textContent","price","childNodes","nodeValue","replace","referer","document","referrer","object","ecommerce","currency","parseFloat","items","item_name","item_id","item_list_name","includes","index","event","Storage","productIndex","sessionStorage","getItem","JSON","parse","attributes","itemListName","item_brand","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","_createElementBlock","_hoisted_1"],"mappings":"sDAO6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,MAAOF,OACPG,SAAUH,OACVI,SAAUJ,OACVK,GAAIC,QAERC,eAAMT,OACIU,EAAQC,aACRC,EAASC,MAAI,MACbC,EAAgBC,YAAS,kBAAML,EAAMM,QAAQ,gBAAgBhB,EAAMO,cAEzEU,MAAMC,KAAKC,OAAO,cAAe,CAC7BC,OAAQ,OACRnB,KAAMD,EAAMC,OAGhBoB,aAAU,eACAC,EAAUV,EAAOW,MAAMC,QAAQ,kBAC/BzB,EAAOuB,EAAQG,cAAc,uBAAuBC,YACpDC,EAAQL,EAAQG,cAAc,wBAA0BH,EAAQG,cAAc,wBAAwBG,WAAW,GAAGC,UAAUC,QAAQ,KAAM,IAAM,KAClJ3B,EAAOH,EAAMG,KACb4B,EAAUC,SAASC,SAErBC,EAAS,CACTC,UAAW,CACPC,SAAU,MACVb,MAAOc,WAAWV,GAClBW,MAAO,CACH,CACIC,UAAWxC,EACXyC,QAASrC,EACTsC,e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"),n=require("vue-toastification"),e=n.useToast(),c={namespaced:!0,state:{items:[],cross:[],bundles:[],modal:!1},getters:{items:function(t){return t.items},cross:function(t){return t.cross},bundles:function(t){return t.bundles},productQuantity:function(t,a){return function(t){var n=a.items.find((function(a){return a.id===t}));return n?n.quantity:0}},quantity:function(t,a){var n=0;return a.items.forEach((function(t){n+=parseInt(t.quantity)})),n},total:function(t,a){var n=0;return a.items.forEach((function(t){var a=t.attributes.price?t.attributes.price:t.price;if(t.attributes.options&&t.attributes.options.length&&t.options&&t.options.length){var e=0;t.options.forEach((function(a){-1!==t.attributes.options.indexOf(a.id)&&(e+=parseInt(a.price))})),a+=e}n+=a*(!1===t.attributes.active?0:t.quantity)})),n},modal:function(t){return!1!==t.modal&&document.documentElement.classList[t.modal?"add":"remove"]("is-modal-open"),t.modal}},actions:{get:function(t,n){var e=t.commit;a.cart.items().then((function(t){e("items",t.data.items),t.data&&t.data.cross&&e("cross",t.data.cross),t.data&&t.data.bundles&&e("bundles",t.data.bundles),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},add:function(t,n){var c=t.commit,o=t.state;a.cart.add(n.product).then((function(t){t.data&&t.data.error&&t.data.message?e(t.data.message,{type:"error"}):(t.data&&t.data.items&&t.data.items.length?c("items",t.data.items):c("quantity",n.product),t.data&&t.data.cross&&c("cross",t.data.cross),t.data&&t.data.bundles&&c("bundles",t.data.bundles),o.modal||c("modal",!0),"function"==typeof n.callback&&n.callback())})).finally(n.finally)},options:function(t,n){var e=t.commit,c=t.state;a.cart.options(n.product).then((function(t){t.data&&t.data.items&&t.data.items.length&&e("items",t.data.items),c.modal||e("modal",!0),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},quantity:function(t,n){var e=t.commit;a.cart.quantity(n.product).then((function(){e("quantity",n.product),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},remove:function(t,n){var e=t.commit;a.cart.remove(n.id).then((function(t){e("remove",n.id),t.data&&t.data.cross&&e("cross",t.data.cross),t.data&&t.data.bundles&&e("bundles",t.data.bundles),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},clear:function(t,n){var e=t.commit;a.cart.clear(n.id).then((function(){e("clear"),"function"==typeof n.callback&&n.callback()})).finally(n.finally)}},mutations:{modal:function(t,a){t.modal=a},items:function(t,a){t.items=a},cross:function(t,a){t.cross=a},bundles:function(t,a){t.bundles=a},remove:function(t,a){t.items=t.items.filter((function(t){return t.id!==a}))},quantity:function(t,a){var n=t.items.find((function(t){return t.id===a.id}));n.quantity=a.exact?a.exact:n.quantity+a.quantity},clear:function(t){t.items=[],t.cross=[],t.bundles=[]}}};function o(t){if(null==t)throw new TypeError("Cannot destructure undefined")}var i=n.useToast(),l={user:{},modal:!1,account:[]},s={me:function(t){return t.user},account:function(t){return t.account},modal:function(t){return t.modal},is:function(t){return Object.keys(t.user).length>0}};t.watch((function(){return l.modal}),(function(t){!1!==t&&document.documentElement.classList[t?"add":"remove"]("is-modal-open")}),{immediate:!0});var r={me:function(t,a){t.user=Array.isArray(a.user)&&!a.user.length?{}:a.user,t.account=a.account},modal:function(t,a){t.modal=a}},u={namespaced:!0,state:{items:[],list:[],last:""},getters:{items:function(t){return t.items},item:function(t,a){return function(t){return-1!==a.items.indexOf(t)}},list:function(t){return t.list},last:function(t){return t.last}},actions:{get:function(t,n){var e=t.commit;a.wishlist.items().then((function(t){e("items",t.data.items),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},list:function(t,n){var e=t.commit;a.wishlist.list().then((function(t){e("list",t.data),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},toggle:function(t,n){var e=t.commit;t.state,a.wishlist.toggle(n.id).then((function(t){t.data&&t.data.items&&e("items",t.data.items),t.data&&t.data.last&&e("last",t.data.last),"function"==typeof n.callback&&n.callback()})).finally(n.finally)}},mutations:{items:function(t,a){t.items=a},list:function(t,a){t.list=a},last:function(t,a){t.last=a},remove:function(t,a){t.items=t.items.filter((function(t){return t.id!==a}))}}},f={namespaced:!0,state:{products:[],categories:[],list:[],last:"",modal:null},getters:{products:function(t){return t.products},categories:function(t){return t.categories},product:function(t,a){return function(t){return-1!==a.products.indexOf(t)}},list:function(t){return t.list},last:function(t){return t.last},modal:function(t){return t.modal}},actions:{get:function(t,n){var e=t.commit;a.compare.items().then((function(t){e("products",t.data.products),e("categories",t.data.categories),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},category:function(t,n){var e=t.commit;a.compare.category(n.slug).then((function(t){e("products",t.data.products),e("categories",t.data.categories),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},list:function(t,n){var e=t.commit;a.compare.list().then((function(t){e("list",t.data),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},toggle:function(t,n){var e=t.commit;t.state,a.compare.toggle(n.id).then((function(t){t.data&&(e("products",t.data.products),e("categories",t.data.categories),e("last",t.data.last)),"function"==typeof n.callback&&n.callback(t.data)})).finally(n.finally)},delete:function(t,n){t.commit,t.state,a.compare.delete(n.id).then((function(t){"function"==typeof n.callback&&n.callback(t.data)})).finally(n.finally)},modal:function(t,n){var e=t.commit;t.state,a.compare.modal(n.id).then((function(t){e("modal",t.data),"function"==typeof n.callback&&n.callback(t.data)})).finally(n.finally)}},mutations:{products:function(t,a){t.products=a},categories:function(t,a){t.categories=a},list:function(t,a){t.list=a},remove:function(t,a){t.products=t.products.filter((function(t){return t.id!==a}))},last:function(t,a){t.last=a},modal:function(t,a){t.modal=a}}},d={namespaced:!0,state:{modal:!1},getters:{modal:function(t){return t.modal}},mutations:{modal:function(t,a){!1!==t.modal&&document.documentElement.classList[a?"add":"remove"]("is-modal-open"),t.modal=a}}},m={namespaced:!0,state:{steps:{},current:1,modal:!1},getters:{steps:function(t){return t.steps},current:function(t){return t.current},modal:function(t){return t.modal}},mutations:{step:function(t,a){Number.isInteger(a)?t.current=a:a.data&&(t.steps[a.step]=a.data)},stepInit:function(t,a){t.steps[a.step]||(t.steps[a.step]=a.data)},reset:function(t){t.steps={},t.current=1},modal:function(t,a){t.modal=a}}},p={modules:{cart:c,auth:{namespaced:!0,state:l,getters:s,actions:{me:function(t,n){var e=t.commit;a.auth.me().then((function(t){e("me",t.data),t.data.flash&&t.data.flash.message&&(console.error(t.data.flash.message),i(t.data.flash.message,{type:t.data.flash.type?t.data.flash.type:"default"})),t.data.flash&&t.data.flash.modal&&e("modal",t.data.flash.modal),n&&"function"==typeof n.callback&&n.callback()})).finally(n&&n.finally?n.finally:function(){})},login:function(t,n){var e=t.commit,c=t.dispatch;a.auth.login(n.credentials).then((function(t){t.data.csrf_token&&($http.defaults.headers.common["X-CSRF-TOKEN"]=t.data.csrf_token,delete t.data.csrf_token),e("me",t.data),e("modal",null),c("cart/get",{finally:function(){}},{root:!0}),c("wishlist/get",{finally:function(){}},{root:!0}),window.localStorage&&window.localStorage.clear(),n&&"function"==typeof n.callback&&n.callback(t)})).catch((function(t){n&&"function"==typeof n.catch&&n.catch(t)})).finally(n.finally)},logout:function(t,n){var e=t.commit;a.auth.logout().then((function(){e("me",{user:{},account:[]}),e("wishlist/items",[],{root:!0}),window.localStorage&&window.localStorage.clear(),n&&"function"==typeof n.callback&&n.callback(),-1!==window.location.href.indexOf("/account")&&(window.location.href=$env.locale.url+"/")}))},reset:function(t,n){o(t),a.auth.reset(n.credentials).then((function(t){if(n&&"function"==typeof n.callback){var a=t.data&&t.data.message?t.data.message:"";n.callback(a,!1,t.data)}})).catch((function(t){n&&"function"==typeof n.callback&&t.response.data.errors&&t.response.data.errors.email&&n.callback(t.response.data.errors.email[0],!0)})).finally(n.finally)},resetSms:function(t,n){o(t),a.auth.resetSms(n.credentials).then((function(t){n&&"function"==typeof n.callback&&n.callback(t.data,!1)})).catch((function(t){n&&"function"==typeof n.callback&&t.response.data.error&&n.callback(t.response.data,!0)})).finally(n.finally)},passwordUpdate:function(t,n){o(t),a.auth.passwordUpdate(n.credentials).then((function(t){if(n&&"function"==typeof n.callback){var a=t.data&&t.data.message?t.data.message:"";n.callback(a)}})).catch((function(t){n&&"function"==typeof n.callback&&t.response.data.errors&&t.response.data.errors.email&&n.callback(t.response.data.errors.email[0],!0)})).finally(n.finally)},register:function(t,n){t.commit,a.auth["register"+n.type](n.credentials).then((function(t){n&&"function"==typeof n.callback&&n.callback(t)})).catch((function(t){n&&"function"==typeof n.catch&&n.catch(t)})).finally(n.finally)},update:function(t,n){t.commit,a.auth.update(n.credentials).then((function(t){n&&"function"==typeof n.callback&&n.callback()})).catch((function(t){n&&"function"==typeof n.catch&&n.catch(t)})).finally(n.finally)}},mutations:r},wishlist:u,compare:f,review:d,order:m,checkout:{namespaced:!0,state:{user:{},payment:null,shipping:null,shippingData:{},dontcall:!1,comment:""},getters:{user:function(t,a,n,e){return Object.keys(t.user).length?t.user:JSON.parse(JSON.stringify(e["auth/me"]))},shipping:function(t){return t.shipping},shippingData:function(t){return t.shippingData},payment:function(t){return t.payment},dontcall:function(t){return t.dontcall},comment:function(t){return t.comment}},mutations:{user:function(t,a){t.user=a},shipping:function(t,a){t.shipping=a},shippingData:function(t,a){t.shippingData=a},payment:function(t,a){t.payment=a},dontcall:function(t,a){t.dontcall=a},comment:function(t,a){t.comment=a},reset:function(t){t.user={},t.payment=null,t.shipping=null,t.shippingData={},t.dontcall=!1,t.comment=""}}}},strict:!1};module.exports=p;
|
|
1
|
+
"use strict";var t=require("vue"),a=require("@perevorot/shop/dist/api"),n=require("vue-toastification");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=e(require("js-cookie")),o=n.useToast(),i={namespaced:!0,state:{items:[],cross:[],bundles:[],modal:!1},getters:{items:function(t){return t.items},cross:function(t){return t.cross},bundles:function(t){return t.bundles},productQuantity:function(t,a){return function(t){var n=a.items.find((function(a){return a.id===t}));return n?n.quantity:0}},product:function(t,a){return function(t){var n=a.items.find((function(a){return a.id===t}));return n||null}},quantity:function(t,a){var n=0;return a.items.forEach((function(t){n+=parseInt(t.quantity)})),n},total:function(t,a){var n=0;return a.items.forEach((function(t){var a=t.attributes.price?t.attributes.price:t.price;if(t.attributes.options&&t.attributes.options.length&&t.options&&t.options.length){var e=0;t.options.forEach((function(a){-1!==t.attributes.options.indexOf(a.id)&&(e+=parseInt(a.price))})),a+=e}n+=a*(!1===t.attributes.active?0:t.quantity)})),n},modal:function(t){return!1!==t.modal&&document.documentElement.classList[t.modal?"add":"remove"]("is-modal-open"),t.modal}},actions:{get:function(t,n){var e=t.commit;a.cart.items().then((function(t){e("items",t.data.items),t.data&&t.data.cross&&e("cross",t.data.cross),t.data&&t.data.bundles&&e("bundles",t.data.bundles),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},add:function(t,n){var e=t.commit,c=t.state;a.cart.add(n.product).then((function(t){t.data&&t.data.error&&t.data.message?o(t.data.message,{type:"error"}):(t.data&&t.data.items&&t.data.items.length?e("items",t.data.items):e("quantity",n.product),t.data&&t.data.cross&&e("cross",t.data.cross),t.data&&t.data.bundles&&e("bundles",t.data.bundles),c.modal||e("modal",!0),"function"==typeof n.callback&&n.callback())})).finally(n.finally)},options:function(t,n){var e=t.commit,c=t.state;a.cart.options(n.product).then((function(t){t.data&&t.data.items&&t.data.items.length&&e("items",t.data.items),c.modal||e("modal",!0),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},quantity:function(t,n){var e=t.commit;a.cart.quantity(n.product).then((function(){e("quantity",n.product),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},remove:function(t,n){var e=t.commit;a.cart.remove(n.id).then((function(t){e("remove",n.id),t.data&&t.data.cross&&e("cross",t.data.cross),t.data&&t.data.bundles&&e("bundles",t.data.bundles),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},clear:function(t,n){var e=t.commit;a.cart.clear(n.id).then((function(){e("clear"),"function"==typeof n.callback&&n.callback()})).finally(n.finally)}},mutations:{modal:function(t,a){t.modal=a},items:function(t,a){t.items=a},cross:function(t,a){t.cross=a},bundles:function(t,a){t.bundles=a},remove:function(t,a){t.items=t.items.filter((function(t){return t.id!==a}))},quantity:function(t,a){var n=t.items.find((function(t){return t.id===a.id}));n.quantity=a.exact?a.exact:n.quantity+a.quantity},clear:function(t){t.items=[],t.cross=[],t.bundles=[]}}};function l(t){if(null==t)throw new TypeError("Cannot destructure undefined")}var s=n.useToast(),r={user:{},modal:!1,account:[]},u={me:function(t){return t.user},account:function(t){return t.account},modal:function(t){return t.modal},is:function(t){return Object.keys(t.user).length>0}};t.watch((function(){return r.modal}),(function(t){!1!==t&&document.documentElement.classList[t?"add":"remove"]("is-modal-open")}),{immediate:!0});var f={me:function(t,a){t.user=Array.isArray(a.user)&&!a.user.length?{}:a.user,t.account=a.account},modal:function(t,a){t.modal=a}},d={namespaced:!0,state:{items:[],list:[],last:""},getters:{items:function(t){return t.items},item:function(t,a){return function(t){return-1!==a.items.indexOf(t)}},list:function(t){return t.list},last:function(t){return t.last}},actions:{get:function(t,n){var e=t.commit;a.wishlist.items().then((function(t){e("items",t.data.items),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},list:function(t,n){var e=t.commit;a.wishlist.list().then((function(t){e("list",t.data),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},toggle:function(t,n){var e=t.commit;t.state,a.wishlist.toggle(n.id).then((function(t){t.data&&t.data.items&&e("items",t.data.items),t.data&&t.data.last&&e("last",t.data.last),"function"==typeof n.callback&&n.callback()})).finally(n.finally)}},mutations:{items:function(t,a){t.items=a},list:function(t,a){t.list=a},last:function(t,a){t.last=a},remove:function(t,a){t.items=t.items.filter((function(t){return t.id!==a}))}}},m={namespaced:!0,state:{products:[],categories:[],list:[],last:"",modal:null},getters:{products:function(t){return t.products},categories:function(t){return t.categories},product:function(t,a){return function(t){return-1!==a.products.indexOf(t)}},list:function(t){return t.list},last:function(t){return t.last},modal:function(t){return t.modal}},actions:{get:function(t,n){var e=t.commit;a.compare.items().then((function(t){e("products",t.data.products),e("categories",t.data.categories),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},category:function(t,n){var e=t.commit;a.compare.category(n.slug).then((function(t){e("products",t.data.products),e("categories",t.data.categories),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},list:function(t,n){var e=t.commit;a.compare.list().then((function(t){e("list",t.data),"function"==typeof n.callback&&n.callback()})).finally(n.finally)},toggle:function(t,n){var e=t.commit;t.state,a.compare.toggle(n.id).then((function(t){t.data&&(e("products",t.data.products),e("categories",t.data.categories),e("last",t.data.last)),"function"==typeof n.callback&&n.callback(t.data)})).finally(n.finally)},delete:function(t,n){t.commit,t.state,a.compare.delete(n.id).then((function(t){"function"==typeof n.callback&&n.callback(t.data)})).finally(n.finally)},modal:function(t,n){var e=t.commit;t.state,a.compare.modal(n.id).then((function(t){e("modal",t.data),"function"==typeof n.callback&&n.callback(t.data)})).finally(n.finally)}},mutations:{products:function(t,a){t.products=a},categories:function(t,a){t.categories=a},list:function(t,a){t.list=a},remove:function(t,a){t.products=t.products.filter((function(t){return t.id!==a}))},last:function(t,a){t.last=a},modal:function(t,a){t.modal=a}}},p={namespaced:!0,state:{modal:!1},getters:{modal:function(t){return t.modal}},mutations:{modal:function(t,a){!1!==t.modal&&document.documentElement.classList[a?"add":"remove"]("is-modal-open"),t.modal=a}}},y={namespaced:!0,state:{steps:{},current:1,modal:!1},getters:{steps:function(t){return t.steps},current:function(t){return t.current},modal:function(t){return t.modal}},mutations:{step:function(t,a){Number.isInteger(a)?t.current=a:a.data&&(t.steps[a.step]=a.data)},stepInit:function(t,a){t.steps[a.step]||(t.steps[a.step]=a.data)},reset:function(t){t.steps={},t.current=1},modal:function(t,a){t.modal=a}}},h={modules:{cart:i,auth:{namespaced:!0,state:r,getters:u,actions:{me:function(t,n){var e=t.commit;a.auth.me().then((function(t){e("me",t.data),t.data.flash&&t.data.flash.message&&(console.error(t.data.flash.message),s(t.data.flash.message,{type:t.data.flash.type?t.data.flash.type:"default"})),t.data.flash&&t.data.flash.modal&&e("modal",t.data.flash.modal),n&&"function"==typeof n.callback&&n.callback()})).finally(n&&n.finally?n.finally:function(){})},login:function(t,n){var e=t.commit,c=t.dispatch;a.auth.login(n.credentials).then((function(t){t.data.csrf_token&&($http.defaults.headers.common["X-CSRF-TOKEN"]=t.data.csrf_token,delete t.data.csrf_token),e("me",t.data),e("modal",null),c("cart/get",{finally:function(){}},{root:!0}),c("wishlist/get",{finally:function(){}},{root:!0}),window.localStorage&&window.localStorage.clear(),n&&"function"==typeof n.callback&&n.callback(t)})).catch((function(t){n&&"function"==typeof n.catch&&n.catch(t)})).finally(n.finally)},logout:function(t,n){var e=t.commit;a.auth.logout().then((function(){e("me",{user:{},account:[]}),e("wishlist/items",[],{root:!0}),window.localStorage&&window.localStorage.clear(),c.default.remove("user_id"),n&&"function"==typeof n.callback&&n.callback(),-1!==window.location.href.indexOf("/account")&&(window.location.href=$env.locale.url+"/")}))},reset:function(t,n){l(t),a.auth.reset(n.credentials).then((function(t){if(n&&"function"==typeof n.callback){var a=t.data&&t.data.message?t.data.message:"";n.callback(a,!1,t.data)}})).catch((function(t){n&&"function"==typeof n.callback&&t.response.data.errors&&t.response.data.errors.email&&n.callback(t.response.data.errors.email[0],!0)})).finally(n.finally)},resetSms:function(t,n){l(t),a.auth.resetSms(n.credentials).then((function(t){n&&"function"==typeof n.callback&&n.callback(t.data,!1)})).catch((function(t){n&&"function"==typeof n.callback&&t.response.data.error&&n.callback(t.response.data,!0)})).finally(n.finally)},passwordUpdate:function(t,n){l(t),a.auth.passwordUpdate(n.credentials).then((function(t){if(n&&"function"==typeof n.callback){var a=t.data&&t.data.message?t.data.message:"";n.callback(a)}})).catch((function(t){n&&"function"==typeof n.callback&&t.response.data.errors&&t.response.data.errors.email&&n.callback(t.response.data.errors.email[0],!0)})).finally(n.finally)},register:function(t,n){t.commit,a.auth["register"+n.type](n.credentials).then((function(t){n&&"function"==typeof n.callback&&n.callback(t)})).catch((function(t){n&&"function"==typeof n.catch&&n.catch(t)})).finally(n.finally)},update:function(t,n){t.commit,a.auth.update(n.credentials).then((function(t){n&&"function"==typeof n.callback&&n.callback()})).catch((function(t){n&&"function"==typeof n.catch&&n.catch(t)})).finally(n.finally)}},mutations:f},wishlist:d,compare:m,review:p,order:y,checkout:{namespaced:!0,state:{user:{},payment:null,shipping:null,shippingData:{},dontcall:!1,comment:""},getters:{user:function(t,a,n,e){return Object.keys(t.user).length?t.user:JSON.parse(JSON.stringify(e["auth/me"]))},shipping:function(t){return t.shipping},shippingData:function(t){return t.shippingData},payment:function(t){return t.payment},dontcall:function(t){return t.dontcall},comment:function(t){return t.comment}},mutations:{user:function(t,a){t.user=a},shipping:function(t,a){t.shipping=a},shippingData:function(t,a){t.shippingData=a},payment:function(t,a){t.payment=a},dontcall:function(t,a){t.dontcall=a},comment:function(t,a){t.comment=a},reset:function(t){t.user={},t.payment=null,t.shipping=null,t.shippingData={},t.dontcall=!1,t.comment=""}}}},strict:!1};module.exports=h;
|
|
2
2
|
//# sourceMappingURL=store.js.map
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sources":["../src/store/modules/cart.js","../src/store/modules/auth.js","../src/store/modules/wishlist.js","../src/store/modules/compare.js","../src/store/modules/review.js","../src/store/modules/order.js","../src/store/index.js","../src/store/modules/checkout.js"],"sourcesContent":["import { watch } from 'vue';\n\nimport { cart as api } from '@perevorot/shop/dist/api';\nimport { useToast } from 'vue-toastification';\nconst toast = useToast();\n\nconst state = {\n items: [],\n cross: [],\n bundles: [],\n modal: false,\n};\n\nconst getters = {\n items: (state) => {\n return state.items;\n },\n\n cross: (state) => {\n return state.cross;\n },\n\n bundles: (state) => {\n return state.bundles;\n },\n\n productQuantity: (state, getters) => (id) => {\n const product = getters.items.find((product) => product.id === id);\n\n return product ? product.quantity : 0;\n },\n\n quantity: (state, getters) => {\n let count = 0;\n\n getters.items.forEach((item) => {\n count += parseInt(item.quantity);\n });\n\n return count;\n },\n\n total: (state, getters) => {\n let total = 0;\n\n getters.items.forEach((item) => {\n let price = item.attributes.price ? item.attributes.price : item.price;\n\n if (item.attributes.options && item.attributes.options.length && item.options && item.options.length) {\n let optionsPrice = 0;\n\n item.options.forEach((option) => {\n if (item.attributes.options.indexOf(option.id) !== -1) {\n optionsPrice += parseInt(option.price);\n }\n });\n\n price += optionsPrice;\n }\n\n total += price * (item.attributes.active === false ? 0 : item.quantity);\n });\n\n return total;\n },\n\n modal: (state) => {\n //initial state\n if (state.modal !== false) {\n document.documentElement.classList[state.modal ? 'add' : 'remove']('is-modal-open');\n }\n\n return state.modal;\n },\n};\n\nconst actions = {\n get({ commit }, data) {\n api.items()\n .then((response) => {\n commit('items', response.data.items);\n\n if (response.data && response.data.cross) {\n commit('cross', response.data.cross);\n }\n\n if (response.data && response.data.bundles) {\n commit('bundles', response.data.bundles);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n add({ commit, state }, data) {\n api.add(data.product)\n .then((response) => {\n if (response.data && response.data.error && response.data.message) {\n toast(response.data.message, {\n type: 'error',\n });\n } else {\n if (response.data && response.data.items && response.data.items.length) {\n commit('items', response.data.items);\n } else {\n commit('quantity', data.product);\n }\n\n if (response.data && response.data.cross) {\n commit('cross', response.data.cross);\n }\n\n if (response.data && response.data.bundles) {\n commit('bundles', response.data.bundles);\n }\n\n if (!state.modal) {\n commit('modal', true);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n }\n })\n .finally(data.finally);\n },\n\n options({ commit, state }, data) {\n api.options(data.product)\n .then((response) => {\n if (response.data && response.data.items && response.data.items.length) {\n commit('items', response.data.items);\n }\n\n if (!state.modal) {\n commit('modal', true);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n quantity({ commit }, data) {\n api.quantity(data.product)\n .then(() => {\n commit('quantity', data.product);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n remove({ commit }, data) {\n api.remove(data.id)\n .then((response) => {\n commit('remove', data.id);\n\n if (response.data && response.data.cross) {\n commit('cross', response.data.cross);\n }\n\n if (response.data && response.data.bundles) {\n commit('bundles', response.data.bundles);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n clear({ commit }, data) {\n api.clear(data.id)\n .then(() => {\n commit('clear');\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n};\n\nconst mutations = {\n modal(state, action) {\n state.modal = action;\n },\n\n items(state, items) {\n state.items = items;\n },\n\n cross(state, cross) {\n state.cross = cross;\n },\n\n bundles(state, bundles) {\n state.bundles = bundles;\n },\n\n remove(state, id) {\n state.items = state.items.filter((item) => item.id !== id);\n },\n\n quantity(state, item) {\n const product = state.items.find((product) => product.id === item.id);\n\n product.quantity = item.exact ? item.exact : product.quantity + item.quantity;\n },\n\n clear(state) {\n state.items = [];\n state.cross = [];\n state.bundles = [];\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations,\n};\n","import { watch } from 'vue';\nimport { auth as api } from '@perevorot/shop/dist/api';\n// import {\n// useGlobalToast as useToast\n// } from \"@/global/toast\";\nimport { useToast } from 'vue-toastification';\nconst toast = useToast();\n\nconst state = {\n user: {},\n modal: false,\n account: [],\n};\n\nconst getters = {\n me: (state) => {\n return state.user;\n },\n account: (state) => {\n return state.account;\n },\n modal: (state) => {\n //initial state\n // if (state.modal !== false) {\n // document.documentElement.classList[state.modal ? 'add' : 'remove']('is-modal-open');\n // }\n\n return state.modal;\n },\n is: (state) => {\n return Object.keys(state.user).length > 0;\n },\n};\n\nwatch(\n () => state.modal,\n (modal) => {\n if (modal !== false) {\n document.documentElement.classList[modal ? 'add' : 'remove']('is-modal-open');\n }\n },\n {\n immediate: true,\n }\n);\n\nconst actions = {\n me({ commit }, data) {\n api.me()\n .then((response) => {\n commit('me', response.data);\n\n if (response.data.flash && response.data.flash.message) {\n console.error(response.data.flash.message);\n\n toast(response.data.flash.message, {\n type: response.data.flash.type ? response.data.flash.type : 'default',\n });\n }\n\n if (response.data.flash && response.data.flash.modal) {\n commit('modal', response.data.flash.modal);\n }\n\n if (data && typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data && data.finally ? data.finally : () => {});\n },\n login({ commit, dispatch }, data) {\n api.login(data.credentials)\n .then((response) => {\n if (response.data.csrf_token) {\n $http.defaults.headers.common['X-CSRF-TOKEN'] = response.data.csrf_token;\n\n delete response.data.csrf_token;\n }\n\n commit('me', response.data);\n commit('modal', null);\n\n dispatch(\n 'cart/get',\n {\n finally: () => {},\n },\n {\n root: true,\n }\n );\n\n dispatch(\n 'wishlist/get',\n {\n finally: () => {},\n },\n {\n root: true,\n }\n );\n\n if (window.localStorage) {\n window.localStorage.clear();\n }\n\n if (data && typeof data.callback == 'function') {\n data.callback(response);\n }\n })\n .catch((error) => {\n if (data && typeof data.catch == 'function') {\n data.catch(error);\n }\n })\n .finally(data.finally);\n },\n logout({ commit }, data) {\n api.logout().then(() => {\n commit('me', {\n user: {},\n account: [],\n });\n\n commit('wishlist/items', [], {\n root: true,\n });\n\n if (window.localStorage) {\n window.localStorage.clear();\n }\n\n if (data && typeof data.callback == 'function') {\n data.callback();\n }\n\n if (window.location.href.indexOf('/account') !== -1) {\n window.location.href = $env.locale.url + '/';\n }\n });\n },\n reset({}, data) {\n api.reset(data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n const message = response.data && response.data.message ? response.data.message : '';\n\n data.callback(message, false, response.data);\n }\n })\n .catch((error) => {\n if (data && typeof data.callback == 'function') {\n if (error.response.data.errors && error.response.data.errors.email) {\n data.callback(error.response.data.errors.email[0], true);\n }\n }\n })\n .finally(data.finally);\n },\n resetSms({}, data) {\n api.resetSms(data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n data.callback(response.data, false);\n }\n })\n .catch((error) => {\n if (data && typeof data.callback == 'function') {\n if (error.response.data.error) {\n data.callback(error.response.data, true);\n }\n }\n })\n .finally(data.finally);\n },\n passwordUpdate({}, data) {\n api.passwordUpdate(data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n const message = response.data && response.data.message ? response.data.message : '';\n\n data.callback(message);\n }\n })\n .catch((error) => {\n if (data && typeof data.callback == 'function') {\n if (error.response.data.errors && error.response.data.errors.email) {\n data.callback(error.response.data.errors.email[0], true);\n }\n }\n })\n .finally(data.finally);\n },\n register({ commit }, data) {\n api['register' + data.type](data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n data.callback(response);\n }\n })\n .catch((error) => {\n if (data && typeof data.catch == 'function') {\n data.catch(error);\n }\n })\n .finally(data.finally);\n },\n update({ commit }, data) {\n api['update'](data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n data.callback();\n }\n })\n .catch((error) => {\n if (data && typeof data.catch == 'function') {\n data.catch(error);\n }\n })\n .finally(data.finally);\n },\n};\n\nconst mutations = {\n me(state, me) {\n state.user = Array.isArray(me.user) && !me.user.length ? {} : me.user;\n state.account = me.account;\n },\n modal(state, action) {\n state.modal = action;\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations,\n};\n","import {\n wishlist as api\n} from '@perevorot/shop/dist/api'\n\nconst state = {\n items: [],\n list: [],\n last: ''\n}\n\nconst getters = {\n items: (state) => {\n return state.items;\n },\n item: (state, getters) => (id) => {\n return getters.items.indexOf(id) !== -1;\n },\n list: (state) => {\n return state.list;\n },\n // badge: (state) => {\n // return state.items.length;\n // },\n last: (state) => {\n return state.last;\n },\n}\n\nconst actions = {\n get({\n commit,\n }, data) {\n api.items().then((response) => {\n commit('items', response.data.items);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n }).finally(data.finally);\n },\n\n list({\n commit,\n }, data) {\n api.list().then((response) => {\n commit('list', response.data);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n }).finally(data.finally);\n },\n\n toggle({\n commit,\n state\n }, data) {\n api.toggle(data.id).then((response) => {\n if (response.data && response.data.items) {\n commit('items', response.data.items);\n }\n\n if (response.data && response.data.last) {\n commit('last', response.data.last);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n }).finally(data.finally);\n },\n}\n\nconst mutations = {\n items(state, items) {\n state.items = items;\n },\n\n list(state, list) {\n state.list = list;\n },\n\n last(state, last) {\n state.last = last;\n },\n\n remove(state, id) {\n state.items = state.items.filter(item => item.id !== id);\n },\n}\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations\n}","import { compare as api } from '@perevorot/shop/dist/api';\n\nconst state = {\n products: [],\n categories: [],\n list: [],\n last: '',\n modal: null,\n};\n\nconst getters = {\n products: (state) => {\n return state.products;\n },\n categories: (state) => {\n return state.categories;\n },\n product: (state, getters) => (id) => {\n return getters.products.indexOf(id) !== -1;\n },\n list: (state) => {\n return state.list;\n },\n last: (state) => {\n return state.last;\n },\n modal: (state) => {\n return state.modal;\n },\n};\n\nconst actions = {\n get({ commit }, data) {\n api.items()\n .then((response) => {\n commit('products', response.data.products);\n commit('categories', response.data.categories);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n category({ commit }, data) {\n api.category(data.slug)\n .then((response) => {\n commit('products', response.data.products);\n commit('categories', response.data.categories);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n list({ commit }, data) {\n api.list()\n .then((response) => {\n commit('list', response.data);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n toggle({ commit, state }, data) {\n api.toggle(data.id)\n .then((response) => {\n if (response.data) {\n commit('products', response.data.products);\n commit('categories', response.data.categories);\n commit('last', response.data.last);\n }\n\n if (typeof data.callback == 'function') {\n data.callback(response.data);\n }\n })\n .finally(data.finally);\n },\n\n delete({ commit, state }, data) {\n api.delete(data.id)\n .then((response) => {\n if (typeof data.callback == 'function') {\n data.callback(response.data);\n }\n })\n .finally(data.finally);\n },\n\n modal({ commit, state }, data) {\n api.modal(data.id)\n .then((response) => {\n commit('modal', response.data);\n\n if (typeof data.callback == 'function') {\n data.callback(response.data);\n }\n })\n .finally(data.finally);\n },\n};\n\nconst mutations = {\n products(state, products) {\n state.products = products;\n },\n\n categories(state, categories) {\n state.categories = categories;\n },\n\n list(state, list) {\n state.list = list;\n },\n\n remove(state, id) {\n state.products = state.products.filter((item) => item.id !== id);\n },\n\n last(state, last) {\n state.last = last;\n },\n\n modal(state, modal) {\n state.modal = modal;\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations,\n};\n","const state = {\n modal: false,\n};\n\nconst getters = {\n modal: (state) => {\n return state.modal;\n },\n};\n\nconst mutations = {\n modal(state, action) {\n //initial state\n if (state.modal !== false) {\n document.documentElement.classList[action ? 'add' : 'remove']('is-modal-open');\n }\n\n state.modal = action;\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n mutations,\n};\n","const state = {\n steps: {},\n current: 1,\n modal: false,\n}\n\nconst getters = {\n steps: (state) => {\n return state.steps;\n },\n current: (state) => {\n return state.current;\n },\n modal: (state) => {\n return state.modal;\n }\n}\n\nconst mutations = {\n step(state, data) {\n if (Number.isInteger(data)) {\n state.current = data;\n } else {\n if (data.data) {\n state.steps[data.step] = data.data;\n }\n }\n },\n stepInit(state, data) {\n if (!state.steps[data.step]) {\n state.steps[data.step] = data.data;\n }\n },\n reset(state) {\n state.steps = {};\n state.current = 1;\n },\n modal(state, action) {\n state.modal = action;\n },\n}\n\nexport default {\n namespaced: true,\n state,\n getters,\n mutations\n}","import cart from './modules/cart';\nimport auth from './modules/auth';\nimport wishlist from './modules/wishlist';\nimport compare from './modules/compare';\nimport review from './modules/review';\nimport order from './modules/order';\nimport checkout from './modules/checkout';\n\nexport default {\n modules: {\n cart,\n auth,\n wishlist,\n compare,\n review,\n order,\n checkout,\n },\n strict: false,\n};","const state = {\n user: {},\n payment: null,\n shipping: null,\n shippingData: {},\n dontcall: false,\n comment: '',\n};\n\nconst getters = {\n user: (state, getters, rootState, rootGetters) => {\n return Object.keys(state.user).length ? state.user : JSON.parse(JSON.stringify(rootGetters['auth/me']));\n },\n shipping: (state) => {\n return state.shipping;\n },\n shippingData: (state) => {\n return state.shippingData;\n },\n payment: (state) => {\n return state.payment;\n },\n dontcall: (state) => {\n return state.dontcall;\n },\n comment: (state) => {\n return state.comment;\n },\n};\n\nconst mutations = {\n user(state, data) {\n state.user = data;\n },\n shipping(state, data) {\n state.shipping = data;\n },\n shippingData(state, data) {\n state.shippingData = data;\n },\n payment(state, data) {\n state.payment = data;\n },\n dontcall(state, data) {\n state.dontcall = data;\n },\n comment(state, data) {\n state.comment = data;\n },\n reset(state) {\n state.user = {};\n state.payment = null;\n state.shipping = null;\n state.shippingData = {};\n state.dontcall = false;\n state.comment = '';\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n mutations,\n};\n"],"names":["toast","useToast","namespaced","state","items","cross","bundles","modal","getters","productQuantity","id","product","find","quantity","count","forEach","item","parseInt","total","price","attributes","options","length","optionsPrice","option","indexOf","active","document","documentElement","classList","actions","get","data","commit","api","then","response","callback","add","error","message","type","remove","clear","mutations","action","filter","exact","user","account","me","is","Object","keys","watch","immediate","Array","isArray","list","last","toggle","products","categories","category","slug","steps","current","step","Number","isInteger","stepInit","reset","modules","cart","auth","flash","console","login","dispatch","credentials","csrf_token","$http","defaults","headers","common","root","window","localStorage","logout","location","href","$env","locale","url","errors","email","resetSms","passwordUpdate","register","update","wishlist","compare","review","order","checkout","payment","shipping","shippingData","dontcall","comment","rootState","rootGetters","JSON","parse","stringify","strict"],"mappings":"wGAIMA,EAAQC,eAgOC,CACXC,YAAY,EACZC,MAhOU,CACVC,MAAO,GACPC,MAAO,GACPC,QAAS,GACTC,OAAO,GA6NPC,QA1NY,CACZJ,MAAO,SAACD,UACGA,EAAMC,OAGjBC,MAAO,SAACF,UACGA,EAAME,OAGjBC,QAAS,SAACH,UACCA,EAAMG,SAGjBG,gBAAiB,SAACN,EAAOK,UAAY,SAACE,OAC5BC,EAAUH,EAAQJ,MAAMQ,MAAK,SAACD,UAAYA,EAAQD,KAAOA,YAExDC,EAAUA,EAAQE,SAAW,IAGxCA,SAAU,SA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AM6C,KAAO,GACb7C,EAAMsG,QAAU,KAChBtG,EAAMuG,SAAW,KACjBvG,EAAMwG,aAAe,GACrBxG,EAAMyG,UAAW,EACjBzG,EAAM0G,QAAU,ODrCpBM,QAAQ"}
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../src/store/modules/cart.js","../src/store/modules/auth.js","../src/store/modules/wishlist.js","../src/store/modules/compare.js","../src/store/modules/review.js","../src/store/modules/order.js","../src/store/index.js","../src/store/modules/checkout.js"],"sourcesContent":["import { watch } from 'vue';\n\nimport { cart as api } from '@perevorot/shop/dist/api';\nimport { useToast } from 'vue-toastification';\nconst toast = useToast();\n\nconst state = {\n items: [],\n cross: [],\n bundles: [],\n modal: false,\n};\n\nconst getters = {\n items: (state) => {\n return state.items;\n },\n\n cross: (state) => {\n return state.cross;\n },\n\n bundles: (state) => {\n return state.bundles;\n },\n\n productQuantity: (state, getters) => (id) => {\n const product = getters.items.find((product) => product.id === id);\n\n return product ? product.quantity : 0;\n },\n\n product: (state, getters) => (id) => {\n const product = getters.items.find((product) => product.id === id);\n\n return product ? product : null;\n },\n\n quantity: (state, getters) => {\n let count = 0;\n\n getters.items.forEach((item) => {\n count += parseInt(item.quantity);\n });\n\n return count;\n },\n\n total: (state, getters) => {\n let total = 0;\n\n getters.items.forEach((item) => {\n let price = item.attributes.price ? item.attributes.price : item.price;\n\n if (item.attributes.options && item.attributes.options.length && item.options && item.options.length) {\n let optionsPrice = 0;\n\n item.options.forEach((option) => {\n if (item.attributes.options.indexOf(option.id) !== -1) {\n optionsPrice += parseInt(option.price);\n }\n });\n\n price += optionsPrice;\n }\n\n total += price * (item.attributes.active === false ? 0 : item.quantity);\n });\n\n return total;\n },\n\n modal: (state) => {\n //initial state\n if (state.modal !== false) {\n document.documentElement.classList[state.modal ? 'add' : 'remove']('is-modal-open');\n }\n\n return state.modal;\n },\n};\n\nconst actions = {\n get({ commit }, data) {\n api.items()\n .then((response) => {\n commit('items', response.data.items);\n\n if (response.data && response.data.cross) {\n commit('cross', response.data.cross);\n }\n\n if (response.data && response.data.bundles) {\n commit('bundles', response.data.bundles);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n add({ commit, state }, data) {\n api.add(data.product)\n .then((response) => {\n if (response.data && response.data.error && response.data.message) {\n toast(response.data.message, {\n type: 'error',\n });\n } else {\n if (response.data && response.data.items && response.data.items.length) {\n commit('items', response.data.items);\n } else {\n commit('quantity', data.product);\n }\n\n if (response.data && response.data.cross) {\n commit('cross', response.data.cross);\n }\n\n if (response.data && response.data.bundles) {\n commit('bundles', response.data.bundles);\n }\n\n if (!state.modal) {\n commit('modal', true);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n }\n })\n .finally(data.finally);\n },\n\n options({ commit, state }, data) {\n api.options(data.product)\n .then((response) => {\n if (response.data && response.data.items && response.data.items.length) {\n commit('items', response.data.items);\n }\n\n if (!state.modal) {\n commit('modal', true);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n quantity({ commit }, data) {\n api.quantity(data.product)\n .then(() => {\n commit('quantity', data.product);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n remove({ commit }, data) {\n api.remove(data.id)\n .then((response) => {\n commit('remove', data.id);\n\n if (response.data && response.data.cross) {\n commit('cross', response.data.cross);\n }\n\n if (response.data && response.data.bundles) {\n commit('bundles', response.data.bundles);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n clear({ commit }, data) {\n api.clear(data.id)\n .then(() => {\n commit('clear');\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n};\n\nconst mutations = {\n modal(state, action) {\n state.modal = action;\n },\n\n items(state, items) {\n state.items = items;\n },\n\n cross(state, cross) {\n state.cross = cross;\n },\n\n bundles(state, bundles) {\n state.bundles = bundles;\n },\n\n remove(state, id) {\n state.items = state.items.filter((item) => item.id !== id);\n },\n\n quantity(state, item) {\n const product = state.items.find((product) => product.id === item.id);\n\n product.quantity = item.exact ? item.exact : product.quantity + item.quantity;\n },\n\n clear(state) {\n state.items = [];\n state.cross = [];\n state.bundles = [];\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations,\n};\n","import { watch } from 'vue';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport Cookies from 'js-cookie';\n// import {\n// useGlobalToast as useToast\n// } from \"@/global/toast\";\nimport { useToast } from 'vue-toastification';\nconst toast = useToast();\n\nconst state = {\n user: {},\n modal: false,\n account: [],\n};\n\nconst getters = {\n me: (state) => {\n return state.user;\n },\n account: (state) => {\n return state.account;\n },\n modal: (state) => {\n //initial state\n // if (state.modal !== false) {\n // document.documentElement.classList[state.modal ? 'add' : 'remove']('is-modal-open');\n // }\n\n return state.modal;\n },\n is: (state) => {\n return Object.keys(state.user).length > 0;\n },\n};\n\nwatch(\n () => state.modal,\n (modal) => {\n if (modal !== false) {\n document.documentElement.classList[modal ? 'add' : 'remove']('is-modal-open');\n }\n },\n {\n immediate: true,\n }\n);\n\nconst actions = {\n me({ commit }, data) {\n api.me()\n .then((response) => {\n commit('me', response.data);\n\n if (response.data.flash && response.data.flash.message) {\n console.error(response.data.flash.message);\n\n toast(response.data.flash.message, {\n type: response.data.flash.type ? response.data.flash.type : 'default',\n });\n }\n\n if (response.data.flash && response.data.flash.modal) {\n commit('modal', response.data.flash.modal);\n }\n\n if (data && typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data && data.finally ? data.finally : () => {});\n },\n login({ commit, dispatch }, data) {\n api.login(data.credentials)\n .then((response) => {\n if (response.data.csrf_token) {\n $http.defaults.headers.common['X-CSRF-TOKEN'] = response.data.csrf_token;\n\n delete response.data.csrf_token;\n }\n\n commit('me', response.data);\n commit('modal', null);\n\n dispatch(\n 'cart/get',\n {\n finally: () => {},\n },\n {\n root: true,\n }\n );\n\n dispatch(\n 'wishlist/get',\n {\n finally: () => {},\n },\n {\n root: true,\n }\n );\n\n if (window.localStorage) {\n window.localStorage.clear();\n }\n\n if (data && typeof data.callback == 'function') {\n data.callback(response);\n }\n })\n .catch((error) => {\n if (data && typeof data.catch == 'function') {\n data.catch(error);\n }\n })\n .finally(data.finally);\n },\n logout({ commit }, data) {\n api.logout().then(() => {\n commit('me', {\n user: {},\n account: [],\n });\n\n commit('wishlist/items', [], {\n root: true,\n });\n\n if (window.localStorage) {\n window.localStorage.clear();\n }\n\n Cookies.remove('user_id');\n\n if (data && typeof data.callback == 'function') {\n data.callback();\n }\n\n if (window.location.href.indexOf('/account') !== -1) {\n window.location.href = $env.locale.url + '/';\n }\n });\n },\n reset({}, data) {\n api.reset(data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n const message = response.data && response.data.message ? response.data.message : '';\n\n data.callback(message, false, response.data);\n }\n })\n .catch((error) => {\n if (data && typeof data.callback == 'function') {\n if (error.response.data.errors && error.response.data.errors.email) {\n data.callback(error.response.data.errors.email[0], true);\n }\n }\n })\n .finally(data.finally);\n },\n resetSms({}, data) {\n api.resetSms(data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n data.callback(response.data, false);\n }\n })\n .catch((error) => {\n if (data && typeof data.callback == 'function') {\n if (error.response.data.error) {\n data.callback(error.response.data, true);\n }\n }\n })\n .finally(data.finally);\n },\n passwordUpdate({}, data) {\n api.passwordUpdate(data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n const message = response.data && response.data.message ? response.data.message : '';\n\n data.callback(message);\n }\n })\n .catch((error) => {\n if (data && typeof data.callback == 'function') {\n if (error.response.data.errors && error.response.data.errors.email) {\n data.callback(error.response.data.errors.email[0], true);\n }\n }\n })\n .finally(data.finally);\n },\n register({ commit }, data) {\n api['register' + data.type](data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n data.callback(response);\n }\n })\n .catch((error) => {\n if (data && typeof data.catch == 'function') {\n data.catch(error);\n }\n })\n .finally(data.finally);\n },\n update({ commit }, data) {\n api['update'](data.credentials)\n .then((response) => {\n if (data && typeof data.callback == 'function') {\n data.callback();\n }\n })\n .catch((error) => {\n if (data && typeof data.catch == 'function') {\n data.catch(error);\n }\n })\n .finally(data.finally);\n },\n};\n\nconst mutations = {\n me(state, me) {\n state.user = Array.isArray(me.user) && !me.user.length ? {} : me.user;\n state.account = me.account;\n },\n modal(state, action) {\n state.modal = action;\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations,\n};\n","import {\n wishlist as api\n} from '@perevorot/shop/dist/api'\n\nconst state = {\n items: [],\n list: [],\n last: ''\n}\n\nconst getters = {\n items: (state) => {\n return state.items;\n },\n item: (state, getters) => (id) => {\n return getters.items.indexOf(id) !== -1;\n },\n list: (state) => {\n return state.list;\n },\n // badge: (state) => {\n // return state.items.length;\n // },\n last: (state) => {\n return state.last;\n },\n}\n\nconst actions = {\n get({\n commit,\n }, data) {\n api.items().then((response) => {\n commit('items', response.data.items);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n }).finally(data.finally);\n },\n\n list({\n commit,\n }, data) {\n api.list().then((response) => {\n commit('list', response.data);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n }).finally(data.finally);\n },\n\n toggle({\n commit,\n state\n }, data) {\n api.toggle(data.id).then((response) => {\n if (response.data && response.data.items) {\n commit('items', response.data.items);\n }\n\n if (response.data && response.data.last) {\n commit('last', response.data.last);\n }\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n }).finally(data.finally);\n },\n}\n\nconst mutations = {\n items(state, items) {\n state.items = items;\n },\n\n list(state, list) {\n state.list = list;\n },\n\n last(state, last) {\n state.last = last;\n },\n\n remove(state, id) {\n state.items = state.items.filter(item => item.id !== id);\n },\n}\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations\n}","import { compare as api } from '@perevorot/shop/dist/api';\n\nconst state = {\n products: [],\n categories: [],\n list: [],\n last: '',\n modal: null,\n};\n\nconst getters = {\n products: (state) => {\n return state.products;\n },\n categories: (state) => {\n return state.categories;\n },\n product: (state, getters) => (id) => {\n return getters.products.indexOf(id) !== -1;\n },\n list: (state) => {\n return state.list;\n },\n last: (state) => {\n return state.last;\n },\n modal: (state) => {\n return state.modal;\n },\n};\n\nconst actions = {\n get({ commit }, data) {\n api.items()\n .then((response) => {\n commit('products', response.data.products);\n commit('categories', response.data.categories);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n category({ commit }, data) {\n api.category(data.slug)\n .then((response) => {\n commit('products', response.data.products);\n commit('categories', response.data.categories);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n list({ commit }, data) {\n api.list()\n .then((response) => {\n commit('list', response.data);\n\n if (typeof data.callback == 'function') {\n data.callback();\n }\n })\n .finally(data.finally);\n },\n\n toggle({ commit, state }, data) {\n api.toggle(data.id)\n .then((response) => {\n if (response.data) {\n commit('products', response.data.products);\n commit('categories', response.data.categories);\n commit('last', response.data.last);\n }\n\n if (typeof data.callback == 'function') {\n data.callback(response.data);\n }\n })\n .finally(data.finally);\n },\n\n delete({ commit, state }, data) {\n api.delete(data.id)\n .then((response) => {\n if (typeof data.callback == 'function') {\n data.callback(response.data);\n }\n })\n .finally(data.finally);\n },\n\n modal({ commit, state }, data) {\n api.modal(data.id)\n .then((response) => {\n commit('modal', response.data);\n\n if (typeof data.callback == 'function') {\n data.callback(response.data);\n }\n })\n .finally(data.finally);\n },\n};\n\nconst mutations = {\n products(state, products) {\n state.products = products;\n },\n\n categories(state, categories) {\n state.categories = categories;\n },\n\n list(state, list) {\n state.list = list;\n },\n\n remove(state, id) {\n state.products = state.products.filter((item) => item.id !== id);\n },\n\n last(state, last) {\n state.last = last;\n },\n\n modal(state, modal) {\n state.modal = modal;\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations,\n};\n","const state = {\n modal: false,\n};\n\nconst getters = {\n modal: (state) => {\n return state.modal;\n },\n};\n\nconst mutations = {\n modal(state, action) {\n //initial state\n if (state.modal !== false) {\n document.documentElement.classList[action ? 'add' : 'remove']('is-modal-open');\n }\n\n state.modal = action;\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n mutations,\n};\n","const state = {\n steps: {},\n current: 1,\n modal: false,\n}\n\nconst getters = {\n steps: (state) => {\n return state.steps;\n },\n current: (state) => {\n return state.current;\n },\n modal: (state) => {\n return state.modal;\n }\n}\n\nconst mutations = {\n step(state, data) {\n if (Number.isInteger(data)) {\n state.current = data;\n } else {\n if (data.data) {\n state.steps[data.step] = data.data;\n }\n }\n },\n stepInit(state, data) {\n if (!state.steps[data.step]) {\n state.steps[data.step] = data.data;\n }\n },\n reset(state) {\n state.steps = {};\n state.current = 1;\n },\n modal(state, action) {\n state.modal = action;\n },\n}\n\nexport default {\n namespaced: true,\n state,\n getters,\n mutations\n}","import cart from './modules/cart';\nimport auth from './modules/auth';\nimport wishlist from './modules/wishlist';\nimport compare from './modules/compare';\nimport review from './modules/review';\nimport order from './modules/order';\nimport checkout from './modules/checkout';\n\nexport default {\n modules: {\n cart,\n auth,\n wishlist,\n compare,\n review,\n order,\n checkout,\n },\n strict: false,\n};","const state = {\n user: {},\n payment: null,\n shipping: null,\n shippingData: {},\n dontcall: false,\n comment: '',\n};\n\nconst getters = {\n user: (state, getters, rootState, rootGetters) => {\n return Object.keys(state.user).length ? state.user : JSON.parse(JSON.stringify(rootGetters['auth/me']));\n },\n shipping: (state) => {\n return state.shipping;\n },\n shippingData: (state) => {\n return state.shippingData;\n },\n payment: (state) => {\n return state.payment;\n },\n dontcall: (state) => {\n return state.dontcall;\n },\n comment: (state) => {\n return state.comment;\n },\n};\n\nconst mutations = {\n user(state, data) {\n state.user = data;\n },\n shipping(state, data) {\n state.shipping = data;\n },\n shippingData(state, data) {\n state.shippingData = data;\n },\n payment(state, data) {\n state.payment = data;\n },\n dontcall(state, data) {\n state.dontcall = data;\n },\n comment(state, data) {\n state.comment = data;\n },\n reset(state) {\n state.user = {};\n state.payment = null;\n state.shipping = null;\n state.shippingData = {};\n state.dontcall = false;\n state.comment = '';\n },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n mutations,\n};\n"],"names":["toast","useToast","namespaced","state","items","cross","bundles","modal","getters","productQuantity","id","product","find","quantity","count","forEach","item","parseInt","total","price","attributes","options","length","optionsPrice","option","indexOf","active","document","documentElement","classList","actions","get","data","commit","api","then","response","callback","add","error","message","type","remove","clear","mutations","action","filter","exact","user","account","me","is","Object","keys","watch","immediate","Array","isArray","list","last","toggle","products","categories","category","slug","steps","current","step","Number","isInteger","stepInit","reset","modules","cart","auth","flash","console","login","dispatch","credentials","csrf_token","$http","defaults","headers","common","root","window","localStorage","logout","Cookies","location","href","$env","locale","url","errors","email","resetSms","passwordUpdate","register","update","wishlist","compare","review","order","checkout","payment","shipping","shippingData","dontcall","comment","rootState","rootGetters","JSON","parse","stringify","strict"],"mappings":"8MAIMA,EAAQC,eAsOC,CACXC,YAAY,EACZC,MAtOU,CACVC,MAAO,GACPC,MAAO,GACPC,QAAS,GACTC,OAAO,GAmOPC,QAhOY,CACZJ,MAAO,SAACD,UACGA,EAAMC,OAGjBC,MAAO,SAACF,UACGA,EAAME,OAGjBC,QAAS,SAACH,UACCA,EAAMG,SAGjBG,gBAAiB,SAACN,EAAOK,UAAY,SAACE,OAC5BC,EAAUH,EAAQJ,MAAMQ,MAAK,SAACD,UAAYA,EAAQD,KAAOA,YAExDC,EAAUA,EAAQE,SAAW,IAGxCF,QAAS,SAACR,EAAOK,UAAY,SAACE,OACpBC,EAAUH,EAAQJ,MAAMQ,MAAK,SAACD,UAAYA,EAAQD,KAAOA,YAExDC,GAAoB,OAG/BE,SAAU,SAACV,EAAOK,OACVM,EAAQ,SAEZN,EAAQJ,MAAMW,SAAQ,SAACC,GACnBF,GAASG,SAASD,EAAKH,aAGpBC,GAGXI,MAAO,SAACf,EAAOK,OACPU,EAAQ,SAEZV,EA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,QAAU,ODrCpBM,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perevorot/shop",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.124",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*"
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"dayjs": "^1.10.7",
|
|
26
26
|
"dragscroll": "^0.0.8",
|
|
27
27
|
"formvuelate": "^3.8.1",
|
|
28
|
+
"js-cookie": "^3.0.5",
|
|
28
29
|
"maska": "^1.5.0",
|
|
29
30
|
"rollup-plugin-vue": "^6.0.0",
|
|
30
31
|
"secure-ls": "^1.2.6",
|