@perevorot/shop 2.0.157 → 2.0.159
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/api.js.map +1 -1
- package/dist/app.js.map +1 -1
- package/dist/components/account/Account.js.map +1 -1
- package/dist/components/account/OrderItem.js.map +1 -1
- package/dist/components/account/Orders.js.map +1 -1
- package/dist/components/account/User.js +1 -1
- package/dist/components/account/User.js.map +1 -1
- package/dist/components/account/Viewed.js.map +1 -1
- package/dist/components/account/Wish.js.map +1 -1
- package/dist/components/auth/Confirm.js.map +1 -1
- package/dist/components/auth/Forget.js.map +1 -1
- package/dist/components/auth/Login.js +1 -1
- package/dist/components/auth/Login.js.map +1 -1
- package/dist/components/auth/Registration.js +1 -1
- package/dist/components/auth/Registration.js.map +1 -1
- package/dist/components/auth/Reset.js.map +1 -1
- package/dist/components/auth/User.js +1 -1
- package/dist/components/auth/User.js.map +1 -1
- package/dist/components/auth/UserTrigger.js.map +1 -1
- package/dist/components/shop/Catalog.js.map +1 -1
- package/dist/components/shop/CodeCopy.js +1 -1
- package/dist/components/shop/CodeCopy.js.map +1 -1
- package/dist/components/shop/Cross.js +1 -1
- package/dist/components/shop/Cross.js.map +1 -1
- package/dist/components/shop/FilterToggle.js +1 -1
- package/dist/components/shop/FilterToggle.js.map +1 -1
- package/dist/components/shop/Gallery.js +1 -1
- package/dist/components/shop/Gallery.js.map +1 -1
- package/dist/components/shop/Notice.js.map +1 -1
- package/dist/components/shop/Pagination.js.map +1 -1
- package/dist/components/shop/PromoProducts.js +1 -1
- package/dist/components/shop/PromoProducts.js.map +1 -1
- package/dist/components/shop/Search.js.map +1 -1
- package/dist/components/shop/bundle/Bundle.js +1 -1
- package/dist/components/shop/bundle/Bundle.js.map +1 -1
- package/dist/components/shop/bundle/BundleAdd.js.map +1 -1
- package/dist/components/shop/cart/Cart.js +1 -1
- package/dist/components/shop/cart/Cart.js.map +1 -1
- package/dist/components/shop/cart/CartAdd.js.map +1 -1
- package/dist/components/shop/cart/CartItem.js.map +1 -1
- package/dist/components/shop/cart/CartTrigger.js.map +1 -1
- package/dist/components/shop/cart/SuccessMessage.js.map +1 -1
- package/dist/components/shop/compare/Compare.js.map +1 -1
- package/dist/components/shop/compare/CompareAdd.js.map +1 -1
- package/dist/components/shop/compare/CompareDelete.js.map +1 -1
- package/dist/components/shop/compare/CompareDeleteAll.js.map +1 -1
- package/dist/components/shop/compare/CompareList.js.map +1 -1
- package/dist/components/shop/compare/Comparsion.js.map +1 -1
- package/dist/components/shop/compare/ComparsionModal.js.map +1 -1
- package/dist/components/shop/compare/SuccessMessage.js.map +1 -1
- package/dist/components/shop/filters/FilterSearch.js.map +1 -1
- package/dist/components/shop/filters/Price.js.map +1 -1
- package/dist/components/shop/order/Checkout.js.map +1 -1
- package/dist/components/shop/order/CheckoutItem.js.map +1 -1
- package/dist/components/shop/order/OneClick.js +1 -1
- package/dist/components/shop/order/OneClick.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingCourier.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaAddress.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingNovaposhtaWarehouse.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingPickup.js.map +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.js +1 -1
- package/dist/components/shop/order/shipping/CheckoutShippingUkrposhtaWarehouse.js.map +1 -1
- package/dist/components/shop/order/shipping/OtherRecipient.js.map +1 -1
- package/dist/components/shop/reviews/Question.js +1 -1
- package/dist/components/shop/reviews/Question.js.map +1 -1
- package/dist/components/shop/reviews/Review.js +1 -1
- package/dist/components/shop/reviews/Review.js.map +1 -1
- package/dist/components/shop/viewed/Viewed.js +1 -1
- package/dist/components/shop/viewed/Viewed.js.map +1 -1
- package/dist/components/shop/viewed/ViewedDelete.js.map +1 -1
- package/dist/components/shop/viewed/Viewer.js.map +1 -1
- package/dist/components/shop/wishlist/SuccessMessage.js.map +1 -1
- package/dist/components/shop/wishlist/Wishlist.js.map +1 -1
- package/dist/components/shop/wishlist/WishlistAdd.js.map +1 -1
- package/dist/components/shop/wishlist/WishlistDelete.js.map +1 -1
- package/dist/forms/FormCheckbox.js.map +1 -1
- package/dist/forms/FormCheckboxes.js.map +1 -1
- package/dist/forms/FormPassword.js.map +1 -1
- package/dist/forms/FormRadio.js.map +1 -1
- package/dist/forms/FormRating.js.map +1 -1
- package/dist/forms/FormSection.js.map +1 -1
- package/dist/forms/FormSelect.js.map +1 -1
- package/dist/forms/FormSwitch.js.map +1 -1
- package/dist/forms/FormText.js.map +1 -1
- package/dist/forms/FormTextarea.js.map +1 -1
- package/dist/global.js.map +1 -1
- package/dist/helpers.js +1 -1
- package/dist/helpers.js.map +1 -1
- package/dist/store.js +1 -1
- package/dist/store.js.map +1 -1
- package/dist/vuex.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),n=require("formvuelate"),r=require("@formvuelate/plugin-vee-validate"),o=require("@perevorot/shop/dist/forms/FormTextarea"),a=require("@perevorot/shop/dist/forms/FormText"),i=require("yup");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),n=require("formvuelate"),r=require("@formvuelate/plugin-vee-validate"),o=require("@perevorot/shop/dist/forms/FormTextarea"),a=require("@perevorot/shop/dist/forms/FormText"),i=require("yup");function l(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(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var s=l(r),u=l(o),d=l(a),m=c(i);function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,l=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(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(u.default),e.markRaw(d.default);var h=n.SchemaFormFactory([s.default({})]),y=e.defineComponent({name:"review",components:{SchemaForm:h},props:{id:Number},setup:function(r){var o=e.ref(!1),a=t.useStore(),i=e.ref(0),l=e.ref({}),c=e.ref(!1),s=e.computed((function(){return a.getters["auth/me"]})),v=e.ref(!1),h=e.ref({review:{component:u.default,label:__("shop.question.review"),model:"review"},name:{component:d.default,label:__("shop.question.name"),model:"name"}}),y=m.object().shape({review:m.string().required(__("auth.validation.required")),name:m.string().required(__("auth.validation.required"))}),b=e.ref({review:"",question:!0,name:s.value.name,id:r.id});n.useSchemaForm(b);var g=function(){c.value&&(c.value=!1,v.value=!1,document.documentElement.classList.remove("is-modal-open"))};return window.addEventListener("keyup",(function(e){c.value&&"Escape"===e.key&&g()})),document.addEventListener("DOMContentLoaded",(function(){c.value&&document.documentElement.classList.add("is-modal-open");var e=document.getElementById("questions-show-more");e&&e.addEventListener("click",(function(){document.getElementById("questions-list").querySelectorAll(".review.is-hidden").forEach((function(t){t.classList.remove("is-hidden"),e.remove()}))}))}),!1),f(f(f(f(f(f({loading:o,modal:c,schema:h,validation:y,add:function(){c.value=!0,document.documentElement.classList.add("is-modal-open")},cancel:g},"schema",h),"onSubmit",(function(){o.value=!0,$http.post($ziggy("api.review"),b.value).then((function(){v.value=!0,b.value={review:"",question:!0,name:s.value.name,id:r.id}})).catch((function(e){if(l.value={},e.response.data&&e.response.data.errors){for(var t=0,n=Object.entries(e.response.data.errors);t<n.length;t++){var r=p(n[t],2),o=r[0],a=r[1];a[0]&&(l.value[o]=a[0])}i.value++}})).finally((function(){o.value=!1}))})),"errors",l),"key",i),"model",b),"thanks",v)}}),b={class:"shop-reviews"},g={class:"modal-content"},E=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],w={class:"box"},k={class:"title"},q={class:"shop-reviews-form"},S={class:"field"},_={class:"columns is-vcentered"},N={class:"column"},V={class:"column has-text-right"},j={class:"shop-reviews-thanks"},C=["innerHTML"],O={class:"mt-3"};y.render=function(t,n,r,o,a,i){var l=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("button",{class:"button review-add",onClick:n[0]||(n[0]=function(){return t.add&&t.add.apply(t,arguments)})},e.toDisplayString(t.__("shop.question.add")),1),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":t.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:n[1]||(n[1]=function(){return t.cancel&&t.cancel.apply(t,arguments)})}),e.createElementVNode("div",g,[e.createElementVNode("button",{class:"modal-close is-large",onClick:n[2]||(n[2]=function(){return t.cancel&&t.cancel.apply(t,arguments)})},E),e.createElementVNode("div",w,[e.createElementVNode("div",k,e.toDisplayString(t.__("shop.question.title")),1),e.withDirectives(e.createElementVNode("div",q,[(e.openBlock(),e.createBlock(l,{schemaRowClasses:"field",schema:t.schema,"validation-schema":t.validation,"initial-errors":t.errors,key:t.key,onSubmit:t.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",S,[e.createElementVNode("div",_,[e.createElementVNode("div",N,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":t.loading}]),type:"submit"},e.toDisplayString(t.__("shop.question.save")),3)]),e.createElementVNode("div",V,[e.createElementVNode("button",{class:"button",onClick:n[3]||(n[3]=function(){return t.cancel&&t.cancel.apply(t,arguments)})},e.toDisplayString(t.__("shop.question.cancel")),1)])])])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"]))],512),[[e.vShow,!t.thanks]]),e.withDirectives(e.createElementVNode("div",j,[e.createElementVNode("div",{class:"message",innerHTML:t.__("shop.question.thanks")},null,8,C),e.createElementVNode("div",O,[e.createElementVNode("button",{class:"button",onClick:n[4]||(n[4]=function(){return t.cancel&&t.cancel.apply(t,arguments)})},e.toDisplayString(t.__("shop.question.continue")),1)])],512),[[e.vShow,t.thanks]])])])],2)])},module.exports=y;
|
|
2
2
|
//# sourceMappingURL=Question.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Question.js","sources":["../../../../src/components/shop/reviews/Question.vue","../../../../src/components/shop/reviews/Question.vue?vue&type=template&id=22162317&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-reviews\">\n <button class=\"button review-add\" @click=\"add\">{{ __(\"shop.question.add\") }}</button>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"cancel\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"cancel\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">{{ __(\"shop.question.title\") }}</div>\n <div class=\"shop-reviews-form\" 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 <div class=\"columns is-vcentered\">\n <div class=\"column\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{\n 'is-loading': loading,\n }\">{{ __(\"shop.question.save\") }}</button>\n </div>\n <div class=\"column has-text-right\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.question.cancel\") }}</button>\n </div>\n </div>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div class=\"shop-reviews-thanks\" v-show=\"thanks\">\n <div class=\"message\" v-html=\"__('shop.question.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.question.continue\") }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { SchemaFormFactory, useSchemaForm } from \"formvuelate\";\nimport VeeValidatePlugin from \"@formvuelate/plugin-vee-validate\";\nimport FormTextarea from \"@perevorot/shop/dist/forms/FormTextarea\";\nimport FormText from \"@perevorot/shop/dist/forms/FormText\";\nimport * as yup from \"yup\";\n\nmarkRaw(FormTextarea);\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"review\",\n components: {\n SchemaForm,\n },\n props: {\n id: Number,\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 = ref(false);\n const user = computed(() => store.getters[\"auth/me\"]);\n const thanks = ref(false);\n\n const schema = ref({\n review: {\n component: FormTextarea,\n label: __(\"shop.question.review\"),\n model: \"review\",\n },\n name: {\n component: FormText,\n label: __(\"shop.question.name\"),\n model: \"name\",\n },\n });\n\n const validation = yup.object().shape({\n review: yup.string().required(__(\"auth.validation.required\")),\n name: yup.string().required(__(\"auth.validation.required\")),\n });\n\n const model = ref({\n review: \"\",\n question: true,\n name: user.value.name,\n id: props.id,\n });\n\n useSchemaForm(model);\n\n const add = () => {\n modal.value = true;\n\n document.documentElement.classList.add('is-modal-open');\n };\n\n const cancel = () => {\n if (modal.value) {\n modal.value = false;\n thanks.value = false;\n\n document.documentElement.classList.remove('is-modal-open');\n }\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n $http\n .post($ziggy(\"api.review\"), model.value)\n .then(() => {\n thanks.value = true;\n\n model.value = {\n review: \"\",\n question: true,\n name: user.value.name,\n id: props.id,\n };\n })\n .catch((error) => {\n errors.value = {};\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(\n error.response.data.errors\n )) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n });\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n cancel();\n }\n });\n\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (modal.value) {\n document.documentElement.classList.add('is-modal-open');\n }\n\n const showMore = document.getElementById('questions-show-more');\n\n if (showMore) {\n showMore.addEventListener('click', () => {\n document.getElementById('questions-list').querySelectorAll('.review.is-hidden').forEach(review => {\n review.classList.remove('is-hidden');\n showMore.remove();\n });\n });\n }\n }, false);\n\n return {\n loading,\n modal,\n schema,\n validation,\n add,\n cancel,\n schema,\n onSubmit,\n errors,\n key,\n model,\n thanks,\n };\n },\n});\n</script>","<template>\n <div class=\"shop-reviews\">\n <button class=\"button review-add\" @click=\"add\">{{ __(\"shop.question.add\") }}</button>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"cancel\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"cancel\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">{{ __(\"shop.question.title\") }}</div>\n <div class=\"shop-reviews-form\" 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 <div class=\"columns is-vcentered\">\n <div class=\"column\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{\n 'is-loading': loading,\n }\">{{ __(\"shop.question.save\") }}</button>\n </div>\n <div class=\"column has-text-right\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.question.cancel\") }}</button>\n </div>\n </div>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div class=\"shop-reviews-thanks\" v-show=\"thanks\">\n <div class=\"message\" v-html=\"__('shop.question.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.question.continue\") }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { SchemaFormFactory, useSchemaForm } from \"formvuelate\";\nimport VeeValidatePlugin from \"@formvuelate/plugin-vee-validate\";\nimport FormTextarea from \"@perevorot/shop/dist/forms/FormTextarea\";\nimport FormText from \"@perevorot/shop/dist/forms/FormText\";\nimport * as yup from \"yup\";\n\nmarkRaw(FormTextarea);\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"review\",\n components: {\n SchemaForm,\n },\n props: {\n id: Number,\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 = ref(false);\n const user = computed(() => store.getters[\"auth/me\"]);\n const thanks = ref(false);\n\n const schema = ref({\n review: {\n component: FormTextarea,\n label: __(\"shop.question.review\"),\n model: \"review\",\n },\n name: {\n component: FormText,\n label: __(\"shop.question.name\"),\n model: \"name\",\n },\n });\n\n const validation = yup.object().shape({\n review: yup.string().required(__(\"auth.validation.required\")),\n name: yup.string().required(__(\"auth.validation.required\")),\n });\n\n const model = ref({\n review: \"\",\n question: true,\n name: user.value.name,\n id: props.id,\n });\n\n useSchemaForm(model);\n\n const add = () => {\n modal.value = true;\n\n document.documentElement.classList.add('is-modal-open');\n };\n\n const cancel = () => {\n if (modal.value) {\n modal.value = false;\n thanks.value = false;\n\n document.documentElement.classList.remove('is-modal-open');\n }\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n $http\n .post($ziggy(\"api.review\"), model.value)\n .then(() => {\n thanks.value = true;\n\n model.value = {\n review: \"\",\n question: true,\n name: user.value.name,\n id: props.id,\n };\n })\n .catch((error) => {\n errors.value = {};\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(\n error.response.data.errors\n )) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n });\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n cancel();\n }\n });\n\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (modal.value) {\n document.documentElement.classList.add('is-modal-open');\n }\n\n const showMore = document.getElementById('questions-show-more');\n\n if (showMore) {\n showMore.addEventListener('click', () => {\n document.getElementById('questions-list').querySelectorAll('.review.is-hidden').forEach(review => {\n review.classList.remove('is-hidden');\n showMore.remove();\n });\n });\n }\n }, false);\n\n return {\n loading,\n modal,\n schema,\n validation,\n add,\n cancel,\n schema,\n onSubmit,\n errors,\n key,\n model,\n thanks,\n };\n },\n});\n</script>"],"names":["markRaw","FormTextarea","FormText","SchemaForm","SchemaFormFactory","VeeValidatePlugin","defineComponent","name","components","props","id","Number","setup","loading","ref","store","useStore","key","errors","modal","user","computed","getters","thanks","schema","review","component","label","__","model","validation","yup","object","shape","string","required","question","value","useSchemaForm","cancel","document","documentElement","classList","remove","window","addEventListener","e","add","showMore","getElementById","querySelectorAll","forEach","$http","post","$ziggy","then","error","response","data","Object","entries","field","messages","_createElementVNode","_createElementBlock","_hoisted_1","onClick","_ctx","_hoisted_2","_hoisted_5","_hoisted_6","_hoisted_7","_createBlock","schemaRowClasses","onSubmit","afterForm","_hoisted_8","_hoisted_9","_hoisted_10","type","_hoisted_11","_hoisted_12","innerHTML","_hoisted_14"],"mappings":"isDAmDAA,UAAQC,WACRD,UAAQE,WAER,IAAMC,EAAaC,oBAAkB,CAACC,UAAkB,QAE3BC,kBAAgB,CACzCC,KAAM,SACNC,WAAY,CACRL,WAAAA,GAEJM,MAAO,CACHC,GAAIC,QAERC,eAAMH,SACII,EAAUC,OAAI,GACdC,EAAQC,aACRC,EAAMH,MAAI,GACVI,EAASJ,MAAI,IACbK,EAAQL,OAAI,GACZM,EAAOC,YAAS,kBAAMN,EAAMO,QAAQ,cACpCC,EAAST,OAAI,GAEbU,EAASV,MAAI,CACfW,OAAQ,CACJC,UAAWzB,UACX0B,MAAOC,GAAG,wBACVC,MAAO,UAEXtB,KAAM,CACFmB,UAAWxB,UACXyB,MAAOC,GAAG,sBACVC,MAAO,UAITC,EAAaC,EAAIC,SAASC,MAAM,CAClCR,OAAQM,EAAIG,SAASC,SAASP,GAAG,6BACjCrB,KAAMwB,EAAIG,SAASC,SAASP,GAAG,+BAG7BC,EAAQf,MAAI,CACdW,OAAQ,GACRW,UAAU,EACV7B,KAAMa,EAAKiB,MAAM9B,KACjBG,GAAID,EAAMC,KAGd4B,gBAAcT,OAQRU,EAAS,WACPpB,EAAMkB,QACNlB,EAAMkB,OAAQ,EACdd,EAAOc,OAAQ,EAEfG,SAASC,gBAAgBC,UAAUC,OAAO,0BAuClDC,OAAO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AK,GACIL,qCAAc,uBAAwBG,sCAAOC,4CAK7CJ,2BAAAM,GACIN,2BAAAO,oBAAsBH,iDACtBJ,2BAAAQ,kBACIC,iBAAYC,iBAAiB,QAASjD,OAAQ2C,6BAA4BA,8BAA6BA,SAASlD,IAAKkD,MAAMO,SAAQP,aACpHQ,qBACP,kBAAAZ,2BAAAa,GACIb,2BAAAc,GACId,2BAAAe,GACIf,uDAAc,4CAAiBgB,KAAK,4BAE9BZ,iCAEVJ,2BAAAiB,GACIjB,qCAAc,SAAUG,sCAAOC,2DAAWA,gIAX1BA,6BAkBxCJ,2BAAAkB,GACIlB,kCAAW,UAAUmB,UAAQf,wCAC7BJ,2BAAAoB,GACIpB,qCAAc,SAAUG,sCAAOC,2DAAWA,qDAHTA"}
|
|
1
|
+
{"version":3,"file":"Question.js","sources":["../../../../src/components/shop/reviews/Question.vue","../../../../src/components/shop/reviews/Question.vue?vue&type=template&id=22162317&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-reviews\">\n <button class=\"button review-add\" @click=\"add\">{{ __(\"shop.question.add\") }}</button>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"cancel\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"cancel\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">{{ __(\"shop.question.title\") }}</div>\n <div class=\"shop-reviews-form\" 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 <div class=\"columns is-vcentered\">\n <div class=\"column\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{\n 'is-loading': loading,\n }\">{{ __(\"shop.question.save\") }}</button>\n </div>\n <div class=\"column has-text-right\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.question.cancel\") }}</button>\n </div>\n </div>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div class=\"shop-reviews-thanks\" v-show=\"thanks\">\n <div class=\"message\" v-html=\"__('shop.question.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.question.continue\") }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { SchemaFormFactory, useSchemaForm } from \"formvuelate\";\nimport VeeValidatePlugin from \"@formvuelate/plugin-vee-validate\";\nimport FormTextarea from \"@perevorot/shop/dist/forms/FormTextarea\";\nimport FormText from \"@perevorot/shop/dist/forms/FormText\";\nimport * as yup from \"yup\";\n\nmarkRaw(FormTextarea);\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"review\",\n components: {\n SchemaForm,\n },\n props: {\n id: Number,\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 = ref(false);\n const user = computed(() => store.getters[\"auth/me\"]);\n const thanks = ref(false);\n\n const schema = ref({\n review: {\n component: FormTextarea,\n label: __(\"shop.question.review\"),\n model: \"review\",\n },\n name: {\n component: FormText,\n label: __(\"shop.question.name\"),\n model: \"name\",\n },\n });\n\n const validation = yup.object().shape({\n review: yup.string().required(__(\"auth.validation.required\")),\n name: yup.string().required(__(\"auth.validation.required\")),\n });\n\n const model = ref({\n review: \"\",\n question: true,\n name: user.value.name,\n id: props.id,\n });\n\n useSchemaForm(model);\n\n const add = () => {\n modal.value = true;\n\n document.documentElement.classList.add('is-modal-open');\n };\n\n const cancel = () => {\n if (modal.value) {\n modal.value = false;\n thanks.value = false;\n\n document.documentElement.classList.remove('is-modal-open');\n }\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n $http\n .post($ziggy(\"api.review\"), model.value)\n .then(() => {\n thanks.value = true;\n\n model.value = {\n review: \"\",\n question: true,\n name: user.value.name,\n id: props.id,\n };\n })\n .catch((error) => {\n errors.value = {};\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(\n error.response.data.errors\n )) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n });\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n cancel();\n }\n });\n\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (modal.value) {\n document.documentElement.classList.add('is-modal-open');\n }\n\n const showMore = document.getElementById('questions-show-more');\n\n if (showMore) {\n showMore.addEventListener('click', () => {\n document.getElementById('questions-list').querySelectorAll('.review.is-hidden').forEach(review => {\n review.classList.remove('is-hidden');\n showMore.remove();\n });\n });\n }\n }, false);\n\n return {\n loading,\n modal,\n schema,\n validation,\n add,\n cancel,\n schema,\n onSubmit,\n errors,\n key,\n model,\n thanks,\n };\n },\n});\n</script>","<template>\n <div class=\"shop-reviews\">\n <button class=\"button review-add\" @click=\"add\">{{ __(\"shop.question.add\") }}</button>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"cancel\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"cancel\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">{{ __(\"shop.question.title\") }}</div>\n <div class=\"shop-reviews-form\" 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 <div class=\"columns is-vcentered\">\n <div class=\"column\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{\n 'is-loading': loading,\n }\">{{ __(\"shop.question.save\") }}</button>\n </div>\n <div class=\"column has-text-right\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.question.cancel\") }}</button>\n </div>\n </div>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div class=\"shop-reviews-thanks\" v-show=\"thanks\">\n <div class=\"message\" v-html=\"__('shop.question.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.question.continue\") }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { SchemaFormFactory, useSchemaForm } from \"formvuelate\";\nimport VeeValidatePlugin from \"@formvuelate/plugin-vee-validate\";\nimport FormTextarea from \"@perevorot/shop/dist/forms/FormTextarea\";\nimport FormText from \"@perevorot/shop/dist/forms/FormText\";\nimport * as yup from \"yup\";\n\nmarkRaw(FormTextarea);\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"review\",\n components: {\n SchemaForm,\n },\n props: {\n id: Number,\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 = ref(false);\n const user = computed(() => store.getters[\"auth/me\"]);\n const thanks = ref(false);\n\n const schema = ref({\n review: {\n component: FormTextarea,\n label: __(\"shop.question.review\"),\n model: \"review\",\n },\n name: {\n component: FormText,\n label: __(\"shop.question.name\"),\n model: \"name\",\n },\n });\n\n const validation = yup.object().shape({\n review: yup.string().required(__(\"auth.validation.required\")),\n name: yup.string().required(__(\"auth.validation.required\")),\n });\n\n const model = ref({\n review: \"\",\n question: true,\n name: user.value.name,\n id: props.id,\n });\n\n useSchemaForm(model);\n\n const add = () => {\n modal.value = true;\n\n document.documentElement.classList.add('is-modal-open');\n };\n\n const cancel = () => {\n if (modal.value) {\n modal.value = false;\n thanks.value = false;\n\n document.documentElement.classList.remove('is-modal-open');\n }\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n $http\n .post($ziggy(\"api.review\"), model.value)\n .then(() => {\n thanks.value = true;\n\n model.value = {\n review: \"\",\n question: true,\n name: user.value.name,\n id: props.id,\n };\n })\n .catch((error) => {\n errors.value = {};\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(\n error.response.data.errors\n )) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n });\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n cancel();\n }\n });\n\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (modal.value) {\n document.documentElement.classList.add('is-modal-open');\n }\n\n const showMore = document.getElementById('questions-show-more');\n\n if (showMore) {\n showMore.addEventListener('click', () => {\n document.getElementById('questions-list').querySelectorAll('.review.is-hidden').forEach(review => {\n review.classList.remove('is-hidden');\n showMore.remove();\n });\n });\n }\n }, false);\n\n return {\n loading,\n modal,\n schema,\n validation,\n add,\n cancel,\n schema,\n onSubmit,\n errors,\n key,\n model,\n thanks,\n };\n },\n});\n</script>"],"names":["markRaw","FormTextarea","FormText","SchemaForm","SchemaFormFactory","VeeValidatePlugin","script","defineComponent","name","components","props","id","Number","setup","loading","ref","store","useStore","key","errors","modal","user","computed","getters","thanks","schema","review","component","label","__","model","validation","yup","object","shape","string","required","question","value","useSchemaForm","cancel","document","documentElement","classList","remove","window","addEventListener","e","add","showMore","getElementById","querySelectorAll","forEach","_defineProperty","onSubmit","$http","post","$ziggy","then","error","response","data","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","field","messages","_hoisted_1","class","_hoisted_2","_createElementVNode","createElementVNode","xlink:href","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_14","_openBlock","_createElementBlock","onClick","_ctx","apply","arguments","_normalizeClass","is-active","_toDisplayString","toDisplayString","_withDirectives","_createBlock","_component_SchemaForm","schemaRowClasses","validation-schema","initial-errors","afterForm","type","withDirectives","innerHTML"],"mappings":"sjEAmDAA,EAAOA,QAACC,EAAY,SACpBD,EAAOA,QAACE,EAAQ,SAEhB,IAAMC,EAAaC,EAAAA,kBAAkB,CAACC,EAAiB,QAAC,MAEzCC,EAAcC,kBAAgB,CACzCC,KAAM,SACNC,WAAY,CACRN,WAAAA,GAEJO,MAAO,CACHC,GAAIC,QAERC,MAAK,SAACH,GACF,IAAMI,EAAUC,OAAI,GACdC,EAAQC,EAAAA,WACRC,EAAMH,MAAI,GACVI,EAASJ,MAAI,IACbK,EAAQL,OAAI,GACZM,EAAOC,EAAAA,UAAS,WAAA,OAAMN,EAAMO,QAAQ,cACpCC,EAAST,OAAI,GAEbU,EAASV,EAAAA,IAAI,CACfW,OAAQ,CACJC,UAAW1B,EAAY,QACvB2B,MAAOC,GAAG,wBACVC,MAAO,UAEXtB,KAAM,CACFmB,UAAWzB,EAAQ,QACnB0B,MAAOC,GAAG,sBACVC,MAAO,UAITC,EAAaC,EAAIC,SAASC,MAAM,CAClCR,OAAQM,EAAIG,SAASC,SAASP,GAAG,6BACjCrB,KAAMwB,EAAIG,SAASC,SAASP,GAAG,+BAG7BC,EAAQf,EAAAA,IAAI,CACdW,OAAQ,GACRW,UAAU,EACV7B,KAAMa,EAAKiB,MAAM9B,KACjBG,GAAID,EAAMC,KAGd4B,EAAaA,cAACT,GAEd,IAMMU,EAAS,WACPpB,EAAMkB,QACNlB,EAAMkB,OAAQ,EACdd,EAAOc,OAAQ,EAEfG,SAASC,gBAAgBC,UAAUC,OAAO,mBA8DlD,OAvBAC,OAAOC,iBAAiB,SAAS,SAACC,GAC1B3B,EAAMkB,OAAmB,WAAVS,EAAE7B,KACjBsB,OAIRC,SAASK,iBAAiB,oBAAoB,WACtC1B,EAAMkB,OACNG,SAASC,gBAAgBC,UAAUK,IAAI,iBAG3C,IAAMC,EAAWR,SAASS,eAAe,uBAErCD,G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AAAA,mBAEyC,SAAA,CAFjCF,wBAAM,+BAA6CiB,EAAA3E,WAA5ByF,KAAK,4BAE9Bd,EAAE5D,GAAA,uBAAA,KAEZ6C,EAAAC,mBAEK,MAFLQ,EAEK,CADDT,EAAAA,mBAA+E,SAAA,CAAvEF,MAAM,SAAUgB,sCAAOC,EAAMjD,QAAAiD,EAAAjD,OAAAkD,MAAAD,EAAAE,gCAAKF,EAAE5D,GAAA,yBAAA,kGAX5B4D,EAAMjE,UAkB9CwE,EAAAQ,eAAA9B,qBAKK,MALLU,EAKK,CAJDV,EAA8DC,mBAAA,MAAA,CAAzDH,MAAM,UAAUiC,UAAQhB,EAAE5D,GAAA,mCAC/B6C,EAAAA,mBAEK,MAFLW,EAEK,CADDX,EAAiFC,mBAAA,SAAA,CAAzEH,MAAM,SAAUgB,sCAAOC,EAAMjD,QAAAiD,EAAAjD,OAAAkD,MAAAD,EAAAE,gCAAKF,EAAE5D,GAAA,2BAAA,qBAHX4D,EAAMjE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),n=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/forms/FormTextarea"),o=require("@perevorot/shop/dist/forms/FormText"),i=require("@perevorot/shop/dist/forms/FormRating"),l=require("yup");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=c(n),d=c(a),m=c(o),v=c(i),f=u(l);function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),n=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/forms/FormTextarea"),o=require("@perevorot/shop/dist/forms/FormText"),i=require("@perevorot/shop/dist/forms/FormRating"),l=require("yup");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=c(n),d=c(a),m=c(o),v=c(i),f=u(l);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function h(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 n=r.call(e,t||"default");if("object"!=typeof n)return n;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 y(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 n,a,o,i,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}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(v.default),e.markRaw(d.default),e.markRaw(m.default);var b=r.SchemaFormFactory([s.default({})]),w=e.defineComponent({name:"review",components:{SchemaForm:b},props:{id:Number},setup:function(n){var a=e.ref(!1),o=t.useStore(),i=e.ref(0),l=e.ref({}),c=e.computed((function(){return o.getters["review/modal"]})),u=e.computed((function(){return o.getters["auth/is"]})),s=e.computed((function(){return o.getters["auth/me"]})),p=e.ref(!1),b=e.ref({rating:{component:v.default,model:"rating"},review:{component:d.default,label:__("shop.review.review"),model:"review"},name:{component:m.default,label:__("shop.review.name"),model:"name"}}),w=f.object().shape({review:f.string().required(__("auth.validation.required")),rating:f.number().min(1,__("auth.validation.required")).required(__("auth.validation.required")),name:f.string().required(__("auth.validation.required"))}),g=e.ref({review:"",rating:0,name:s.value.name,id:n.id});r.useSchemaForm(g);var E=function(){o.commit("review/modal",!1),p.value=!1};return window.addEventListener("keyup",(function(e){c.value&&"Escape"===e.key&&E()})),document.addEventListener("DOMContentLoaded",(function(){c.value&&document.documentElement.classList.add("is-modal-open");var e=document.getElementById("reviews-show-more");e&&e.addEventListener("click",(function(){document.getElementById("reviews-list").querySelectorAll(".review.is-hidden").forEach((function(t){t.classList.remove("is-hidden"),e.remove()}))}))}),!1),h(h(h(h(h(h({loading:a,modal:c,schema:b,validation:w,add:function(){u.value?o.commit("review/modal",!0):o.commit("auth/modal","login")},cancel:E},"schema",b),"onSubmit",(function(){a.value=!0,$http.post($ziggy("api.review"),g.value).then((function(){p.value=!0,g.value={review:"",rating:0,name:s.value.name,id:n.id}})).catch((function(e){if(l.value={},e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var n=y(r[t],2),a=n[0],o=n[1];o[0]&&(l.value[a]=o[0])}i.value++}})).finally((function(){a.value=!1}))})),"errors",l),"key",i),"model",g),"thanks",p)}}),g={class:"shop-reviews"},E={class:"modal-content"},k=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],_={class:"box"},S={class:"title"},N={class:"shop-reviews-form"},V={class:"field"},q={class:"columns is-vcentered"},j={class:"column"},C={class:"column has-text-right"},O={class:"shop-reviews-thanks"},x=["innerHTML"],D={class:"mt-3"};w.render=function(t,r,n,a,o,i){var l=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",g,[e.createElementVNode("button",{class:"button review-add",onClick:r[0]||(r[0]=function(){return t.add&&t.add.apply(t,arguments)})},e.toDisplayString(t.__("shop.review.add")),1),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":t.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:r[1]||(r[1]=function(){return t.cancel&&t.cancel.apply(t,arguments)})}),e.createElementVNode("div",E,[e.createElementVNode("button",{class:"modal-close is-large",onClick:r[2]||(r[2]=function(){return t.cancel&&t.cancel.apply(t,arguments)})},k),e.createElementVNode("div",_,[e.createElementVNode("div",S,e.toDisplayString(t.__("shop.review.title")),1),e.withDirectives(e.createElementVNode("div",N,[(e.openBlock(),e.createBlock(l,{schemaRowClasses:"field",schema:t.schema,"validation-schema":t.validation,"initial-errors":t.errors,key:t.key,onSubmit:t.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",V,[e.createElementVNode("div",q,[e.createElementVNode("div",j,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":t.loading}]),type:"submit"},e.toDisplayString(t.__("shop.review.save")),3)]),e.createElementVNode("div",C,[e.createElementVNode("button",{class:"button",onClick:r[3]||(r[3]=function(){return t.cancel&&t.cancel.apply(t,arguments)})},e.toDisplayString(t.__("shop.review.cancel")),1)])])])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"]))],512),[[e.vShow,!t.thanks]]),e.withDirectives(e.createElementVNode("div",O,[e.createElementVNode("div",{class:"message",innerHTML:t.__("shop.review.thanks")},null,8,x),e.createElementVNode("div",D,[e.createElementVNode("button",{class:"button",onClick:r[4]||(r[4]=function(){return t.cancel&&t.cancel.apply(t,arguments)})},e.toDisplayString(t.__("shop.review.continue")),1)])],512),[[e.vShow,t.thanks]])])])],2)])},module.exports=w;
|
|
2
2
|
//# sourceMappingURL=Review.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Review.js","sources":["../../../../src/components/shop/reviews/Review.vue","../../../../src/components/shop/reviews/Review.vue?vue&type=template&id=3317de44&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-reviews\">\n <button class=\"button review-add\" @click=\"add\">{{ __(\"shop.review.add\") }}</button>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"cancel\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"cancel\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">{{ __(\"shop.review.title\") }}</div>\n <div class=\"shop-reviews-form\" v-show=\"!thanks\">\n <SchemaForm\n schemaRowClasses=\"field\"\n :schema=\"schema\"\n :validation-schema=\"validation\"\n :initial-errors=\"errors\"\n :key=\"key\"\n @submit=\"onSubmit\"\n >\n <template #afterForm>\n <div class=\"field\">\n <div class=\"columns is-vcentered\">\n <div class=\"column\">\n <button\n class=\"button is-link\"\n type=\"submit\"\n v-bind:class=\"{\n 'is-loading': loading,\n }\"\n >{{ __(\"shop.review.save\") }}</button>\n </div>\n <div class=\"column has-text-right\">\n <button\n class=\"button\"\n @click=\"cancel\"\n >{{ __(\"shop.review.cancel\") }}</button>\n </div>\n </div>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div class=\"shop-reviews-thanks\" v-show=\"thanks\">\n <div class=\"message\" v-html=\"__('shop.review.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.review.continue\") }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { SchemaFormFactory, useSchemaForm } from \"formvuelate\";\nimport VeeValidatePlugin from \"@formvuelate/plugin-vee-validate\";\nimport FormTextarea from \"@perevorot/shop/dist/forms/FormTextarea\";\nimport FormText from \"@perevorot/shop/dist/forms/FormText\";\nimport FormRating from \"@perevorot/shop/dist/forms/FormRating\";\nimport * as yup from \"yup\";\n\nmarkRaw(FormRating);\nmarkRaw(FormTextarea);\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"review\",\n components: {\n SchemaForm,\n },\n props: {\n id: Number,\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[\"review/modal\"]);\n const auth = computed(() => store.getters[\"auth/is\"]);\n const user = computed(() => store.getters[\"auth/me\"]);\n const thanks = ref(false);\n\n const schema = ref({\n rating: {\n component: FormRating,\n model: \"rating\",\n },\n review: {\n component: FormTextarea,\n label: __(\"shop.review.review\"),\n model: \"review\",\n },\n name: {\n component: FormText,\n label: __(\"shop.review.name\"),\n model: \"name\",\n },\n });\n\n const validation = yup.object().shape({\n review: yup.string().required(__(\"auth.validation.required\")),\n rating: yup\n .number()\n .min(1, __(\"auth.validation.required\"))\n .required(__(\"auth.validation.required\")),\n name: yup.string().required(__(\"auth.validation.required\")),\n });\n\n const model = ref({\n review: \"\",\n rating: 0,\n name: user.value.name,\n id: props.id,\n });\n\n useSchemaForm(model);\n\n const add = () => {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n store.commit(\"review/modal\", true);\n }\n };\n\n const cancel = () => {\n store.commit(\"review/modal\", false);\n thanks.value = false;\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n $http\n .post($ziggy(\"api.review\"), model.value)\n .then(() => {\n thanks.value = true;\n\n model.value = {\n review: \"\",\n rating: 0,\n name: user.value.name,\n id: props.id,\n };\n })\n .catch((error) => {\n errors.value = {};\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(\n error.response.data.errors\n )) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n });\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n cancel();\n }\n });\n\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (modal.value) {\n document.documentElement.classList.add('is-modal-open');\n }\n\n const showMore = document.getElementById('reviews-show-more');\n\n if (showMore) {\n showMore.addEventListener('click', () => {\n document.getElementById('reviews-list').querySelectorAll('.review.is-hidden').forEach(review => {\n review.classList.remove('is-hidden');\n showMore.remove();\n });\n });\n }\n }, false);\n\n return {\n loading,\n modal,\n schema,\n validation,\n add,\n cancel,\n schema,\n onSubmit,\n errors,\n key,\n model,\n thanks,\n };\n },\n});\n</script>","<template>\n <div class=\"shop-reviews\">\n <button class=\"button review-add\" @click=\"add\">{{ __(\"shop.review.add\") }}</button>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"cancel\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"cancel\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">{{ __(\"shop.review.title\") }}</div>\n <div class=\"shop-reviews-form\" v-show=\"!thanks\">\n <SchemaForm\n schemaRowClasses=\"field\"\n :schema=\"schema\"\n :validation-schema=\"validation\"\n :initial-errors=\"errors\"\n :key=\"key\"\n @submit=\"onSubmit\"\n >\n <template #afterForm>\n <div class=\"field\">\n <div class=\"columns is-vcentered\">\n <div class=\"column\">\n <button\n class=\"button is-link\"\n type=\"submit\"\n v-bind:class=\"{\n 'is-loading': loading,\n }\"\n >{{ __(\"shop.review.save\") }}</button>\n </div>\n <div class=\"column has-text-right\">\n <button\n class=\"button\"\n @click=\"cancel\"\n >{{ __(\"shop.review.cancel\") }}</button>\n </div>\n </div>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div class=\"shop-reviews-thanks\" v-show=\"thanks\">\n <div class=\"message\" v-html=\"__('shop.review.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.review.continue\") }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { SchemaFormFactory, useSchemaForm } from \"formvuelate\";\nimport VeeValidatePlugin from \"@formvuelate/plugin-vee-validate\";\nimport FormTextarea from \"@perevorot/shop/dist/forms/FormTextarea\";\nimport FormText from \"@perevorot/shop/dist/forms/FormText\";\nimport FormRating from \"@perevorot/shop/dist/forms/FormRating\";\nimport * as yup from \"yup\";\n\nmarkRaw(FormRating);\nmarkRaw(FormTextarea);\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"review\",\n components: {\n SchemaForm,\n },\n props: {\n id: Number,\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[\"review/modal\"]);\n const auth = computed(() => store.getters[\"auth/is\"]);\n const user = computed(() => store.getters[\"auth/me\"]);\n const thanks = ref(false);\n\n const schema = ref({\n rating: {\n component: FormRating,\n model: \"rating\",\n },\n review: {\n component: FormTextarea,\n label: __(\"shop.review.review\"),\n model: \"review\",\n },\n name: {\n component: FormText,\n label: __(\"shop.review.name\"),\n model: \"name\",\n },\n });\n\n const validation = yup.object().shape({\n review: yup.string().required(__(\"auth.validation.required\")),\n rating: yup\n .number()\n .min(1, __(\"auth.validation.required\"))\n .required(__(\"auth.validation.required\")),\n name: yup.string().required(__(\"auth.validation.required\")),\n });\n\n const model = ref({\n review: \"\",\n rating: 0,\n name: user.value.name,\n id: props.id,\n });\n\n useSchemaForm(model);\n\n const add = () => {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n store.commit(\"review/modal\", true);\n }\n };\n\n const cancel = () => {\n store.commit(\"review/modal\", false);\n thanks.value = false;\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n $http\n .post($ziggy(\"api.review\"), model.value)\n .then(() => {\n thanks.value = true;\n\n model.value = {\n review: \"\",\n rating: 0,\n name: user.value.name,\n id: props.id,\n };\n })\n .catch((error) => {\n errors.value = {};\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(\n error.response.data.errors\n )) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n });\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n cancel();\n }\n });\n\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (modal.value) {\n document.documentElement.classList.add('is-modal-open');\n }\n\n const showMore = document.getElementById('reviews-show-more');\n\n if (showMore) {\n showMore.addEventListener('click', () => {\n document.getElementById('reviews-list').querySelectorAll('.review.is-hidden').forEach(review => {\n review.classList.remove('is-hidden');\n showMore.remove();\n });\n });\n }\n }, false);\n\n return {\n loading,\n modal,\n schema,\n validation,\n add,\n cancel,\n schema,\n onSubmit,\n errors,\n key,\n model,\n thanks,\n };\n },\n});\n</script>"],"names":["markRaw","FormRating","FormTextarea","FormText","SchemaForm","SchemaFormFactory","VeeValidatePlugin","defineComponent","name","components","props","id","Number","setup","loading","ref","store","useStore","key","errors","modal","computed","getters","auth","user","thanks","schema","rating","component","model","review","label","__","validation","yup","object","shape","string","required","number","min","value","useSchemaForm","cancel","commit","window","addEventListener","e","document","documentElement","classList","add","showMore","getElementById","querySelectorAll","forEach","remove","$http","post","$ziggy","then","error","response","data","Object","entries","field","messages","_createElementVNode","_createElementBlock","_hoisted_1","onClick","_ctx","_hoisted_2","_hoisted_5","_hoisted_6","_hoisted_7","_createBlock","schemaRowClasses","onSubmit","afterForm","_hoisted_8","_hoisted_9","_hoisted_10","type","_hoisted_11","_hoisted_12","innerHTML","_hoisted_14"],"mappings":"2vDAkEAA,UAAQC,WACRD,UAAQE,WACRF,UAAQG,WAER,IAAMC,EAAaC,oBAAkB,CAACC,UAAkB,QAE3BC,kBAAgB,CACzCC,KAAM,SACNC,WAAY,CACRL,WAAAA,GAEJM,MAAO,CACHC,GAAIC,QAERC,eAAMH,SACII,EAAUC,OAAI,GACdC,EAAQC,aACRC,EAAMH,MAAI,GACVI,EAASJ,MAAI,IACbK,EAAQC,YAAS,kBAAML,EAAMM,QAAQ,mBACrCC,EAAOF,YAAS,kBAAML,EAAMM,QAAQ,cACpCE,EAAOH,YAAS,kBAAML,EAAMM,QAAQ,cACpCG,EAASV,OAAI,GAEbW,EAASX,MAAI,CACfY,OAAQ,CACJC,UAAW3B,UACX4B,MAAO,UAEXC,OAAQ,CACJF,UAAW1B,UACX6B,MAAOC,GAAG,sBACVH,MAAO,UAEXrB,KAAM,CACFoB,UAAWzB,UACX4B,MAAOC,GAAG,oBACVH,MAAO,UAITI,EAAaC,EAAIC,SAASC,MAAM,CAClCN,OAAQI,EAAIG,SAASC,SAASN,GAAG,6BACjCL,OAAQO,EACHK,SACAC,IAAI,EAAGR,GAAG,6BACVM,SAASN,GAAG,6BACjBxB,KAAM0B,EAAIG,SAASC,SAASN,GAAG,+BAG7BH,EAAQd,MAAI,CACde,OAAQ,GACRH,OAAQ,EACRnB,KAAMgB,EAAKiB,MAAMjC,KACjBG,GAAID,EAAMC,KAGd+B,gBAAcb,OAURc,EAAS,WACX3B,EAAM4B,OAAO,gBAAgB,GAC7BnB,EAAOgB,OAAQ,UAsCnBI,OAAOC,iBAAiB,SAAS,SAACC,GAC1B3B,EAAMqB,OAAmB,WAAVM,EAAE7B,KACjByB,OAIRK,SAASF,iBAAiB,oBAAoB,WACtC1B,EAAMqB,OACNO,SAASC,gBAAgBC,UA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AiB,QAChBpD,OAAQ8C,6BACWA,8BACHA,SAChBtD,IAAKsD,MACLO,SAAQP,aAEEQ,qBACP,kBAAAZ,2BAAAa,GACIb,2BAAAc,GACId,2BAAAe,GACIf,uDACU,4CACNgB,KAAK,4BAILZ,+BAERJ,2BAAAiB,GACIjB,qCACU,SACLG,sCAAOC,2DACRA,8HAzBYA,6BAgCxCJ,2BAAAkB,GACIlB,kCAAW,UAAUmB,UAAQf,sCAC7BJ,2BAAAoB,GACIpB,qCAAc,SAAUG,sCAAOC,2DAAWA,mDAHTA"}
|
|
1
|
+
{"version":3,"file":"Review.js","sources":["../../../../src/components/shop/reviews/Review.vue","../../../../src/components/shop/reviews/Review.vue?vue&type=template&id=3317de44&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-reviews\">\n <button class=\"button review-add\" @click=\"add\">{{ __(\"shop.review.add\") }}</button>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"cancel\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"cancel\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">{{ __(\"shop.review.title\") }}</div>\n <div class=\"shop-reviews-form\" v-show=\"!thanks\">\n <SchemaForm\n schemaRowClasses=\"field\"\n :schema=\"schema\"\n :validation-schema=\"validation\"\n :initial-errors=\"errors\"\n :key=\"key\"\n @submit=\"onSubmit\"\n >\n <template #afterForm>\n <div class=\"field\">\n <div class=\"columns is-vcentered\">\n <div class=\"column\">\n <button\n class=\"button is-link\"\n type=\"submit\"\n v-bind:class=\"{\n 'is-loading': loading,\n }\"\n >{{ __(\"shop.review.save\") }}</button>\n </div>\n <div class=\"column has-text-right\">\n <button\n class=\"button\"\n @click=\"cancel\"\n >{{ __(\"shop.review.cancel\") }}</button>\n </div>\n </div>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div class=\"shop-reviews-thanks\" v-show=\"thanks\">\n <div class=\"message\" v-html=\"__('shop.review.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.review.continue\") }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { SchemaFormFactory, useSchemaForm } from \"formvuelate\";\nimport VeeValidatePlugin from \"@formvuelate/plugin-vee-validate\";\nimport FormTextarea from \"@perevorot/shop/dist/forms/FormTextarea\";\nimport FormText from \"@perevorot/shop/dist/forms/FormText\";\nimport FormRating from \"@perevorot/shop/dist/forms/FormRating\";\nimport * as yup from \"yup\";\n\nmarkRaw(FormRating);\nmarkRaw(FormTextarea);\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"review\",\n components: {\n SchemaForm,\n },\n props: {\n id: Number,\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[\"review/modal\"]);\n const auth = computed(() => store.getters[\"auth/is\"]);\n const user = computed(() => store.getters[\"auth/me\"]);\n const thanks = ref(false);\n\n const schema = ref({\n rating: {\n component: FormRating,\n model: \"rating\",\n },\n review: {\n component: FormTextarea,\n label: __(\"shop.review.review\"),\n model: \"review\",\n },\n name: {\n component: FormText,\n label: __(\"shop.review.name\"),\n model: \"name\",\n },\n });\n\n const validation = yup.object().shape({\n review: yup.string().required(__(\"auth.validation.required\")),\n rating: yup\n .number()\n .min(1, __(\"auth.validation.required\"))\n .required(__(\"auth.validation.required\")),\n name: yup.string().required(__(\"auth.validation.required\")),\n });\n\n const model = ref({\n review: \"\",\n rating: 0,\n name: user.value.name,\n id: props.id,\n });\n\n useSchemaForm(model);\n\n const add = () => {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n store.commit(\"review/modal\", true);\n }\n };\n\n const cancel = () => {\n store.commit(\"review/modal\", false);\n thanks.value = false;\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n $http\n .post($ziggy(\"api.review\"), model.value)\n .then(() => {\n thanks.value = true;\n\n model.value = {\n review: \"\",\n rating: 0,\n name: user.value.name,\n id: props.id,\n };\n })\n .catch((error) => {\n errors.value = {};\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(\n error.response.data.errors\n )) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n });\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n cancel();\n }\n });\n\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (modal.value) {\n document.documentElement.classList.add('is-modal-open');\n }\n\n const showMore = document.getElementById('reviews-show-more');\n\n if (showMore) {\n showMore.addEventListener('click', () => {\n document.getElementById('reviews-list').querySelectorAll('.review.is-hidden').forEach(review => {\n review.classList.remove('is-hidden');\n showMore.remove();\n });\n });\n }\n }, false);\n\n return {\n loading,\n modal,\n schema,\n validation,\n add,\n cancel,\n schema,\n onSubmit,\n errors,\n key,\n model,\n thanks,\n };\n },\n});\n</script>","<template>\n <div class=\"shop-reviews\">\n <button class=\"button review-add\" @click=\"add\">{{ __(\"shop.review.add\") }}</button>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"cancel\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"cancel\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <div class=\"title\">{{ __(\"shop.review.title\") }}</div>\n <div class=\"shop-reviews-form\" v-show=\"!thanks\">\n <SchemaForm\n schemaRowClasses=\"field\"\n :schema=\"schema\"\n :validation-schema=\"validation\"\n :initial-errors=\"errors\"\n :key=\"key\"\n @submit=\"onSubmit\"\n >\n <template #afterForm>\n <div class=\"field\">\n <div class=\"columns is-vcentered\">\n <div class=\"column\">\n <button\n class=\"button is-link\"\n type=\"submit\"\n v-bind:class=\"{\n 'is-loading': loading,\n }\"\n >{{ __(\"shop.review.save\") }}</button>\n </div>\n <div class=\"column has-text-right\">\n <button\n class=\"button\"\n @click=\"cancel\"\n >{{ __(\"shop.review.cancel\") }}</button>\n </div>\n </div>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div class=\"shop-reviews-thanks\" v-show=\"thanks\">\n <div class=\"message\" v-html=\"__('shop.review.thanks')\"></div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"cancel\">{{ __(\"shop.review.continue\") }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { SchemaFormFactory, useSchemaForm } from \"formvuelate\";\nimport VeeValidatePlugin from \"@formvuelate/plugin-vee-validate\";\nimport FormTextarea from \"@perevorot/shop/dist/forms/FormTextarea\";\nimport FormText from \"@perevorot/shop/dist/forms/FormText\";\nimport FormRating from \"@perevorot/shop/dist/forms/FormRating\";\nimport * as yup from \"yup\";\n\nmarkRaw(FormRating);\nmarkRaw(FormTextarea);\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default /*#__PURE__*/ defineComponent({\n name: \"review\",\n components: {\n SchemaForm,\n },\n props: {\n id: Number,\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[\"review/modal\"]);\n const auth = computed(() => store.getters[\"auth/is\"]);\n const user = computed(() => store.getters[\"auth/me\"]);\n const thanks = ref(false);\n\n const schema = ref({\n rating: {\n component: FormRating,\n model: \"rating\",\n },\n review: {\n component: FormTextarea,\n label: __(\"shop.review.review\"),\n model: \"review\",\n },\n name: {\n component: FormText,\n label: __(\"shop.review.name\"),\n model: \"name\",\n },\n });\n\n const validation = yup.object().shape({\n review: yup.string().required(__(\"auth.validation.required\")),\n rating: yup\n .number()\n .min(1, __(\"auth.validation.required\"))\n .required(__(\"auth.validation.required\")),\n name: yup.string().required(__(\"auth.validation.required\")),\n });\n\n const model = ref({\n review: \"\",\n rating: 0,\n name: user.value.name,\n id: props.id,\n });\n\n useSchemaForm(model);\n\n const add = () => {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n store.commit(\"review/modal\", true);\n }\n };\n\n const cancel = () => {\n store.commit(\"review/modal\", false);\n thanks.value = false;\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n $http\n .post($ziggy(\"api.review\"), model.value)\n .then(() => {\n thanks.value = true;\n\n model.value = {\n review: \"\",\n rating: 0,\n name: user.value.name,\n id: props.id,\n };\n })\n .catch((error) => {\n errors.value = {};\n\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(\n error.response.data.errors\n )) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n })\n .finally(() => {\n loading.value = false;\n });\n };\n\n window.addEventListener(\"keyup\", (e) => {\n if (modal.value && e.key === \"Escape\") {\n cancel();\n }\n });\n\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (modal.value) {\n document.documentElement.classList.add('is-modal-open');\n }\n\n const showMore = document.getElementById('reviews-show-more');\n\n if (showMore) {\n showMore.addEventListener('click', () => {\n document.getElementById('reviews-list').querySelectorAll('.review.is-hidden').forEach(review => {\n review.classList.remove('is-hidden');\n showMore.remove();\n });\n });\n }\n }, false);\n\n return {\n loading,\n modal,\n schema,\n validation,\n add,\n cancel,\n schema,\n onSubmit,\n errors,\n key,\n model,\n thanks,\n };\n },\n});\n</script>"],"names":["markRaw","FormRating","FormTextarea","FormText","SchemaForm","SchemaFormFactory","VeeValidatePlugin","script","defineComponent","name","components","props","id","Number","setup","loading","ref","store","useStore","key","errors","modal","computed","getters","auth","user","thanks","schema","rating","component","model","review","label","__","validation","yup","object","shape","string","required","number","min","value","useSchemaForm","cancel","commit","window","addEventListener","e","document","documentElement","classList","add","showMore","getElementById","querySelectorAll","forEach","remove","_defineProperty","onSubmit","$http","post","$ziggy","then","error","response","data","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","field","messages","_hoisted_1","class","_hoisted_2","_createElementVNode","createElementVNode","xlink:href","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_14","_openBlock","_createElementBlock","onClick","_ctx","apply","arguments","_normalizeClass","is-active","_toDisplayString","toDisplayString","_withDirectives","_createBlock","_component_SchemaForm","schemaRowClasses","validation-schema","initial-errors","afterForm","type","withDirectives","innerHTML"],"mappings":"gnEAkEAA,EAAOA,QAACC,EAAU,SAClBD,EAAOA,QAACE,EAAY,SACpBF,EAAOA,QAACG,EAAQ,SAEhB,IAAMC,EAAaC,EAAAA,kBAAkB,CAACC,EAAiB,QAAC,MAEzCC,EAAcC,kBAAgB,CACzCC,KAAM,SACNC,WAAY,CACRN,WAAAA,GAEJO,MAAO,CACHC,GAAIC,QAERC,MAAK,SAACH,GACF,IAAMI,EAAUC,OAAI,GACdC,EAAQC,EAAAA,WACRC,EAAMH,MAAI,GACVI,EAASJ,MAAI,IACbK,EAAQC,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,mBACrCC,EAAOF,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,cACpCE,EAAOH,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,cACpCG,EAASV,OAAI,GAEbW,EAASX,EAAAA,IAAI,CACfY,OAAQ,CACJC,UAAW5B,EAAU,QACrB6B,MAAO,UAEXC,OAAQ,CACJF,UAAW3B,EAAY,QACvB8B,MAAOC,GAAG,sBACVH,MAAO,UAEXrB,KAAM,CACFoB,UAAW1B,EAAQ,QACnB6B,MAAOC,GAAG,oBACVH,MAAO,UAITI,EAAaC,EAAIC,SAASC,MAAM,CAClCN,OAAQ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|
1
|
-
"use strict";var e=require("vue"),n=require("swiper");function
|
|
1
|
+
"use strict";var e=require("vue"),n=require("swiper"),o=require("swiper/modules");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=i(n),r=e.defineComponent({name:"viewed",props:{slider:{type:Boolean,default:!1}},setup:function(n){var i=!1,r=e.ref(null),a=e.ref(null),c=function(e){e.forEach((function(e){e.isIntersecting&&(i||(i=!0,l()))}))},l=function(){$http.post($ziggy("api.viewed"),{action:"list",account:-1!==window.location.href.indexOf("/account/viewed")}).then((function(i){window.app.component("viewed-container",{template:i.data?i.data:"<i></i>"}),a.value="viewed-container",e.nextTick((function(){if(n.slider){var e=window.viewedSwiperOptions?window.viewedSwiperOptions:{slidesPerView:5,spaceBetween:24,freeMode:!0,navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"},mousewheel:{forceToAxis:!0}};e.modules=[o.Navigation,o.Mousewheel],new t.default(r.value.querySelector(".swiper"),e)}window.lazyImages&&window.lazyImages.update(),window.promoCodeCallback&&"function"==typeof window.promoCodeCallback&&window.promoCodeCallback(r.value)}))}))};return e.onMounted((function(){new IntersectionObserver(c).observe(r.value)})),{container:r,component:a}}}),a={ref:"container"};r.render=function(n,o,i,t,r,c){return e.openBlock(),e.createElementBlock("div",a,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.component)))],512)},module.exports=r;
|
|
2
2
|
//# sourceMappingURL=Viewed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewed.js","sources":["../../../../src/components/shop/viewed/Viewed.vue","../../../../src/components/shop/viewed/Viewed.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"Viewed.js","sources":["../../../../src/components/shop/viewed/Viewed.vue","../../../../src/components/shop/viewed/Viewed.vue?vue&type=template&id=4628efcc&lang.js"],"sourcesContent":["<template>\n <div ref=\"container\">\n <component :is=\"component\"></component>\n </div>\n</template>\n<script>\nimport { ref, onMounted, nextTick, defineComponent } from 'vue';\nimport Swiper from 'swiper';\nimport { Navigation, Mousewheel } from 'swiper/modules';\n\nexport default defineComponent({\n name: 'viewed',\n props: {\n slider: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n let inited = false;\n\n const container = ref(null);\n const component = ref(null);\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n if (!inited) {\n inited = true;\n load();\n }\n }\n });\n };\n\n const load = () => {\n $http\n .post($ziggy('api.viewed'), {\n action: 'list',\n account: window.location.href.indexOf('/account/viewed') !== -1\n })\n .then((response) => {\n window.app.component('viewed-container', {\n template: response.data ? response.data : '<i></i>'\n });\n\n component.value = 'viewed-container';\n\n nextTick(() => {\n if (props.slider) {\n const options = window.viewedSwiperOptions\n ? window.viewedSwiperOptions\n : {\n slidesPerView: 5,\n spaceBetween: 24,\n freeMode: true,\n navigation: {\n nextEl: '.swiper-button-next',\n prevEl: '.swiper-button-prev'\n },\n mousewheel: {\n forceToAxis: true\n }\n };\n\n options.modules = [Navigation, Mousewheel];\n\n new Swiper(container.value.querySelector('.swiper'), options);\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(container.value);\n }\n });\n });\n };\n\n onMounted(() => {\n const observer = new IntersectionObserver(callback);\n observer.observe(container.value);\n });\n\n return {\n container,\n component\n };\n }\n});\n</script>\n","<template>\n <div ref=\"container\">\n <component :is=\"component\"></component>\n </div>\n</template>\n<script>\nimport { ref, onMounted, nextTick, defineComponent } from 'vue';\nimport Swiper from 'swiper';\nimport { Navigation, Mousewheel } from 'swiper/modules';\n\nexport default defineComponent({\n name: 'viewed',\n props: {\n slider: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n let inited = false;\n\n const container = ref(null);\n const component = ref(null);\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n if (!inited) {\n inited = true;\n load();\n }\n }\n });\n };\n\n const load = () => {\n $http\n .post($ziggy('api.viewed'), {\n action: 'list',\n account: window.location.href.indexOf('/account/viewed') !== -1\n })\n .then((response) => {\n window.app.component('viewed-container', {\n template: response.data ? response.data : '<i></i>'\n });\n\n component.value = 'viewed-container';\n\n nextTick(() => {\n if (props.slider) {\n const options = window.viewedSwiperOptions\n ? window.viewedSwiperOptions\n : {\n slidesPerView: 5,\n spaceBetween: 24,\n freeMode: true,\n navigation: {\n nextEl: '.swiper-button-next',\n prevEl: '.swiper-button-prev'\n },\n mousewheel: {\n forceToAxis: true\n }\n };\n\n options.modules = [Navigation, Mousewheel];\n\n new Swiper(container.value.querySelector('.swiper'), options);\n }\n\n if (window.lazyImages) {\n window.lazyImages.update();\n }\n\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(container.value);\n }\n });\n });\n };\n\n onMounted(() => {\n const observer = new IntersectionObserver(callback);\n observer.observe(container.value);\n });\n\n return {\n container,\n component\n };\n }\n});\n</script>\n"],"names":["script","defineComponent","name","props","slider","type","Boolean","default","setup","inited","container","ref","component","callback","entries","forEach","entry","isIntersecting","load","$http","post","$ziggy","action","account","window","location","href","indexOf","then","response","app","template","data","value","nextTick","options","viewedSwiperOptions","slidesPerView","spaceBetween","freeMode","navigation","nextEl","prevEl","mousewheel","forceToAxis","modules","Navigation","Mousewheel","Swiper","querySelector","lazyImages","update","promoCodeCallback","onMounted","IntersectionObserver","observe","_hoisted_1","_openBlock","openBlock","_createElementBlock","_createBlock","_resolveDynamicComponent","_ctx"],"mappings":"qKAUAA,EAAeC,kBAAgB,CAC3BC,KAAM,SACNC,MAAO,CACHC,OAAQ,CACJC,KAAMC,QACNC,SAAS,IAGjBC,MAAK,SAACL,GACF,IAAIM,GAAS,EAEPC,EAAYC,MAAI,MAChBC,EAAYD,MAAI,MAEhBE,EAAW,SAACC,GACdA,EAAQC,SAAQ,SAACC,GACTA,EAAMC,iBACDR,IACDA,GAAS,EACTS,UAMVA,EAAO,WACTC,MACKC,KAAKC,OAAO,cAAe,CACxBC,OAAQ,OACRC,SAA8D,IAArDC,OAAOC,SAASC,KAAKC,QAAQ,qBAEzCC,MAAK,SAACC,GACHL,OAAOM,IAAIlB,UAAU,mBAAoB,CACrCmB,SAAUF,EAASG,KAAOH,EAASG,KAAO,YAG9CpB,EAAUqB,MAAQ,mBAElBC,EAAAA,UAAS,WACL,GAAI/B,EAAMC,OAAQ,CACd,IAAM+B,EAAUX,OAAOY,oBACjBZ,OAAOY,oBACP,CACEC,cAAe,EACfC,aAAc,GACdC,UAAU,EACVC,WAAY,CACRC,OAAQ,sBACRC,OAAQ,uBAEZC,WAAY,CACRC,aAAa,IAIzBT,EAAQU,QAAU,CAACC,EAAUA,WAAEC,EAAUA,YAEzC,IAAIC,EAAAA,QAAOtC,EAAUuB,MAAMgB,cAAc,WAAYd,GAGrDX,OAAO0B,YACP1B,OAAO0B,WAAWC,SAGlB3B,OAAO4B,mBAAyD,mBAA7B5B,OAAO4B,mBAC1C5B,OAAO4B,kBAAkB1C,EAAUuB,cAWvD,OALAoB,EAAAA,WAAU,WACW,IAAIC,qBAAqBzC,GACjC0C,QAAQ7C,EAAUuB,UAGxB,CACHvB,UAAAA,EACAE,UAAAA,MCvFH4C,EAAA,CAAA7C,IAAI,4CAAT,OAAA8C,EAAAC,YAAAC,EAAAA,mBAEK,MAFLH,EAEK,EADDC,EAAAC,YAAAE,EAAAA,YAAsCC,EAAAA,wBAAtBC,EAASlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewedDelete.js","sources":["../../../../src/components/shop/viewed/ViewedDelete.vue","../../../../src/components/shop/viewed/ViewedDelete.vue?vue&type=template&id=56faefa1&lang.js"],"sourcesContent":["<template>\n <button class=\"button viewed\" @click=\"action($event)\" v-bind:class=\"{ 'is-loading': loading }\" v-if=\"id\"></button>\n <button class=\"button is-delete-all-viewed\" @click=\"action($event)\" v-else>{{ __('shop.viewed.delete_all') }}</button>\n</template>\n<script>\nimport { ref, defineComponent } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number\n },\n setup(props) {\n const loading = ref(false);\n\n const notice = () => {\n const notice = document.getElementById('viewed-notice');\n\n if (notice) {\n notice.classList.remove('is-hidden');\n }\n };\n\n const action = (e) => {\n if (!loading.value) {\n loading.value = true;\n\n let item = props.id ? e.currentTarget.closest('.product') : null;\n\n $http\n .post($ziggy('api.viewed'), {\n action: 'delete',\n id: props.id\n })\n .then(() => {\n if (item) {\n item.remove();\n\n if (!document.getElementById('viewed-items-container').querySelectorAll('.product').length) {\n document.getElementById('viewed-items-container').remove();\n\n notice();\n }\n } else {\n document.getElementById('viewed-items-container').remove();\n\n notice();\n }\n })\n .finally(() => {\n loading.value = false;\n });\n }\n };\n\n return {\n action,\n loading\n };\n }\n});\n</script>","<template>\n <button class=\"button viewed\" @click=\"action($event)\" v-bind:class=\"{ 'is-loading': loading }\" v-if=\"id\"></button>\n <button class=\"button is-delete-all-viewed\" @click=\"action($event)\" v-else>{{ __('shop.viewed.delete_all') }}</button>\n</template>\n<script>\nimport { ref, defineComponent } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number\n },\n setup(props) {\n const loading = ref(false);\n\n const notice = () => {\n const notice = document.getElementById('viewed-notice');\n\n if (notice) {\n notice.classList.remove('is-hidden');\n }\n };\n\n const action = (e) => {\n if (!loading.value) {\n loading.value = true;\n\n let item = props.id ? e.currentTarget.closest('.product') : null;\n\n $http\n .post($ziggy('api.viewed'), {\n action: 'delete',\n id: props.id\n })\n .then(() => {\n if (item) {\n item.remove();\n\n if (!document.getElementById('viewed-items-container').querySelectorAll('.product').length) {\n document.getElementById('viewed-items-container').remove();\n\n notice();\n }\n } else {\n document.getElementById('viewed-items-container').remove();\n\n notice();\n }\n })\n .finally(() => {\n loading.value = false;\n });\n }\n };\n\n return {\n action,\n loading\n };\n }\n});\n</script>"],"names":["defineComponent","props","id","Number","setup","loading","ref","notice","document","getElementById","classList","remove","action","e","value","item","currentTarget","closest","$http","post","$ziggy","then","querySelectorAll","length","_ctx","_createElementBlock","onClick","$event"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ViewedDelete.js","sources":["../../../../src/components/shop/viewed/ViewedDelete.vue","../../../../src/components/shop/viewed/ViewedDelete.vue?vue&type=template&id=56faefa1&lang.js"],"sourcesContent":["<template>\n <button class=\"button viewed\" @click=\"action($event)\" v-bind:class=\"{ 'is-loading': loading }\" v-if=\"id\"></button>\n <button class=\"button is-delete-all-viewed\" @click=\"action($event)\" v-else>{{ __('shop.viewed.delete_all') }}</button>\n</template>\n<script>\nimport { ref, defineComponent } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number\n },\n setup(props) {\n const loading = ref(false);\n\n const notice = () => {\n const notice = document.getElementById('viewed-notice');\n\n if (notice) {\n notice.classList.remove('is-hidden');\n }\n };\n\n const action = (e) => {\n if (!loading.value) {\n loading.value = true;\n\n let item = props.id ? e.currentTarget.closest('.product') : null;\n\n $http\n .post($ziggy('api.viewed'), {\n action: 'delete',\n id: props.id\n })\n .then(() => {\n if (item) {\n item.remove();\n\n if (!document.getElementById('viewed-items-container').querySelectorAll('.product').length) {\n document.getElementById('viewed-items-container').remove();\n\n notice();\n }\n } else {\n document.getElementById('viewed-items-container').remove();\n\n notice();\n }\n })\n .finally(() => {\n loading.value = false;\n });\n }\n };\n\n return {\n action,\n loading\n };\n }\n});\n</script>","<template>\n <button class=\"button viewed\" @click=\"action($event)\" v-bind:class=\"{ 'is-loading': loading }\" v-if=\"id\"></button>\n <button class=\"button is-delete-all-viewed\" @click=\"action($event)\" v-else>{{ __('shop.viewed.delete_all') }}</button>\n</template>\n<script>\nimport { ref, defineComponent } from 'vue';\n\nexport default /*#__PURE__*/ defineComponent({\n props: {\n id: Number\n },\n setup(props) {\n const loading = ref(false);\n\n const notice = () => {\n const notice = document.getElementById('viewed-notice');\n\n if (notice) {\n notice.classList.remove('is-hidden');\n }\n };\n\n const action = (e) => {\n if (!loading.value) {\n loading.value = true;\n\n let item = props.id ? e.currentTarget.closest('.product') : null;\n\n $http\n .post($ziggy('api.viewed'), {\n action: 'delete',\n id: props.id\n })\n .then(() => {\n if (item) {\n item.remove();\n\n if (!document.getElementById('viewed-items-container').querySelectorAll('.product').length) {\n document.getElementById('viewed-items-container').remove();\n\n notice();\n }\n } else {\n document.getElementById('viewed-items-container').remove();\n\n notice();\n }\n })\n .finally(() => {\n loading.value = false;\n });\n }\n };\n\n return {\n action,\n loading\n };\n }\n});\n</script>"],"names":["script","defineComponent","props","id","Number","setup","loading","ref","notice","document","getElementById","classList","remove","action","e","value","item","currentTarget","closest","$http","post","$ziggy","then","querySelectorAll","length","_ctx","_createElementBlock","class","_normalizeClass","is-loading","onClick","_cache","$event","__"],"mappings":"kCAOeA,EAAcC,kBAAgB,CACzCC,MAAO,CACHC,GAAIC,QAERC,MAAK,SAACH,GACF,IAAMI,EAAUC,OAAI,GAEdC,EAAS,WACX,IAAMA,EAASC,SAASC,eAAe,iBAEnCF,GACAA,EAAOG,UAAUC,OAAO,cAoChC,MAAO,CACHC,OAjCW,SAACC,GACZ,IAAKR,EAAQS,MAAO,CAChBT,EAAQS,OAAQ,EAEhB,IAAIC,EAAOd,EAAMC,GAAKW,EAAEG,cAAcC,QAAQ,YAAc,KAE5DC,MACKC,KAAKC,OAAO,cAAe,CACxBR,OAAQ,SACRV,GAAID,EAAMC,KAEbmB,MAAK,WACEN,GACAA,EAAKJ,SAEAH,SAASC,eAAe,0BAA0Ba,iBAAiB,YAAYC,SAChFf,SAASC,eAAe,0BAA0BE,SAElDJ,OAGJC,SAASC,eAAe,0BAA0BE,SAElDJ,QAGA,SAAC,WACLF,EAAQS,OAAQ,OAO5BT,QAAAA,4CCvD6FmB,EAAEtB,kBAAvGuB,EAAAA,mBAAiH,SAAA,OAAzGC,MAAKC,EAAAA,eAAA,CAAC,gBAAgB,CAAAC,aAAsDJ,EAAMnB,WAA3DwB,QAAKC,EAAA,KAAAA,EAAA,GAAA,SAAAC,GAAA,OAAEP,EAAMZ,OAACmB,8BAC7CN,EAAAA,mBAAqH,SAAA,OAA7GC,MAAM,8BAA+BG,QAAKC,EAAA,KAAAA,EAAA,GAAA,SAAAC,GAAA,OAAEP,EAAMZ,OAACmB,wBAAmBP,EAAEQ,GAAA,2BAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewer.js","sources":["../../../../src/components/shop/viewed/Viewer.vue","../../../../src/components/shop/viewed/Viewer.vue?vue&type=template&id=1eaede6a&lang.js"],"sourcesContent":["<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>","<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","slug","String","code","brand","category","property","id","Number","setup","store","useStore","viewer","ref","productInCart","computed","getters","$http","post","$ziggy","action","onMounted","product","value","closest","querySelector","textContent","price","childNodes","nodeValue","replace","referer","document","referrer","object","ecommerce","currency","parseFloat","items","item_name","item_id","item_list_name","includes","index","event","Storage","productIndex","sessionStorage","getItem","JSON","parse","attributes","itemListName","item_brand","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","_createElementBlock","_hoisted_1"],"mappings":"sDAO6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,KAAMC,OACNC,KAAMD,OACNE,MAAOF,OACPG,SAAUH,OACVI,SAAUJ,OACVK,GAAIC,QAERC,eAAMT,OACIU,EAAQC,aACRC,EAASC,MAAI,MACbC,EAAgBC,YAAS,kBAAML,EAAMM,QAA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C,UAGpFxB,EAAOC,UAAUG,MAAM,GAAGqB,cAAgB3D,EAAMK,UAIpDL,EAAMM,WACN4B,EAAOC,UAAUG,MAAM,GAAGsB,aAAe5D,EAAMM,UAG/CuD,KAAKC,MAAM3B,WACX4B,QAAQC,IAAI9B,IAGX2B,KAAKC,MAAM3B,WAAa8B,OAAOC,YAChCD,OAAOC,UAAUC,KAAK,CAClBhC,UAAW,OAGf8B,OAAOC,UAAUC,KAAKjC,OAIvB,CACHtB,OAAAA,eCxGI,YAAYC,IAAI,8DAA5BuD,4BAAAC"}
|
|
1
|
+
{"version":3,"file":"Viewer.js","sources":["../../../../src/components/shop/viewed/Viewer.vue","../../../../src/components/shop/viewed/Viewer.vue?vue&type=template&id=1eaede6a&lang.js"],"sourcesContent":["<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>","<template>\n <span class=\"is-hidden\" ref=\"viewer\"></span>\n</template>\n<script>\nimport { ref, onMounted, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'viewer',\n props: {\n slug: String,\n code: String,\n brand: String,\n category: String,\n property: String,\n id: Number\n },\n setup(props) {\n const store = useStore();\n const viewer = ref(null);\n const productInCart = computed(() => store.getters['cart/product'](props.id));\n\n $http.post($ziggy('api.viewed'), {\n action: 'view',\n slug: props.slug\n });\n\n onMounted(() => {\n const product = viewer.value.closest('[shop-product]');\n const name = product.querySelector('[shop-product-name]').textContent;\n const price = product.querySelector('[shop-product-price]') ? product.querySelector('[shop-product-price]').childNodes[0].nodeValue.replace(/ /g, '') : null;\n const code = props.code;\n const referer = document.referrer;\n\n let object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n item_list_name: referer.includes('/post') ? 'Новини' : 'Direct',\n index: 1,\n }\n ]\n },\n event: 'view_item'\n };\n\n if (typeof Storage !== 'undefined') {\n let productIndex = sessionStorage.getItem('productIndex');\n\n if (productIndex) {\n productIndex = JSON.parse(productIndex);\n\n object.ecommerce.items[0].item_list_name = productIndex.item_list_name;\n object.ecommerce.items[0].index = productIndex.index;\n }\n }\n\n if (productInCart.value && productInCart.value.attributes.index) {\n object.ecommerce.items[0].index = productInCart.value.attributes.index;\n }\n\n if (productInCart.value && productInCart.value.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = productInCart.value.attributes.itemListName;\n }\n\n if (price) {\n object.ecommerce.items[0].price = parseFloat(price);\n }\n\n if (props.brand) {\n object.ecommerce.items[0].item_brand = props.brand;\n }\n\n if (props.category) {\n if (props.category.indexOf('/') !== -1) {\n props.category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = props.category;\n }\n }\n\n if (props.property) {\n object.ecommerce.items[0].item_variant = props.property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n });\n\n return {\n viewer\n };\n }\n});\n</script>"],"names":["script","defineComponent","name","props","slug","String","code","brand","category","property","id","Number","setup","store","useStore","viewer","ref","productInCart","computed","getters","$http","post","$ziggy","action","onMounted","product","value","closest","querySelector","textContent","price","childNodes","nodeValue","replace","referer","document","referrer","object","ecommerce","currency","parseFloat","items","item_name","item_id","item_list_name","includes","index","event","Storage","productIndex","sessionStorage","getItem","JSON","parse","attributes","itemListName","item_brand","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","class","_openBlock","_createElementBlock","_hoisted_1"],"mappings":"oDAOeA,EAAcC,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,KAAMC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,MAAM,GAAGe,WAAarD,EAAMI,OAG7CJ,EAAMK,YAC+B,IAAjCL,EAAMK,SAASiD,QAAQ,KACvBtD,EAAMK,SAASkD,MAAM,KAAKC,SAAQ,SAACC,EAASd,GACxCT,EAAOC,UAAUG,MAAM,GAAG,iBAAmBK,EAAQA,EAAQ,EAAI,KAAOc,EAAQC,UAGpFxB,EAAOC,UAAUG,MAAM,GAAGqB,cAAgB3D,EAAMK,UAIpDL,EAAMM,WACN4B,EAAOC,UAAUG,MAAM,GAAGsB,aAAe5D,EAAMM,UAG/CuD,KAAKC,MAAM3B,WACX4B,QAAQC,IAAI9B,IAGX2B,KAAKC,MAAM3B,WAAa8B,OAAOC,YAChCD,OAAOC,UAAUC,KAAK,CAClBhC,UAAW,OAGf8B,OAAOC,UAAUC,KAAKjC,OAIvB,CACHtB,OAAAA,SCxGFwD,MAAM,YAAYvD,IAAI,yCAA5B,OAAAwD,EAAAA,YAAAC,qBAA2C,OAA3CC,EAA2C,KAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuccessMessage.js","sources":["../../../../src/components/shop/wishlist/SuccessMessage.vue","../../../../src/components/shop/wishlist/SuccessMessage.vue?vue&type=template&id=2780632f&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-wishlist-success-message\">\n <div>\n {{\n translate(\"shop.wishlist.product_added_named\", {\n product: last.name,\n })\n }}\n </div>\n <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.wishlist.goto\") }}</a\n >\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"shop-wishlist-success-message\">\n <div>\n {{\n translate(\"shop.wishlist.product_added_named\", {\n product: last.name,\n })\n }}\n </div>\n <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.wishlist.goto\") }}</a\n >\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>"],"names":["props","last","setup","translate","window","__","
|
|
1
|
+
{"version":3,"file":"SuccessMessage.js","sources":["../../../../src/components/shop/wishlist/SuccessMessage.vue","../../../../src/components/shop/wishlist/SuccessMessage.vue?vue&type=template&id=2780632f&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-wishlist-success-message\">\n <div>\n {{\n translate(\"shop.wishlist.product_added_named\", {\n product: last.name,\n })\n }}\n </div>\n <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.wishlist.goto\") }}</a\n >\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>","<template>\n <div class=\"shop-wishlist-success-message\">\n <div>\n {{\n translate(\"shop.wishlist.product_added_named\", {\n product: last.name,\n })\n }}\n </div>\n <a\n :href=\"last.url\"\n class=\"mt-2 is-size-7\"\n style=\"color: #fff; border-bottom: 1px solid #fff\"\n >{{ translate(\"shop.wishlist.goto\") }}</a\n >\n </div>\n</template>\n<script>\nexport default {\n props: {\n last: null,\n },\n setup() {\n const translate = window.__;\n\n return {\n translate,\n };\n },\n};\n</script>"],"names":["script","props","last","setup","translate","window","__","_hoisted_1","class","_openBlock","openBlock","_createElementBlock","_createElementVNode","$setup","product","$props","name","href","url","style","color","border-bottom","_hoisted_2"],"mappings":"kCAkBeA,EAAA,CACXC,MAAO,CACHC,KAAM,MAEVC,MAAK,WAGD,MAAO,CACHC,UAHcC,OAAOC,MCtBxBC,EAAA,CAAAC,MAAM,2EAAX,OAAAC,EAAAC,YAAAC,EAAAA,mBAcK,MAdLJ,EAcK,CAbDK,EAAAA,mBAMK,6BAJGC,EAAST,UAAA,oCAAA,CAAsCU,QAAAC,EAAAb,KAAAc,WAKvDJ,EAAAA,mBAKA,IAAA,CAJKK,KAAMF,EAAIb,KAACgB,IACZV,MAAM,iBACNW,MAAA,CAAiDC,MAAA,OAAAC,gBAAA,qCAC7CR,EAAST,UAAA,uBAAA,EAAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wishlist.js","sources":["../../../../src/components/shop/wishlist/Wishlist.vue","../../../../src/components/shop/wishlist/Wishlist.vue?vue&type=template&id=b1bbabba&lang.js"],"sourcesContent":["<template>\n <div class=\"button\" @click=\"action\" v-if=\"mounted\">\n <slot :total=\"items.length\">\n <span>\n <i class=\"fas fa-heart\"></i>\n </span>\n <span class=\"ml-2\">\n {{ items.length }}\n </span>\n </slot>\n </div>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\n\nexport default /*#__PURE__*/ defineComponent({\n setup() {\n const store = useStore();\n const mounted = ref(false);\n const items = computed(() => store.getters[\"wishlist/items\"]);\n const auth = computed(() => store.getters[\"auth/is\"]);\n\n const action = () => {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n window.location.href = $ziggy(\"account.wish\");\n }\n };\n\n store.dispatch(\"wishlist/get\", {\n finally: () => {\n mounted.value = true;\n },\n });\n\n return {\n mounted,\n auth,\n action,\n items,\n };\n },\n});\n</script>","<template>\n <div class=\"button\" @click=\"action\" v-if=\"mounted\">\n <slot :total=\"items.length\">\n <span>\n <i class=\"fas fa-heart\"></i>\n </span>\n <span class=\"ml-2\">\n {{ items.length }}\n </span>\n </slot>\n </div>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\n\nexport default /*#__PURE__*/ defineComponent({\n setup() {\n const store = useStore();\n const mounted = ref(false);\n const items = computed(() => store.getters[\"wishlist/items\"]);\n const auth = computed(() => store.getters[\"auth/is\"]);\n\n const action = () => {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n window.location.href = $ziggy(\"account.wish\");\n }\n };\n\n store.dispatch(\"wishlist/get\", {\n finally: () => {\n mounted.value = true;\n },\n });\n\n return {\n mounted,\n auth,\n action,\n items,\n };\n },\n});\n</script>"],"names":["defineComponent","setup","store","useStore","mounted","ref","items","computed","getters","auth","dispatch","value","action","window","location","href","$ziggy","commit","_createElementVNode","_ctx","_createElementBlock","onClick","_renderSlot","total","length","_hoisted_1","
|
|
1
|
+
{"version":3,"file":"Wishlist.js","sources":["../../../../src/components/shop/wishlist/Wishlist.vue","../../../../src/components/shop/wishlist/Wishlist.vue?vue&type=template&id=b1bbabba&lang.js"],"sourcesContent":["<template>\n <div class=\"button\" @click=\"action\" v-if=\"mounted\">\n <slot :total=\"items.length\">\n <span>\n <i class=\"fas fa-heart\"></i>\n </span>\n <span class=\"ml-2\">\n {{ items.length }}\n </span>\n </slot>\n </div>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\n\nexport default /*#__PURE__*/ defineComponent({\n setup() {\n const store = useStore();\n const mounted = ref(false);\n const items = computed(() => store.getters[\"wishlist/items\"]);\n const auth = computed(() => store.getters[\"auth/is\"]);\n\n const action = () => {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n window.location.href = $ziggy(\"account.wish\");\n }\n };\n\n store.dispatch(\"wishlist/get\", {\n finally: () => {\n mounted.value = true;\n },\n });\n\n return {\n mounted,\n auth,\n action,\n items,\n };\n },\n});\n</script>","<template>\n <div class=\"button\" @click=\"action\" v-if=\"mounted\">\n <slot :total=\"items.length\">\n <span>\n <i class=\"fas fa-heart\"></i>\n </span>\n <span class=\"ml-2\">\n {{ items.length }}\n </span>\n </slot>\n </div>\n</template>\n<script>\nimport { ref, computed, defineComponent } from \"vue\";\nimport { useStore } from \"vuex\";\n\nexport default /*#__PURE__*/ defineComponent({\n setup() {\n const store = useStore();\n const mounted = ref(false);\n const items = computed(() => store.getters[\"wishlist/items\"]);\n const auth = computed(() => store.getters[\"auth/is\"]);\n\n const action = () => {\n if (!auth.value) {\n store.commit(\"auth/modal\", \"login\");\n } else {\n window.location.href = $ziggy(\"account.wish\");\n }\n };\n\n store.dispatch(\"wishlist/get\", {\n finally: () => {\n mounted.value = true;\n },\n });\n\n return {\n mounted,\n auth,\n action,\n items,\n };\n },\n});\n</script>"],"names":["script","defineComponent","setup","store","useStore","mounted","ref","items","computed","getters","auth","dispatch","finally","value","action","window","location","href","$ziggy","commit","_createElementVNode","createElementVNode","class","_hoisted_2","_ctx","_createElementBlock","onClick","apply","arguments","_renderSlot","renderSlot","$slots","total","length","_hoisted_1","_toDisplayString"],"mappings":"oDAgBeA,EAAcC,kBAAgB,CACzCC,MAAK,WACD,IAAMC,EAAQC,EAAAA,WACRC,EAAUC,OAAI,GACdC,EAAQC,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,qBACrCC,EAAOF,EAAAA,UAAS,WAAA,OAAML,EAAMM,QAAQ,cAgB1C,OANAN,EAAMQ,SAAS,eAAgB,CAC3BC,QAAS,WACLP,EAAQQ,OAAQ,KAIjB,CACHR,QAAAA,EACAK,KAAAA,EACAI,OAjBW,WACNJ,EAAKG,MAGNE,OAAOC,SAASC,KAAOC,OAAO,gBAF9Bf,EAAMgB,OAAO,aAAc,UAgB/BZ,MAAAA,QCtCAa,EAEMC,mBAAA,OAAA,KAAA,CADFD,EAAAA,mBAA2B,IAAA,CAAxBE,MAAM,sBAEPC,EAAA,CAAAD,MAAM,8CALsBE,EAAOnB,uBAAjDoB,EAAAA,mBASK,MAAA,OATAH,MAAM,SAAUI,sCAAOF,EAAMV,QAAAU,EAAAV,OAAAa,MAAAH,EAAAI,eAC9BC,EAOMC,WAAAN,EAAAO,OAAA,UAAA,CAPCC,MAAOR,EAAKjB,MAAC0B,SAApB,WAAA,MAOM,CANFC,EAGAd,qBAEM,OAFNG,EACOY,EAAAA,gBAAAX,EAAAjB,MAAM0B"}
|