@perevorot/shop 1.1.21 → 1.1.23
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/js/components/auth/Login.js +1 -1
- package/dist/js/components/auth/Login.js.map +1 -1
- package/dist/js/components/auth/Registration.js +1 -1
- package/dist/js/components/auth/Registration.js.map +1 -1
- package/dist/js/components/auth/User.js +1 -1
- package/dist/js/components/auth/User.js.map +1 -1
- package/dist/js/components/shop/Gallery.js +1 -1
- package/dist/js/components/shop/Gallery.js.map +1 -1
- package/dist/js/components/shop/Pagination.js +1 -1
- package/dist/js/components/shop/Pagination.js.map +1 -1
- package/dist/js/components/shop/cart/Cart.js +1 -1
- package/dist/js/components/shop/cart/Cart.js.map +1 -1
- package/dist/js/components/shop/cart/CartAdd.js +1 -1
- package/dist/js/components/shop/cart/CartAdd.js.map +1 -1
- package/dist/js/components/shop/cart/CartItem.js +1 -1
- package/dist/js/components/shop/cart/CartItem.js.map +1 -1
- package/dist/js/components/shop/cart/CartTrigger.js +1 -1
- package/dist/js/components/shop/cart/CartTrigger.js.map +1 -1
- package/dist/js/components/shop/compare/CompareAdd.js +1 -1
- package/dist/js/components/shop/compare/CompareAdd.js.map +1 -1
- package/dist/js/components/shop/order/OneClick.js +1 -1
- package/dist/js/components/shop/order/OneClick.js.map +1 -1
- package/dist/js/components/shop/wishlist/WishlistAdd.js +1 -1
- package/dist/js/components/shop/wishlist/WishlistAdd.js.map +1 -1
- package/dist/js/components/shop/wishlist/WishlistDelete.js +1 -1
- package/dist/js/components/shop/wishlist/WishlistDelete.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),o=require("@formvuelate/plugin-vee-validate"),n=require("@perevorot/shop/dist/js/forms/FormText"),a=require("@perevorot/shop/dist/js/forms/FormPassword"),i=require("@perevorot/shop/dist/js/components/auth/Forget"),l=require("yup");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=u(o),f=u(n),m=u(a),d=u(i),g=c(l);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function v(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(o=a.call(r)).done)&&(l.push(o.value),l.length!==t);u=!0);}catch(e){c=!0,n=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}e.markRaw(f.default);var b=r.SchemaFormFactory([s.default({})]),y={props:{loginCallback:Function,default:function(){}},name:"login",components:{SchemaForm:b,Forget:d.default},setup:function(o){var n=e.ref(!1),a=t.useStore(),i=e.ref(0),l=e.ref({}),u=e.computed((function(){return a.getters["auth/modal"]})),c=e.ref({email:{component:f.default,label:__("auth.login.form.email"),store:"login",model:"email"},password:{component:m.default,label:__("auth.login.form.password")}}),s=g.object().shape({email:g.string().email(__("auth.validation.email")).required(__("auth.validation.required")),password:g.string().required(__("auth.validation.required"))}),d=e.ref({email:"",password:""});r.useSchemaForm(d);return v(v(v(v(v(v({loading:n,modal:u,schema:c,validation:s,reset:function(){a.commit("auth/modal","forget")},facebook:function(){window.location.href=$ziggy("auth.login.social",{provider:"facebook"})},google:function(){window.location.href=$ziggy("auth.login.social",{provider:"google"})}},"schema",c),"onSubmit",(function(){n.value=!0,a.dispatch("auth/login",{credentials:d.value,callback:function(){o.loginCallback&&o.loginCallback()},finally:function(){n.value=!1},catch:function(e){if(e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var o=h(r[t],2),n=o[0],a=o[1];a[0]&&(l.value[n]=a[0])}d.value.password="",i.value++}}})})),"errors",l),"key",i),"model",d),"register",(function(){a.commit("auth/modal","registration")}))}},k={class:"auth-login"},w={class:"title"},_={class:"href-forget-password"},E={class:"field"},N={class:"socials"},S={class:"description has-text-centered"},V={class:"buttons"},j=[e.createElementVNode("svg",{class:"icon fb-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-facebook-icon"})],-1),e.createElementVNode("span",null,"Facebook",-1)],C=[e.createElementVNode("svg",{class:"icon google-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-google-icon"})],-1),e.createElementVNode("span",null,"Google",-1)],q={class:"href-register"};y.render=function(t,r,o,n,a,i){var l=e.resolveComponent("SchemaForm"),u=e.resolveComponent("forget");return e.openBlock(),e.createElementBlock("div",k,[e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",w,e.toDisplayString(t.__("auth.login.title")),1),e.createVNode(l,{schemaRowClasses:"field",schema:n.schema,"validation-schema":n.validation,"initial-errors":n.errors,key:n.key,onSubmit:n.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",_,[e.createElementVNode("a",{onClick:r[0]||(r[0]=function(){return n.reset&&n.reset.apply(n,arguments)})},e.toDisplayString(t.__("auth.login.forget_password")),1)]),e.createElementVNode("div",E,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":n.loading}]),type:"submit"},e.toDisplayString(t.__("auth.login.form.submit")),3)]),e.createElementVNode("div",N,[e.createElementVNode("div",S,e.toDisplayString(t.__("auth.login.socials")),1),e.createElementVNode("div",V,[e.createElementVNode("a",{class:"button",onClick:r[1]||(r[1]=function(){return n.facebook&&n.facebook.apply(n,arguments)})},j),e.createElementVNode("a",{class:"button",onClick:r[2]||(r[2]=function(){return n.google&&n.google.apply(n,arguments)})},C)])]),e.createElementVNode("div",q,[e.createElementVNode("a",{onClick:r[3]||(r[3]=function(){return n.register&&n.register.apply(n,arguments)})},e.toDisplayString(t.__("auth.login.signup")),1)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"])],512),[[e.vShow,"login"==n.modal]]),"forget"==n.modal?(e.openBlock(),e.createBlock(u,{key:0,email:n.model.email},null,8,["email"])):e.createCommentVNode("v-if",!0)])},module.exports=y;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),o=require("@formvuelate/plugin-vee-validate"),n=require("@perevorot/shop/dist/js/forms/FormText"),a=require("@perevorot/shop/dist/js/forms/FormPassword"),i=require("@perevorot/shop/dist/js/components/auth/Forget"),l=require("yup");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=u(o),f=u(n),m=u(a),d=u(i),g=c(l);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function v(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(o=a.call(r)).done)&&(l.push(o.value),l.length!==t);u=!0);}catch(e){c=!0,n=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}e.markRaw(f.default);var b=r.SchemaFormFactory([s.default({})]),y={props:{loginCallback:Function,default:function(){}},name:"login",components:{SchemaForm:b,Forget:d.default},setup:function(o){var n=e.ref(!1),a=t.useStore(),i=e.ref(0),l=e.ref({}),u=e.computed((function(){return a.getters["auth/modal"]})),c=e.ref({email:{component:f.default,label:__("auth.login.form.email"),store:"login",model:"email"},password:{component:m.default,label:__("auth.login.form.password")}}),s=g.object().shape({email:g.string().email(__("auth.validation.email")).required(__("auth.validation.required")),password:g.string().required(__("auth.validation.required"))}),d=e.ref({email:"",password:""});r.useSchemaForm(d);return v(v(v(v(v(v({loading:n,modal:u,schema:c,validation:s,reset:function(){a.commit("auth/modal","forget")},facebook:function(){window.location.href=$ziggy("auth.login.social",{provider:"facebook"})},google:function(){window.location.href=$ziggy("auth.login.social",{provider:"google"})}},"schema",c),"onSubmit",(function(){n.value=!0,a.dispatch("auth/login",{credentials:d.value,callback:function(){o.loginCallback&&o.loginCallback()},finally:function(){n.value=!1},catch:function(e){if(e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var o=h(r[t],2),n=o[0],a=o[1];a[0]&&(l.value[n]=a[0])}d.value.password="",i.value++}}})})),"errors",l),"key",i),"model",d),"register",(function(){a.commit("auth/modal","registration")}))}},k={class:"auth-login"},w={class:"title"},_={class:"href-forget-password"},E={class:"field"},N={class:"socials"},S={class:"description has-text-centered"},V={class:"buttons"},j=[e.createElementVNode("svg",{class:"icon fb-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-facebook-icon"})],-1),e.createElementVNode("span",null,"Facebook",-1)],C=[e.createElementVNode("svg",{class:"icon google-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-google-icon"})],-1),e.createElementVNode("span",null,"Google",-1)],q={class:"href-register"};y.render=function(t,r,o,n,a,i){var l=e.resolveComponent("SchemaForm"),u=e.resolveComponent("forget");return e.openBlock(),e.createElementBlock("div",k,[e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",w,e.toDisplayString(t.__("auth.login.title")),1),e.createVNode(l,{schemaRowClasses:"field",schema:n.schema,"validation-schema":n.validation,"initial-errors":n.errors,key:n.key,onSubmit:n.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",_,[e.createElementVNode("a",{onClick:r[0]||(r[0]=function(){return n.reset&&n.reset.apply(n,arguments)})},e.toDisplayString(t.__("auth.login.forget_password")),1)]),e.createElementVNode("div",E,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":n.loading}]),type:"submit","aria-label":"Login"},e.toDisplayString(t.__("auth.login.form.submit")),3)]),e.createElementVNode("div",N,[e.createElementVNode("div",S,e.toDisplayString(t.__("auth.login.socials")),1),e.createElementVNode("div",V,[e.createElementVNode("a",{class:"button",onClick:r[1]||(r[1]=function(){return n.facebook&&n.facebook.apply(n,arguments)})},j),e.createElementVNode("a",{class:"button",onClick:r[2]||(r[2]=function(){return n.google&&n.google.apply(n,arguments)})},C)])]),e.createElementVNode("div",q,[e.createElementVNode("a",{onClick:r[3]||(r[3]=function(){return n.register&&n.register.apply(n,arguments)})},e.toDisplayString(t.__("auth.login.signup")),1)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"])],512),[[e.vShow,"login"==n.modal]]),"forget"==n.modal?(e.openBlock(),e.createBlock(u,{key:0,email:n.model.email},null,8,["email"])):e.createCommentVNode("v-if",!0)])},module.exports=y;
|
|
2
2
|
//# sourceMappingURL=Login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Login.js","sources":["../../../../src/js/components/auth/Login.vue","../../../../src/js/components/auth/Login.vue?vue&type=template&id=4373a806&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-login\">\n <div v-show=\"modal == 'login'\">\n <div class=\"title\">{{ __('auth.login.title') }}</div>\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"href-forget-password\">\n <a @click=\"reset\">{{ __('auth.login.forget_password') }}</a>\n </div>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">\n {{ __('auth.login.form.submit') }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-register\">\n <a @click=\"register\">{{ __('auth.login.signup') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n\n <forget v-if=\"modal == 'forget'\" :email=\"model.email\"></forget>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/js/forms/FormText';\nimport FormPassword from '@perevorot/shop/dist/js/forms/FormPassword';\nimport Forget from '@perevorot/shop/dist/js/components/auth/Forget';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n props: {\n loginCallback: Function,\n default: () => { }\n },\n name: 'login',\n components: {\n SchemaForm,\n Forget\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const key = ref(0);\n const errors = ref({});\n const modal = computed(() => store.getters['auth/modal']);\n\n const schema = ref({\n email: {\n component: FormText,\n label: __('auth.login.form.email'),\n store: 'login',\n model: 'email'\n },\n password: {\n component: FormPassword,\n label: __('auth.login.form.password')\n }\n });\n\n const validation = yup.object().shape({\n email: yup.string().email(__('auth.validation.email')).required(__('auth.validation.required')),\n password: yup.string().required(__('auth.validation.required'))\n });\n\n const model = ref({\n email: '',\n password: ''\n });\n\n useSchemaForm(model);\n\n const reset = () => {\n store.commit('auth/modal', 'forget');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/login', {\n credentials: model.value,\n callback: () => {\n if (props.loginCallback) {\n props.loginCallback();\n }\n },\n finally: () => {\n loading.value = false;\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n model.value.password = '';\n\n key.value++;\n }\n }\n });\n };\n\n return {\n loading,\n modal,\n schema,\n validation,\n reset,\n facebook,\n google,\n schema,\n onSubmit,\n errors,\n key,\n model,\n register\n };\n }\n};\n</script>","<template>\n <div class=\"auth-login\">\n <div v-show=\"modal == 'login'\">\n <div class=\"title\">{{ __('auth.login.title') }}</div>\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"href-forget-password\">\n <a @click=\"reset\">{{ __('auth.login.forget_password') }}</a>\n </div>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">\n {{ __('auth.login.form.submit') }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-register\">\n <a @click=\"register\">{{ __('auth.login.signup') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n\n <forget v-if=\"modal == 'forget'\" :email=\"model.email\"></forget>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/js/forms/FormText';\nimport FormPassword from '@perevorot/shop/dist/js/forms/FormPassword';\nimport Forget from '@perevorot/shop/dist/js/components/auth/Forget';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n props: {\n loginCallback: Function,\n default: () => { }\n },\n name: 'login',\n components: {\n SchemaForm,\n Forget\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const key = ref(0);\n const errors = ref({});\n const modal = computed(() => store.getters['auth/modal']);\n\n const schema = ref({\n email: {\n component: FormText,\n label: __('auth.login.form.email'),\n store: 'login',\n model: 'email'\n },\n password: {\n component: FormPassword,\n label: __('auth.login.form.password')\n }\n });\n\n const validation = yup.object().shape({\n email: yup.string().email(__('auth.validation.email')).required(__('auth.validation.required')),\n password: yup.string().required(__('auth.validation.required'))\n });\n\n const model = ref({\n email: '',\n password: ''\n });\n\n useSchemaForm(model);\n\n const reset = () => {\n store.commit('auth/modal', 'forget');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/login', {\n credentials: model.value,\n callback: () => {\n if (props.loginCallback) {\n props.loginCallback();\n }\n },\n finally: () => {\n loading.value = false;\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n model.value.password = '';\n\n key.value++;\n }\n }\n });\n };\n\n return {\n loading,\n modal,\n schema,\n validation,\n reset,\n facebook,\n google,\n schema,\n onSubmit,\n errors,\n key,\n model,\n register\n };\n }\n};\n</script>"],"names":["markRaw","FormText","SchemaForm","SchemaFormFactory","VeeValidatePlugin","script","props","loginCallback","Function","default","name","components","Forget","setup","loading","ref","store","useStore","key","errors","modal","computed","getters","schema","email","component","label","__","model","password","FormPassword","validation","yup","object","shape","string","required","useSchemaForm","_defineProperty","reset","commit","facebook","window","location","href","$ziggy","provider","google","onSubmit","value","dispatch","credentials","callback","finally","catch","error","response","data","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","field","messages","_hoisted_1","class","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_createElementVNode","createElementVNode","xlink:href","_hoisted_14","_openBlock","openBlock","_createElementBlock","createElementBlock","_toDisplayString","_ctx","_createVNode","createVNode","_component_SchemaForm","schemaRowClasses","$setup","validation-schema","initial-errors","afterForm","onClick","apply","arguments","_normalizeClass","is-loading","type","toDisplayString","register","_createBlock","createBlock","_component_forget"],"mappings":"+nEAoDAA,EAAOA,QAACC,EAAQ,SAEhB,IAAMC,EAAaC,EAAAA,kBAAkB,CAACC,EAAiB,QAAC,MAEzCC,EAAA,CACXC,MAAO,CACHC,cAAeC,SACfC,QAAS,cAEbC,KAAM,QACNC,WAAY,CACRT,WAAAA,EACAU,OAAAA,EAAAA,SAEJC,MAAAA,SAAMP,GACF,IAAMQ,EAAUC,OAAI,GACdC,EAAQC,EAAAA,WACRC,EAAMH,MAAI,GACVI,EAASJ,MAAI,IACbK,EAAQC,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,iBAErCC,EAASR,EAAAA,IAAI,CACfS,MAAO,CACHC,UAAWxB,EAAQ,QACnByB,MAAOC,GAAG,yBACVX,MAAO,QACPY,MAAO,SAEXC,SAAU,CACNJ,UAAWK,EAAY,QACvBJ,MAAOC,GAAG,+BAIZI,EAAaC,EAAIC,SAASC,MAAM,CAClCV,MAAOQ,EAAIG,SAASX,MAAMG,GAAG,0BAA0BS,SAAST,GAAG,6BACnEE,SAAUG,EAAI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AAhD,SAAAqD,MAAAL,EAAAM,iBAMlCpB,EAIGC,mBAAA,IAAA,CAJAR,MAAM,SAAUyB,sCAAOJ,EAAM1C,QAAA0C,EAAA1C,OAAA+C,MAAAL,EAAAM,qBAOxCpB,EAAAA,mBAEK,MAFLG,EAEK,CADDH,EAAqDC,mBAAA,IAAA,CAAjDiB,sCAAOJ,EAAQW,UAAAX,EAAAW,SAAAN,MAAAL,EAAAM,gCAAKX,EAAEzD,GAAA,sBAAA,4FA/BvB,SAAN8D,EAAMrE,SAqCC,UAANqE,EAAMrE,qBAApBiF,EAA8DC,YAAAC,EAAA,OAA5B/E,MAAOiE,EAAK7D,MAACJ"}
|
|
1
|
+
{"version":3,"file":"Login.js","sources":["../../../../src/js/components/auth/Login.vue","../../../../src/js/components/auth/Login.vue?vue&type=template&id=1a057e75&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-login\">\n <div v-show=\"modal == 'login'\">\n <div class=\"title\">{{ __('auth.login.title') }}</div>\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"href-forget-password\">\n <a @click=\"reset\">{{ __('auth.login.forget_password') }}</a>\n </div>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\" aria-label=\"Login\">\n {{ __('auth.login.form.submit') }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-register\">\n <a @click=\"register\">{{ __('auth.login.signup') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n\n <forget v-if=\"modal == 'forget'\" :email=\"model.email\"></forget>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/js/forms/FormText';\nimport FormPassword from '@perevorot/shop/dist/js/forms/FormPassword';\nimport Forget from '@perevorot/shop/dist/js/components/auth/Forget';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n props: {\n loginCallback: Function,\n default: () => { }\n },\n name: 'login',\n components: {\n SchemaForm,\n Forget\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const key = ref(0);\n const errors = ref({});\n const modal = computed(() => store.getters['auth/modal']);\n\n const schema = ref({\n email: {\n component: FormText,\n label: __('auth.login.form.email'),\n store: 'login',\n model: 'email'\n },\n password: {\n component: FormPassword,\n label: __('auth.login.form.password')\n }\n });\n\n const validation = yup.object().shape({\n email: yup.string().email(__('auth.validation.email')).required(__('auth.validation.required')),\n password: yup.string().required(__('auth.validation.required'))\n });\n\n const model = ref({\n email: '',\n password: ''\n });\n\n useSchemaForm(model);\n\n const reset = () => {\n store.commit('auth/modal', 'forget');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/login', {\n credentials: model.value,\n callback: () => {\n if (props.loginCallback) {\n props.loginCallback();\n }\n },\n finally: () => {\n loading.value = false;\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n model.value.password = '';\n\n key.value++;\n }\n }\n });\n };\n\n return {\n loading,\n modal,\n schema,\n validation,\n reset,\n facebook,\n google,\n schema,\n onSubmit,\n errors,\n key,\n model,\n register\n };\n }\n};\n</script>","<template>\n <div class=\"auth-login\">\n <div v-show=\"modal == 'login'\">\n <div class=\"title\">{{ __('auth.login.title') }}</div>\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"href-forget-password\">\n <a @click=\"reset\">{{ __('auth.login.forget_password') }}</a>\n </div>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\" aria-label=\"Login\">\n {{ __('auth.login.form.submit') }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-register\">\n <a @click=\"register\">{{ __('auth.login.signup') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n\n <forget v-if=\"modal == 'forget'\" :email=\"model.email\"></forget>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/js/forms/FormText';\nimport FormPassword from '@perevorot/shop/dist/js/forms/FormPassword';\nimport Forget from '@perevorot/shop/dist/js/components/auth/Forget';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n props: {\n loginCallback: Function,\n default: () => { }\n },\n name: 'login',\n components: {\n SchemaForm,\n Forget\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const key = ref(0);\n const errors = ref({});\n const modal = computed(() => store.getters['auth/modal']);\n\n const schema = ref({\n email: {\n component: FormText,\n label: __('auth.login.form.email'),\n store: 'login',\n model: 'email'\n },\n password: {\n component: FormPassword,\n label: __('auth.login.form.password')\n }\n });\n\n const validation = yup.object().shape({\n email: yup.string().email(__('auth.validation.email')).required(__('auth.validation.required')),\n password: yup.string().required(__('auth.validation.required'))\n });\n\n const model = ref({\n email: '',\n password: ''\n });\n\n useSchemaForm(model);\n\n const reset = () => {\n store.commit('auth/modal', 'forget');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/login', {\n credentials: model.value,\n callback: () => {\n if (props.loginCallback) {\n props.loginCallback();\n }\n },\n finally: () => {\n loading.value = false;\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n model.value.password = '';\n\n key.value++;\n }\n }\n });\n };\n\n return {\n loading,\n modal,\n schema,\n validation,\n reset,\n facebook,\n google,\n schema,\n onSubmit,\n errors,\n key,\n model,\n register\n };\n }\n};\n</script>"],"names":["markRaw","FormText","SchemaForm","SchemaFormFactory","VeeValidatePlugin","script","props","loginCallback","Function","default","name","components","Forget","setup","loading","ref","store","useStore","key","errors","modal","computed","getters","schema","email","component","label","__","model","password","FormPassword","validation","yup","object","shape","string","required","useSchemaForm","_defineProperty","reset","commit","facebook","window","location","href","$ziggy","provider","google","onSubmit","value","dispatch","credentials","callback","finally","catch","error","response","data","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","field","messages","_hoisted_1","class","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_createElementVNode","createElementVNode","xlink:href","_hoisted_14","_openBlock","openBlock","_createElementBlock","createElementBlock","_toDisplayString","_ctx","_createVNode","createVNode","_component_SchemaForm","schemaRowClasses","$setup","validation-schema","initial-errors","afterForm","onClick","apply","arguments","_normalizeClass","is-loading","type","aria-label","toDisplayString","register","_createBlock","createBlock","_component_forget"],"mappings":"+nEAoDAA,EAAOA,QAACC,EAAQ,SAEhB,IAAMC,EAAaC,EAAAA,kBAAkB,CAACC,EAAiB,QAAC,MAEzCC,EAAA,CACXC,MAAO,CACHC,cAAeC,SACfC,QAAS,cAEbC,KAAM,QACNC,WAAY,CACRT,WAAAA,EACAU,OAAAA,EAAAA,SAEJC,MAAAA,SAAMP,GACF,IAAMQ,EAAUC,OAAI,GACdC,EAAQC,EAAAA,WACRC,EAAMH,MAAI,GACVI,EAASJ,MAAI,IACbK,EAAQC,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,iBAErCC,EAASR,EAAAA,IAAI,CACfS,MAAO,CACHC,UAAWxB,EAAQ,QACnByB,MAAOC,GAAG,yBACVX,MAAO,QACPY,MAAO,SAEXC,SAAU,CACNJ,UAAWK,EAAY,QACvBJ,MAAOC,GAAG,+BAIZI,EAAaC,EAAIC,SAASC,MAAM,CAClCV,MAAOQ,EAAIG,SAASX,MAAMG,GAAG,0BAA0BS,SAAST,GAAG,6BACnEE,SAAUG,EAAIG,SAASC,SAAST,GAAG,+BAGjCC,EAAQb,EAAAA,IAAI,CACdS,MAAO,GACPK,SAAU,KAGdQ,EAAaA,cAACT,GAmDd,OAAAU,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAA,CACIxB,QAAAA,EACAM,MAAAA,EACAG,OAA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EAAqDC,mBAAA,IAAA,CAAjDiB,sCAAOJ,EAAQY,UAAAZ,EAAAY,SAAAP,MAAAL,EAAAM,gCAAKX,EAAEzD,GAAA,sBAAA,4FA/BvB,SAAN8D,EAAMrE,SAqCC,UAANqE,EAAMrE,qBAApBkF,EAA8DC,YAAAC,EAAA,OAA5BhF,MAAOiE,EAAK7D,MAACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),o=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/api"),n=require("@perevorot/shop/dist/helpers"),i=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(o),c=l(i);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,a,n,i,l=[],s=!0,c=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(o=n.call(r)).done)&&(l.push(o.value),l.length!==t);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m={name:"registration",components:{SchemaForm:r.SchemaFormFactory([s.default({})])},setup:function(){var o,i=t.useStore(),l=e.ref(!1),s=e.ref(!0),u=e.ref(0),m=e.ref({}),f=e.ref(!1),v=e.ref(""),h=e.ref({}),g=e.ref({}),p=e.ref({});r.useSchemaForm(p);return a.auth.registerForm().then((function(e){var t=n.formParse(e.data);o=t.model,h.value=t.schema,p.value=t.model,g.value=t.validation,v.value=e.data.type})).finally((function(){s.value=!1})),{loading:l,loadingForm:s,key:u,errors:m,schema:h,validation:g,onSubmit:function(){l.value=!0,i.dispatch("auth/register",{type:v.value.charAt(0).toUpperCase()+v.value.slice(1),credentials:p.value,finally:function(){l.value=!1},callback:function(){f.value=!0,p.value=o,u.value++;var e=new c.default({isCompression:!1}),t=e.get("forms");t.registration&&(t.registration={}),e.set("forms",t)},catch:function(e){if(e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var o=d(r[t],2),a=o[0],n=o[1];n[0]&&(m.value[a]=n[0])}u.value++}}})},facebook:function(){window.location.href=$ziggy("auth.login.social",{provider:"facebook"})},google:function(){window.location.href=$ziggy("auth.login.social",{provider:"google"})},thanks:f,model:p,close:function(){i.commit("auth/modal",null),i.dispatch("auth/me")},type:v,login:function(){i.commit("auth/modal","login")}}}},f={key:0,class:"auth-registration"},v={class:"title"},h={class:"field"},g={class:"socials"},p={class:"description has-text-centered"},y={class:"buttons"},b=[e.createElementVNode("svg",{class:"icon fb-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-facebook-icon"})],-1),e.createElementVNode("span",null,"Facebook",-1)],k=[e.createElementVNode("svg",{class:"icon google-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-google-icon"})],-1),e.createElementVNode("span",null,"Google",-1)],E={class:"href-already-register"},N={class:"mt-3"};m.render=function(t,r,o,a,n,i){var l=e.resolveComponent("SchemaForm");return a.loadingForm?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("div",v,e.toDisplayString(t.__("auth.registration.title")),1),e.withDirectives(e.createElementVNode("div",null,[e.createVNode(l,{schemaRowClasses:"field",schema:a.schema,"validation-schema":a.validation,"initial-errors":a.errors,key:a.key,onSubmit:a.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",h,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":a.loading}]),type:"submit"},e.toDisplayString(t.__("auth.registration.form.submit"+("short"==a.type?"_short":""))),3)]),e.createElementVNode("div",g,[e.createElementVNode("div",p,e.toDisplayString(t.__("auth.login.socials")),1),e.createElementVNode("div",y,[e.createElementVNode("a",{class:"button",onClick:r[0]||(r[0]=function(){return a.facebook&&a.facebook.apply(a,arguments)})},b),e.createElementVNode("a",{class:"button",onClick:r[1]||(r[1]=function(){return a.google&&a.google.apply(a,arguments)})},k)])]),e.createElementVNode("div",E,[e.createElementVNode("a",{onClick:r[2]||(r[2]=function(){return a.login&&a.login.apply(a,arguments)})},e.toDisplayString(t.__("auth.registration.already")),1)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"])],512),[[e.vShow,!a.thanks]]),e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString(t.__("auth.registration.thanks"+("short"==a.type?"_short":""),{email:a.model.email})),1),e.createElementVNode("div",N,[e.createElementVNode("button",{class:"button",onClick:r[3]||(r[3]=function(){return a.close&&a.close.apply(a,arguments)})},e.toDisplayString(t.__("auth.registration.continue")),1)])],512),[[e.vShow,a.thanks]])]))},module.exports=m;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),o=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/api"),n=require("@perevorot/shop/dist/helpers"),i=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(o),c=l(i);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,a,n,i,l=[],s=!0,c=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(o=n.call(r)).done)&&(l.push(o.value),l.length!==t);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m={name:"registration",components:{SchemaForm:r.SchemaFormFactory([s.default({})])},setup:function(){var o,i=t.useStore(),l=e.ref(!1),s=e.ref(!0),u=e.ref(0),m=e.ref({}),f=e.ref(!1),v=e.ref(""),h=e.ref({}),g=e.ref({}),p=e.ref({});r.useSchemaForm(p);return a.auth.registerForm().then((function(e){var t=n.formParse(e.data);o=t.model,h.value=t.schema,p.value=t.model,g.value=t.validation,v.value=e.data.type})).finally((function(){s.value=!1})),{loading:l,loadingForm:s,key:u,errors:m,schema:h,validation:g,onSubmit:function(){l.value=!0,i.dispatch("auth/register",{type:v.value.charAt(0).toUpperCase()+v.value.slice(1),credentials:p.value,finally:function(){l.value=!1},callback:function(){f.value=!0,p.value=o,u.value++;var e=new c.default({isCompression:!1}),t=e.get("forms");t.registration&&(t.registration={}),e.set("forms",t)},catch:function(e){if(e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var o=d(r[t],2),a=o[0],n=o[1];n[0]&&(m.value[a]=n[0])}u.value++}}})},facebook:function(){window.location.href=$ziggy("auth.login.social",{provider:"facebook"})},google:function(){window.location.href=$ziggy("auth.login.social",{provider:"google"})},thanks:f,model:p,close:function(){i.commit("auth/modal",null),i.dispatch("auth/me")},type:v,login:function(){i.commit("auth/modal","login")}}}},f={key:0,class:"auth-registration"},v={class:"title"},h={class:"field"},g={class:"socials"},p={class:"description has-text-centered"},y={class:"buttons"},b=[e.createElementVNode("svg",{class:"icon fb-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-facebook-icon"})],-1),e.createElementVNode("span",null,"Facebook",-1)],k=[e.createElementVNode("svg",{class:"icon google-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-google-icon"})],-1),e.createElementVNode("span",null,"Google",-1)],E={class:"href-already-register"},N={class:"mt-3"};m.render=function(t,r,o,a,n,i){var l=e.resolveComponent("SchemaForm");return a.loadingForm?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("div",v,e.toDisplayString(t.__("auth.registration.title")),1),e.withDirectives(e.createElementVNode("div",null,[e.createVNode(l,{schemaRowClasses:"field",schema:a.schema,"validation-schema":a.validation,"initial-errors":a.errors,key:a.key,onSubmit:a.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",h,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":a.loading}]),type:"submit","aria-label":"Register"},e.toDisplayString(t.__("auth.registration.form.submit"+("short"==a.type?"_short":""))),3)]),e.createElementVNode("div",g,[e.createElementVNode("div",p,e.toDisplayString(t.__("auth.login.socials")),1),e.createElementVNode("div",y,[e.createElementVNode("a",{class:"button",onClick:r[0]||(r[0]=function(){return a.facebook&&a.facebook.apply(a,arguments)})},b),e.createElementVNode("a",{class:"button",onClick:r[1]||(r[1]=function(){return a.google&&a.google.apply(a,arguments)})},k)])]),e.createElementVNode("div",E,[e.createElementVNode("a",{onClick:r[2]||(r[2]=function(){return a.login&&a.login.apply(a,arguments)})},e.toDisplayString(t.__("auth.registration.already")),1)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"])],512),[[e.vShow,!a.thanks]]),e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString(t.__("auth.registration.thanks"+("short"==a.type?"_short":""),{email:a.model.email})),1),e.createElementVNode("div",N,[e.createElementVNode("button",{class:"button",onClick:r[3]||(r[3]=function(){return a.close&&a.close.apply(a,arguments)}),"aria-label":"Close"},e.toDisplayString(t.__("auth.registration.continue")),1)])],512),[[e.vShow,a.thanks]])]))},module.exports=m;
|
|
2
2
|
//# sourceMappingURL=Registration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Registration.js","sources":["../../../../src/js/components/auth/Registration.vue","../../../../src/js/components/auth/Registration.vue?vue&type=template&id=47b68e84&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-registration\" v-if=\"!loadingForm\">\n <div class=\"title\">{{ __('auth.registration.title') }}</div>\n <div v-show=\"!thanks\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">\n {{ __('auth.registration.form.submit' + (type == 'short' ? '_short' : '')) }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-already-register\">\n <a @click=\"login\">{{ __('auth.registration.already') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div>\n {{\n __('auth.registration.thanks' + (type == 'short' ? '_short' : ''), {\n email: model.email\n })\n }}\n </div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close\">\n {{ __('auth.registration.continue') }}\n </button>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport { formParse } from '@perevorot/shop/dist/helpers';\nimport SecureLS from 'secure-ls';\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n name: 'registration',\n components: {\n SchemaForm\n },\n setup() {\n const store = useStore();\n const loading = ref(false);\n const loadingForm = ref(true);\n const key = ref(0);\n const errors = ref({});\n const thanks = ref(false);\n const type = ref('');\n const schema = ref({});\n const validation = ref({});\n const model = ref({});\n\n let emptyModel;\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/register', {\n type: type.value.charAt(0).toUpperCase() + type.value.slice(1),\n credentials: model.value,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n thanks.value = true;\n\n model.value = emptyModel;\n\n key.value++;\n\n let ls = new SecureLS({\n isCompression: false\n });\n\n let forms = ls.get('forms');\n\n if (forms.registration) {\n forms.registration = {};\n }\n\n ls.set('forms', forms);\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n }\n });\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const login = () => {\n store.commit('auth/modal', 'login');\n };\n\n api.registerForm()\n .then((response) => {\n const form = formParse(response.data);\n\n emptyModel = form.model;\n\n schema.value = form.schema;\n model.value = form.model;\n validation.value = form.validation;\n\n type.value = response.data.type;\n })\n .finally(() => {\n loadingForm.value = false;\n });\n\n return {\n loading,\n loadingForm,\n key,\n errors,\n schema,\n validation,\n onSubmit,\n facebook,\n google,\n thanks,\n model,\n close,\n type,\n login\n };\n }\n};\n</script>","<template>\n <div class=\"auth-registration\" v-if=\"!loadingForm\">\n <div class=\"title\">{{ __('auth.registration.title') }}</div>\n <div v-show=\"!thanks\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">\n {{ __('auth.registration.form.submit' + (type == 'short' ? '_short' : '')) }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-already-register\">\n <a @click=\"login\">{{ __('auth.registration.already') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div>\n {{\n __('auth.registration.thanks' + (type == 'short' ? '_short' : ''), {\n email: model.email\n })\n }}\n </div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close\">\n {{ __('auth.registration.continue') }}\n </button>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport { formParse } from '@perevorot/shop/dist/helpers';\nimport SecureLS from 'secure-ls';\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n name: 'registration',\n components: {\n SchemaForm\n },\n setup() {\n const store = useStore();\n const loading = ref(false);\n const loadingForm = ref(true);\n const key = ref(0);\n const errors = ref({});\n const thanks = ref(false);\n const type = ref('');\n const schema = ref({});\n const validation = ref({});\n const model = ref({});\n\n let emptyModel;\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/register', {\n type: type.value.charAt(0).toUpperCase() + type.value.slice(1),\n credentials: model.value,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n thanks.value = true;\n\n model.value = emptyModel;\n\n key.value++;\n\n let ls = new SecureLS({\n isCompression: false\n });\n\n let forms = ls.get('forms');\n\n if (forms.registration) {\n forms.registration = {};\n }\n\n ls.set('forms', forms);\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n }\n });\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const login = () => {\n store.commit('auth/modal', 'login');\n };\n\n api.registerForm()\n .then((response) => {\n const form = formParse(response.data);\n\n emptyModel = form.model;\n\n schema.value = form.schema;\n model.value = form.model;\n validation.value = form.validation;\n\n type.value = response.data.type;\n })\n .finally(() => {\n loadingForm.value = false;\n });\n\n return {\n loading,\n loadingForm,\n key,\n errors,\n schema,\n validation,\n onSubmit,\n facebook,\n google,\n thanks,\n model,\n close,\n type,\n login\n };\n }\n};\n</script>"],"names":["script","name","components","SchemaForm","SchemaFormFactory","VeeValidatePlugin","setup","emptyModel","store","useStore","loading","ref","loadingForm","key","errors","thanks","type","schema","validation","model","useSchemaForm","api","registerForm","then","response","form","formParse","data","value","finally","onSubmit","dispatch","charAt","toUpperCase","slice","credentials","callback","ls","SecureLS","isCompression","forms","get","registration","set","catch","error","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","field","messages","facebook","window","location","href","$ziggy","provider","google","close","commit","login","class","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_createElementVNode","createElementVNode","xlink:href","_hoisted_13","_hoisted_14","$setup","_openBlock","_createElementBlock","_hoisted_1","_toDisplayString","_ctx","__","_createVNode","_component_SchemaForm","schemaRowClasses","validation-schema","initial-errors","afterForm","_normalizeClass","is-loading","onClick","apply","arguments","email"],"mappings":"4zCA4DA,IAEeA,EAAA,CACXC,KAAM,eACNC,WAAY,CACRC,WALWC,EAAAA,kBAAkB,CAACC,EAAiB,QAAC,OAOpDC,MAAK,WACD,IAWIC,EAXEC,EAAQC,EAAAA,WACRC,EAAUC,OAAI,GACdC,EAAcD,OAAI,GAClBE,EAAMF,MAAI,GACVG,EAASH,MAAI,IACbI,EAASJ,OAAI,GACbK,EAAOL,MAAI,IACXM,EAASN,MAAI,IACbO,EAAaP,MAAI,IACjBQ,EAAQR,MAAI,IAIlBS,EAAaA,cAACD,GAiFd,OAhBAE,EAAAA,KAAIC,eACCC,MAAK,SAACC,GACH,IAAMC,EAAOC,EAAAA,UAAUF,EAASG,MAEhCpB,EAAakB,EAAKN,MAElBF,EAAOW,MAAQH,EAAKR,OACpBE,EAAMS,MAAQH,EAAKN,MACnBD,EAAWU,MAAQH,EAAKP,WAExBF,EAAKY,MAAQJ,EAASG,KAAKX,QAE9Ba,SAAQ,WACLjB,EAAYgB,OAAQ,KAGrB,CACHlB,QAAAA,EACAE,YAAAA,EACAC,IAAAA,EACAC,OAAAA,EACAG,OAAAA,EACAC,WAAAA,EACAY,SAtFa,WACbpB,EAAQkB,OAAQ,EAEhBpB,EAAMuB,SAAS,gBAAiB,CAC5Bf,KAAMA,EAAKY,MAAMI,OAAO,GAAGC,cAAgBj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KZ,OAAAY,EAAAZ,MAAA4B,MAAAhB,EAAAiB,gCAAKZ,EAAEC,GAAA,8BAAA,6FA3BzBN,EAAM7D,2BAgCpBwD,EAAAA,mBAaK,MAAA,KAAA,CAZDA,EAMKC,mBAAA,MAAA,KAAAQ,kBAJGC,EAAEC,GAAA,4BAAoC,SAALN,EAAK5D,KAAA,SAAA,IAAA,CAA6B8E,MAAAlB,EAAAzD,MAAA2E,YAK3EvB,EAAAC,mBAIK,MAJLG,EAIK,CAHDJ,EAEQC,mBAAA,SAAA,CAFAP,MAAM,SAAU0B,sCAAOf,EAAKd,OAAAc,EAAAd,MAAA8B,MAAAhB,EAAAiB,gCAC7BZ,EAAEC,GAAA,+BAAA,qBAVJN,EAAM7D"}
|
|
1
|
+
{"version":3,"file":"Registration.js","sources":["../../../../src/js/components/auth/Registration.vue","../../../../src/js/components/auth/Registration.vue?vue&type=template&id=3977cc8a&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-registration\" v-if=\"!loadingForm\">\n <div class=\"title\">{{ __('auth.registration.title') }}</div>\n <div v-show=\"!thanks\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\" aria-label=\"Register\">\n {{ __('auth.registration.form.submit' + (type == 'short' ? '_short' : '')) }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-already-register\">\n <a @click=\"login\">{{ __('auth.registration.already') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div>\n {{\n __('auth.registration.thanks' + (type == 'short' ? '_short' : ''), {\n email: model.email\n })\n }}\n </div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close\" aria-label=\"Close\">\n {{ __('auth.registration.continue') }}\n </button>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport { formParse } from '@perevorot/shop/dist/helpers';\nimport SecureLS from 'secure-ls';\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n name: 'registration',\n components: {\n SchemaForm\n },\n setup() {\n const store = useStore();\n const loading = ref(false);\n const loadingForm = ref(true);\n const key = ref(0);\n const errors = ref({});\n const thanks = ref(false);\n const type = ref('');\n const schema = ref({});\n const validation = ref({});\n const model = ref({});\n\n let emptyModel;\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/register', {\n type: type.value.charAt(0).toUpperCase() + type.value.slice(1),\n credentials: model.value,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n thanks.value = true;\n\n model.value = emptyModel;\n\n key.value++;\n\n let ls = new SecureLS({\n isCompression: false\n });\n\n let forms = ls.get('forms');\n\n if (forms.registration) {\n forms.registration = {};\n }\n\n ls.set('forms', forms);\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n }\n });\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const login = () => {\n store.commit('auth/modal', 'login');\n };\n\n api.registerForm()\n .then((response) => {\n const form = formParse(response.data);\n\n emptyModel = form.model;\n\n schema.value = form.schema;\n model.value = form.model;\n validation.value = form.validation;\n\n type.value = response.data.type;\n })\n .finally(() => {\n loadingForm.value = false;\n });\n\n return {\n loading,\n loadingForm,\n key,\n errors,\n schema,\n validation,\n onSubmit,\n facebook,\n google,\n thanks,\n model,\n close,\n type,\n login\n };\n }\n};\n</script>","<template>\n <div class=\"auth-registration\" v-if=\"!loadingForm\">\n <div class=\"title\">{{ __('auth.registration.title') }}</div>\n <div v-show=\"!thanks\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\" aria-label=\"Register\">\n {{ __('auth.registration.form.submit' + (type == 'short' ? '_short' : '')) }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-already-register\">\n <a @click=\"login\">{{ __('auth.registration.already') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div>\n {{\n __('auth.registration.thanks' + (type == 'short' ? '_short' : ''), {\n email: model.email\n })\n }}\n </div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close\" aria-label=\"Close\">\n {{ __('auth.registration.continue') }}\n </button>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport { formParse } from '@perevorot/shop/dist/helpers';\nimport SecureLS from 'secure-ls';\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n name: 'registration',\n components: {\n SchemaForm\n },\n setup() {\n const store = useStore();\n const loading = ref(false);\n const loadingForm = ref(true);\n const key = ref(0);\n const errors = ref({});\n const thanks = ref(false);\n const type = ref('');\n const schema = ref({});\n const validation = ref({});\n const model = ref({});\n\n let emptyModel;\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/register', {\n type: type.value.charAt(0).toUpperCase() + type.value.slice(1),\n credentials: model.value,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n thanks.value = true;\n\n model.value = emptyModel;\n\n key.value++;\n\n let ls = new SecureLS({\n isCompression: false\n });\n\n let forms = ls.get('forms');\n\n if (forms.registration) {\n forms.registration = {};\n }\n\n ls.set('forms', forms);\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n }\n });\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const login = () => {\n store.commit('auth/modal', 'login');\n };\n\n api.registerForm()\n .then((response) => {\n const form = formParse(response.data);\n\n emptyModel = form.model;\n\n schema.value = form.schema;\n model.value = form.model;\n validation.value = form.validation;\n\n type.value = response.data.type;\n })\n .finally(() => {\n loadingForm.value = false;\n });\n\n return {\n loading,\n loadingForm,\n key,\n errors,\n schema,\n validation,\n onSubmit,\n facebook,\n google,\n thanks,\n model,\n close,\n type,\n login\n };\n }\n};\n</script>"],"names":["script","name","components","SchemaForm","SchemaFormFactory","VeeValidatePlugin","setup","emptyModel","store","useStore","loading","ref","loadingForm","key","errors","thanks","type","schema","validation","model","useSchemaForm","api","registerForm","then","response","form","formParse","data","value","finally","onSubmit","dispatch","charAt","toUpperCase","slice","credentials","callback","ls","SecureLS","isCompression","forms","get","registration","set","catch","error","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","field","messages","facebook","window","location","href","$ziggy","provider","google","close","commit","login","class","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_createElementVNode","createElementVNode","xlink:href","_hoisted_13","_hoisted_14","$setup","_openBlock","_createElementBlock","_hoisted_1","_toDisplayString","_ctx","__","_createVNode","_component_SchemaForm","schemaRowClasses","validation-schema","initial-errors","afterForm","_normalizeClass","aria-label","onClick","apply","arguments","email"],"mappings":"4zCA4DA,IAEeA,EAAA,CACXC,KAAM,eACNC,WAAY,CACRC,WALWC,EAAAA,kBAAkB,CAACC,EAAiB,QAAC,OAOpDC,MAAK,WACD,IAWIC,EAXEC,EAAQC,EAAAA,WACRC,EAAUC,OAAI,GACdC,EAAcD,OAAI,GAClBE,EAAMF,MAAI,GACVG,EAASH,MAAI,IACbI,EAASJ,OAAI,GACbK,EAAOL,MAAI,IACXM,EAASN,MAAI,IACbO,EAAaP,MAAI,IACjBQ,EAAQR,MAAI,IAIlBS,EAAaA,cAACD,GAiFd,OAhBAE,EAAAA,KAAIC,eACCC,MAAK,SAACC,GACH,IAAMC,EAAOC,EAAAA,UAAUF,EAASG,MAEhCpB,EAAakB,EAAKN,MAElBF,EAAOW,MAAQH,EAAKR,OACpBE,EAAMS,MAAQH,EAAKN,MACnBD,EAAWU,MAAQH,EAAKP,WAExBF,EAAKY,MAAQJ,EAASG,KAAKX,QAE9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,UAAAqB,EAAArB,SAAAqC,MAAAhB,EAAAiB,iBAMlCtB,EAIGC,mBAAA,IAAA,CAJAP,MAAM,SAAU0B,sCAAOf,EAAMf,QAAAe,EAAAf,OAAA+B,MAAAhB,EAAAiB,qBAOxCtB,EAAAA,mBAEK,MAFLG,EAEK,CADDH,EAA0DC,mBAAA,IAAA,CAAtDmB,sCAAOf,EAAKZ,OAAAY,EAAAZ,MAAA4B,MAAAhB,EAAAiB,gCAAKZ,EAAEC,GAAA,8BAAA,6FA3BzBN,EAAM7D,2BAgCpBwD,EAAAA,mBAaK,MAAA,KAAA,CAZDA,EAMKC,mBAAA,MAAA,KAAAQ,kBAJGC,EAAEC,GAAA,4BAAoC,SAALN,EAAK5D,KAAA,SAAA,IAAA,CAA6B8E,MAAAlB,EAAAzD,MAAA2E,YAK3EvB,EAAAC,mBAIK,MAJLG,EAIK,CAHDJ,EAEQC,mBAAA,SAAA,CAFAP,MAAM,SAAU0B,sCAAOf,EAAKd,OAAAc,EAAAd,MAAA8B,MAAAhB,EAAAiB,aAAEH,aAAW,2BAC1CT,EAAEC,GAAA,+BAAA,qBAVJN,EAAM7D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n={name:"user",components:{Reset:o(require("@perevorot/shop/dist/js/components/auth/Reset")).default},props:{resetToken:{type:String,default:""},resetEmail:{type:String,default:""},tokenValid:{type:Boolean,default:!1}},setup:function(o){var n=t.useStore(),l=e.computed((function(){return n.getters["auth/me"]})),a=e.computed((function(){return n.getters["auth/modal"]})),r=e.computed((function(){return Object.keys(l.value).length>0})),c=e.ref(!1),s=e.computed((function(){return n.getters["auth/account"]})),i=function(){n.commit("auth/modal",null),n.dispatch("auth/me")};return n.dispatch("auth/me",{finally:function(){c.value=!0}}),window.addEventListener("keyup",(function(e){a.value&&"Escape"===e.key&&i()})),o.resetToken&&n.commit("auth/modal","reset"),{mounted:c,user:l,logged:r,modal:a,open:function(){n.commit("auth/modal","login")},close:i,register:function(){n.commit("auth/modal","registration")},logout:function(){n.dispatch("auth/logout")},routes:s}}},l={key:0,class:"auth-user"},a={class:"modal-content"},r=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],c={class:"box"},s={class:"tabs"},i={key:1,class:"auth-user"},u={class:"dropdown is-right is-hoverable"},d={class:"dropdown-trigger"},m=["href"],p=e.createElementVNode("i",{class:"fas fa-user"},null,-1),g=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-angle-down","aria-hidden":"true"})],-1),f={class:"dropdown-menu",role:"menu"},k={class:"dropdown-content"},v=["href"],E={key:0,class:"icon"},h=["xlink:href"],V={key:1,class:"badge"},N={key:1,class:"dropdown-divider"},y=e.createElementVNode("hr",{class:"dropdown-divider"},null,-1),B=e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#icon-logout"})],-1);n.render=function(t,o,n,C,b,w){var S=e.resolveComponent("login"),x=e.resolveComponent("registration"),_=e.resolveComponent("reset");return C.mounted&&!C.logged?(e.openBlock(),e.createElementBlock("div",l,[e.renderSlot(t.$slots,"login",{open:C.open,label:t.__("auth.login.login")},(function(){return[e.createElementVNode("a",{class:"button",onClick:o[0]||(o[0]=function(){return C.open&&C.open.apply(C,arguments)})},e.toDisplayString(t.__("auth.login.login")),1)]})),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":C.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:o[1]||(o[1]=function(){return C.close&&C.close.apply(C,arguments)})}),e.createElementVNode("div",a,[e.createElementVNode("button",{class:"modal-close is-large",onClick:o[2]||(o[2]=function(){return C.close&&C.close.apply(C,arguments)})},r),e.createElementVNode("div",c,[e.createElementVNode("div",s,[e.createElementVNode("ul",null,[e.createElementVNode("li",{class:e.normalizeClass({"is-active":"login"==C.modal||"forget"==C.modal})},[e.createElementVNode("a",{onClick:o[3]||(o[3]=function(){return C.open&&C.open.apply(C,arguments)})},e.toDisplayString(t.__("auth.login.login")),1)],2),e.createElementVNode("li",{class:e.normalizeClass({"is-active":"registration"==C.modal}),onClick:o[4]||(o[4]=function(){return C.register&&C.register.apply(C,arguments)})},[e.createElementVNode("a",null,e.toDisplayString(t.__("auth.login.signup")),1)],2)])]),(e.openBlock(),e.createBlock(e.KeepAlive,null,["login"==C.modal||"forget"==C.modal?(e.openBlock(),e.createBlock(S,{key:0})):e.createCommentVNode("v-if",!0)],1024)),(e.openBlock(),e.createBlock(e.KeepAlive,null,["registration"==C.modal?(e.openBlock(),e.createBlock(x,{key:0})):e.createCommentVNode("v-if",!0)],1024)),e.withDirectives(e.createVNode(_,null,null,512),[[e.vShow,"reset"==C.modal]])])])],2)])):C.mounted?(e.openBlock(),e.createElementBlock("div",i,[e.createElementVNode("div",u,[e.createElementVNode("div",d,[e.createElementVNode("a",{class:"button",href:C.routes[0].path},[e.renderSlot(t.$slots,"user",{user:C.user.name?C.user.name:C.user.email},(function(){return[e.createElementVNode("span",null,[p,e.createTextVNode(" "+e.toDisplayString(C.user.name?C.user.name:C.user.email),1)]),g]}))],8,m)]),e.createElementVNode("div",f,[e.createElementVNode("div",k,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.routes,(function(t,o){return e.openBlock(),e.createElementBlock("div",{key:o},[t.text?(e.openBlock(),e.createElementBlock("a",{key:0,href:t.path,class:"dropdown-item"},[t.icon?(e.openBlock(),e.createElementBlock("svg",E,[e.createElementVNode("use",{"xlink:href":"#"+t.icon},null,8,h)])):e.createCommentVNode("v-if",!0),e.createElementVNode("span",null,e.toDisplayString(t.text),1),t.badge?(e.openBlock(),e.createElementBlock("span",V,e.toDisplayString(t.badge),1)):e.createCommentVNode("v-if",!0)],8,v)):(e.openBlock(),e.createElementBlock("hr",N))])})),128)),y,e.createElementVNode("
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n={name:"user",components:{Reset:o(require("@perevorot/shop/dist/js/components/auth/Reset")).default},props:{resetToken:{type:String,default:""},resetEmail:{type:String,default:""},tokenValid:{type:Boolean,default:!1}},setup:function(o){var n=t.useStore(),l=e.computed((function(){return n.getters["auth/me"]})),a=e.computed((function(){return n.getters["auth/modal"]})),r=e.computed((function(){return Object.keys(l.value).length>0})),c=e.ref(!1),s=e.computed((function(){return n.getters["auth/account"]})),i=function(){n.commit("auth/modal",null),n.dispatch("auth/me")};return n.dispatch("auth/me",{finally:function(){c.value=!0}}),window.addEventListener("keyup",(function(e){a.value&&"Escape"===e.key&&i()})),o.resetToken&&n.commit("auth/modal","reset"),{mounted:c,user:l,logged:r,modal:a,open:function(){n.commit("auth/modal","login")},close:i,register:function(){n.commit("auth/modal","registration")},logout:function(){n.dispatch("auth/logout")},routes:s}}},l={key:0,class:"auth-user"},a={class:"modal-content"},r=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],c={class:"box"},s={class:"tabs"},i={key:1,class:"auth-user"},u={class:"dropdown is-right is-hoverable"},d={class:"dropdown-trigger"},m=["href"],p=e.createElementVNode("i",{class:"fas fa-user"},null,-1),g=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-angle-down","aria-hidden":"true"})],-1),f={class:"dropdown-menu",role:"menu"},k={class:"dropdown-content"},v=["href"],E={key:0,class:"icon"},h=["xlink:href"],V={key:1,class:"badge"},N={key:1,class:"dropdown-divider"},y=e.createElementVNode("hr",{class:"dropdown-divider"},null,-1),B=e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#icon-logout"})],-1);n.render=function(t,o,n,C,b,w){var S=e.resolveComponent("login"),x=e.resolveComponent("registration"),_=e.resolveComponent("reset");return C.mounted&&!C.logged?(e.openBlock(),e.createElementBlock("div",l,[e.renderSlot(t.$slots,"login",{open:C.open,label:t.__("auth.login.login")},(function(){return[e.createElementVNode("a",{class:"button",onClick:o[0]||(o[0]=function(){return C.open&&C.open.apply(C,arguments)})},e.toDisplayString(t.__("auth.login.login")),1)]})),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":C.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:o[1]||(o[1]=function(){return C.close&&C.close.apply(C,arguments)})}),e.createElementVNode("div",a,[e.createElementVNode("button",{class:"modal-close is-large",onClick:o[2]||(o[2]=function(){return C.close&&C.close.apply(C,arguments)}),"aria-label":"Close"},r),e.createElementVNode("div",c,[e.createElementVNode("div",s,[e.createElementVNode("ul",null,[e.createElementVNode("li",{class:e.normalizeClass({"is-active":"login"==C.modal||"forget"==C.modal})},[e.createElementVNode("a",{onClick:o[3]||(o[3]=function(){return C.open&&C.open.apply(C,arguments)})},e.toDisplayString(t.__("auth.login.login")),1)],2),e.createElementVNode("li",{class:e.normalizeClass({"is-active":"registration"==C.modal}),onClick:o[4]||(o[4]=function(){return C.register&&C.register.apply(C,arguments)})},[e.createElementVNode("a",null,e.toDisplayString(t.__("auth.login.signup")),1)],2)])]),(e.openBlock(),e.createBlock(e.KeepAlive,null,["login"==C.modal||"forget"==C.modal?(e.openBlock(),e.createBlock(S,{key:0})):e.createCommentVNode("v-if",!0)],1024)),(e.openBlock(),e.createBlock(e.KeepAlive,null,["registration"==C.modal?(e.openBlock(),e.createBlock(x,{key:0})):e.createCommentVNode("v-if",!0)],1024)),e.withDirectives(e.createVNode(_,null,null,512),[[e.vShow,"reset"==C.modal]])])])],2)])):C.mounted?(e.openBlock(),e.createElementBlock("div",i,[e.createElementVNode("div",u,[e.createElementVNode("div",d,[e.createElementVNode("a",{class:"button",href:C.routes[0].path},[e.renderSlot(t.$slots,"user",{user:C.user.name?C.user.name:C.user.email},(function(){return[e.createElementVNode("span",null,[p,e.createTextVNode(" "+e.toDisplayString(C.user.name?C.user.name:C.user.email),1)]),g]}))],8,m)]),e.createElementVNode("div",f,[e.createElementVNode("div",k,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.routes,(function(t,o){return e.openBlock(),e.createElementBlock("div",{key:o},[t.text?(e.openBlock(),e.createElementBlock("a",{key:0,href:t.path,class:"dropdown-item"},[t.icon?(e.openBlock(),e.createElementBlock("svg",E,[e.createElementVNode("use",{"xlink:href":"#"+t.icon},null,8,h)])):e.createCommentVNode("v-if",!0),e.createElementVNode("span",null,e.toDisplayString(t.text),1),t.badge?(e.openBlock(),e.createElementBlock("span",V,e.toDisplayString(t.badge),1)):e.createCommentVNode("v-if",!0)],8,v)):(e.openBlock(),e.createElementBlock("hr",N))])})),128)),y,e.createElementVNode("button",{class:"dropdown-item",onClick:o[5]||(o[5]=function(){return C.logout&&C.logout.apply(C,arguments)}),"aria-label":"Logout"},[B,e.createElementVNode("span",null,e.toDisplayString(t.__("auth.user.menu.logout")),1)])])])])])):e.createCommentVNode("v-if",!0)},module.exports=n;
|
|
2
2
|
//# sourceMappingURL=User.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","sources":["../../../../src/js/components/auth/User.vue","../../../../src/js/components/auth/User.vue?vue&type=template&id=fc39b0b6&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 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 <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a>{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user\" 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 } from 'vue';\nimport { useStore } from 'vuex';\nimport Reset from '@perevorot/shop/dist/js/components/auth/Reset';\n\nexport default {\n name: 'user',\n components: {\n Reset\n },\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 },\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\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 });\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 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 <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a>{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user\" 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 } from 'vue';\nimport { useStore } from 'vuex';\nimport Reset from '@perevorot/shop/dist/js/components/auth/Reset';\n\nexport default {\n name: 'user',\n components: {\n Reset\n },\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 },\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\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 });\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":["script","name","components","Reset","props","resetToken","type","String","default","resetEmail","tokenValid","Boolean","setup","store","useStore","user","computed","getters","modal","logged","Object","keys","value","length","mounted","ref","routes","close","commit","dispatch","finally","window","addEventListener","e","key","open","register","logout","class","_hoisted_2","_createElementVNode","createElementVNode","xlink:href","_hoisted_5","_hoisted_6","_hoisted_8","_hoisted_9","aria-hidden","role","_hoisted_14","$setup","_openBlock","_createElementBlock","createElementBlock","_hoisted_1","_renderSlot","_ctx","$slots","label","__","onClick","apply","arguments","_normalizeClass","is-active","_createBlock","_KeepAlive","_component_login","createBlock","_component_registration","_createVNode","_component_reset","openBlock","_hoisted_7","href","path","renderSlot","email","_hoisted_11","_toDisplayString","_hoisted_12","_hoisted_13","_Fragment","_renderList","renderList","item","text","icon","_hoisted_16","badge","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21"],"mappings":"gIAoFeA,EAAA,CACXC,KAAM,OACNC,WAAY,CACRC,kEAAAA,SAEJC,MAAO,CACHC,WAAY,CACRC,KAAMC,OACNC,QAAS,IAEbC,WAAY,CACRH,KAAMC,OACNC,QAAS,IAEbE,WAAY,CACRJ,KAAMK,QACNH,SAAS,IAGjBI,MAAAA,SAAMR,GACF,IAAMS,EAAQC,EAAAA,WACRC,EAAOC,EAAAA,UAAS,WAAA,OAAMH,EAAMI,QAAQ,cACpCC,EAAQF,EAAAA,UAAS,WAAA,OAAMH,EAAMI,QAAQ,iBACrCE,EAASH,EAAAA,UAAS,WAAA,OAAMI,OAAOC,KAAKN,EAAKO,OAAOC,OAAS,KACzDC,EAAUC,OAAI,GACdC,EAASV,EAAAA,UAAS,WAAA,OAAMH,EAAMI,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SD,EAAKI,OAA/BtC,cAAAC,EAAAC,mBAA4D,OAA5DqC,EAAyCX,EAAAA,gBAAAM,EAAKI,OAAM,4CAExDtC,cAAAC,EAAAC,mBAAqC,KAArCsC,eAEJC,EACApD,EAAAA,mBAKG,IAAA,CALAF,MAAM,gBAAiBsB,sCAAOV,EAAMb,QAAAa,EAAAb,OAAAwB,MAAAX,EAAAY,eACnC+B,EAGArD,EAAAA,mBAA6C,8BAApCgB,EAAEG,GAAA,0BAAA"}
|
|
1
|
+
{"version":3,"file":"User.js","sources":["../../../../src/js/components/auth/User.vue","../../../../src/js/components/auth/User.vue?vue&type=template&id=220de36e&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 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\" aria-label=\"Close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a>{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user\" 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 <button class=\"dropdown-item\" @click=\"logout\" aria-label=\"Logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </button>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { ref, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport Reset from '@perevorot/shop/dist/js/components/auth/Reset';\n\nexport default {\n name: 'user',\n components: {\n Reset\n },\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 },\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\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 });\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 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\" aria-label=\"Close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a>{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user\" 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 <button class=\"dropdown-item\" @click=\"logout\" aria-label=\"Logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </button>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { ref, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport Reset from '@perevorot/shop/dist/js/components/auth/Reset';\n\nexport default {\n name: 'user',\n components: {\n Reset\n },\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 },\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\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 });\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":["script","name","components","Reset","props","resetToken","type","String","default","resetEmail","tokenValid","Boolean","setup","store","useStore","user","computed","getters","modal","logged","Object","keys","value","length","mounted","ref","routes","close","commit","dispatch","finally","window","addEventListener","e","key","open","register","logout","class","_hoisted_2","_createElementVNode","createElementVNode","xlink:href","_hoisted_5","_hoisted_6","_hoisted_8","_hoisted_9","aria-hidden","role","_hoisted_14","$setup","_openBlock","_createElementBlock","createElementBlock","_hoisted_1","_renderSlot","_ctx","$slots","label","__","onClick","apply","arguments","_normalizeClass","is-active","aria-label","_createBlock","_KeepAlive","_component_login","createBlock","_component_registration","_createVNode","_component_reset","openBlock","_hoisted_7","href","path","renderSlot","email","_hoisted_11","_toDisplayString","_hoisted_12","_hoisted_13","_Fragment","_renderList","renderList","item","text","icon","_hoisted_16","badge","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21"],"mappings":"gIAoFeA,EAAA,CACXC,KAAM,OACNC,WAAY,CACRC,kEAAAA,SAEJC,MAAO,CACHC,WAAY,CACRC,KAAMC,OACNC,QAAS,IAEbC,WAAY,CACRH,KAAMC,OACNC,QAAS,IAEbE,WAAY,CACRJ,KAAMK,QACNH,SAAS,IAGjBI,MAAAA,SAAMR,GACF,IAAMS,EAAQC,EAAAA,WACRC,EAAOC,EAAAA,UAAS,WAAA,OAAMH,EAAMI,QAAQ,cACpCC,EAAQF,EAAAA,UAAS,WAAA,OAAMH,EAAMI,QAAQ,iBACrCE,EAASH,EAAAA,UAAS,WAAA,OAAMI,OAAOC,KAAKN,EAAKO,OAAOC,OAAS,KACzDC,EAAUC,OAAI,GACdC,EAASV,EAAAA,UAAS,WAAA,OAAMH,EAAMI,QAAQ,mBAMtCU,EAAQ,WACVd,EAAMe,OAAO,aAAc,MAC3Bf,EAAMgB,SAAS,YA2BnB,OAhBAhB,EAAMgB,SAAS,UAAW,CACtBC,QAAS,WACLN,EAAQF,OAAQ,KAIxBS,OAAOC,iBAAiB,SAAS,SAACC,GAC1Bf,EAAMI,OAAmB,WAAVW,EAAEC,KACjBP,OAIJvB,EAAMC,YACNQ,EAAMe,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EG,aAAW,WACrD6B,EAGAtD,EAAAA,mBAA6C,8BAApCgB,EAAEG,GAAA,0BAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("swiper/core");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(t);i.default.use([t.Navigation,t.Mousewheel,t.Thumbs]);var o=e.defineComponent({name:"gallery",props:{thumbsDirection:{type:String,default:"horizontal"},fullscreenThumbsDirection:{type:String,default:"horizontal"},prev:{type:String,default:".swiper-button-prev"},next:{type:String,default:".swiper-button-next"},thumbPrev:{type:String,default:".swiper-button-prev"},thumbNext:{type:String,default:".swiper-button-next"},fullscreen:{type:Boolean,default:!1},isResizeThumbs:{type:Boolean,default:!1},thumbsSpaceBetween:{type:Number,default:10}},setup:function(t){var n,o,r,u,l,s=e.ref(!1),a=function(){document.body.classList.remove("product-gallery-modal-open"),s.value=!1,d("close"),t.isResizeThumbs&&p()},c=function(){document.body.classList.add("product-gallery-modal-open"),s.value=!0,d("open")},d=function(e){o&&(t.thumbsDirection!=t.fullscreenThumbsDirection?u.changeDirection("open"==e?t.fullscreenThumbsDirection:t.thumbsDirection):u.update()),l.update()};window.addEventListener("keyup",(function(e){s.value&&"Escape"===e.key&&a()}));var p=function(){o.style.height=parseInt(r.offsetHeight)+"px",u.update()},m=function(){clearTimeout(n),n=setTimeout((function(){p()}),500)};return document.addEventListener("DOMContentLoaded",(function(){if(o=document.getElementById("product-gallery-thumbs"),r=document.getElementById("product-gallery"),o&&(u=new i.default(o,{spaceBetween:t.thumbsSpaceBetween,slidesPerView:"auto",mousewheel:{forceToAxis:!0},freeMode:!0,watchSlidesVisibility:!0,watchSlidesProgress:!0,direction:t.thumbsDirection,navigation:{nextEl:t.thumbNext,prevEl:t.thumbPrev}}),t.isResizeThumbs&&(window.addEventListener("resize",m),p()),o.classList.remove("not-inited")),t.fullscreen&&r.addEventListener("click",c),r){var e={spaceBetween:10,mousewheel:{forceToAxis:!0},centeredSlides:!0,navigation:{nextEl:t.next,prevEl:t.prev}};u&&(e.thumbs={swiper:u}),l=new i.default(r,e)}d("close")}),!1),{modal:s,close:a}}});o.render=function(t,n,i,o,r,u){return t.fullscreen?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["delete is-large",{"is-hidden":!t.modal}]),onClick:n[0]||(n[0]=function(){return t.close&&t.close.apply(t,arguments)})},null,2)):e.createCommentVNode("v-if",!0)},module.exports=o;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("swiper/core");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(t);i.default.use([t.Navigation,t.Mousewheel,t.Thumbs]);var o=e.defineComponent({name:"gallery",props:{thumbsDirection:{type:String,default:"horizontal"},fullscreenThumbsDirection:{type:String,default:"horizontal"},prev:{type:String,default:".swiper-button-prev"},next:{type:String,default:".swiper-button-next"},thumbPrev:{type:String,default:".swiper-button-prev"},thumbNext:{type:String,default:".swiper-button-next"},fullscreen:{type:Boolean,default:!1},isResizeThumbs:{type:Boolean,default:!1},thumbsSpaceBetween:{type:Number,default:10}},setup:function(t){var n,o,r,u,l,s=e.ref(!1),a=function(){document.body.classList.remove("product-gallery-modal-open"),s.value=!1,d("close"),t.isResizeThumbs&&p()},c=function(){document.body.classList.add("product-gallery-modal-open"),s.value=!0,d("open")},d=function(e){o&&(t.thumbsDirection!=t.fullscreenThumbsDirection?u.changeDirection("open"==e?t.fullscreenThumbsDirection:t.thumbsDirection):u.update()),l.update()};window.addEventListener("keyup",(function(e){s.value&&"Escape"===e.key&&a()}));var p=function(){o.style.height=parseInt(r.offsetHeight)+"px",u.update()},m=function(){clearTimeout(n),n=setTimeout((function(){p()}),500)};return document.addEventListener("DOMContentLoaded",(function(){if(o=document.getElementById("product-gallery-thumbs"),r=document.getElementById("product-gallery"),o&&(u=new i.default(o,{spaceBetween:t.thumbsSpaceBetween,slidesPerView:"auto",mousewheel:{forceToAxis:!0},freeMode:!0,watchSlidesVisibility:!0,watchSlidesProgress:!0,direction:t.thumbsDirection,navigation:{nextEl:t.thumbNext,prevEl:t.thumbPrev}}),t.isResizeThumbs&&(window.addEventListener("resize",m),p()),o.classList.remove("not-inited")),t.fullscreen&&r.addEventListener("click",c),r){var e={spaceBetween:10,mousewheel:{forceToAxis:!0},centeredSlides:!0,navigation:{nextEl:t.next,prevEl:t.prev}};u&&(e.thumbs={swiper:u}),l=new i.default(r,e)}d("close")}),!1),{modal:s,close:a}}});o.render=function(t,n,i,o,r,u){return t.fullscreen?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["delete is-large",{"is-hidden":!t.modal}]),onClick:n[0]||(n[0]=function(){return t.close&&t.close.apply(t,arguments)}),"aria-label":"Close"},null,2)):e.createCommentVNode("v-if",!0)},module.exports=o;
|
|
2
2
|
//# sourceMappingURL=Gallery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gallery.js","sources":["../../../../src/js/components/shop/Gallery.vue","../../../../src/js/components/shop/Gallery.vue?vue&type=template&id=6652fb70&lang.js"],"sourcesContent":["<template>\n <button\n class=\"delete is-large\"\n @click=\"close\"\n v-if=\"fullscreen\"\n v-bind:class=\"{ 'is-hidden': !modal }\"\n ></button>\n</template>\n<script>\nimport { ref, defineComponent } from \"vue\";\nimport SwiperCore, { Navigation, Mousewheel, Thumbs } from \"swiper/core\";\n\nSwiperCore.use([Navigation, Mousewheel, Thumbs]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"gallery\",\n props: {\n thumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n fullscreenThumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n prev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n next: {\n type: String,\n default: \".swiper-button-next\",\n },\n thumbPrev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n thumbNext: {\n type: String,\n default: \".swiper-button-next\",\n },\n fullscreen: {\n type: Boolean,\n default: false,\n },\n isResizeThumbs: {\n type: Boolean,\n default: false,\n },\n thumbsSpaceBetween: {\n type: Number,\n default: 10,\n },\n },\n setup(props) {\n const modal = ref(false);\n let resizeTimeout;\n let thumbs;\n let slider;\n let thumbsSwiper;\n let sliderSwiper;\n\n const close = () => {\n document.body.classList.remove(\"product-gallery-modal-open\");\n modal.value = false;\n\n update(\"close\");\n\n if (props.isResizeThumbs) {\n resizeThumbsSwiper();\n }\n };\n\n const open = () => {\n document.body.classList.add(\"product-gallery-modal-open\");\n modal.value = true;\n\n update(\"open\");\n };\n\n const update = (action) => {\n if (thumbs) {\n if (props.thumbsDirection != props.fullscreenThumbsDirection) {\n thumbsSwiper.changeDirection(\n action == \"open\"\n ? props.fullscreenThumbsDirection\n : props.thumbsDirection\n );\n } else {\n thumbsSwiper.update();\n }\n }\n\n sliderSwiper.update();\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n close();\n }\n });\n\n const resizeThumbsSwiper = () => {\n thumbs.style.height = parseInt(slider.offsetHeight) + \"px\";\n thumbsSwiper.update();\n };\n\n const resizeBounced = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = setTimeout(() => {\n resizeThumbsSwiper();\n }, 500);\n };\n\n const init = () => {\n thumbs = document.getElementById(\"product-gallery-thumbs\");\n slider = document.getElementById(\"product-gallery\");\n\n if (thumbs) {\n thumbsSwiper = new SwiperCore(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\n });\n\n if (props.isResizeThumbs) {\n window.addEventListener(\"resize\", resizeBounced);\n resizeThumbsSwiper();\n }\n\n thumbs.classList.remove(\"not-inited\");\n }\n\n if (props.fullscreen) {\n slider.addEventListener(\"click\", open);\n }\n\n if (slider) {\n let options = {\n spaceBetween: 10,\n mousewheel: {\n forceToAxis: true,\n },\n centeredSlides: true,\n navigation: {\n nextEl: props.next,\n prevEl: props.prev,\n },\n };\n\n if (thumbsSwiper) {\n options.thumbs = {\n swiper: thumbsSwiper,\n };\n }\n\n sliderSwiper = new SwiperCore(slider, options);\n }\n\n update(\"close\");\n };\n\n document.addEventListener(\"DOMContentLoaded\", init, false);\n\n return {\n modal,\n close,\n };\n },\n});\n</script>","<template>\n <button\n class=\"delete is-large\"\n @click=\"close\"\n v-if=\"fullscreen\"\n v-bind:class=\"{ 'is-hidden': !modal }\"\n ></button>\n</template>\n<script>\nimport { ref, defineComponent } from \"vue\";\nimport SwiperCore, { Navigation, Mousewheel, Thumbs } from \"swiper/core\";\n\nSwiperCore.use([Navigation, Mousewheel, Thumbs]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"gallery\",\n props: {\n thumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n fullscreenThumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n prev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n next: {\n type: String,\n default: \".swiper-button-next\",\n },\n thumbPrev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n thumbNext: {\n type: String,\n default: \".swiper-button-next\",\n },\n fullscreen: {\n type: Boolean,\n default: false,\n },\n isResizeThumbs: {\n type: Boolean,\n default: false,\n },\n thumbsSpaceBetween: {\n type: Number,\n default: 10,\n },\n },\n setup(props) {\n const modal = ref(false);\n let resizeTimeout;\n let thumbs;\n let slider;\n let thumbsSwiper;\n let sliderSwiper;\n\n const close = () => {\n document.body.classList.remove(\"product-gallery-modal-open\");\n modal.value = false;\n\n update(\"close\");\n\n if (props.isResizeThumbs) {\n resizeThumbsSwiper();\n }\n };\n\n const open = () => {\n document.body.classList.add(\"product-gallery-modal-open\");\n modal.value = true;\n\n update(\"open\");\n };\n\n const update = (action) => {\n if (thumbs) {\n if (props.thumbsDirection != props.fullscreenThumbsDirection) {\n thumbsSwiper.changeDirection(\n action == \"open\"\n ? props.fullscreenThumbsDirection\n : props.thumbsDirection\n );\n } else {\n thumbsSwiper.update();\n }\n }\n\n sliderSwiper.update();\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n close();\n }\n });\n\n const resizeThumbsSwiper = () => {\n thumbs.style.height = parseInt(slider.offsetHeight) + \"px\";\n thumbsSwiper.update();\n };\n\n const resizeBounced = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = setTimeout(() => {\n resizeThumbsSwiper();\n }, 500);\n };\n\n const init = () => {\n thumbs = document.getElementById(\"product-gallery-thumbs\");\n slider = document.getElementById(\"product-gallery\");\n\n if (thumbs) {\n thumbsSwiper = new SwiperCore(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\n });\n\n if (props.isResizeThumbs) {\n window.addEventListener(\"resize\", resizeBounced);\n resizeThumbsSwiper();\n }\n\n thumbs.classList.remove(\"not-inited\");\n }\n\n if (props.fullscreen) {\n slider.addEventListener(\"click\", open);\n }\n\n if (slider) {\n let options = {\n spaceBetween: 10,\n mousewheel: {\n forceToAxis: true,\n },\n centeredSlides: true,\n navigation: {\n nextEl: props.next,\n prevEl: props.prev,\n },\n };\n\n if (thumbsSwiper) {\n options.thumbs = {\n swiper: thumbsSwiper,\n };\n }\n\n sliderSwiper = new SwiperCore(slider, options);\n }\n\n update(\"close\");\n };\n\n document.addEventListener(\"DOMContentLoaded\", init, false);\n\n return {\n modal,\n close,\n };\n },\n});\n</script>"],"names":["SwiperCore","use","Navigation","Mousewheel","Thumbs","script","defineComponent","name","props","thumbsDirection","type","String","default","fullscreenThumbsDirection","prev","next","thumbPrev","thumbNext","fullscreen","Boolean","isResizeThumbs","thumbsSpaceBetween","Number","setup","resizeTimeout","thumbs","slider","thumbsSwiper","sliderSwiper","modal","ref","close","document","body","classList","remove","value","update","resizeThumbsSwiper","open","add","action","changeDirection","window","addEventListener","e","key","style","height","parseInt","offsetHeight","resizeBounced","clearTimeout","setTimeout","getElementById","spaceBetween","slidesPerView","mousewheel","forceToAxis","freeMode","watchSlidesVisibility","watchSlidesProgress","direction","navigation","nextEl","prevEl","options","centeredSlides","swiper","_ctx","_createElementBlock","class","_normalizeClass","is-hidden","onClick","apply","arguments"],"mappings":"8IAYAA,EAAU,QAACC,IAAI,CAACC,EAAAA,WAAYC,EAAAA,WAAYC,EAAAA,SAExC,IAAeC,EAAcC,kBAAgB,CACzCC,KAAM,UACNC,MAAO,CACHC,gBAAiB,CACbC,KAAMC,OACNC,QAAS,cAEbC,0BAA2B,CACvBH,KAAMC,OACNC,QAAS,cAEbE,KAAM,CACFJ,KAAMC,OACNC,QAAS,uBAEbG,KAAM,CACFL,KAAMC,OACNC,QAAS,uBAEbI,UAAW,CACPN,KAAMC,OACNC,QAAS,uBAEbK,UAAW,CACPP,KAAMC,OACNC,QAAS,uBAEbM,WAAY,CACRR,KAAMS,QACNP,SAAS,GAEbQ,eAAgB,CACZV,KAAMS,QACNP,SAAS,GAEbS,mBAAoB,CAChBX,KAAMY,OACNV,QAAS,KAGjBW,MAAAA,SAAMf,GACF,IACIgB,EACAC,EACAC,EACAC,EACAC,EALEC,EAAQC,OAAI,GAOZC,EAAQ,WACVC,SAASC,KAAKC,UAAUC,OAAO,8BAC/BN,EAAMO,OAAQ,EAEdC,EAAO,SAEH7B,EAAMY,gBACNkB,KAIFC,EAAO,WACTP,SAASC,KAAKC,UAAUM,IAAI,8BAC5BX,EAAMO,OAAQ,EAEdC,EAAO,SAGLA,EAAS,SAACI,GACRhB,IACIjB,EAAMC,iBAAmBD,EAAMK,0BAC/Bc,EAAae,gBACC,QAAVD,EACMjC,EAAMK,0BACNL,EAAMC,iBAGhBkB,EAAaU,UAIrBT,EAAaS,UAGjBM,OAAOC,iBAAiB,SAAS,SAACC,GAC1BhB,EAAMO,OAAmB,WAAVS,EAAEC,KACjBf,OAIR,IAAMO,EAAqB,WACvBb,EAAOsB,MAAMC,OAASC,SAASvB,EAAOwB,cAAgB,KACtDvB,EAAaU,UAGXc,EAAgB,WAClBC,aAAa5B,GAEbA,EAAgB6B,YAAW,WACvBf,MACD,MA+DP,OAFAN,SAASY,iBAAiB,oBA1Db,WAiCT,GAhCAnB,EAASO,SAASsB,eAAe,0BACjC5B,EAASM,SAASsB,eAAe,mBAE7B7B,IACAE,EAAe,IAAI3B,EAAU,QAACyB,EAAQ,CAClC8B,aAAc/C,EAAMa,mBACpBmC,cAAe,OACfC,WAAY,CACRC,aAAa,GAEjBC,UAAU,EACVC,uBAAuB,EACvBC,qBAAqB,EACrBC,UAAWtD,EAAMC,gBACjBsD,WAAY,CACRC,OAAQxD,EAAMS,UACdgD,OAAQzD,EAAMQ,aAIlBR,EAAMY,iBACNuB,OAAOC,iBAAiB,SAAUO,GAClCb,KAGJb,EAAOS,UAAUC,OAAO,eAGxB3B,EAAMU,YACNQ,EAAOkB,iBAAiB,QAASL,GAGjCb,EAAQ,CACR,IAAIwC,EAAU,CACVX,aAAc,GACdE,WAAY,CACRC,aAAa,GAEjBS,gBAAgB,EAChBJ,WAAY,CACRC,OAAQxD,EAAMO,KACdkD,OAAQzD,EAAMM,OAIlBa,IACAuC,EAAQzC,OAAS,CACb2C,OAAQzC,IAIhBC,EAAe,IAAI5B,EAAAA,QAAW0B,EAAQwC,GAG1C7B,EAAO,YAGyC,GAE7C,CACHR,MAAAA,EACAE,MAAAA,4CC7KEsC,EAAUnD,0BAHpBoD,EAAAA,mBAKS,SAAA,OAJLC,MAAKC,EAAAA,eAAA,CAAC,kBAAgB,CAAAC,aAGQJ,WAF7BK,sCAAOL,EAAKtC,OAAAsC,EAAAtC,MAAA4C,MAAAN,EAAAO"}
|
|
1
|
+
{"version":3,"file":"Gallery.js","sources":["../../../../src/js/components/shop/Gallery.vue","../../../../src/js/components/shop/Gallery.vue?vue&type=template&id=54f761fb&lang.js"],"sourcesContent":["<template>\n <button class=\"delete is-large\" @click=\"close\" v-if=\"fullscreen\" v-bind:class=\"{ 'is-hidden': !modal }\" aria-label=\"Close\"></button>\n</template>\n<script>\nimport { ref, defineComponent } from \"vue\";\nimport SwiperCore, { Navigation, Mousewheel, Thumbs } from \"swiper/core\";\n\nSwiperCore.use([Navigation, Mousewheel, Thumbs]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"gallery\",\n props: {\n thumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n fullscreenThumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n prev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n next: {\n type: String,\n default: \".swiper-button-next\",\n },\n thumbPrev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n thumbNext: {\n type: String,\n default: \".swiper-button-next\",\n },\n fullscreen: {\n type: Boolean,\n default: false,\n },\n isResizeThumbs: {\n type: Boolean,\n default: false,\n },\n thumbsSpaceBetween: {\n type: Number,\n default: 10,\n },\n },\n setup(props) {\n const modal = ref(false);\n let resizeTimeout;\n let thumbs;\n let slider;\n let thumbsSwiper;\n let sliderSwiper;\n\n const close = () => {\n document.body.classList.remove(\"product-gallery-modal-open\");\n modal.value = false;\n\n update(\"close\");\n\n if (props.isResizeThumbs) {\n resizeThumbsSwiper();\n }\n };\n\n const open = () => {\n document.body.classList.add(\"product-gallery-modal-open\");\n modal.value = true;\n\n update(\"open\");\n };\n\n const update = (action) => {\n if (thumbs) {\n if (props.thumbsDirection != props.fullscreenThumbsDirection) {\n thumbsSwiper.changeDirection(\n action == \"open\"\n ? props.fullscreenThumbsDirection\n : props.thumbsDirection\n );\n } else {\n thumbsSwiper.update();\n }\n }\n\n sliderSwiper.update();\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n close();\n }\n });\n\n const resizeThumbsSwiper = () => {\n thumbs.style.height = parseInt(slider.offsetHeight) + \"px\";\n thumbsSwiper.update();\n };\n\n const resizeBounced = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = setTimeout(() => {\n resizeThumbsSwiper();\n }, 500);\n };\n\n const init = () => {\n thumbs = document.getElementById(\"product-gallery-thumbs\");\n slider = document.getElementById(\"product-gallery\");\n\n if (thumbs) {\n thumbsSwiper = new SwiperCore(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\n });\n\n if (props.isResizeThumbs) {\n window.addEventListener(\"resize\", resizeBounced);\n resizeThumbsSwiper();\n }\n\n thumbs.classList.remove(\"not-inited\");\n }\n\n if (props.fullscreen) {\n slider.addEventListener(\"click\", open);\n }\n\n if (slider) {\n let options = {\n spaceBetween: 10,\n mousewheel: {\n forceToAxis: true,\n },\n centeredSlides: true,\n navigation: {\n nextEl: props.next,\n prevEl: props.prev,\n },\n };\n\n if (thumbsSwiper) {\n options.thumbs = {\n swiper: thumbsSwiper,\n };\n }\n\n sliderSwiper = new SwiperCore(slider, options);\n }\n\n update(\"close\");\n };\n\n document.addEventListener(\"DOMContentLoaded\", init, false);\n\n return {\n modal,\n close,\n };\n },\n});\n</script>","<template>\n <button class=\"delete is-large\" @click=\"close\" v-if=\"fullscreen\" v-bind:class=\"{ 'is-hidden': !modal }\" aria-label=\"Close\"></button>\n</template>\n<script>\nimport { ref, defineComponent } from \"vue\";\nimport SwiperCore, { Navigation, Mousewheel, Thumbs } from \"swiper/core\";\n\nSwiperCore.use([Navigation, Mousewheel, Thumbs]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"gallery\",\n props: {\n thumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n fullscreenThumbsDirection: {\n type: String,\n default: \"horizontal\",\n },\n prev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n next: {\n type: String,\n default: \".swiper-button-next\",\n },\n thumbPrev: {\n type: String,\n default: \".swiper-button-prev\",\n },\n thumbNext: {\n type: String,\n default: \".swiper-button-next\",\n },\n fullscreen: {\n type: Boolean,\n default: false,\n },\n isResizeThumbs: {\n type: Boolean,\n default: false,\n },\n thumbsSpaceBetween: {\n type: Number,\n default: 10,\n },\n },\n setup(props) {\n const modal = ref(false);\n let resizeTimeout;\n let thumbs;\n let slider;\n let thumbsSwiper;\n let sliderSwiper;\n\n const close = () => {\n document.body.classList.remove(\"product-gallery-modal-open\");\n modal.value = false;\n\n update(\"close\");\n\n if (props.isResizeThumbs) {\n resizeThumbsSwiper();\n }\n };\n\n const open = () => {\n document.body.classList.add(\"product-gallery-modal-open\");\n modal.value = true;\n\n update(\"open\");\n };\n\n const update = (action) => {\n if (thumbs) {\n if (props.thumbsDirection != props.fullscreenThumbsDirection) {\n thumbsSwiper.changeDirection(\n action == \"open\"\n ? props.fullscreenThumbsDirection\n : props.thumbsDirection\n );\n } else {\n thumbsSwiper.update();\n }\n }\n\n sliderSwiper.update();\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n close();\n }\n });\n\n const resizeThumbsSwiper = () => {\n thumbs.style.height = parseInt(slider.offsetHeight) + \"px\";\n thumbsSwiper.update();\n };\n\n const resizeBounced = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = setTimeout(() => {\n resizeThumbsSwiper();\n }, 500);\n };\n\n const init = () => {\n thumbs = document.getElementById(\"product-gallery-thumbs\");\n slider = document.getElementById(\"product-gallery\");\n\n if (thumbs) {\n thumbsSwiper = new SwiperCore(thumbs, {\n spaceBetween: props.thumbsSpaceBetween,\n slidesPerView: \"auto\",\n mousewheel: {\n forceToAxis: true,\n },\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n direction: props.thumbsDirection,\n navigation: {\n nextEl: props.thumbNext,\n prevEl: props.thumbPrev,\n },\n });\n\n if (props.isResizeThumbs) {\n window.addEventListener(\"resize\", resizeBounced);\n resizeThumbsSwiper();\n }\n\n thumbs.classList.remove(\"not-inited\");\n }\n\n if (props.fullscreen) {\n slider.addEventListener(\"click\", open);\n }\n\n if (slider) {\n let options = {\n spaceBetween: 10,\n mousewheel: {\n forceToAxis: true,\n },\n centeredSlides: true,\n navigation: {\n nextEl: props.next,\n prevEl: props.prev,\n },\n };\n\n if (thumbsSwiper) {\n options.thumbs = {\n swiper: thumbsSwiper,\n };\n }\n\n sliderSwiper = new SwiperCore(slider, options);\n }\n\n update(\"close\");\n };\n\n document.addEventListener(\"DOMContentLoaded\", init, false);\n\n return {\n modal,\n close,\n };\n },\n});\n</script>"],"names":["SwiperCore","use","Navigation","Mousewheel","Thumbs","script","defineComponent","name","props","thumbsDirection","type","String","default","fullscreenThumbsDirection","prev","next","thumbPrev","thumbNext","fullscreen","Boolean","isResizeThumbs","thumbsSpaceBetween","Number","setup","resizeTimeout","thumbs","slider","thumbsSwiper","sliderSwiper","modal","ref","close","document","body","classList","remove","value","update","resizeThumbsSwiper","open","add","action","changeDirection","window","addEventListener","e","key","style","height","parseInt","offsetHeight","resizeBounced","clearTimeout","setTimeout","getElementById","spaceBetween","slidesPerView","mousewheel","forceToAxis","freeMode","watchSlidesVisibility","watchSlidesProgress","direction","navigation","nextEl","prevEl","options","centeredSlides","swiper","_ctx","_createElementBlock","class","_normalizeClass","is-hidden","onClick","apply","arguments","aria-label"],"mappings":"8IAOAA,EAAU,QAACC,IAAI,CAACC,EAAAA,WAAYC,EAAAA,WAAYC,EAAAA,SAExC,IAAeC,EAAcC,kBAAgB,CACzCC,KAAM,UACNC,MAAO,CACHC,gBAAiB,CACbC,KAAMC,OACNC,QAAS,cAEbC,0BAA2B,CACvBH,KAAMC,OACNC,QAAS,cAEbE,KAAM,CACFJ,KAAMC,OACNC,QAAS,uBAEbG,KAAM,CACFL,KAAMC,OACNC,QAAS,uBAEbI,UAAW,CACPN,KAAMC,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GJb,EAAOS,UAAUC,OAAO,eAGxB3B,EAAMU,YACNQ,EAAOkB,iBAAiB,QAASL,GAGjCb,EAAQ,CACR,IAAIwC,EAAU,CACVX,aAAc,GACdE,WAAY,CACRC,aAAa,GAEjBS,gBAAgB,EAChBJ,WAAY,CACRC,OAAQxD,EAAMO,KACdkD,OAAQzD,EAAMM,OAIlBa,IACAuC,EAAQzC,OAAS,CACb2C,OAAQzC,IAIhBC,EAAe,IAAI5B,EAAAA,QAAW0B,EAAQwC,GAG1C7B,EAAO,YAGyC,GAE7C,CACHR,MAAAA,EACAE,MAAAA,4CC3K6CsC,EAAUnD,0BAA/DoD,EAAAA,mBAAmI,SAAA,OAA3HC,MAAKC,EAAAA,eAAA,CAAC,kBAAkB,CAAAC,aAA+DJ,WAA9DK,sCAAOL,EAAKtC,OAAAsC,EAAAtC,MAAA4C,MAAAN,EAAAO,aAA2DC,aAAW"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=e.defineComponent({setup:function(){var t=e.ref(!1),n=e.ref(!0),o=e.ref([]),a=[],r={},i=!1,c=!1,l={},u={},s={},d=function(e){var t=e.substring(e.lastIndexOf("/")+1);return"page-product-"+(t.match(/^page([0-9]+)$/)?t:"page1")},p=[d(window.location.href)],m=function(e){e.preventDefault(),p=[d(e.currentTarget.href)],f(e.currentTarget)},f=function(n,c){var p=n.href,m=d(p);if(i||(window.app.component("products-paginate",{data:function(){return{components:o}},template:'<teleport to="#products"><component :is="component" v-for="(component, key) in components" v-bind:key="key"></component></teleport>'}),t.value="products-paginate",i=!0),-1===a.indexOf(m))n.classList.add("is-loading"),$http.get(p+"?paginator").then((function(t){h(c);var n=document.createElement("html");n.innerHTML=t.data.products;var i=t.data.h1;if(i){var d=document.querySelector(".shop-subcategory-title h1");d&&(d.innerHTML=i)}window.app.component(m,{template:n.querySelector("#products").innerHTML});var f=t.data.title;u[m]=f,s[m]=t.data.extra,l[m]=i,a.push(m),n.innerHTML=t.data.paginator,r[m]=t.data.paginator,document.getElementById("pagination").replaceWith(n.querySelector("#pagination")),c?(o.value.push(m),g()):(o.value=[m],window.scrollTo({top:0,left:0,behavior:"instant"})),setTimeout((function(){document.title=f||i,history.pushState(null,f,p),e.nextTick((function(){"function"==typeof window.loadProductsCallback&&window.loadProductsCallback(null,"catalog",t.data.extra)}))}),200),window.lazyImages&&window.lazyImages.update(),e.nextTick(v)}));else{var f=document.createElement("html");if(f.innerHTML=r[m],document.getElementById("pagination").replaceWith(f.querySelector("#pagination")),c)o.value.push(m),g();else{if(o.value=[m],l[m]){var y=document.querySelector(".shop-subcategory-title h1");y&&(y.innerHTML=l[m])}window.scrollTo({top:0,left:0,behavior:"instant"})}setTimeout((function(){document.title=u[m],history.pushState(null,u[m],p),e.nextTick((function(){"function"==typeof window.loadProductsCallback&&window.loadProductsCallback(null,"catalog",s[m])}))}),200),e.nextTick(v)}},g=function(){var e=document.getElementById("pagination");p.forEach((function(t){var n=e.querySelector("."+t);n&&n.classList.add("is-current")}))},h=function(e){e||c||(document.querySelectorAll("#products > *").forEach((function(e){e.remove()})),c=!0)},v=function(){var e=document.querySelector("#pagination .pagination-next:not([disabled])");document.querySelectorAll("#pagination a:not([disabled])").forEach((function(e){e.addEventListener("click",m)})),n.value=Boolean(e),window.lazyImages&&window.lazyImages.update()};return e.onMounted((function(){v()})),{component:t,hasMorePages:n,more:function(){var e=document.querySelector("#pagination .pagination-next:not([disabled])"),t=d(e.href);p.push(t),f(e,!0)}}}}),n={class:"shop-pagination has-text-centered mb-3"},o={key:0,class:"shop-pagination-more"},a=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-sync-alt"})],-1);t.render=function(t,r,i,c,l,u){return e.openBlock(),e.createElementBlock("div",n,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component))),t.hasMorePages?(e.openBlock(),e.createElementBlock("div",o,[e.renderSlot(t.$slots,"default",{more:t.more},(function(){return[e.createElementVNode("button",{class:"button is-small",onClick:r[0]||(r[0]=function(){return t.more&&t.more.apply(t,arguments)})},[a,e.createElementVNode("span",null,e.toDisplayString(t.__("shop.pagination.more")),1)])]}))])):e.createCommentVNode("v-if",!0)])},module.exports=t;
|
|
1
|
+
"use strict";var e=require("vue"),t=e.defineComponent({setup:function(){var t=e.ref(!1),n=e.ref(!0),o=e.ref([]),a=[],r={},i=!1,c=!1,l={},u={},s={},d=function(e){var t=e.substring(e.lastIndexOf("/")+1);return"page-product-"+(t.match(/^page([0-9]+)$/)?t:"page1")},p=[d(window.location.href)],m=function(e){e.preventDefault(),p=[d(e.currentTarget.href)],f(e.currentTarget)},f=function(n,c){var p=n.href,m=d(p);if(i||(window.app.component("products-paginate",{data:function(){return{components:o}},template:'<teleport to="#products"><component :is="component" v-for="(component, key) in components" v-bind:key="key"></component></teleport>'}),t.value="products-paginate",i=!0),-1===a.indexOf(m))n.classList.add("is-loading"),$http.get(p+"?paginator").then((function(t){h(c);var n=document.createElement("html");n.innerHTML=t.data.products;var i=t.data.h1;if(i){var d=document.querySelector(".shop-subcategory-title h1");d&&(d.innerHTML=i)}window.app.component(m,{template:n.querySelector("#products").innerHTML});var f=t.data.title;u[m]=f,s[m]=t.data.extra,l[m]=i,a.push(m),n.innerHTML=t.data.paginator,r[m]=t.data.paginator,document.getElementById("pagination").replaceWith(n.querySelector("#pagination")),c?(o.value.push(m),g()):(o.value=[m],window.scrollTo({top:0,left:0,behavior:"instant"})),setTimeout((function(){document.title=f||i,history.pushState(null,f,p),e.nextTick((function(){"function"==typeof window.loadProductsCallback&&window.loadProductsCallback(null,"catalog",t.data.extra)}))}),200),window.lazyImages&&window.lazyImages.update(),e.nextTick(v)}));else{var f=document.createElement("html");if(f.innerHTML=r[m],document.getElementById("pagination").replaceWith(f.querySelector("#pagination")),c)o.value.push(m),g();else{if(o.value=[m],l[m]){var y=document.querySelector(".shop-subcategory-title h1");y&&(y.innerHTML=l[m])}window.scrollTo({top:0,left:0,behavior:"instant"})}setTimeout((function(){document.title=u[m],history.pushState(null,u[m],p),e.nextTick((function(){"function"==typeof window.loadProductsCallback&&window.loadProductsCallback(null,"catalog",s[m])}))}),200),e.nextTick(v)}},g=function(){var e=document.getElementById("pagination");p.forEach((function(t){var n=e.querySelector("."+t);n&&n.classList.add("is-current")}))},h=function(e){e||c||(document.querySelectorAll("#products > *").forEach((function(e){e.remove()})),c=!0)},v=function(){var e=document.querySelector("#pagination .pagination-next:not([disabled])");document.querySelectorAll("#pagination a:not([disabled])").forEach((function(e){e.addEventListener("click",m)})),n.value=Boolean(e),window.lazyImages&&window.lazyImages.update()};return e.onMounted((function(){v()})),{component:t,hasMorePages:n,more:function(){var e=document.querySelector("#pagination .pagination-next:not([disabled])"),t=d(e.href);p.push(t),f(e,!0)}}}}),n={class:"shop-pagination has-text-centered mb-3"},o={key:0,class:"shop-pagination-more"},a=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-sync-alt"})],-1);t.render=function(t,r,i,c,l,u){return e.openBlock(),e.createElementBlock("div",n,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component))),t.hasMorePages?(e.openBlock(),e.createElementBlock("div",o,[e.renderSlot(t.$slots,"default",{more:t.more},(function(){return[e.createElementVNode("button",{class:"button is-small",onClick:r[0]||(r[0]=function(){return t.more&&t.more.apply(t,arguments)}),"aria-label":"Load more"},[a,e.createElementVNode("span",null,e.toDisplayString(t.__("shop.pagination.more")),1)])]}))])):e.createCommentVNode("v-if",!0)])},module.exports=t;
|
|
2
2
|
//# sourceMappingURL=Pagination.js.map
|