@perevorot/shop 2.0.147 → 2.0.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=require("vuex"),i={name:"CartItem",props:{item:Object},setup:function(i){var o=e.inject("cartStorage"),n=t.useStore(),a=e.ref(!1),r=e.ref(),c=e.ref(i.item.attributes.options&&i.item.attributes.options.length?i.item.attributes.options:[]),l=e.ref(!1),s=e.computed((function(){return n.getters["auth/is"]}));i.item.attributes.options&&i.item.attributes.options.length&&(l.value=!0);var m=i.item.name,d=i.item.attributes.price,u=i.item.attributes.code,p=i.item.attributes.categoryFull?i.item.attributes.categoryFull:i.item.attributes.category,b=i.item.attributes.brand,v=i.item.attributes.property,g=i.item.attributes.index,k=i.item.attributes.itemListName,f=function(e){a.value=!0,n.dispatch(o+"/add",{cart:o,product:{id:i.item.id,quantity:e},finally:function(){a.value=!1},callback:function(){if(e>0){i.item.quantity;var t={ecommerce:{currency:"UAH",value:parseFloat(d),items:[{item_name:m,item_id:u,price:parseFloat(d),quantity:1}]},event:"add_to_cart"};b&&(t.ecommerce.items[0].item_brand=b),i.item.attributes.index&&(t.ecommerce.items[0].index=i.item.attributes.index),i.item.attributes.itemListName&&(t.ecommerce.items[0].item_list_name=i.item.attributes.itemListName),p&&(-1!==p.indexOf("/")?p.split("/").forEach((function(e,i){t.ecommerce.items[0]["item_category"+(i?i+1:"")]=e.trim()})):t.ecommerce.items[0].item_category=p),v&&(t.ecommerce.items[0].item_variant=v),$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}}})};i.item.options&&i.item.options.length&&e.watch(c,(function(e){a.value=!0,n.dispatch(o+"/options",{product:{id:i.item.id,options:Object.values(e)},finally:function(){a.value=!1}})}));return{loading:a,increase:function(){f(1)},decrease:function(){f(-1)},remove:function(){a.value=!0,n.dispatch(o+"/remove",{id:i.item.id,cart:o,finally:function(){a.value=!1},callback:function(){var e=i.item.quantity,t={ecommerce:{currency:"UAH",value:parseFloat(d)*e,items:[{item_name:m,item_id:u,price:parseFloat(d),quantity:e}]},event:"remove_from_cart"};p&&(-1!==p.indexOf("/")?p.split("/").forEach((function(e,i){t.ecommerce.items[0]["item_category"+(i?i+1:"")]=e.trim()})):t.ecommerce.items[0].item_category=p),g&&(t.ecommerce.items[0].index=g),k&&(t.ecommerce.items[0].item_list_name=k),v&&(t.ecommerce.items[0].item_variant=v),$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}})},options:c,optionsToggled:l,input:r,gotoProduct:function(e){window.addEventListener("beforeunload",(function(){n.commit(o+"/modal",null)})),window.addEventListener("pagehide",(function(){n.commit(o+"/modal",null)})),window.location.href=e},auth:s}}},o=["data-code"],n={key:0,class:"column is-12"},a={class:"bundle-title"},r={class:"column name"},c={class:"column is-narrow cart-actions-parent"},l={class:"cart-actions"},s=["disabled"],m=[e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#cart-remove"})],-1)],d={class:"column is-narrow image-parent"},u=["src"],p={key:1},b=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],v={class:"column"},g={class:"columns is-gapless mb-0"},k={class:"column"},f={key:0,class:"code"},E={class:"is-hidden","shop-product-category":""},y={class:"title"},N={key:0,"shop-product-name":""},V={key:0,class:"column is-narrow has-text-right is-relative quantity-parent"},h={class:"quantity"},B=["disabled"],w=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-minus"})],-1)],C=["disabled"],_=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-plus"})],-1)],x={key:0,class:"quantity-price"},L=["innerHTML"],S={class:"column is-2 has-text-right"},q=["innerHTML"],D=["innerHTML"],T=["innerHTML"],H=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),M={class:"wrapper"},$={class:"column is-narrow"},P=["value","id"],z={class:"column"},F=["for"],O={key:0,class:"option-description"},U={class:"column is-2 has-text-right"},j=["innerHTML"],I={key:0,class:"bundle columns"},A=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),G={class:"column is-narrow"},J=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),K=["src"],Q={key:1},R=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],W={class:"column"},X={key:0,class:"code"},Y={class:"title"},Z={key:1,class:"bundle columns"},ee=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),te={class:"column is-narrow"},ie=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),oe=["src"],ne={key:1},ae=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],re={class:"column"},ce={key:0,class:"code"},le={class:"title"};i.render=function(t,i,se,me,de,ue){var pe=e.resolveComponent("wishlist-add");return se.item.deleted?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["columns is-multiline shop-cart-item",{inactive:!1===se.item.attributes.active,"is-bundle":se.item.attributes.bundle}]),"data-code":se.item.attributes.code,"shop-product":""},[se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",a,e.toDisplayString(t.__("shop.cart.bundle")),1)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",r,[e.createElementVNode("div",{class:e.normalizeClass(["columns",{"mb-0":se.item.attributes.bundle}])},[e.createElementVNode("div",c,[e.createElementVNode("div",l,[e.createElementVNode("button",{class:"remove",onClick:i[0]||(i[0]=function(){return me.remove&&me.remove.apply(me,arguments)}),disabled:me.loading},m,8,s),me.auth&&!se.item.attributes.bundle?(e.openBlock(),e.createBlock(pe,{key:0,id:se.item.attributes.productId?se.item.attributes.productId:se.item.id,item:se.item},null,8,["id","item"])):e.createCommentVNode("v-if",!0)])]),e.createElementVNode("div",d,[e.createElementVNode("a",{onClick:i[1]||(i[1]=function(e){return me.gotoProduct(se.item.attributes.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.image}])},[se.item.attributes.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.image},null,8,u)):(e.openBlock(),e.createElementBlock("svg",p,b))],2)])]),e.createElementVNode("div",v,[e.createElementVNode("div",g,[e.createElementVNode("div",k,[e.renderSlot(t.$slots,"item-name",{item:se.item,gotoProduct:me.gotoProduct},(function(){return[se.item.attributes.code?(e.openBlock(),e.createElementBlock("div",f,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",E,e.toDisplayString(se.item.attributes.categoryFull),1),e.createElementVNode("div",y,[!1===se.item.attributes.active?(e.openBlock(),e.createElementBlock("span",N,e.toDisplayString(se.item.name),1)):(e.openBlock(),e.createElementBlock("a",{key:1,onClick:i[2]||(i[2]=function(e){return me.gotoProduct(se.item.attributes.href)})},e.toDisplayString(se.item.name),1))])]}))]),(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",h,[e.createElementVNode("button",{class:"button decrease",onClick:i[3]||(i[3]=function(){return me.decrease&&me.decrease.apply(me,arguments)}),disabled:me.loading||1==se.item.quantity},w,8,B),e.withDirectives(e.createElementVNode("input",{class:"input is-small",type:"number",min:"1","onUpdate:modelValue":i[4]||(i[4]=function(e){return se.item.quantity=e}),disabled:""},null,512),[[e.vModelText,se.item.quantity]]),e.createElementVNode("button",{class:"button increase",onClick:i[5]||(i[5]=function(){return me.increase&&me.increase.apply(me,arguments)}),disabled:me.loading},_,8,C)]),se.item.quantity>1?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("span",{innerHTML:t.$filters.price(se.item.attributes.price)},null,8,L),e.createTextVNode(" / "+e.toDisplayString(t.__("shop.cart.q")),1)])):e.createCommentVNode("v-if",!0)])),e.createElementVNode("div",S,[e.renderSlot(t.$slots,"item-price",{item:se.item,filters:t.$filters},(function(){return[e.createElementVNode("div",{class:e.normalizeClass(["price",{"bundle-price":se.item.attributes.bundle}])},[se.item.attributes.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(se.item.attributes.priceOld*se.item.quantity)},null,8,q)):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.amount?(e.openBlock(),e.createElementBlock("div",{key:1,class:"bundle-amount",innerHTML:t.__("shop.cart.bundle_amount")+(se.item.attributes.amount.percent?se.item.attributes.amount.percent+"%":t.$filters.price(se.item.attributes.amount.sum*se.item.quantity))},null,8,D)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{innerHTML:t.$filters.price(se.item.attributes.price*se.item.quantity),"shop-product-price":""},null,8,T)],2)]}))])]),se.item.options&&se.item.options.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["options",{"is-toggled":me.optionsToggled}])},[e.createElementVNode("div",{class:"toggler",onClick:i[6]||(i[6]=function(e){return me.optionsToggled=!me.optionsToggled})},[e.createElementVNode("span",null,e.toDisplayString(t.__("shop.cart.additional"))+" "+e.toDisplayString(se.item.options.length),1),H]),e.withDirectives(e.createElementVNode("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.item.options,(function(o,n){return e.openBlock(),e.createElementBlock("div",{key:n,class:e.normalizeClass(["columns",{"is-checked":-1!==me.options.indexOf(o.id)}])},[e.createElementVNode("div",$,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"checkbox","onUpdate:modelValue":i[7]||(i[7]=function(e){return me.options=e}),value:o.id,id:"option-"+se.item.id+"-"+o.id},null,8,P),[[e.vModelCheckbox,me.options]])]),e.createElementVNode("div",z,[e.createElementVNode("label",{class:"option-title is-clickable",for:"option-"+se.item.id+"-"+o.id},e.toDisplayString(o.name),9,F),o.description?(e.openBlock(),e.createElementBlock("div",O,e.toDisplayString(o.description),1)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",U,[e.createTextVNode("+"),e.createElementVNode("span",{innerHTML:t.$filters.price(o.price)},null,8,j)])],2)})),128))],512),[[e.vShow,me.optionsToggled]])],2)):e.createCommentVNode("v-if",!0)])],2),se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",I,[A,e.createElementVNode("div",G,[J,e.createElementVNode("a",{onClick:i[8]||(i[8]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.second.image}])},[se.item.attributes.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.second.image},null,8,K)):(e.openBlock(),e.createElementBlock("svg",Q,R))],2)])]),e.createElementVNode("div",W,[se.item.attributes.second.code?(e.openBlock(),e.createElementBlock("div",X,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.second.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Y,[e.createElementVNode("a",{onClick:i[9]||(i[9]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},e.toDisplayString(se.item.attributes.second.name),1)])])])):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.third?(e.openBlock(),e.createElementBlock("div",Z,[ee,e.createElementVNode("div",te,[ie,e.createElementVNode("a",{onClick:i[10]||(i[10]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.third.image}])},[se.item.attributes.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.third.image},null,8,oe)):(e.openBlock(),e.createElementBlock("svg",ne,ae))],2)])]),e.createElementVNode("div",re,[se.item.attributes.third.code?(e.openBlock(),e.createElementBlock("div",ce,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.third.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",le,[e.createElementVNode("a",{onClick:i[11]||(i[11]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},e.toDisplayString(se.item.attributes.third.name),1)])])])):e.createCommentVNode("v-if",!0)])],10,o))},module.exports=i;
1
+ "use strict";var e=require("vue"),t=require("vuex"),i={name:"CartItem",props:{item:Object},setup:function(i){var o=e.inject("cartStorage");o=o||"cart";var n=t.useStore(),a=e.ref(!1),r=e.ref(),c=e.ref(i.item.attributes.options&&i.item.attributes.options.length?i.item.attributes.options:[]),l=e.ref(!1),s=e.computed((function(){return n.getters["auth/is"]}));i.item.attributes.options&&i.item.attributes.options.length&&(l.value=!0);var m=i.item.name,d=i.item.attributes.price,u=i.item.attributes.code,p=i.item.attributes.categoryFull?i.item.attributes.categoryFull:i.item.attributes.category,b=i.item.attributes.brand,v=i.item.attributes.property,g=i.item.attributes.index,k=i.item.attributes.itemListName,f=function(e){a.value=!0,n.dispatch(o+"/add",{cart:o,product:{id:i.item.id,quantity:e},finally:function(){a.value=!1},callback:function(){if(e>0){i.item.quantity;var t={ecommerce:{currency:"UAH",value:parseFloat(d),items:[{item_name:m,item_id:u,price:parseFloat(d),quantity:1}]},event:"add_to_cart"};b&&(t.ecommerce.items[0].item_brand=b),i.item.attributes.index&&(t.ecommerce.items[0].index=i.item.attributes.index),i.item.attributes.itemListName&&(t.ecommerce.items[0].item_list_name=i.item.attributes.itemListName),p&&(-1!==p.indexOf("/")?p.split("/").forEach((function(e,i){t.ecommerce.items[0]["item_category"+(i?i+1:"")]=e.trim()})):t.ecommerce.items[0].item_category=p),v&&(t.ecommerce.items[0].item_variant=v),$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}}})};i.item.options&&i.item.options.length&&e.watch(c,(function(e){a.value=!0,n.dispatch(o+"/options",{product:{id:i.item.id,options:Object.values(e)},finally:function(){a.value=!1}})}));return{loading:a,increase:function(){f(1)},decrease:function(){f(-1)},remove:function(){a.value=!0,n.dispatch(o+"/remove",{id:i.item.id,cart:o,finally:function(){a.value=!1},callback:function(){var e=i.item.quantity,t={ecommerce:{currency:"UAH",value:parseFloat(d)*e,items:[{item_name:m,item_id:u,price:parseFloat(d),quantity:e}]},event:"remove_from_cart"};p&&(-1!==p.indexOf("/")?p.split("/").forEach((function(e,i){t.ecommerce.items[0]["item_category"+(i?i+1:"")]=e.trim()})):t.ecommerce.items[0].item_category=p),g&&(t.ecommerce.items[0].index=g),k&&(t.ecommerce.items[0].item_list_name=k),v&&(t.ecommerce.items[0].item_variant=v),$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}})},options:c,optionsToggled:l,input:r,gotoProduct:function(e){window.addEventListener("beforeunload",(function(){n.commit(o+"/modal",null)})),window.addEventListener("pagehide",(function(){n.commit(o+"/modal",null)})),window.location.href=e},auth:s}}},o=["data-code"],n={key:0,class:"column is-12"},a={class:"bundle-title"},r={class:"column name"},c={class:"column is-narrow cart-actions-parent"},l={class:"cart-actions"},s=["disabled"],m=[e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#cart-remove"})],-1)],d={class:"column is-narrow image-parent"},u=["src"],p={key:1},b=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],v={class:"column"},g={class:"columns is-gapless mb-0"},k={class:"column"},f={key:0,class:"code"},E={class:"is-hidden","shop-product-category":""},y={class:"title"},N={key:0,"shop-product-name":""},V={key:0,class:"column is-narrow has-text-right is-relative quantity-parent"},h={class:"quantity"},B=["disabled"],w=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-minus"})],-1)],C=["disabled"],_=[e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#cart-plus"})],-1)],x={key:0,class:"quantity-price"},L=["innerHTML"],S={class:"column is-2 has-text-right"},q=["innerHTML"],D=["innerHTML"],T=["innerHTML"],H=e.createElementVNode("svg",null,[e.createElementVNode("use",{"xlink:href":"#arrow-down"})],-1),M={class:"wrapper"},$={class:"column is-narrow"},P=["value","id"],z={class:"column"},F=["for"],O={key:0,class:"option-description"},U={class:"column is-2 has-text-right"},j=["innerHTML"],I={key:0,class:"bundle columns"},A=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),G={class:"column is-narrow"},J=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),K=["src"],Q={key:1},R=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],W={class:"column"},X={key:0,class:"code"},Y={class:"title"},Z={key:1,class:"bundle columns"},ee=e.createElementVNode("div",{class:"column is-narrow"},[e.createElementVNode("div",{class:"cart-bundle-spacer"})],-1),te={class:"column is-narrow"},ie=e.createElementVNode("svg",{class:"bundle-icon"},[e.createElementVNode("use",{"xlink:href":"#bundle-plus"})],-1),oe=["src"],ne={key:1},ae=[e.createElementVNode("use",{"xlink:href":"#logo"},null,-1)],re={class:"column"},ce={key:0,class:"code"},le={class:"title"};i.render=function(t,i,se,me,de,ue){var pe=e.resolveComponent("wishlist-add");return se.item.deleted?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["columns is-multiline shop-cart-item",{inactive:!1===se.item.attributes.active,"is-bundle":se.item.attributes.bundle}]),"data-code":se.item.attributes.code,"shop-product":""},[se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",a,e.toDisplayString(t.__("shop.cart.bundle")),1)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",r,[e.createElementVNode("div",{class:e.normalizeClass(["columns",{"mb-0":se.item.attributes.bundle}])},[e.createElementVNode("div",c,[e.createElementVNode("div",l,[e.createElementVNode("button",{class:"remove",onClick:i[0]||(i[0]=function(){return me.remove&&me.remove.apply(me,arguments)}),disabled:me.loading},m,8,s),me.auth&&!se.item.attributes.bundle?(e.openBlock(),e.createBlock(pe,{key:0,id:se.item.attributes.productId?se.item.attributes.productId:se.item.id,item:se.item},null,8,["id","item"])):e.createCommentVNode("v-if",!0)])]),e.createElementVNode("div",d,[e.createElementVNode("a",{onClick:i[1]||(i[1]=function(e){return me.gotoProduct(se.item.attributes.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.image}])},[se.item.attributes.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.image},null,8,u)):(e.openBlock(),e.createElementBlock("svg",p,b))],2)])]),e.createElementVNode("div",v,[e.createElementVNode("div",g,[e.createElementVNode("div",k,[e.renderSlot(t.$slots,"item-name",{item:se.item,gotoProduct:me.gotoProduct},(function(){return[se.item.attributes.code?(e.openBlock(),e.createElementBlock("div",f,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",E,e.toDisplayString(se.item.attributes.categoryFull),1),e.createElementVNode("div",y,[!1===se.item.attributes.active?(e.openBlock(),e.createElementBlock("span",N,e.toDisplayString(se.item.name),1)):(e.openBlock(),e.createElementBlock("a",{key:1,onClick:i[2]||(i[2]=function(e){return me.gotoProduct(se.item.attributes.href)})},e.toDisplayString(se.item.name),1))])]}))]),(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",h,[e.createElementVNode("button",{class:"button decrease",onClick:i[3]||(i[3]=function(){return me.decrease&&me.decrease.apply(me,arguments)}),disabled:me.loading||1==se.item.quantity},w,8,B),e.withDirectives(e.createElementVNode("input",{class:"input is-small",type:"number",min:"1","onUpdate:modelValue":i[4]||(i[4]=function(e){return se.item.quantity=e}),disabled:""},null,512),[[e.vModelText,se.item.quantity]]),e.createElementVNode("button",{class:"button increase",onClick:i[5]||(i[5]=function(){return me.increase&&me.increase.apply(me,arguments)}),disabled:me.loading},_,8,C)]),se.item.quantity>1?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("span",{innerHTML:t.$filters.price(se.item.attributes.price)},null,8,L),e.createTextVNode(" / "+e.toDisplayString(t.__("shop.cart.q")),1)])):e.createCommentVNode("v-if",!0)])),e.createElementVNode("div",S,[e.renderSlot(t.$slots,"item-price",{item:se.item,filters:t.$filters},(function(){return[e.createElementVNode("div",{class:e.normalizeClass(["price",{"bundle-price":se.item.attributes.bundle}])},[se.item.attributes.priceOld?(e.openBlock(),e.createElementBlock("div",{key:0,class:"price-old",innerHTML:t.$filters.price(se.item.attributes.priceOld*se.item.quantity)},null,8,q)):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.amount?(e.openBlock(),e.createElementBlock("div",{key:1,class:"bundle-amount",innerHTML:t.__("shop.cart.bundle_amount")+(se.item.attributes.amount.percent?se.item.attributes.amount.percent+"%":t.$filters.price(se.item.attributes.amount.sum*se.item.quantity))},null,8,D)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{innerHTML:t.$filters.price(se.item.attributes.price*se.item.quantity),"shop-product-price":""},null,8,T)],2)]}))])]),se.item.options&&se.item.options.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["options",{"is-toggled":me.optionsToggled}])},[e.createElementVNode("div",{class:"toggler",onClick:i[6]||(i[6]=function(e){return me.optionsToggled=!me.optionsToggled})},[e.createElementVNode("span",null,e.toDisplayString(t.__("shop.cart.additional"))+" "+e.toDisplayString(se.item.options.length),1),H]),e.withDirectives(e.createElementVNode("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.item.options,(function(o,n){return e.openBlock(),e.createElementBlock("div",{key:n,class:e.normalizeClass(["columns",{"is-checked":-1!==me.options.indexOf(o.id)}])},[e.createElementVNode("div",$,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"checkbox","onUpdate:modelValue":i[7]||(i[7]=function(e){return me.options=e}),value:o.id,id:"option-"+se.item.id+"-"+o.id},null,8,P),[[e.vModelCheckbox,me.options]])]),e.createElementVNode("div",z,[e.createElementVNode("label",{class:"option-title is-clickable",for:"option-"+se.item.id+"-"+o.id},e.toDisplayString(o.name),9,F),o.description?(e.openBlock(),e.createElementBlock("div",O,e.toDisplayString(o.description),1)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",U,[e.createTextVNode("+"),e.createElementVNode("span",{innerHTML:t.$filters.price(o.price)},null,8,j)])],2)})),128))],512),[[e.vShow,me.optionsToggled]])],2)):e.createCommentVNode("v-if",!0)])],2),se.item.attributes.bundle?(e.openBlock(),e.createElementBlock("div",I,[A,e.createElementVNode("div",G,[J,e.createElementVNode("a",{onClick:i[8]||(i[8]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.second.image}])},[se.item.attributes.second.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.second.image},null,8,K)):(e.openBlock(),e.createElementBlock("svg",Q,R))],2)])]),e.createElementVNode("div",W,[se.item.attributes.second.code?(e.openBlock(),e.createElementBlock("div",X,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.second.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Y,[e.createElementVNode("a",{onClick:i[9]||(i[9]=function(e){return me.gotoProduct(se.item.attributes.second.href)})},e.toDisplayString(se.item.attributes.second.name),1)])])])):e.createCommentVNode("v-if",!0),se.item.attributes.bundle&&se.item.attributes.third?(e.openBlock(),e.createElementBlock("div",Z,[ee,e.createElementVNode("div",te,[ie,e.createElementVNode("a",{onClick:i[10]||(i[10]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},[e.createElementVNode("figure",{class:e.normalizeClass(["image is-square",{"no-thumb":!se.item.attributes.third.image}])},[se.item.attributes.third.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:se.item.attributes.third.image},null,8,oe)):(e.openBlock(),e.createElementBlock("svg",ne,ae))],2)])]),e.createElementVNode("div",re,[se.item.attributes.third.code?(e.openBlock(),e.createElementBlock("div",ce,e.toDisplayString(t.__("shop.cart.code"))+" "+e.toDisplayString(se.item.attributes.third.code),1)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",le,[e.createElementVNode("a",{onClick:i[11]||(i[11]=function(e){return me.gotoProduct(se.item.attributes.third.href)})},e.toDisplayString(se.item.attributes.third.name),1)])])])):e.createCommentVNode("v-if",!0)])],10,o))},module.exports=i;
2
2
  //# sourceMappingURL=CartItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CartItem.js","sources":["../../../../src/components/shop/cart/CartItem.vue","../../../../src/components/shop/cart/CartItem.vue?vue&type=template&id=532fea16&lang.js"],"sourcesContent":["<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\" :data-code=\"item.attributes.code\" shop-product>\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.attributes.productId ? item.attributes.productId : item.id\" :item=\"item\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"is-hidden\" shop-product-category>{{ item.attributes.categoryFull }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\" shop-product-name>\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\" shop-product-price></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, inject } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n const cartStorage = inject('cartStorage');\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n const index = props.item.attributes.index;\n const itemListName = props.item.attributes.itemListName;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/remove', {\n id: props.item.id,\n cart: cartStorage,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\n };\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (index) {\n object.ecommerce.items[0].index = index;\n }\n\n if (itemListName) {\n object.ecommerce.items[0].item_list_name = itemListName;\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/add', {\n cart: cartStorage,\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n if (difference > 0) {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: 1,\n }\n ]\n },\n event: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n }\n });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>","<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\" :data-code=\"item.attributes.code\" shop-product>\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.attributes.productId ? item.attributes.productId : item.id\" :item=\"item\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"is-hidden\" shop-product-category>{{ item.attributes.categoryFull }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\" shop-product-name>\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\" shop-product-price></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, inject } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n const cartStorage = inject('cartStorage');\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n const index = props.item.attributes.index;\n const itemListName = props.item.attributes.itemListName;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/remove', {\n id: props.item.id,\n cart: cartStorage,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\n };\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (index) {\n object.ecommerce.items[0].index = index;\n }\n\n if (itemListName) {\n object.ecommerce.items[0].item_list_name = itemListName;\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/add', {\n cart: cartStorage,\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n if (difference > 0) {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: 1,\n }\n ]\n },\n event: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n }\n });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>"],"names":["name","props","item","Object","setup","cartStorage","inject","store","useStore","loading","ref","input","options","attributes","length","optionsToggled","auth","computed","getters","value","price","code","category","categoryFull","brand","property","index","itemListName","quantity","difference","dispatch","cart","product","id","callback","object","ecommerce","currency","parseFloat","items","item_name","item_id","event","item_brand","item_list_name","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","watch","values","increase","decrease","remove","q","gotoProduct","href","addEventListener","commit","location","_createElementVNode","$props","deleted","_createElementBlock","active","bundle","_hoisted_2","_hoisted_3","_ctx","_hoisted_4","_hoisted_5","_hoisted_6","onClick","$setup","disabled","_createBlock","productId","_hoisted_10","image","src","_hoisted_15","_hoisted_16","_hoisted_17","_renderSlot","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","type","min","_hoisted_30","innerHTML","_hoisted_33","filters","priceOld","amount","percent","sum","_hoisted_37","_hoisted_38","option","key","_hoisted_39","_hoisted_41","description","_hoisted_43","_hoisted_44","_hoisted_46","_hoisted_47","_hoisted_48","_hoisted_49","second","_hoisted_54","_hoisted_55","_hoisted_56","third","_hoisted_57","_hoisted_58","_hoisted_59","_hoisted_60","_hoisted_65","_hoisted_66","_hoisted_67"],"mappings":"sDAiJe,CACXA,KAAM,WACNC,MAAO,CACHC,KAAMC,QAEVC,eAAMH,OACII,EAAcC,SAAO,eACrBC,EAAQC,aACRC,EAAUC,OAAI,GACdC,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artItem.vue?vue&type=template&id=30ed1a56&lang.js"],"sourcesContent":["<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\" :data-code=\"item.attributes.code\" shop-product>\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.attributes.productId ? item.attributes.productId : item.id\" :item=\"item\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"is-hidden\" shop-product-category>{{ item.attributes.categoryFull }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\" shop-product-name>\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\" shop-product-price></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, inject } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n let cartStorage = inject('cartStorage');\n cartStorage = cartStorage ? cartStorage : 'cart';\n\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n const index = props.item.attributes.index;\n const itemListName = props.item.attributes.itemListName;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/remove', {\n id: props.item.id,\n cart: cartStorage,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\n };\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (index) {\n object.ecommerce.items[0].index = index;\n }\n\n if (itemListName) {\n object.ecommerce.items[0].item_list_name = itemListName;\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/add', {\n cart: cartStorage,\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n if (difference > 0) {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: 1,\n }\n ]\n },\n event: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n }\n });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>","<template>\n <div class=\"columns is-multiline shop-cart-item\" v-if=\"!item.deleted\" v-bind:class=\"{ inactive: item.attributes.active === false, 'is-bundle': item.attributes.bundle }\" :data-code=\"item.attributes.code\" shop-product>\n <div class=\"column is-12\" v-if=\"item.attributes.bundle\">\n <div class=\"bundle-title\">{{ __('shop.cart.bundle') }}</div>\n </div>\n <div class=\"column name\">\n <div class=\"columns\" v-bind:class=\"{ 'mb-0': item.attributes.bundle }\">\n <div class=\"column is-narrow cart-actions-parent\">\n <div class=\"cart-actions\">\n <button class=\"remove\" @click=\"remove\" :disabled=\"loading\">\n <svg class=\"icon\">\n <use xlink:href=\"#cart-remove\" />\n </svg>\n </button>\n <wishlist-add :id=\"item.attributes.productId ? item.attributes.productId : item.id\" :item=\"item\" v-if=\"auth && !item.attributes.bundle\"></wishlist-add>\n </div>\n </div>\n <div class=\"column is-narrow image-parent\">\n <a @click=\"gotoProduct(item.attributes.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.image }\">\n <img :src=\"item.attributes.image\" v-if=\"item.attributes.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"columns is-gapless mb-0\">\n <div class=\"column\">\n <slot name=\"item-name\" :item=\"item\" :gotoProduct=\"gotoProduct\">\n <div class=\"code\" v-if=\"item.attributes.code\">{{ __('shop.cart.code') }} {{ item.attributes.code }}</div>\n <div class=\"is-hidden\" shop-product-category>{{ item.attributes.categoryFull }}</div>\n <div class=\"title\">\n <span v-if=\"item.attributes.active === false\" shop-product-name>\n {{ item.name }}\n </span>\n <a @click=\"gotoProduct(item.attributes.href)\" v-else>{{ item.name }}</a>\n </div>\n </slot>\n </div>\n <div class=\"column is-narrow has-text-right is-relative quantity-parent\" v-if=\"true || $env.shop.isChangeQuantity\">\n <div class=\"quantity\">\n <button class=\"button decrease\" @click=\"decrease\" :disabled=\"loading || item.quantity == 1\">\n <svg>\n <use xlink:href=\"#cart-minus\" />\n </svg>\n </button>\n <input class=\"input is-small\" type=\"number\" min=\"1\" v-model=\"item.quantity\" disabled />\n <button class=\"button increase\" @click=\"increase\" :disabled=\"loading\">\n <svg>\n <use xlink:href=\"#cart-plus\" />\n </svg>\n </button>\n </div>\n <div class=\"quantity-price\" v-if=\"item.quantity > 1\"><span v-html=\"$filters.price(item.attributes.price)\"></span> / {{ __('shop.cart.q') }}</div>\n </div>\n <div class=\"column is-narrow has-text-right\" v-else>{{ item.quantity }}✕</div>\n <div class=\"column is-2 has-text-right\">\n <slot name=\"item-price\" :item=\"item\" :filters=\"$filters\">\n <div class=\"price\" v-bind:class=\"{ 'bundle-price': item.attributes.bundle }\">\n <div v-if=\"item.attributes.priceOld\" class=\"price-old\" v-html=\"$filters.price(item.attributes.priceOld * item.quantity)\"></div>\n <div class=\"bundle-amount\" v-if=\"item.attributes.bundle && item.attributes.amount\" v-html=\"__('shop.cart.bundle_amount') + (item.attributes.amount.percent ? item.attributes.amount.percent + '%' : $filters.price(item.attributes.amount.sum * item.quantity))\"></div>\n <div v-html=\"$filters.price(item.attributes.price * item.quantity)\" shop-product-price></div>\n </div>\n </slot>\n </div>\n </div>\n <div class=\"options\" v-if=\"item.options && item.options.length\" v-bind:class=\"{ 'is-toggled': optionsToggled }\">\n <div class=\"toggler\" @click=\"optionsToggled = !optionsToggled\">\n <span>{{ __('shop.cart.additional') }} {{ item.options.length }}</span>\n <svg>\n <use xlink:href=\"#arrow-down\" />\n </svg>\n </div>\n <div class=\"wrapper\" v-show=\"optionsToggled\">\n <div v-for=\"(option, index) in item.options\" v-bind:key=\"index\" class=\"columns\" v-bind:class=\"{ 'is-checked': options.indexOf(option.id) !== -1 }\">\n <div class=\"column is-narrow\">\n <input type=\"checkbox\" class=\"checkbox\" v-model=\"options\" :value=\"option.id\" :id=\"'option-' + item.id + '-' + option.id\" />\n </div>\n <div class=\"column\">\n <label class=\"option-title is-clickable\" :for=\"'option-' + item.id + '-' + option.id\">{{ option.name }}</label>\n <div class=\"option-description\" v-if=\"option.description\">{{ option.description }}</div>\n </div>\n <div class=\"column is-2 has-text-right\">+<span v-html=\"$filters.price(option.price)\"></span></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.second.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.second.image }\">\n <img :src=\"item.attributes.second.image\" v-if=\"item.attributes.second.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.second.code\">{{ __('shop.cart.code') }} {{ item.attributes.second.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.second.href)\">{{ item.attributes.second.name }}</a>\n </div>\n </div>\n </div>\n <div class=\"bundle columns\" v-if=\"item.attributes.bundle && item.attributes.third\">\n <div class=\"column is-narrow\">\n <div class=\"cart-bundle-spacer\"></div>\n </div>\n <div class=\"column is-narrow\">\n <svg class=\"bundle-icon\">\n <use xlink:href=\"#bundle-plus\" />\n </svg>\n <a @click=\"gotoProduct(item.attributes.third.href)\">\n <figure class=\"image is-square\" v-bind:class=\"{ 'no-thumb': !item.attributes.third.image }\">\n <img :src=\"item.attributes.third.image\" v-if=\"item.attributes.third.image\" />\n <svg v-else>\n <use xlink:href=\"#logo\" />\n </svg>\n </figure>\n </a>\n </div>\n <div class=\"column\">\n <div class=\"code\" v-if=\"item.attributes.third.code\">{{ __('shop.cart.code') }} {{ item.attributes.third.code }}</div>\n <div class=\"title\">\n <a @click=\"gotoProduct(item.attributes.third.href)\">{{ item.attributes.third.name }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, computed, watch, inject } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'CartItem',\n props: {\n item: Object\n },\n setup(props) {\n let cartStorage = inject('cartStorage');\n cartStorage = cartStorage ? cartStorage : 'cart';\n\n const store = useStore();\n const loading = ref(false);\n const input = ref();\n const options = ref(props.item.attributes.options && props.item.attributes.options.length ? props.item.attributes.options : []);\n const optionsToggled = ref(false);\n const auth = computed(() => store.getters['auth/is']);\n\n if (props.item.attributes.options && props.item.attributes.options.length) {\n optionsToggled.value = true;\n }\n\n const name = props.item.name;\n const price = props.item.attributes.price;\n const code = props.item.attributes.code;\n const category = props.item.attributes.categoryFull ? props.item.attributes.categoryFull : props.item.attributes.category;\n const brand = props.item.attributes.brand;\n const property = props.item.attributes.property;\n const index = props.item.attributes.index;\n const itemListName = props.item.attributes.itemListName;\n\n const remove = () => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/remove', {\n id: props.item.id,\n cart: cartStorage,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price) * q,\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: q,\n }\n ]\n },\n event: 'remove_from_cart'\n };\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (index) {\n object.ecommerce.items[0].index = index;\n }\n\n if (itemListName) {\n object.ecommerce.items[0].item_list_name = itemListName;\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n });\n };\n\n const increase = () => {\n quantity(+1);\n };\n\n const decrease = () => {\n quantity(-1);\n };\n\n const quantity = (difference) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/add', {\n cart: cartStorage,\n product: {\n id: props.item.id,\n quantity: difference\n },\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n if (difference > 0) {\n const q = props.item.quantity;\n\n const object = {\n ecommerce: {\n currency: 'UAH',\n value: parseFloat(price),\n items: [\n {\n item_name: name,\n item_id: code,\n price: parseFloat(price),\n quantity: 1,\n }\n ]\n },\n event: 'add_to_cart'\n };\n\n if (brand) {\n object.ecommerce.items[0].item_brand = brand;\n }\n\n if (props.item.attributes.index) {\n object.ecommerce.items[0].index = props.item.attributes.index;\n }\n\n if (props.item.attributes.itemListName) {\n object.ecommerce.items[0].item_list_name = props.item.attributes.itemListName;\n }\n\n if (category) {\n if (category.indexOf('/') !== -1) {\n category.split('/').forEach((segment, index) => {\n object.ecommerce.items[0]['item_category' + (index ? index + 1 : '')] = segment.trim();\n });\n } else {\n object.ecommerce.items[0].item_category = category;\n }\n }\n\n if (property) {\n object.ecommerce.items[0].item_variant = property;\n }\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n }\n });\n };\n\n if (props.item.options && props.item.options.length) {\n watch(options, (options) => {\n loading.value = true;\n\n store.dispatch(cartStorage + '/options', {\n product: {\n id: props.item.id,\n options: Object.values(options)\n },\n finally: () => {\n loading.value = false;\n }\n });\n });\n }\n\n const gotoProduct = (href) => {\n window.addEventListener('beforeunload', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.addEventListener('pagehide', () => {\n store.commit(cartStorage + '/modal', null);\n });\n\n window.location.href = href;\n };\n\n return {\n loading,\n increase,\n decrease,\n remove,\n options,\n optionsToggled,\n input,\n gotoProduct,\n auth\n };\n }\n};\n</script>"],"names":["name","props","item","Object","setup","cartStorage","inject","store","useStore","loading","ref","input","options","attributes","length","optionsToggled","auth","computed","getters","value","price","code","category","categoryFull","brand","property","index","itemListName","quantity","difference","dispatch","cart","product","id","callback","object","ecommerce","currency","parseFloat","items","item_name","item_id","event","item_brand","item_list_name","indexOf","split","forEach","segment","trim","item_category","item_variant","$env","debug","console","log","window","dataLayer","push","watch","values","increase","decrease","remove","q","gotoProduct","href","addEventListener","commit","location","_createElementVNode","$props","deleted","_createElementBlock","active","bundle","_hoisted_2","_hoisted_3","_ctx","_hoisted_4","_hoisted_5","_hoisted_6","onClick","$setup","disabled","_createBlock","productId","_hoisted_10","image","src","_hoisted_15","_hoisted_16","_hoisted_17","_renderSlot","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","type","min","_hoisted_30","innerHTML","_hoisted_33","filters","priceOld","amount","percent","sum","_hoisted_37","_hoisted_38","option","key","_hoisted_39","_hoisted_41","description","_hoisted_43","_hoisted_44","_hoisted_46","_hoisted_47","_hoisted_48","_hoisted_49","second","_hoisted_54","_hoisted_55","_hoisted_56","third","_hoisted_57","_hoisted_58","_hoisted_59","_hoisted_60","_hoisted_65","_hoisted_66","_hoisted_67"],"mappings":"sDAiJe,CACXA,KAAM,WACNC,MAAO,CACHC,KAAMC,QAEVC,eAAMH,OACEI,EAAcC,SAAO,eACzBD,EAAcA,GAA4B,WAEpCE,EAAQC,aACRC,EAAUC,OAAI,GACdC,EAAQD,QACRE,EAAUF,MAAIT,EAAMC,KAAKW,WAAWD,SAAWX,EAAMC,KAAKW,WAAWD,QAAQE,OAASb,EAAMC,KAAKW,WAAWD,QAAU,IACtHG,EAAiBL,OAAI,GACrBM,EAAOC,YAAS,kBAAMV,EAAMW,QAAQ,cAEtCjB,EAAMC,KAAKW,WAAWD,SAAWX,EAAMC,KAAKW,WAAWD,QAAQE,SAC/DC,EAAeI,OAAQ,OAGrBnB,EAAOC,EAAMC,KAAKF,KAClBoB,EAAQnB,EAAMC,KAAKW,WAAWO,MAC9BC,EAAOpB,EAAMC,KAAKW,WAAWQ,KAC7BC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CAMZH,2BAAAsD,GAC4BrD,QAAK1D,WAAW8G,OAAOtG,oBAA/CoD,2BAAAoD,oBAAwD/C,8CAA2BP,QAAK1D,WAAW8G,OAAOtG,0CAC1GiD,2BAAAwD,GACIxD,0BAAIY,uCAAOC,eAAYZ,QAAK1D,WAAW8G,OAAOzD,2BAAUK,QAAK1D,WAAW8G,OAAO3H,gDAIzDuE,QAAK1D,WAAW8D,QAAUJ,QAAK1D,WAAWkH,qBAA5EtD,2BAAAuD,GACIC,GAGA3D,2BAAA4D,IACIC,GAGA7D,0BAAIY,yCAAOC,eAAYZ,QAAK1D,WAAWkH,MAAM7D,UACzCI,uDAAc,+BAA+CC,QAAK1D,WAAWkH,MAAMvC,WACjCjB,QAAK1D,WAAWkH,MAAMvC,qBAApEf,kCAAMgB,IAAKlB,QAAK1D,WAAWkH,MAAMvC,kCACjCf,2CAMZH,2BAAA8D,IAC4B7D,QAAK1D,WAAWkH,MAAM1G,oBAA9CoD,2BAAA4D,qBAAuDvD,8CAA2BP,QAAK1D,WAAWkH,MAAM1G,0CACxGiD,2BAAAgE,IACIhE,0BAAIY,yCAAOC,eAAYZ,QAAK1D,WAAWkH,MAAM7D,2BAAUK,QAAK1D,WAAWkH,MAAM/H"}
package/dist/helpers.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("vue"),e=require("yup"),t=require("@perevorot/shop/dist/forms/FormCheckbox"),o=require("@perevorot/shop/dist/forms/FormCheckboxes"),n=require("@perevorot/shop/dist/forms/FormPassword"),i=require("@perevorot/shop/dist/forms/FormRadio"),a=require("@perevorot/shop/dist/forms/FormRating"),u=require("@perevorot/shop/dist/forms/FormSection"),l=require("@perevorot/shop/dist/forms/FormSelect"),s=require("@perevorot/shop/dist/forms/FormSwitch"),c=require("@perevorot/shop/dist/forms/FormText"),f=require("@perevorot/shop/dist/forms/FormTextarea");function d(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}function m(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:function(){return r[t]}})}})),e.default=r,Object.freeze(e)}var p=m(e),h=d(t),v=d(o),b=d(n),y=d(i),F=d(a),g=d(u),S=d(l),w=d(s),q=d(c),x=d(f);function j(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null==t)return;var o,n,i=[],a=!0,u=!1;try{for(t=t.call(r);!(a=(o=t.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(r){u=!0,n=r}finally{try{a||null==t.return||t.return()}finally{if(u)throw n}}return i}(r,e)||k(r,e)||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.")}()}function O(r){return function(r){if(Array.isArray(r))return A(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||k(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(r,e){if(r){if("string"==typeof r)return A(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A(r,e):void 0}}function A(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,o=new Array(e);t<e;t++)o[t]=r[t];return o}p.addMethod(p.string,"minOrEmpty",(function(r,e){return this.test({name:"minOrEmpty",exclusive:!0,message:e,params:{min:r},test:function(e){return""==e||e.length>=r}})})),p.addMethod(p.string,"numberFilled",(function(r,e){return this.test({name:"numberFilled",exclusive:!0,message:__("auth.validation.number"),params:{min:r},test:function(r){return!(""==r||isNaN(r))}})}));var _={pluralize:function(r,e){var t=Number(String(r).replace(/\D/g,""));return r+" "+e[t%100>4&&t%100<20?2:[2,0,1,1,1,2][Math.min(t%10,5)]]},formParse:function(e){var t={FormCheckbox:h.default,FormCheckboxes:v.default,FormPassword:b.default,FormRadio:y.default,FormRating:F.default,FormSection:g.default,FormSelect:S.default,FormSwitch:w.default,FormText:q.default,FormTextarea:x.default},o={},n={},i={};if(e.form)for(var a=function(){var e=j(l[u],2),a=e[0],s=e[1];if("_"!=a.charAt(0)){var c;switch(s.component){case"FormCheckbox":case"FormSwitch":c=!1;break;case"FormCheckboxes":c=[];break;default:c=""}o[a]=c}var f=t[s.component];f&&r.markRaw(f);var d={component:f||s.component,label:s.label,validations:{}};if(s.validation){var m=p;s.validation.forEach((function(r){var e=[],t=r;if(t.split(":").length>1){var o=r.split(":");t=o.shift(),e=JSON.parse(o)}("required"==t&&(d.validations.required=!0),"phone"==t&&d.validations.required)&&(t="matches",e=[s.pattern?new RegExp(s.pattern):/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,__("auth.validation.phone")]);"array"!=t&&e.push(__("auth.validation."+t));try{var n;m=(n=m)[t].apply(n,O(e))}catch(r){}})),i[a]=m}s.condition&&(d.condition=function(r){return r[s.condition[0]]===s.condition[1]},i[a]=p.string().when(s.condition[0],{is:s.condition[1],then:i[a]})),["mask","placeholder","description","type","list","model","store","default","hidden"].forEach((function(r){s[r]&&(d[r]=s[r])})),n[a]=d},u=0,l=Object.entries(e.form);u<l.length;u++)a();return{schema:n,model:o,validation:p.object().shape(i)}},nl2p:function(r){return null==r?"":"<p>"+(r+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1</p><p>$2")+"</p>"},numberFormat:function(r){return r?r.toString().replace(/\B(?=(\d{3})+(?!\d))/g," "):"0"}};module.exports=_;
1
+ "use strict";var r=require("vue"),e=require("yup"),t=require("@perevorot/shop/dist/forms/FormCheckbox"),o=require("@perevorot/shop/dist/forms/FormCheckboxes"),n=require("@perevorot/shop/dist/forms/FormPassword"),a=require("@perevorot/shop/dist/forms/FormRadio"),i=require("@perevorot/shop/dist/forms/FormRating"),u=require("@perevorot/shop/dist/forms/FormSection"),l=require("@perevorot/shop/dist/forms/FormSelect"),s=require("@perevorot/shop/dist/forms/FormSwitch"),c=require("@perevorot/shop/dist/forms/FormText"),d=require("@perevorot/shop/dist/forms/FormTextarea");function f(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}function m(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:function(){return r[t]}})}})),e.default=r,Object.freeze(e)}var p=m(e),h=f(t),v=f(o),b=f(n),y=f(a),F=f(i),g=f(u),S=f(l),w=f(s),q=f(c),x=f(d);function O(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null==t)return;var o,n,a=[],i=!0,u=!1;try{for(t=t.call(r);!(i=(o=t.next()).done)&&(a.push(o.value),!e||a.length!==e);i=!0);}catch(r){u=!0,n=r}finally{try{i||null==t.return||t.return()}finally{if(u)throw n}}return a}(r,e)||k(r,e)||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.")}()}function j(r){return function(r){if(Array.isArray(r))return _(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||k(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(r,e){if(r){if("string"==typeof r)return _(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_(r,e):void 0}}function _(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,o=new Array(e);t<e;t++)o[t]=r[t];return o}p.addMethod(p.string,"minOrEmpty",(function(r,e){return this.test({name:"minOrEmpty",exclusive:!0,message:e,params:{min:r},test:function(e){return""==e||e.length>=r}})})),p.addMethod(p.string,"numberFilled",(function(r,e){return this.test({name:"numberFilled",exclusive:!0,message:__("auth.validation.number"),params:{min:r},test:function(r){return!(""==r||isNaN(r))}})}));var A={pluralize:function(r,e){var t=Number(String(r).replace(/\D/g,""));return r+" "+e[t%100>4&&t%100<20?2:[2,0,1,1,1,2][Math.min(t%10,5)]]},formParse:function(e){var t={FormCheckbox:h.default,FormCheckboxes:v.default,FormPassword:b.default,FormRadio:y.default,FormRating:F.default,FormSection:g.default,FormSelect:S.default,FormSwitch:w.default,FormText:q.default,FormTextarea:x.default},o={},n={},a={};if(e.form)for(var i=function(){var e=O(l[u],2),i=e[0],s=e[1];if("_"!=i.charAt(0)){var c;switch(s.component){case"FormCheckbox":case"FormSwitch":c=!1;break;case"FormCheckboxes":c=[];break;default:c=""}o[i]=c}var d=t[s.component];d&&r.markRaw(d);var f={component:d||s.component,label:s.label,validations:{}};if(s.validation){var m=p;s.validation.forEach((function(r){var e=[],t=r;if(t.split(":").length>1){var o=r.split(":");t=o.shift(),e=JSON.parse(o)}("required"==t&&(f.validations.required=!0),"phone"==t&&f.validations.required)&&(t="matches",e=[s.pattern?new RegExp(s.pattern):/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,__("auth.validation.phone")]);"array"!=t&&e.push(__("auth.validation."+t));try{var n;if("booleanTrue"==t)m=p.boolean.apply(p,j(e)).oneOf([!0],s.validationLabel?s.validationLabel:__("auth.validation.boolean"));else m=(n=m)[t].apply(n,j(e))}catch(r){}})),a[i]=m}s.condition&&(f.condition=function(r){return r[s.condition[0]]===s.condition[1]},a[i]=p.string().when(s.condition[0],{is:s.condition[1],then:a[i]})),["mask","placeholder","description","type","list","model","store","default","hidden"].forEach((function(r){s[r]&&(f[r]=s[r])})),n[i]=f},u=0,l=Object.entries(e.form);u<l.length;u++)i();return{schema:n,model:o,validation:p.object().shape(a)}},nl2p:function(r){return null==r?"":"<p>"+(r+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1</p><p>$2")+"</p>"},numberFormat:function(r){return r?r.toString().replace(/\B(?=(\d{3})+(?!\d))/g," "):"0"}};module.exports=A;
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../src/helpers/modules/formParse.js","../src/helpers/index.js","../src/helpers/modules/pluralize.js","../src/helpers/modules/nl2p.js","../src/helpers/modules/numberFormat.js"],"sourcesContent":["import { markRaw } from 'vue';\nimport * as yup from 'yup';\n\nimport FormCheckbox from '@perevorot/shop/dist/forms/FormCheckbox';\nimport FormCheckboxes from '@perevorot/shop/dist/forms/FormCheckboxes';\nimport FormPassword from '@perevorot/shop/dist/forms/FormPassword';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport FormRating from '@perevorot/shop/dist/forms/FormRating';\nimport FormSection from '@perevorot/shop/dist/forms/FormSection';\nimport FormSelect from '@perevorot/shop/dist/forms/FormSelect';\nimport FormSwitch from '@perevorot/shop/dist/forms/FormSwitch';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormTextarea from '@perevorot/shop/dist/forms/FormTextarea';\n\nyup.addMethod(yup.string, 'minOrEmpty', function (min, msg) {\n return this.test({\n name: 'minOrEmpty',\n exclusive: true,\n message: msg,\n params: {\n min: min,\n },\n test: (value) => value == '' || value.length >= min,\n });\n});\n\nyup.addMethod(yup.string, 'numberFilled', function (min, msg) {\n return this.test({\n name: 'numberFilled',\n exclusive: true,\n message: __('auth.validation.number'),\n params: {\n min: min,\n },\n test: (value) => !(value == '' || isNaN(value)),\n });\n});\n\nexport default function formParse(json) {\n let components = {\n FormCheckbox: FormCheckbox,\n FormCheckboxes: FormCheckboxes,\n FormPassword: FormPassword,\n FormRadio: FormRadio,\n FormRating: FormRating,\n FormSection: FormSection,\n FormSelect: FormSelect,\n FormSwitch: FormSwitch,\n FormText: FormText,\n FormTextarea: FormTextarea,\n };\n\n let model = {};\n let schema = {};\n let validation = {};\n\n if (json.form) {\n for (const [field, element] of Object.entries(json.form)) {\n if (field.charAt(0) != '_') {\n let value;\n\n switch (element.component) {\n case 'FormCheckbox':\n case 'FormSwitch':\n value = false;\n break;\n\n case 'FormCheckboxes':\n value = [];\n break;\n default:\n value = '';\n }\n\n model[field] = value;\n }\n\n const component = components[element.component];\n\n if (component) {\n markRaw(component);\n }\n\n let s = {\n component: component ? component : element.component,\n label: element.label,\n validations: {},\n };\n\n if (element.validation) {\n let v = yup;\n\n const validations = element.validation;\n\n validations.forEach((rule) => {\n let attributes = [];\n let method = rule;\n\n if (method.split(':').length > 1) {\n let ruleWithAttributes = rule.split(':');\n method = ruleWithAttributes.shift();\n\n attributes = JSON.parse(ruleWithAttributes);\n }\n\n if (method == 'required') {\n s.validations.required = true;\n }\n\n if (method == 'phone' && s.validations.required) {\n const phoneRegExp = element.pattern ? new RegExp(element.pattern) : /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n method = 'matches';\n\n attributes = [phoneRegExp, __('auth.validation.phone')];\n }\n\n if (method != 'array') {\n attributes.push(__('auth.validation.' + method));\n }\n\n try {\n v = v[method](...attributes);\n } catch (error) {}\n });\n\n validation[field] = v;\n }\n\n if (element.condition) {\n s.condition = (model) => model[element.condition[0]] === element.condition[1];\n\n validation[field] = yup.string().when(element.condition[0], {\n is: element.condition[1],\n then: validation[field],\n });\n }\n\n ['mask', 'placeholder', 'description', 'type', 'list', 'model', 'store', 'default', 'hidden'].forEach((f) => {\n if (element[f]) {\n s[f] = element[f];\n }\n });\n\n schema[field] = s;\n }\n }\n\n return {\n schema: schema,\n model: model,\n validation: yup.object().shape(validation),\n };\n}\n","import pluralize from './modules/pluralize';\nimport formParse from './modules/formParse';\nimport nl2p from './modules/nl2p';\nimport numberFormat from './modules/numberFormat';\n\nexport default {\n pluralize,\n formParse,\n nl2p,\n numberFormat,\n};\n","export default function pluralize(count, words) {\n let cases = [2, 0, 1, 1, 1, 2];\n\n const countClear = Number(String(count).replace(/\\D/g, ''));\n\n return count + ' ' + words[countClear % 100 > 4 && countClear % 100 < 20 ? 2 : cases[Math.min(countClear % 10, 5)]];\n}\n","export default function nl2p(str) {\n if (typeof str === 'undefined' || str === null) {\n return '';\n }\n\n return '<p>' + (str + '').replace(/([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g, '$1' + '</p><p>' + '$2') + '</p>';\n}\n","export default function numberFormat(value) {\n return value ? value.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ' ') : '0';\n}\n"],"names":["yup","addMethod","string","min","msg","this","test","name","exclusive","message","params","value","length","__","isNaN","pluralize","count","words","countClear","Number","String","replace","Math","formParse","json","components","FormCheckbox","FormCheckboxes","FormPassword","FormRadio","FormRating","FormSection","FormSelect","FormSwitch","FormText","FormTextarea","model","schema","validation","form","field","element","charAt","component","markRaw","s","label","validations","v","forEach","rule","attributes","method","split","ruleWithAttributes","shift","JSON","parse","required","pattern","RegExp","push","error","condition","when","is","then","f","Object","entries","object","shape","nl2p","str","numberFormat","toString"],"mappings":"kyEAcAA,EAAIC,UAAUD,EAAIE,OAAQ,cAAc,SAAUC,EAAKC,UAC5CC,KAAKC,KAAK,CACbC,KAAM,aACNC,WAAW,EACXC,QAASL,EACTM,OAAQ,CACJP,IAAKA,GAETG,KAAM,SAACK,SAAmB,IAATA,GAAeA,EAAMC,QAAUT,QAIxDH,EAAIC,UAAUD,EAAIE,OAAQ,gBAAgB,SAAUC,EAAKC,UAC9CC,KAAKC,KAAK,CACbC,KAAM,eACNC,WAAW,EACXC,QAASI,GAAG,0BACZH,OAAQ,CACJP,IAAKA,GAETG,KAAM,SAACK,WAAqB,IAATA,GAAeG,MAAMH,UC7Bh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nB,MAAOW,QAGbxB,EAAWE,GAASQ,EAGpBP,EAAQsB,YACRlB,EAAEkB,UAAY,SAAC3B,UAAUA,EAAMK,EAAQsB,UAAU,MAAQtB,EAAQsB,UAAU,IAE3EzB,EAAWE,GAASxC,EAAIE,SAAS8D,KAAKvB,EAAQsB,UAAU,GAAI,CACxDE,GAAIxB,EAAQsB,UAAU,GACtBG,KAAM5B,EAAWE,OAIxB,OAAQ,cAAe,cAAe,OAAQ,OAAQ,QAAS,QAAS,UAAW,UAAUS,SAAQ,SAACkB,GAC/F1B,EAAQ0B,KACRtB,EAAEsB,GAAK1B,EAAQ0B,OAIvB9B,EAAOG,GAASK,SAvFWuB,OAAOC,QAAQ7C,EAAKe,+BA2FhD,CACHF,OAAQA,EACRD,MAAOA,EACPE,WAAYtC,EAAIsE,SAASC,MAAMjC,KC/InCkC,KERW,SAAcC,UACrB,MAAOA,EACA,GAGJ,OAASA,EAAM,IAAIpD,QAAQ,gCAAiC,eAA2B,QFI9FqD,aGTW,SAAsB/D,UAC1BA,EAAQA,EAAMgE,WAAWtD,QAAQ,wBAAyB,KAAO"}
1
+ {"version":3,"file":"helpers.js","sources":["../src/helpers/modules/formParse.js","../src/helpers/index.js","../src/helpers/modules/pluralize.js","../src/helpers/modules/nl2p.js","../src/helpers/modules/numberFormat.js"],"sourcesContent":["import { markRaw } from 'vue';\nimport * as yup from 'yup';\n\nimport FormCheckbox from '@perevorot/shop/dist/forms/FormCheckbox';\nimport FormCheckboxes from '@perevorot/shop/dist/forms/FormCheckboxes';\nimport FormPassword from '@perevorot/shop/dist/forms/FormPassword';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport FormRating from '@perevorot/shop/dist/forms/FormRating';\nimport FormSection from '@perevorot/shop/dist/forms/FormSection';\nimport FormSelect from '@perevorot/shop/dist/forms/FormSelect';\nimport FormSwitch from '@perevorot/shop/dist/forms/FormSwitch';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormTextarea from '@perevorot/shop/dist/forms/FormTextarea';\n\nyup.addMethod(yup.string, 'minOrEmpty', function (min, msg) {\n return this.test({\n name: 'minOrEmpty',\n exclusive: true,\n message: msg,\n params: {\n min: min,\n },\n test: (value) => value == '' || value.length >= min,\n });\n});\n\nyup.addMethod(yup.string, 'numberFilled', function (min, msg) {\n return this.test({\n name: 'numberFilled',\n exclusive: true,\n message: __('auth.validation.number'),\n params: {\n min: min,\n },\n test: (value) => !(value == '' || isNaN(value)),\n });\n});\n\nexport default function formParse(json) {\n let components = {\n FormCheckbox: FormCheckbox,\n FormCheckboxes: FormCheckboxes,\n FormPassword: FormPassword,\n FormRadio: FormRadio,\n FormRating: FormRating,\n FormSection: FormSection,\n FormSelect: FormSelect,\n FormSwitch: FormSwitch,\n FormText: FormText,\n FormTextarea: FormTextarea,\n };\n\n let model = {};\n let schema = {};\n let validation = {};\n\n if (json.form) {\n for (const [field, element] of Object.entries(json.form)) {\n if (field.charAt(0) != '_') {\n let value;\n\n switch (element.component) {\n case 'FormCheckbox':\n case 'FormSwitch':\n value = false;\n break;\n\n case 'FormCheckboxes':\n value = [];\n break;\n default:\n value = '';\n }\n\n model[field] = value;\n }\n\n const component = components[element.component];\n\n if (component) {\n markRaw(component);\n }\n\n let s = {\n component: component ? component : element.component,\n label: element.label,\n validations: {},\n };\n\n if (element.validation) {\n let v = yup;\n\n const validations = element.validation;\n\n validations.forEach((rule) => {\n let attributes = [];\n let method = rule;\n\n if (method.split(':').length > 1) {\n let ruleWithAttributes = rule.split(':');\n method = ruleWithAttributes.shift();\n\n attributes = JSON.parse(ruleWithAttributes);\n }\n\n if (method == 'required') {\n s.validations.required = true;\n }\n\n if (method == 'phone' && s.validations.required) {\n const phoneRegExp = element.pattern ? new RegExp(element.pattern) : /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n method = 'matches';\n\n attributes = [phoneRegExp, __('auth.validation.phone')];\n }\n\n if (method != 'array') {\n attributes.push(__('auth.validation.' + method));\n }\n\n try {\n if (method == 'booleanTrue') {\n v = yup.boolean(...attributes).oneOf([true], element.validationLabel ? element.validationLabel : __('auth.validation.boolean'));\n } else {\n v = v[method](...attributes);\n }\n } catch (error) {}\n });\n\n validation[field] = v;\n }\n\n if (element.condition) {\n s.condition = (model) => model[element.condition[0]] === element.condition[1];\n\n validation[field] = yup.string().when(element.condition[0], {\n is: element.condition[1],\n then: validation[field],\n });\n }\n\n ['mask', 'placeholder', 'description', 'type', 'list', 'model', 'store', 'default', 'hidden'].forEach((f) => {\n if (element[f]) {\n s[f] = element[f];\n }\n });\n\n schema[field] = s;\n }\n }\n\n return {\n schema: schema,\n model: model,\n validation: yup.object().shape(validation),\n };\n}\n","import pluralize from './modules/pluralize';\nimport formParse from './modules/formParse';\nimport nl2p from './modules/nl2p';\nimport numberFormat from './modules/numberFormat';\n\nexport default {\n pluralize,\n formParse,\n nl2p,\n numberFormat,\n};\n","export default function pluralize(count, words) {\n let cases = [2, 0, 1, 1, 1, 2];\n\n const countClear = Number(String(count).replace(/\\D/g, ''));\n\n return count + ' ' + words[countClear % 100 > 4 && countClear % 100 < 20 ? 2 : cases[Math.min(countClear % 10, 5)]];\n}\n","export default function nl2p(str) {\n if (typeof str === 'undefined' || str === null) {\n return '';\n }\n\n return '<p>' + (str + '').replace(/([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g, '$1' + '</p><p>' + '$2') + '</p>';\n}\n","export default function numberFormat(value) {\n return value ? value.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ' ') : '0';\n}\n"],"names":["yup","addMethod","string","min","msg","this","test","name","exclusive","message","params","value","length","__","isNaN","pluralize","count","words","countClear","Number","String","replace","Math","formParse","json","components","FormCheckbox","FormCheckboxes","FormPassword","FormRadio","FormRating","FormSection","FormSelect","FormSwitch","FormText","FormTextarea","model","schema","validation","form","field","element","charAt","component","markRaw","s","label","validations","v","forEach","rule","attributes","method","split","ruleWithAttributes","shift","JSON","parse","required","pattern","RegExp","push","oneOf","validationLabel","error","condition","when","is","then","f","Object","entries","object","shape","nl2p","str","numberFormat","toString"],"mappings":"kyEAcAA,EAAIC,UAAUD,EAAIE,OAAQ,cAAc,SAAUC,EAAKC,UAC5CC,KAAKC,KAAK,CACbC,KAAM,aACNC,WAAW,EACXC,QAASL,EACTM,OAAQ,CACJP,IAAKA,GAETG,KAAM,SAACK,SAAmB,IAATA,GAAeA,EAAMC,QAAUT,QAIxDH,EAAIC,UAAUD,EAAIE,OAAQ,gBAAgB,SAAUC,EAAKC,UAC9CC,KAAKC,KAAK,CACbC,KAAM,eACNC,WAAW,EACXC,QAASI,GAAG,0BACZH,OAAQ,CACJP,IAAKA,GAETG,KAAM,SAACK,WAAqB,IAATA,GAAeG,MAAMH,UC7BhD,MAAe,CACXI,UCNW,SAAmBC,EAAOC,OAG/BC,EAAaC,OAAOC,OAAOJ,GAAOK,QAAQ,MAAO,YAEhDL,EAAQ,IAAMC,EAAMC,EAAa,IAAM,GAAKA,EAAa,IAAM,GAAK,EAJ/D,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,GAIyDI,KAAKnB,IAAIe,EAAa,GAAI,MDE/GK,UD+BW,SAAmBC,OAC1BC,EAAa,CACbC,aAAcA,UACdC,eAAgBA,UAChBC,aAAcA,UACdC,UAAWA,UACXC,WAAYA,UACZC,YAAaA,UACbC,WAAYA,UACZC,WAAYA,UACZC,SAAUA,UACVC,aAAcA,WAGdC,EAAQ,GACRC,EAAS,GACTC,EAAa,MAEbd,EAAKe,0CACOC,OAAOC,UACQ,KAAnBD,EAAME,OAAO,GAAW,KACpB/B,SAEI8B,EAAQE,eACP,mBACA,aACDhC,GAAQ,YAGP,iBACDA,EAAQ,iBAGRA,EAAQ,GAGhByB,EAAMI,GAAS7B,MAGbgC,EAAYlB,EAAWgB,EAAQE,WAEjCA,GACAC,UAAQD,OAGRE,EAAI,CACJF,UAAWA,GAAwBF,EAAQE,UAC3CG,MAAOL,EAAQK,MACfC,YAAa,OAGbN,EAAQH,WAAY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