@ecomplus/storefront-components 1.0.0-beta.180 → 1.0.0-beta.182

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-beta.182](https://github.com/ecomplus/storefront/compare/@ecomplus/storefront-components@1.0.0-beta.181...@ecomplus/storefront-components@1.0.0-beta.182) (2024-09-06)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **components/discount-applier:** ensure alert message updates/reset on coupon change ([a1bfa1b](https://github.com/ecomplus/storefront/commit/a1bfa1bf8831c1df652370b7b38e6b52703197d0))
11
+
12
+ # [1.0.0-beta.181](https://github.com/ecomplus/storefront/compare/@ecomplus/storefront-components@1.0.0-beta.180...@ecomplus/storefront-components@1.0.0-beta.181) (2024-08-22)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **components/discount-applier:** properly handle non-cumulative discounts with gateway discounts ([3ad97a7](https://github.com/ecomplus/storefront/commit/3ad97a702a41962e0b5258489af16389e274851b))
17
+ - **components/shipping-calculator:** minor fixes for disabled service auto select ([311f41b](https://github.com/ecomplus/storefront/commit/311f41b973084cff719e620f2f36098fd0d7116a))
18
+
6
19
  # [1.0.0-beta.180](https://github.com/ecomplus/storefront/compare/@ecomplus/storefront-components@1.0.0-beta.179...@ecomplus/storefront-components@1.0.0-beta.180) (2024-08-15)
7
20
 
8
21
  ### Bug Fixes
@@ -15,7 +15,7 @@ const r=new(i(52).a);e.a=r},,function(t,e,i){"use strict";var r=i(41),n=i(15);co
15
15
  * (c) E-Com Club <ti@e-com.club>
16
16
  * Released under the MIT License.
17
17
  */
18
- const j=new C;e.a=j},function(t,e,i){"use strict";e.a=t=>{const e=t.min_quantity||1,i=t.max_quantity;return"number"!=typeof t.quantity||isNaN(t.quantity)||t.quantity<e?t.quantity=e:i&&t.quantity>i&&(t.quantity=i),t}},function(e,i){e.exports=t},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";const r=(t,e,i)=>{if("object"!=typeof t||null===t)return[];let n=[];if("object"==typeof t&&null!==t)if(Array.isArray(t))t.length&&(t[0].specifications?t.forEach(t=>{n=n.concat(r(t,e,i))}):t[0].text&&(n=t));else{const{specifications:s}=t;if(s)for(const t in s)s[t]&&t===e&&(n=s[e]);if(n&&!n.length&&Array.isArray(i)&&i.length){let t,n;return i&&(n=i.find(t=>t.grid_id===e))&&n.options&&(t=n.options.map(t=>{let e;return e=t.colors&&t.colors.length?t.colors[0]:t.option_id,{text:t.text,value:e}})),r(t,e)}}return n};e.a=r},function(t,e,i){"use strict";var r=i(149),n=i(147),s=i(32),o=i(57),a=i(26),c=i(4),u=i(48),l=i(87),d=i.n(l),p=i(37);const h="object"==typeof window&&window.localStorage,f="object"==typeof window&&window.propsShippingCalculator||{},m=t=>{const e={};return["product_id","variation_id","sku","name","quantity","inventory","currency_id","currency_symbol","price","final_price","dimensions","weight"].forEach(i=>{void 0!==t[i]&&(e[i]=t[i])}),e};var g={name:"ShippingCalculator",components:{CleaveInput:d.a,ShippingLine:p.a},props:{zipCode:String,canSelectServices:Boolean,canAutoSelectService:{type:Boolean,default:"boolean"!=typeof f.canAutoSelectService||f.canAutoSelectService},canInputZip:{type:Boolean,default:"boolean"!=typeof f.canInputZip||f.canInputZip},countryCode:{type:String,default:n.a.get("country_code")},shippedItems:{type:Array,default:()=>[]},shippingResult:{type:Array,default:()=>[]},shippingData:{type:Object,default:()=>({})},skipAppIds:Array,shippingAppsSort:{type:Array,default:()=>window.ecomShippingApps||[]}},data:()=>({localZipCode:null,localShippedItems:[],amountSubtotal:null,shippingServices:[],selectedService:null,hasPaidOption:!1,freeFromValue:null,isScheduled:!1,retryTimer:null,isWaiting:!1,hasCalculated:!1}),computed:{i19add$1ToEarn:()=>Object(s.a)(r.a),i19calculateShipping:()=>Object(s.a)(r.j),i19zipCode:()=>Object(s.a)(r.Pb),i19freeShipping:()=>Object(s.a)(r.A).toLowerCase(),i19selectShippingMsg:()=>Object(s.a)({pt_br:"Selecione uma forma de envio abaixo",en_us:"Select a shipping method below"}),cleaveOptions(){return"BR"===this.countryCode?{blocks:[5,3],delimiter:"-"}:{blocks:[30]}},freeFromPercentage(){return this.hasPaidOption&&this.amountSubtotal<this.freeFromValue?Math.round(100*this.amountSubtotal/this.freeFromValue):null},productionDeadline(){let t=0;return this.shippedItems.forEach(e=>{if(e.quantity&&e.production_time){const{days:i,cumulative:r}=e.production_time,n=r?i*e.quantity:i;n>t&&(t=n)}}),t}},methods:{formatMoney:o.a,updateZipCode(){this.$emit("update:zip-code",this.localZipCode)},parseShippingOptions(t=[],e=!1){this.freeFromValue=null,this.shippingServices=[],t.length&&(t.forEach(e=>{const{validated:i,error:r,response:n}=e;if(!i||r)return;if(this.skipAppIds&&this.skipAppIds.includes(e.app_id)&&t.filter(({app_id:t})=>!this.skipAppIds.includes(t)).length)return;n.shipping_services.forEach(t=>{this.shippingServices.push({app_id:e.app_id,...t})});const s=n.free_shipping_from_value;s&&(!this.freeFromValue||this.freeFromValue>s)&&(this.freeFromValue=s)}),this.shippingServices.length?(this.shippingServices=this.shippingServices.sort((t,e)=>{const i=t.shipping_line.total_price-e.shipping_line.total_price;return i<0?-1:i>0?1:t.shipping_line.delivery_time&&e.shipping_line.delivery_time&&t.shipping_line.delivery_time.days<e.shipping_line.delivery_time.days?-1:1}),this.canAutoSelectService&&this.setSelectedService(0),this.hasPaidOption=Boolean(this.shippingServices.find(t=>t.shipping_line.total_price||t.shipping_line.price)),Array.isArray(this.shippingAppsSort)&&this.shippingAppsSort.length&&(this.shippingServices=Object(u.a)(this.shippingServices,this.shippingAppsSort))):e?this.scheduleRetry():this.fetchShippingServices(!0))},scheduleRetry(t=1e4){clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.localZipCode&&!this.shippingServices.length&&this.shippedItems.length&&this.fetchShippingServices(!0)},t)},fetchShippingServices(t){this.isScheduled||(this.isScheduled=!0,setTimeout(()=>{this.isScheduled=!1;const{storeId:e}=this;let i="/calculate_shipping.json";this.skipAppIds&&this.skipAppIds.length&&(i+="?skip_ids=",this.skipAppIds.forEach((t,e)=>{e>0&&(i+=","),i+=""+t}));const r={...this.shippingData,to:{zip:this.localZipCode,...this.shippingData.to}};this.localShippedItems.length&&(r.items=this.localShippedItems,r.subtotal=this.amountSubtotal),this.isWaiting=!0,Object(c.a)({url:i,method:"POST",storeId:e,data:r}).then(({data:e})=>this.parseShippingOptions(e.result,t)).catch(e=>{t||this.scheduleRetry(4e3),console.error(e)}).finally(()=>{this.hasCalculated=!0,this.isWaiting=!1})},this.hasCalculated?150:50))},submitZipCode(){this.updateZipCode(),h&&h.setItem("shipping-to-zip",this.localZipCode),this.fetchShippingServices()},setSelectedService(t){this.canSelectServices&&(this.$emit("select-service",this.shippingServices[t]),this.selectedService=t)}},watch:{shippedItems:{handler(){setTimeout(()=>{this.localShippedItems=this.shippedItems.map(m);const{amountSubtotal:t}=this;this.amountSubtotal=this.shippedItems.reduce((t,e)=>t+Object(a.a)(e)*e.quantity,0),this.hasCalculated&&(this.canSelectServices||t!==this.amountSubtotal||!this.shippingServices.length&&!this.isWaiting)&&this.fetchShippingServices()},50)},deep:!0,immediate:!0},localZipCode(t){"BR"===this.countryCode&&8===t.replace(/\D/g,"").length&&this.submitZipCode()},zipCode:{handler(t){t&&(this.localZipCode=t)},immediate:!0},skipAppIds(){this.fetchShippingServices()},shippingResult:{handler(t){t.length&&this.parseShippingOptions(t)},immediate:!0}},created(){if(!this.zipCode&&h){const t=h.getItem("shipping-to-zip");t&&(this.localZipCode=t)}}},_=(i(124),i(1)),b=Object(_.a)(g,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"shipping-calculator"},[t.canInputZip?i("form",{staticClass:"shipping-calculator__form",on:{submit:function(e){return e.preventDefault(),t.submitZipCode.apply(null,arguments)}}},[i("div",{staticClass:"form-group"},[i("label",{attrs:{for:"shipping-calculator-zip"}},[t._v(" "+t._s(t.i19calculateShipping)+" ")]),i("div",{staticClass:"input-group"},[i("cleave-input",{staticClass:"form-control shipping-calculator__input",attrs:{type:"tel",id:"shipping-calculator-zip",placeholder:t.i19zipCode,"aria-label":t.i19zipCode,options:t.cleaveOptions},model:{value:t.localZipCode,callback:function(e){t.localZipCode=e},expression:"localZipCode"}}),i("div",{staticClass:"input-group-append"},[i("button",{staticClass:"btn btn-outline-secondary",attrs:{type:"submit","aria-label":t.i19calculateShipping}},[i("i",{staticClass:"i-shipping-fast"})])])],1)])]):t._e(),i("div",{staticClass:"shipping-calculator__services"},[i("transition-group",{attrs:{"enter-active-class":"animated fadeInDown","leave-active-class":"animated position-absolute fadeOutUp"}},[t.isWaiting?i("div",{key:"waiting",staticClass:"spinner-border spinner-border-sm",attrs:{role:"status"}},[i("span",{staticClass:"sr-only"},[t._v("Loading...")])]):i("div",{key:"services",staticClass:"list-group"},[i("transition",{attrs:{"enter-active-class":"animated fadeInUp","leave-active-class":"animated fadeOutDown"}},[t.canSelectServices&&!t.canAutoSelectService&&null===t.selectedService?i("div",{staticClass:"shipping-calculator__label"},[i("i",{staticClass:"i-arrow-down animated wobble"}),t._v(" "+t._s(t.i19selectShippingMsg)+" ")]):t._e()]),t._l(t.shippingServices,(function(e,r){return i(t.canSelectServices?"a":"div",{key:r,tag:"component",staticClass:"list-group-item",class:{"list-group-item-action":t.canSelectServices,active:t.canSelectServices&&t.selectedService===r},attrs:{href:t.canSelectServices&&"#"},on:{click:function(e){return e.preventDefault(),t.setSelectedService(r)}}},[i("span",{staticClass:"shipping-calculator__option"},[t._t("option",(function(){return[i("shipping-line",{attrs:{"shipping-line":e.shipping_line,"production-deadline":t.productionDeadline,"data-service-code":e.service_code}}),t.canSelectServices&&!t.canAutoSelectService?i("div",{staticClass:"custom-control custom-radio"},[i("input",{staticClass:"custom-control-input",attrs:{type:"radio",id:"shipping-method-"+e.service_code,name:"shipping-method-select"},domProps:{checked:t.selectedService===r}}),i("label",{staticClass:"custom-control-label",attrs:{for:"shipping-method-"+e.service_code}},[i("small",[t._v(t._s(e.label))])])]):i("small",[t._v(t._s(e.label))])]}),null,{service:e})],2)])}))],2)]),i("transition",{attrs:{"enter-active-class":"animated fadeInUp","leave-active-class":"animated fadeOutDown"}},[t.freeFromPercentage?i("div",{staticClass:"shipping-calculator__free-from-value"},[t._t("free-from-value",(function(){return[i("span",[t._v(" "+t._s(t.i19add$1ToEarn.replace("$1",t.formatMoney(t.freeFromValue-t.amountSubtotal)))+" "),i("strong",[t._v(t._s(t.i19freeShipping))])]),t.freeFromPercentage>=33?i("div",{staticClass:"progress"},[i("div",{staticClass:"progress-bar progress-bar-striped",style:"width: "+t.freeFromPercentage+"%",attrs:{role:"progressbar","aria-valuenow":t.freeFromPercentage,"aria-valuemin":"0","aria-valuemax":"100"}},[i("span",[t._v(" "+t._s(t.i19freeShipping)+" "),i("i",{staticClass:"i-truck mx-1"}),i("strong",[t._v(t._s(t.freeFromPercentage)+"%")])])])]):t._e()]}),null,{amountSubtotal:t.amountSubtotal,freeFromValue:t.freeFromValue,freeFromPercentage:t.freeFromPercentage})],2):t._e()])],1)])}),[],!1,null,null,null);e.a=b.exports},function(t,e,i){"use strict";var r=i(149),n=i(32),s=i(71),o=i(72),a=i(73),c=i(36),u={name:"ProductVariations",props:{product:{type:Object,required:!0},selectedId:String,maxOptionsBtns:{type:Number,default:6},gridsData:{type:Array,default(){if("object"==typeof window&&window.storefront&&window.storefront.data)return window.storefront.data.grids}}},data:()=>({selectedOptions:{},filteredGrids:{}}),computed:{i19select:()=>Object(n.a)(r.zb),i19selectVariation:()=>Object(n.a)(r.Ab),variationsGrids(){return Object(s.a)(this.product)},orderedGrids(){return Object.keys(this.variationsGrids)},variationFromUrl(){if("object"==typeof window){const t=new URLSearchParams(window.location.search).get("variation_id");if(t)return t}return null}},methods:{getColorOptionBg(t){const e=t.split(",").map(t=>Object(o.a)(this.product.variations,t.trim(),"colors"));return e.length>1?`background:linear-gradient(to right bottom, ${e[0]} 50%, ${e[1]} 50%)`:"background:"+e[0]},getSpecValue(t,e){const{variations:i}=this.product;let r;if("colors"===e){const n=t.split(",");n.length>1&&(r=[],n.forEach(t=>{r.push(Object(o.a)(i,t.trim(),e))}))}return r||Object(o.a)(i,t,e)},getGridTitle(t){return Object(a.a)(t,this.gridsData)},selectOption(t,e,i){const{product:r,selectedOptions:n,orderedGrids:o}=this;this.$set(n,e,t),this.$emit("select-option",{gridId:e,gridIndex:i,optionText:t});const a={};for(let t=0;t<=i;t++){const e=o[t];n[e]&&(a[e]=n[e])}const u=Object(s.a)(r,a,!0);for(let t=i+1;t<o.length;t++){const e=o[t],i=u[e];this.filteredGrids[e]=i,n[e]&&!i.includes(n[e])&&this.$set(n,e,void 0)}const l=r.variations.slice(0);for(let t=0;t<l.length;t++){const e=l[t],{specifications:i}=e;for(const r in i)if(n[r]!==Object(c.a)(e,r)){l.splice(t,1),t--;break}}this.$emit("update:selected-id",l.length?l[0]._id:null)}},watch:{"product.variations":{handler(){this.filteredGrids=Object(s.a)(this.product,null,!0)},deep:!0,immediate:!0}},mounted(){if(this.variationFromUrl&&Array.isArray(this.product.variations)){const t=this.product.variations.find(t=>t._id===this.variationFromUrl);if(t){const{specifications:e}=t,i=Object.keys(e),r=(t=0)=>{const n=i[t];if(i[t]&&e[n]&&1===e[n].length){const i=e[n][0].text;this.variationsGrids[n].find(t=>t===i)&&this.$nextTick(()=>{this.selectOption(i,n,this.orderedGrids.indexOf(n)),r(t+1)})}};r()}}}},l=(i(136),i(1)),d=Object(l.a)(u,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return t.product.variations?i("div",{staticClass:"variations"},t._l(t.variationsGrids,(function(e,r,n){return t.filteredGrids[r]?i("div",{class:"variations__grid variations__grid--"+r},[i("div",{staticClass:"mb-2"},[i("span",{staticClass:"variations__grid-title h5"},[t._v(" "+t._s(t.getGridTitle(r))+" ")]),t.selectedOptions[r]?i("span",{key:"success",staticClass:"variations__value variations__value"},[i("i",{staticClass:"i-check mr-1"}),t._v(" "+t._s(t.selectedOptions[r])+" ")]):i("span",{staticClass:"variations__value variations__value--empty"},[i("i",{staticClass:"i-arrow-down mr-1"}),t._v(" "+t._s(t.i19selectVariation)+" ")])]),e.length<=t.maxOptionsBtns?t._l(e,(function(e){return i("button",{staticClass:"variations__option btn btn-light",class:[t.selectedOptions[r]===e?"variations__option--selected":null,"variations__option--"+e,t.filteredGrids[r].includes(e)?null:"disabled"],style:"colors"===r?t.getColorOptionBg(e):null,on:{click:function(i){return t.selectOption(e,r,n)}}},[t._v(" "+t._s(e)+" ")])})):i("select",{staticClass:"variations__select custom-select",on:{change:function(e){return t.selectOption(e.target.value,r,n)}}},[i("option",{domProps:{selected:!t.selectedOptions[r]}},[t._v(" "+t._s(t.i19select)+"... ")]),t._l(e,(function(e){return i("option",{attrs:{disabled:!t.filteredGrids[r].includes(e)},domProps:{value:e,selected:t.selectedOptions[r]===e}},[t._v(" "+t._s(e)+" ")])}))],2)],2):t._e()})),0):t._e()}),[],!1,null,null,null);e.a=d.exports},function(t,e,i){"use strict";
18
+ const j=new C;e.a=j},function(t,e,i){"use strict";e.a=t=>{const e=t.min_quantity||1,i=t.max_quantity;return"number"!=typeof t.quantity||isNaN(t.quantity)||t.quantity<e?t.quantity=e:i&&t.quantity>i&&(t.quantity=i),t}},function(e,i){e.exports=t},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";const r=(t,e,i)=>{if("object"!=typeof t||null===t)return[];let n=[];if("object"==typeof t&&null!==t)if(Array.isArray(t))t.length&&(t[0].specifications?t.forEach(t=>{n=n.concat(r(t,e,i))}):t[0].text&&(n=t));else{const{specifications:s}=t;if(s)for(const t in s)s[t]&&t===e&&(n=s[e]);if(n&&!n.length&&Array.isArray(i)&&i.length){let t,n;return i&&(n=i.find(t=>t.grid_id===e))&&n.options&&(t=n.options.map(t=>{let e;return e=t.colors&&t.colors.length?t.colors[0]:t.option_id,{text:t.text,value:e}})),r(t,e)}}return n};e.a=r},function(t,e,i){"use strict";var r=i(149),n=i(147),s=i(32),o=i(57),a=i(26),c=i(4),u=i(48),l=i(87),d=i.n(l),p=i(37);const h="object"==typeof window&&window.localStorage,f="object"==typeof window&&window.propsShippingCalculator||{},m=t=>{const e={};return["product_id","variation_id","sku","name","quantity","inventory","currency_id","currency_symbol","price","final_price","dimensions","weight"].forEach(i=>{void 0!==t[i]&&(e[i]=t[i])}),e};var g={name:"ShippingCalculator",components:{CleaveInput:d.a,ShippingLine:p.a},props:{zipCode:String,canSelectServices:Boolean,canAutoSelectService:{type:Boolean,default:"boolean"!=typeof f.canAutoSelectService||f.canAutoSelectService},canInputZip:{type:Boolean,default:"boolean"!=typeof f.canInputZip||f.canInputZip},countryCode:{type:String,default:n.a.get("country_code")},shippedItems:{type:Array,default:()=>[]},shippingResult:{type:Array,default:()=>[]},shippingData:{type:Object,default:()=>({})},skipAppIds:Array,shippingAppsSort:{type:Array,default:()=>window.ecomShippingApps||[]}},data:()=>({localZipCode:null,localShippedItems:[],amountSubtotal:null,shippingServices:[],selectedService:null,hasPaidOption:!1,freeFromValue:null,isScheduled:!1,retryTimer:null,isWaiting:!1,hasCalculated:!1}),computed:{i19add$1ToEarn:()=>Object(s.a)(r.a),i19calculateShipping:()=>Object(s.a)(r.j),i19zipCode:()=>Object(s.a)(r.Pb),i19freeShipping:()=>Object(s.a)(r.A).toLowerCase(),i19selectShippingMsg:()=>Object(s.a)({pt_br:"Selecione uma forma de envio abaixo",en_us:"Select a shipping method below"}),cleaveOptions(){return"BR"===this.countryCode?{blocks:[5,3],delimiter:"-"}:{blocks:[30]}},freeFromPercentage(){return this.hasPaidOption&&this.amountSubtotal<this.freeFromValue?Math.round(100*this.amountSubtotal/this.freeFromValue):null},productionDeadline(){let t=0;return this.shippedItems.forEach(e=>{if(e.quantity&&e.production_time){const{days:i,cumulative:r}=e.production_time,n=r?i*e.quantity:i;n>t&&(t=n)}}),t}},methods:{formatMoney:o.a,updateZipCode(){this.$emit("update:zip-code",this.localZipCode)},parseShippingOptions(t=[],e=!1){this.freeFromValue=null,this.shippingServices=[],t.length&&(t.forEach(e=>{const{validated:i,error:r,response:n}=e;if(!i||r)return;if(this.skipAppIds&&this.skipAppIds.includes(e.app_id)&&t.filter(({app_id:t})=>!this.skipAppIds.includes(t)).length)return;n.shipping_services.forEach(t=>{this.shippingServices.push({app_id:e.app_id,...t})});const s=n.free_shipping_from_value;s&&(!this.freeFromValue||this.freeFromValue>s)&&(this.freeFromValue=s)}),this.shippingServices.length?(this.shippingServices=this.shippingServices.sort((t,e)=>{const i=t.shipping_line.total_price-e.shipping_line.total_price;return i<0?-1:i>0?1:t.shipping_line.delivery_time&&e.shipping_line.delivery_time&&t.shipping_line.delivery_time.days<e.shipping_line.delivery_time.days?-1:1}),this.canAutoSelectService?this.setSelectedService(0):this.selectedService=null,this.hasPaidOption=Boolean(this.shippingServices.find(t=>t.shipping_line.total_price||t.shipping_line.price)),Array.isArray(this.shippingAppsSort)&&this.shippingAppsSort.length&&(this.shippingServices=Object(u.a)(this.shippingServices,this.shippingAppsSort))):e?this.scheduleRetry():this.fetchShippingServices(!0))},scheduleRetry(t=1e4){clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.localZipCode&&!this.shippingServices.length&&this.shippedItems.length&&this.fetchShippingServices(!0)},t)},fetchShippingServices(t){this.isScheduled||(this.isScheduled=!0,setTimeout(()=>{this.isScheduled=!1;const{storeId:e}=this;let i="/calculate_shipping.json";this.skipAppIds&&this.skipAppIds.length&&(i+="?skip_ids=",this.skipAppIds.forEach((t,e)=>{e>0&&(i+=","),i+=""+t}));const r={...this.shippingData,to:{zip:this.localZipCode,...this.shippingData.to}};this.localShippedItems.length&&(r.items=this.localShippedItems,r.subtotal=this.amountSubtotal),this.isWaiting=!0,Object(c.a)({url:i,method:"POST",storeId:e,data:r}).then(({data:e})=>this.parseShippingOptions(e.result,t)).catch(e=>{t||this.scheduleRetry(4e3),console.error(e)}).finally(()=>{this.hasCalculated=!0,this.isWaiting=!1})},this.hasCalculated?150:50))},submitZipCode(){this.updateZipCode(),h&&h.setItem("shipping-to-zip",this.localZipCode),this.fetchShippingServices()},setSelectedService(t){this.canSelectServices&&(this.$emit("select-service",this.shippingServices[t]),this.selectedService=t)}},watch:{shippedItems:{handler(){setTimeout(()=>{this.localShippedItems=this.shippedItems.map(m);const{amountSubtotal:t}=this;this.amountSubtotal=this.shippedItems.reduce((t,e)=>t+Object(a.a)(e)*e.quantity,0),this.hasCalculated&&(this.canSelectServices||t!==this.amountSubtotal||!this.shippingServices.length&&!this.isWaiting)&&this.fetchShippingServices()},50)},deep:!0,immediate:!0},localZipCode(t){"BR"===this.countryCode&&8===t.replace(/\D/g,"").length&&this.submitZipCode()},zipCode:{handler(t){t&&(this.localZipCode=t)},immediate:!0},skipAppIds(){this.fetchShippingServices()},shippingResult:{handler(t){t.length&&this.parseShippingOptions(t)},immediate:!0}},created(){if(!this.zipCode&&h){const t=h.getItem("shipping-to-zip");t&&(this.localZipCode=t)}}},_=(i(124),i(1)),b=Object(_.a)(g,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"shipping-calculator"},[t.canInputZip?i("form",{staticClass:"shipping-calculator__form",on:{submit:function(e){return e.preventDefault(),t.submitZipCode.apply(null,arguments)}}},[i("div",{staticClass:"form-group"},[i("label",{attrs:{for:"shipping-calculator-zip"}},[t._v(" "+t._s(t.i19calculateShipping)+" ")]),i("div",{staticClass:"input-group"},[i("cleave-input",{staticClass:"form-control shipping-calculator__input",attrs:{type:"tel",id:"shipping-calculator-zip",placeholder:t.i19zipCode,"aria-label":t.i19zipCode,options:t.cleaveOptions},model:{value:t.localZipCode,callback:function(e){t.localZipCode=e},expression:"localZipCode"}}),i("div",{staticClass:"input-group-append"},[i("button",{staticClass:"btn btn-outline-secondary",attrs:{type:"submit","aria-label":t.i19calculateShipping}},[i("i",{staticClass:"i-shipping-fast"})])])],1)])]):t._e(),i("div",{staticClass:"shipping-calculator__services"},[i("transition-group",{attrs:{"enter-active-class":"animated fadeInDown","leave-active-class":"animated position-absolute fadeOutUp"}},[t.isWaiting?i("div",{key:"waiting",staticClass:"spinner-border spinner-border-sm",attrs:{role:"status"}},[i("span",{staticClass:"sr-only"},[t._v("Loading...")])]):i("div",{key:"services",staticClass:"list-group"},[i("transition",{attrs:{"enter-active-class":"animated fadeInUp","leave-active-class":"animated fadeOutDown"}},[t.canSelectServices&&!t.canAutoSelectService&&null===t.selectedService&&t.shippingServices.length?i("div",{staticClass:"shipping-calculator__label"},[i("i",{staticClass:"i-arrow-down animated wobble"}),t._v(" "+t._s(t.i19selectShippingMsg)+" ")]):t._e()]),t._l(t.shippingServices,(function(e,r){return i(t.canSelectServices?"a":"div",{key:r,tag:"component",staticClass:"list-group-item",class:{"list-group-item-action":t.canSelectServices,active:t.canSelectServices&&t.selectedService===r},attrs:{href:t.canSelectServices&&"#"},on:{click:function(e){return e.preventDefault(),t.setSelectedService(r)}}},[i("span",{staticClass:"shipping-calculator__option"},[t._t("option",(function(){return[i("shipping-line",{attrs:{"shipping-line":e.shipping_line,"production-deadline":t.productionDeadline,"data-service-code":e.service_code}}),t.canSelectServices&&!t.canAutoSelectService?i("div",{staticClass:"custom-control custom-radio"},[i("input",{staticClass:"custom-control-input",attrs:{type:"radio",id:"shipping-method-"+e.service_code,name:"shipping-method-select"},domProps:{checked:t.selectedService===r}}),i("label",{staticClass:"custom-control-label",attrs:{for:"shipping-method-"+e.service_code}},[i("small",[t._v(t._s(e.label))])])]):i("small",[t._v(t._s(e.label))])]}),null,{service:e})],2)])}))],2)]),i("transition",{attrs:{"enter-active-class":"animated fadeInUp","leave-active-class":"animated fadeOutDown"}},[t.freeFromPercentage?i("div",{staticClass:"shipping-calculator__free-from-value"},[t._t("free-from-value",(function(){return[i("span",[t._v(" "+t._s(t.i19add$1ToEarn.replace("$1",t.formatMoney(t.freeFromValue-t.amountSubtotal)))+" "),i("strong",[t._v(t._s(t.i19freeShipping))])]),t.freeFromPercentage>=33?i("div",{staticClass:"progress"},[i("div",{staticClass:"progress-bar progress-bar-striped",style:"width: "+t.freeFromPercentage+"%",attrs:{role:"progressbar","aria-valuenow":t.freeFromPercentage,"aria-valuemin":"0","aria-valuemax":"100"}},[i("span",[t._v(" "+t._s(t.i19freeShipping)+" "),i("i",{staticClass:"i-truck mx-1"}),i("strong",[t._v(t._s(t.freeFromPercentage)+"%")])])])]):t._e()]}),null,{amountSubtotal:t.amountSubtotal,freeFromValue:t.freeFromValue,freeFromPercentage:t.freeFromPercentage})],2):t._e()])],1)])}),[],!1,null,null,null);e.a=b.exports},function(t,e,i){"use strict";var r=i(149),n=i(32),s=i(71),o=i(72),a=i(73),c=i(36),u={name:"ProductVariations",props:{product:{type:Object,required:!0},selectedId:String,maxOptionsBtns:{type:Number,default:6},gridsData:{type:Array,default(){if("object"==typeof window&&window.storefront&&window.storefront.data)return window.storefront.data.grids}}},data:()=>({selectedOptions:{},filteredGrids:{}}),computed:{i19select:()=>Object(n.a)(r.zb),i19selectVariation:()=>Object(n.a)(r.Ab),variationsGrids(){return Object(s.a)(this.product)},orderedGrids(){return Object.keys(this.variationsGrids)},variationFromUrl(){if("object"==typeof window){const t=new URLSearchParams(window.location.search).get("variation_id");if(t)return t}return null}},methods:{getColorOptionBg(t){const e=t.split(",").map(t=>Object(o.a)(this.product.variations,t.trim(),"colors"));return e.length>1?`background:linear-gradient(to right bottom, ${e[0]} 50%, ${e[1]} 50%)`:"background:"+e[0]},getSpecValue(t,e){const{variations:i}=this.product;let r;if("colors"===e){const n=t.split(",");n.length>1&&(r=[],n.forEach(t=>{r.push(Object(o.a)(i,t.trim(),e))}))}return r||Object(o.a)(i,t,e)},getGridTitle(t){return Object(a.a)(t,this.gridsData)},selectOption(t,e,i){const{product:r,selectedOptions:n,orderedGrids:o}=this;this.$set(n,e,t),this.$emit("select-option",{gridId:e,gridIndex:i,optionText:t});const a={};for(let t=0;t<=i;t++){const e=o[t];n[e]&&(a[e]=n[e])}const u=Object(s.a)(r,a,!0);for(let t=i+1;t<o.length;t++){const e=o[t],i=u[e];this.filteredGrids[e]=i,n[e]&&!i.includes(n[e])&&this.$set(n,e,void 0)}const l=r.variations.slice(0);for(let t=0;t<l.length;t++){const e=l[t],{specifications:i}=e;for(const r in i)if(n[r]!==Object(c.a)(e,r)){l.splice(t,1),t--;break}}this.$emit("update:selected-id",l.length?l[0]._id:null)}},watch:{"product.variations":{handler(){this.filteredGrids=Object(s.a)(this.product,null,!0)},deep:!0,immediate:!0}},mounted(){if(this.variationFromUrl&&Array.isArray(this.product.variations)){const t=this.product.variations.find(t=>t._id===this.variationFromUrl);if(t){const{specifications:e}=t,i=Object.keys(e),r=(t=0)=>{const n=i[t];if(i[t]&&e[n]&&1===e[n].length){const i=e[n][0].text;this.variationsGrids[n].find(t=>t===i)&&this.$nextTick(()=>{this.selectOption(i,n,this.orderedGrids.indexOf(n)),r(t+1)})}};r()}}}},l=(i(136),i(1)),d=Object(l.a)(u,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return t.product.variations?i("div",{staticClass:"variations"},t._l(t.variationsGrids,(function(e,r,n){return t.filteredGrids[r]?i("div",{class:"variations__grid variations__grid--"+r},[i("div",{staticClass:"mb-2"},[i("span",{staticClass:"variations__grid-title h5"},[t._v(" "+t._s(t.getGridTitle(r))+" ")]),t.selectedOptions[r]?i("span",{key:"success",staticClass:"variations__value variations__value"},[i("i",{staticClass:"i-check mr-1"}),t._v(" "+t._s(t.selectedOptions[r])+" ")]):i("span",{staticClass:"variations__value variations__value--empty"},[i("i",{staticClass:"i-arrow-down mr-1"}),t._v(" "+t._s(t.i19selectVariation)+" ")])]),e.length<=t.maxOptionsBtns?t._l(e,(function(e){return i("button",{staticClass:"variations__option btn btn-light",class:[t.selectedOptions[r]===e?"variations__option--selected":null,"variations__option--"+e,t.filteredGrids[r].includes(e)?null:"disabled"],style:"colors"===r?t.getColorOptionBg(e):null,on:{click:function(i){return t.selectOption(e,r,n)}}},[t._v(" "+t._s(e)+" ")])})):i("select",{staticClass:"variations__select custom-select",on:{change:function(e){return t.selectOption(e.target.value,r,n)}}},[i("option",{domProps:{selected:!t.selectedOptions[r]}},[t._v(" "+t._s(t.i19select)+"... ")]),t._l(e,(function(e){return i("option",{attrs:{disabled:!t.filteredGrids[r].includes(e)},domProps:{value:e,selected:t.selectedOptions[r]===e}},[t._v(" "+t._s(e)+" ")])}))],2)],2):t._e()})),0):t._e()}),[],!1,null,null,null);e.a=d.exports},function(t,e,i){"use strict";
19
19
  /*! lozad.js - v1.16.0 - 2020-09-06
20
20
  * https://github.com/ApoorvSaxena/lozad.js
21
21
  * Copyright (c) 2020 Apoorv Saxena; Licensed MIT */const r="undefined"!=typeof document&&document.documentMode,n={rootMargin:"0px",threshold:0,load(t){if("picture"===t.nodeName.toLowerCase()){let e=t.querySelector("img"),i=!1;null===e&&(e=document.createElement("img"),i=!0),r&&t.getAttribute("data-iesrc")&&(e.src=t.getAttribute("data-iesrc")),t.getAttribute("data-alt")&&(e.alt=t.getAttribute("data-alt")),i&&t.append(e)}if("video"===t.nodeName.toLowerCase()&&!t.getAttribute("data-src")&&t.children){const e=t.children;let i;for(let t=0;t<=e.length-1;t++)i=e[t].getAttribute("data-src"),i&&(e[t].src=i);t.load()}t.getAttribute("data-poster")&&(t.poster=t.getAttribute("data-poster")),t.getAttribute("data-src")&&(t.src=t.getAttribute("data-src")),t.getAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"));let e=",";if(t.getAttribute("data-background-delimiter")&&(e=t.getAttribute("data-background-delimiter")),t.getAttribute("data-background-image"))t.style.backgroundImage=`url('${t.getAttribute("data-background-image").split(e).join("'),url('")}')`;else if(t.getAttribute("data-background-image-set")){const i=t.getAttribute("data-background-image-set").split(e);let r=i[0].substr(0,i[0].indexOf(" "))||i[0];r=-1===r.indexOf("url(")?`url(${r})`:r,1===i.length?t.style.backgroundImage=r:t.setAttribute("style",(t.getAttribute("style")||"")+`background-image: ${r}; background-image: -webkit-image-set(${i}); background-image: image-set(${i})`)}t.getAttribute("data-toggle-class")&&t.classList.toggle(t.getAttribute("data-toggle-class"))},loaded(){}};function s(t){t.setAttribute("data-loaded",!0)}const o=t=>"true"===t.getAttribute("data-loaded"),a=(t,e=document)=>t instanceof Element?[t]:t instanceof NodeList?t:e.querySelectorAll(t);e.a=function(t=".lozad",e={}){const{root:i,rootMargin:r,threshold:c,load:u,loaded:l}=Object.assign({},n,e);let d;"undefined"!=typeof window&&window.IntersectionObserver&&(d=new IntersectionObserver(((t,e)=>(i,r)=>{i.forEach(i=>{(i.intersectionRatio>0||i.isIntersecting)&&(r.unobserve(i.target),o(i.target)||(t(i.target),s(i.target),e(i.target)))})})(u,l),{root:i,rootMargin:r,threshold:c}));const p=a(t,i);for(let t=0;t<p.length;t++)(h=p[t]).getAttribute("data-placeholder-background")&&(h.style.background=h.getAttribute("data-placeholder-background"));var h;return{observe(){const e=a(t,i);for(let t=0;t<e.length;t++)o(e[t])||(d?d.observe(e[t]):(u(e[t]),s(e[t]),l(e[t])))},triggerLoad(t){o(t)||(u(t),s(t),l(t))},observer:d}}},function(t,e,i){"use strict";var r=i(33);e.a=t=>Object(r.a)(t)?t.price:t?"number"==typeof t.final_price?t.final_price:Math.max(t.base_price||0,t.price||0):0},function(t,e,i){(function(t,i){var r=/^\[object .+?Constructor\]$/,n=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var o="object"==typeof t&&t&&t.Object===Object&&t,a="object"==typeof self&&self&&self.Object===Object&&self,c=o||a||Function("return this")(),u=e&&!e.nodeType&&e,l=u&&"object"==typeof i&&i&&!i.nodeType&&i,d=l&&l.exports===u,p=d&&o.process,h=function(){try{var t=l&&l.require&&l.require("util").types;return t||p&&p.binding&&p.binding("util")}catch(t){}}(),f=h&&h.isTypedArray;function m(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}var g,_,b,v=Array.prototype,y=Function.prototype,w=Object.prototype,x=c["__core-js_shared__"],S=y.toString,k=w.hasOwnProperty,O=(g=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+g:"",C=w.toString,j=S.call(Object),A=RegExp("^"+S.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),P=d?c.Buffer:void 0,I=c.Symbol,E=c.Uint8Array,T=P?P.allocUnsafe:void 0,R=(_=Object.getPrototypeOf,b=Object,function(t){return _(b(t))}),L=Object.create,F=w.propertyIsEnumerable,B=v.splice,D=I?I.toStringTag:void 0,M=function(){try{var t=ut(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),z=P?P.isBuffer:void 0,N=Math.max,q=Date.now,U=ut(c,"Map"),V=ut(Object,"create"),$=function(){function t(){}return function(e){if(!wt(e))return{};if(L)return L(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}();function H(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function W(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function Q(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function G(t){var e=this.__data__=new W(t);this.size=e.size}function Y(t,e){var i=gt(t),r=!i&&mt(t),n=!i&&!r&&bt(t),s=!i&&!r&&!n&&St(t),o=i||r||n||s,a=o?function(t,e){for(var i=-1,r=Array(t);++i<t;)r[i]=e(i);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!k.call(t,u)||o&&("length"==u||n&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||lt(u,c))||a.push(u);return a}function K(t,e,i){(void 0!==i&&!ft(t[e],i)||void 0===i&&!(e in t))&&X(t,e,i)}function Z(t,e,i){var r=t[e];k.call(t,e)&&ft(r,i)&&(void 0!==i||e in t)||X(t,e,i)}function J(t,e){for(var i=t.length;i--;)if(ft(t[i][0],e))return i;return-1}function X(t,e,i){"__proto__"==e&&M?M(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}H.prototype.clear=function(){this.__data__=V?V(null):{},this.size=0},H.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},H.prototype.get=function(t){var e=this.__data__;if(V){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return k.call(e,t)?e[t]:void 0},H.prototype.has=function(t){var e=this.__data__;return V?void 0!==e[t]:k.call(e,t)},H.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=V&&void 0===e?"__lodash_hash_undefined__":e,this},W.prototype.clear=function(){this.__data__=[],this.size=0},W.prototype.delete=function(t){var e=this.__data__,i=J(e,t);return!(i<0)&&(i==e.length-1?e.pop():B.call(e,i,1),--this.size,!0)},W.prototype.get=function(t){var e=this.__data__,i=J(e,t);return i<0?void 0:e[i][1]},W.prototype.has=function(t){return J(this.__data__,t)>-1},W.prototype.set=function(t,e){var i=this.__data__,r=J(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this},Q.prototype.clear=function(){this.size=0,this.__data__={hash:new H,map:new(U||W),string:new H}},Q.prototype.delete=function(t){var e=ct(this,t).delete(t);return this.size-=e?1:0,e},Q.prototype.get=function(t){return ct(this,t).get(t)},Q.prototype.has=function(t){return ct(this,t).has(t)},Q.prototype.set=function(t,e){var i=ct(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this},G.prototype.clear=function(){this.__data__=new W,this.size=0},G.prototype.delete=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i},G.prototype.get=function(t){return this.__data__.get(t)},G.prototype.has=function(t){return this.__data__.has(t)},G.prototype.set=function(t,e){var i=this.__data__;if(i instanceof W){var r=i.__data__;if(!U||r.length<199)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new Q(r)}return i.set(t,e),this.size=i.size,this};var tt,et=function(t,e,i){for(var r=-1,n=Object(t),s=i(t),o=s.length;o--;){var a=s[tt?o:++r];if(!1===e(n[a],a,n))break}return t};function it(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":D&&D in Object(t)?function(t){var e=k.call(t,D),i=t[D];try{t[D]=void 0;var r=!0}catch(t){}var n=C.call(t);r&&(e?t[D]=i:delete t[D]);return n}(t):function(t){return C.call(t)}(t)}function rt(t){return xt(t)&&"[object Arguments]"==it(t)}function nt(t){return!(!wt(t)||function(t){return!!O&&O in t}(t))&&(vt(t)?A:r).test(function(t){if(null!=t){try{return S.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!wt(t))return function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e}(t);var e=dt(t),i=[];for(var r in t)("constructor"!=r||!e&&k.call(t,r))&&i.push(r);return i}function ot(t,e,i,r,n){t!==e&&et(e,(function(s,o){if(n||(n=new G),wt(s))!function(t,e,i,r,n,s,o){var a=pt(t,i),c=pt(e,i),u=o.get(c);if(u)return void K(t,i,u);var l=s?s(a,c,i+"",t,e,o):void 0,d=void 0===l;if(d){var p=gt(c),h=!p&&bt(c),f=!p&&!h&&St(c);l=c,p||h||f?gt(a)?l=a:xt(v=a)&&_t(v)?l=function(t,e){var i=-1,r=t.length;e||(e=Array(r));for(;++i<r;)e[i]=t[i];return e}(a):h?(d=!1,l=function(t,e){if(e)return t.slice();var i=t.length,r=T?T(i):new t.constructor(i);return t.copy(r),r}(c,!0)):f?(d=!1,m=c,g=!0?(_=m.buffer,b=new _.constructor(_.byteLength),new E(b).set(new E(_)),b):m.buffer,l=new m.constructor(g,m.byteOffset,m.length)):l=[]:function(t){if(!xt(t)||"[object Object]"!=it(t))return!1;var e=R(t);if(null===e)return!0;var i=k.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&S.call(i)==j}(c)||mt(c)?(l=a,mt(a)?l=function(t){return function(t,e,i,r){var n=!i;i||(i={});var s=-1,o=e.length;for(;++s<o;){var a=e[s],c=r?r(i[a],t[a],a,i,t):void 0;void 0===c&&(c=t[a]),n?X(i,a,c):Z(i,a,c)}return i}(t,kt(t))}(a):wt(a)&&!vt(a)||(l=function(t){return"function"!=typeof t.constructor||dt(t)?{}:$(R(t))}(c))):d=!1}var m,g,_,b;var v;d&&(o.set(c,l),n(l,c,r,s,o),o.delete(c));K(t,i,l)}(t,e,o,i,ot,r,n);else{var a=r?r(pt(t,o),s,o+"",t,e,n):void 0;void 0===a&&(a=s),K(t,o,a)}}),kt)}function at(t,e){return ht(function(t,e,i){return e=N(void 0===e?t.length-1:e,0),function(){for(var r=arguments,n=-1,s=N(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=i(o),m(t,this,a)}}(t,e,jt),t+"")}function ct(t,e){var i,r,n=t.__data__;return("string"==(r=typeof(i=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?n["string"==typeof e?"string":"hash"]:n.map}function ut(t,e){var i=function(t,e){return null==t?void 0:t[e]}(t,e);return nt(i)?i:void 0}function lt(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&n.test(t))&&t>-1&&t%1==0&&t<e}function dt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)}function pt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var ht=function(t){var e=0,i=0;return function(){var r=q(),n=16-(r-i);if(i=r,n>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(M?function(t,e){return M(t,"toString",{configurable:!0,enumerable:!1,value:(i=e,function(){return i}),writable:!0});var i}:jt);function ft(t,e){return t===e||t!=t&&e!=e}var mt=rt(function(){return arguments}())?rt:function(t){return xt(t)&&k.call(t,"callee")&&!F.call(t,"callee")},gt=Array.isArray;function _t(t){return null!=t&&yt(t.length)&&!vt(t)}var bt=z||function(){return!1};function vt(t){if(!wt(t))return!1;var e=it(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function yt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function wt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function xt(t){return null!=t&&"object"==typeof t}var St=f?function(t){return function(e){return t(e)}}(f):function(t){return xt(t)&&yt(t.length)&&!!s[it(t)]};function kt(t){return _t(t)?Y(t,!0):st(t)}var Ot,Ct=(Ot=function(t,e,i){ot(t,e,i)},at((function(t,e){var i=-1,r=e.length,n=r>1?e[r-1]:void 0,s=r>2?e[2]:void 0;for(n=Ot.length>3&&"function"==typeof n?(r--,n):void 0,s&&function(t,e,i){if(!wt(i))return!1;var r=typeof e;return!!("number"==r?_t(i)&&lt(e,i.length):"string"==r&&e in i)&&ft(i[e],t)}(e[0],e[1],s)&&(n=r<3?void 0:n,r=1),t=Object(t);++i<r;){var o=e[i];o&&Ot(t,o,i,n)}return t})));function jt(t){return t}i.exports=Ct}).call(this,i(21),i(63)(t))},function(t,e,i){"use strict";var r=i(149),n=i(32),s={name:"AAlert",props:{canShow:{type:Boolean,default:!0},variant:{type:String,default:"warning"}},data:()=>({count:1}),computed:{i19close:()=>Object(n.a)(r.n)},watch:{canShow(t){t&&this.count++}}},o=i(1),a=Object(o.a)(s,(function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("transition",{attrs:{"enter-active-class":"animated fadeInDown fast"}},[this.canShow?e("div",{key:this.count},[this._m(0)]):this._e()])],1)}),[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"alert alert-dismissible fade show",class:"alert-"+t.variant,attrs:{role:"alert"}},[t._t("default"),i("button",{staticClass:"close",attrs:{type:"button","data-dismiss":"alert","aria-label":t.i19close},on:{click:function(e){return t.$emit("dismiss")}}},[i("span",{attrs:{"aria-hidden":"true"}},[t._v("×")])])],2)}],!1,null,null,null);e.a=a.exports},function(t,e,i){"use strict";i.d(e,"b",(function(){return n})),i.d(e,"a",(function(){return s}));var r=i(18);const n=(t,e=r.a)=>{const i=e.getCustomer().favorites||[],n=s(t,e);if(n){const e=i.indexOf(t);i.splice(e,1)}else i.push(t);return e.requestApi("/me.json","patch",{favorites:i}),!n},s=(t,e)=>{const{favorites:i}=e.getCustomer();return i&&i.includes(t)}},function(t,e,i){"use strict";var r=i(147),n=i(4),s=i(49);var o=[],a={query:{bool:{filter:[{term:{visible:!0}}]}},sort:[{in_stock:{order:"desc"}},{ad_relevance:{order:"desc"}},"_score"],aggs:{brands:{terms:{field:"brands.name"}},categories:{terms:{field:"categories.name"}},specs:{nested:{path:"specs"},aggs:{grid:{terms:{field:"specs.grid",size:30},aggs:{text:{terms:{field:"specs.text"}}}}}},min_price:{min:{field:"price"}},max_price:{max:{field:"price"}},avg_price:{avg:{field:"price"}}}},c=t=>(t.dsl=s(a),t.result=void 0,t.setPageSize().setSortOrder()),u=i(27);const l=(t,e)=>{const i=t&&t.nested&&t.nested.query;if(i&&i.bool&&Array.isArray(i.bool[e]))return i.bool[e].find(t=>t.term)};var d=(t,e,i,r,n)=>{const s=null!==e?`${e}.${i}`:i;if(Array.isArray(r)){const o={terms:{}};let a;return o.terms[s]=r,a=null!==e?`${e}.${"_id"===i?"name":"_id"}`:"_id"===i?"sku":"_id",t.removeFilter(a,n).mergeFilter(o,n)}return null===r?t.removeFilter(s,n):t},p=i(64),h=({aggregations:t},e)=>{let i;return t&&t[e]&&(i=t[e].buckets),Array.isArray(i)&&i||[]};const f="object"==typeof window&&window.localStorage;var m=function(t,e="ecomSeachHistory",i=f){const m=this;if(this.storeId=t||r.a.get("store_id"),this.storageKey=e,this.localStorage=i,this.history=[],this.dsl={},this.result=void 0,this.fetch=(t,e)=>((t,e,i)=>{const{storeId:r}=t,a={url:"/items.json",storeId:r,axiosConfig:i};let c=s(t.dsl);if(o.forEach(t=>{if("function"==typeof t){const e=t(c);e&&(c=e)}}),!0===e){const{query:t}=c;if(a.url+="?q=",t&&t.bool&&Array.isArray(t.bool.filter)){let e="";t.bool.filter.forEach(({term:t,terms:i},r)=>{r>0&&(e+=" AND ");const n=t||i;if(n){const t=Object.keys(n)[0],i=n[t];e+=`${t}:${Array.isArray(i)?`("${i.join('" "')}")`:i}`}}),a.url+=encodeURIComponent(e)}["from","size"].forEach(t=>{c[t]&&(a.url+=`&${t}=${c[t]}`)})}else a.method="post",a.data=c,e&&!i&&(a.axiosConfig=e);return Object(n.c)(a).then(({data:e})=>{t.result=e;const{dsl:i,history:r,localStorage:n,storageKey:s}=t;if(e.hits.total&&i&&i.suggest){const{text:t}=i.suggest;if(t){const e=r.indexOf(t);e>-1&&r.splice(e,1),r.unshift(t),n&&s&&n.setItem(s,r.slice(0,20).join("||"))}}return e})})(m,t,e),this.reset=()=>c(m),this.setSearchTerm=t=>((t,e)=>(t.mergeFilter({multi_match:{query:e,fields:["name","keywords"]}},"must"),u(t.dsl,{suggest:{text:e,words:{term:{field:"name"}}}}),t))(m,t),this.setPageNumber=t=>((t,e=1)=>(t.dsl.from=t.dsl.size*(e-1),t))(m,t),this.setPageSize=t=>((t,e=24)=>(t.dsl.size=e,t))(m,t),this.setSortOrder=t=>((t,e)=>{const i=a.sort.slice();let r;switch(e){case"sales":i.splice(2,0,{sales:{order:"desc"}});break;case"news":i[i.length-1]={_id:{order:"desc"}};break;case"lowest_price":case"highest_price":i.splice(1,0,{price:{order:"lowest_price"===e?"asc":"desc"}});break;case"offers":r=Date.now(),i.splice(1,0,{_script:{type:"number",script:{lang:"painless",source:`doc['price'].value > 0 && doc['base_price'].value > 0 && (doc['price_effective_date.start'].empty || doc['price_effective_date.start'].date.millis <= ${r}L) && (doc['price_effective_date.end'].empty || doc['price_effective_date.end'].date.millis >= ${r}L) ? doc['base_price'].value / doc['price'].value : 0`},order:"desc"}});break;case"views":case"":case void 0:case null:i.push({views:{order:"desc"}});break;default:i.splice(1,0,{[e]:{order:"asc"}})}return t.dsl.sort=i,t})(m,t),this.mergeFilter=(t,e)=>((t,e,i="filter")=>{const r=Object.keys(e)[0];u(t.dsl,{query:{bool:{[i]:[]}}});const n=t.dsl.query.bool[i];let s;switch(r){case"terms":case"term":case"multi_match":case"range":if("object"==typeof e[r]&&null!==e[r]){const i=Object.keys(e[r])[0];for(let r=0;r<n.length;r++){const s=n[r][Object.keys(n[r])[0]];if("object"==typeof s&&null!==s&&Object.keys(s)[0]===i)return n[r]=e,t}}break;case"nested":if(s=l(e,i),s){const r=Object.keys(s.term)[0],o=s.term[r];for(let s=0;s<n.length;s++){const a=l(n[s],i);if(a&&a.term[r]===o)return n[s]=e,t}}}return n.push(e),t})(m,t,e),this.removeFilter=(t,e)=>((t,e,i="filter")=>{const r=t.dsl.query&&t.dsl.query.bool&&t.dsl.query.bool[i];if(Array.isArray(r))for(let t=0;t<r.length;t++){const i=r[t];if(i.nested&&i.nested.path===e||i[Object.keys(i)[0]][e]){r.splice(t,1);break}}return t})(m,t,e),this.setSpec=(t,e)=>((t,e,i)=>{if(Array.isArray(i))return t.mergeFilter({nested:{path:"specs",query:{bool:{filter:[{term:{"specs.grid":e}},{terms:{"specs.text":i}}]}}}});if(null===i){const i=t.dsl.query&&t.dsl.query.bool&&t.dsl.query.bool.filter;if(Array.isArray(i))for(let r=0;r<i.length;r++)if(i[r]&&i[r].nested){const{path:n,query:s}=i[r].nested;if("specs"===n&&s&&s.bool){const n=s.bool.filter;if(Array.isArray(n)&&n.find(({term:t})=>t&&t["specs.grid"]===e))return i.splice(r,1),t}}}return t})(m,t,e),this.setCategoryNames=t=>((t,e)=>d(t,"categories","name",e,"must"))(m,t),this.setCategoryIds=t=>((t,e)=>d(t,"categories","_id",e,"must"))(m,t),this.setBrandNames=t=>((t,e)=>d(t,"brands","name",e))(m,t),this.setBrandIds=t=>((t,e)=>d(t,"brands","_id",e))(m,t),this.setSkus=t=>((t,e)=>d(t,null,"sku",e))(m,t),this.setProductIds=t=>((t,e)=>d(t,null,"_id",e))(m,t),this.setPriceRange=(t,e)=>((t,e,i)=>{const r={};return"number"!=typeof e||isNaN(e)||(r.gte=e),"number"!=typeof i||isNaN(i)||(r.lte=i),t.mergeFilter({range:{price:r}})})(m,t,e),this.getItems=t=>((t,e)=>(e||(e=t.result),Object(p.a)(e)))(m,t),this.getTotalCount=t=>((t,e)=>(e||(e=t.result||{}),e.hits?e.hits.total:void 0))(m,t),this.getTermSuggestions=t=>((t,e)=>(e||(e=t.result||{}),e.suggest&&e.suggest.words||[]))(m,t),this.getBrands=t=>((t,e)=>h(e||t.result||{},"brands"))(m,t),this.getCategories=t=>((t,e)=>h(e||t.result||{},"categories"))(m,t),this.getPriceRange=t=>((t,e)=>{e||(e=t.result||{});const{aggregations:i}=e;return i?{min:i.min_price&&i.min_price.value||0,avg:i.avg_price&&i.avg_price.value||0,max:i.max_price&&i.max_price.value||0}:{min:0,avg:0,max:0}})(m,t),this.getSpecs=t=>((t,e)=>{if(e||(e=t.result||{}),e.aggregations){const{specs:t}=e.aggregations;if(t&&t.grid&&Array.isArray(t.grid.buckets))return t.grid.buckets.map(t=>({key:t.key,doc_count:t.doc_count,options:t.text&&t.text.buckets||[]}))}return[]})(m,t),c(m),i&&e){const t=i.getItem(e);"string"==typeof t&&(m.history=t.split("||"))}};var g=(t,e)=>{o.push(i=>{u(i,{query:{bool:{filter:[{term:{[t]:e}}]}}})})};