{"version":3,"sources":["webpack:///./node_modules/nespresso-components/AddToCart/QuantitySelector.vue","webpack:///node_modules/nespresso-components/AddToCart/QuantitySelector.vue","webpack:///./node_modules/nespresso-components/AddToCart/QuantitySelector.vue?bab9","webpack:///./node_modules/nespresso-components/AddToCart/QuantitySelector.vue?edfa","webpack:///./node_modules/nespresso-library/src/utils/isTouch.js","webpack:///./node_modules/nespresso-components/AddToCart/QuantitySelector.vue?42d4"],"names":["render","_vm","this","_c","_self","staticClass","ref","attrs","opened","on","$event","$emit","domProps","_s","voices","close","howTo","preventDefault","isTouch","style","product","images","icon","_e","name","directives","rawName","value","showPriceInQS","expression","inStock","displayedPrice","_l","quantities","quantity","class","g_activeQuantity","activeQuantity","maxQuantity","set","btnLabelAdd","Infinity","warningProductLimit","_uid","chooseQuantity","customQuantity","step","otherQuantity","target","composing","_v","staticRenderFns","html","document","documentElement","props","Boolean","Object","Array","Number","String","type","default","data","created","setRule","watch","oldValue","sku","window","setTimeout","off","clickOutside","toggleClass","_lastPageYScroll","pageYOffset","scrollTo","indexOf","methods","isNaN","length","e","contains","$refs","quantityPopin","napi","market","getPackagingRules","then","packagingRules","packagingRule","products","id","unitQuantity","config","dataLayer","isMobile","isResponsive","isMosaic","labels","quantitySelector","replace","component","DocumentTouch"],"mappings":";2HAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,oBAAoB,CAACF,EAAG,MAAM,CAACG,IAAI,gBAAgBD,YAAY,mBAAmBE,MAAM,CAAC,SAAW,OAAO,CAACJ,EAAG,MAAM,CAACE,YAAY,4BAA4B,CAAEJ,EAAIO,OAAQ,CAACL,EAAG,SAAS,CAACE,YAAY,UAAUI,GAAG,CAAC,MAAQ,SAASC,GAAQ,OAAOT,EAAIU,MAAM,iBAAiB,MAAU,CAACR,EAAG,IAAI,CAACE,YAAY,WAAWE,MAAM,CAAC,cAAc,UAAUJ,EAAG,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C,OAAA,GACA9C,EAAA,KAAAI,cACAJ,EAAA,KAAAI,aAEA,IAAAqB,OAAA,KAAAd,kBACA,KAAAA,eAAA,MAEA,KAAAlC,MAAA,cAAAuB,GAAA,IAEAsC,aAAAS,GACA,KAAAzE,SAAA0E,eAAA,KAAAC,MAAAC,cAAAH,EAAAjC,SACA,KAAArC,MAAA,qBAGAsD,UACAI,OAAAgB,KACAC,SACAC,oBACAC,KAAAC,IACA,UAAAC,KAAAD,EACA,UAAArE,KAAAsE,EAAAC,SACA,GAAAvE,IAAA,KAAAA,QAAAwE,GAAA,CACA,WAAAF,EAAA7B,KAAA,CACA,KAAAvB,YAAAoD,EAAA/D,MAAA,KAAAP,QAAAyE,aACA,IAAAnD,EAAA2B,OAAAyB,OAEApD,EADAqD,OAAAC,SACAtD,sBACAqD,OAAAE,cAAAF,OAAAG,SACAxD,EAAAyD,OAAAC,iBAAA1D,oBAEA,GAEA,KAAAA,sBAAA2D,QAAA,MAAAX,EAAA/D,OAEA,YCzJyR,I,wBCQrR2E,EAAY,eACd,EACAtG,EACAmD,GACA,EACA,KACA,KACA,MAIa,aAAAmD,E,sECnBA,UAAI,iBAAkBjC,QAAYA,OAAOkC,eAAiBlD,oBAAoBgB,OAAOkC,gB,kCCApG","file":"js/QuantitySelector.js","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"g_quantity_scene\"},[_c('div',{ref:\"quantityPopin\",staticClass:\"g_quantity_popin\",attrs:{\"tabindex\":\"-1\"}},[_c('div',{staticClass:\"g_quantity-popin-content\"},[(_vm.opened)?[_c('button',{staticClass:\"g_close\",on:{\"click\":function($event){return _vm.$emit('update:opened', false)}}},[_c('i',{staticClass:\"fn_close\",attrs:{\"aria-hidden\":\"true\"}}),_c('span',{staticClass:\"g_visually_hidden\",domProps:{\"textContent\":_vm._s(_vm.voices.close)}})]),_c('p',{staticClass:\"g_visually_hidden\",domProps:{\"textContent\":_vm._s(_vm.voices.howTo)}}),_c('form',{attrs:{\"role\":\"form\"},on:{\"submit\":function($event){$event.preventDefault();}}},[_c('div',{staticClass:\"g_productRow\"},[_c('div',{staticClass:\"g_product\"},[(_vm.isTouch)?_c('div',{staticClass:\"g_productImage\",style:(`background-image: url(${_vm.product.images.icon})`)}):_vm._e(),_c('span',{domProps:{\"innerHTML\":_vm._s(_vm.product.name)}}),_c('p',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.showPriceInQS),expression:\"showPriceInQS\"}],staticClass:\"g_productPrice\",attrs:{\"data-disabled\":!_vm.product.inStock},domProps:{\"textContent\":_vm._s(_vm.product.displayedPrice)}})])]),_c('div',{staticClass:\"g_quantitySelectorRow\"},[_c('ul',{staticClass:\"g_quantitySelector\"},_vm._l((_vm.quantities),function(quantity){return _c('li',[_c('button',{class:{g_activeQuantity: quantity === _vm.activeQuantity },attrs:{\"disabled\":quantity > _vm.maxQuantity},on:{\"click\":function($event){return _vm.set(quantity)}}},[_c('span',{staticClass:\"g_visually_hidden\",domProps:{\"textContent\":_vm._s(_vm.btnLabelAdd)}}),_c('span',{domProps:{\"textContent\":_vm._s(quantity)}}),_c('span',{staticClass:\"g_visually_hidden\",domProps:{\"innerHTML\":_vm._s(_vm.product.name)}})])])}),0)]),_c('div',{staticClass:\"g_quantityOtherRow\"},[_c('div',{staticClass:\"g_quantityOther\"},[(_vm.maxQuantity < Infinity)?_c('label',{domProps:{\"textContent\":_vm._s(_vm.warningProductLimit)}}):[_c('label',{staticClass:\"g_visually_hidden\",attrs:{\"for\":'g_quantity_selector_other' + _vm._uid},domProps:{\"textContent\":_vm._s(_vm.voices.chooseQuantity)}}),(_vm.isTouch)?_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.customQuantity),expression:\"customQuantity\"}],attrs:{\"type\":\"number\",\"step\":_vm.step,\"min\":0,\"pattern\":\"[0-9]*\",\"inputmode\":\"numeric\",\"id\":'g_quantity_selector_other' + _vm._uid,\"placeholder\":_vm.voices.otherQuantity,\"aria-describedby\":'g_quantity_selector_hint' + _vm._uid,\"maxlength\":\"4\"},domProps:{\"value\":(_vm.customQuantity)},on:{\"input\":function($event){if($event.target.composing)return;_vm.customQuantity=$event.target.value}}}):_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.customQuantity),expression:\"customQuantity\"}],attrs:{\"type\":\"text\",\"step\":_vm.step,\"min\":0,\"pattern\":\"[0-9]*\",\"inputmode\":\"numeric\",\"id\":'g_quantity_selector_other' + _vm._uid,\"placeholder\":_vm.voices.otherQuantity,\"aria-describedby\":'g_quantity_selector_hint' + _vm._uid,\"maxlength\":\"4\"},domProps:{\"value\":(_vm.customQuantity)},on:{\"input\":function($event){if($event.target.composing)return;_vm.customQuantity=$event.target.value}}}),_c('span',{staticClass:\"g_visually_hidden\",attrs:{\"id\":'g_quantity_selector_hint' + _vm._uid},domProps:{\"textContent\":_vm._s(_vm.voices.otherQuantity)}}),_c('button',{staticClass:\"g_valid\",on:{\"click\":function($event){return _vm.set(_vm.customQuantity)}}},[_c('span',[_vm._v(\"OK\")])])]],2)])])]:_vm._e()],2)])])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<style lang=\"sass\">\n @import ~nespresso-bi/utilities\n @import ~nespresso-bi/brand/variables\n @import variables\n @import quantitySelector\n</style>\n\n<template lang=\"html\">\n <div class=\"g_quantity_scene\">\n <div class=\"g_quantity_popin\" ref=\"quantityPopin\" tabindex=\"-1\">\n <div class=\"g_quantity-popin-content\">\n <template v-if=\"opened\">\n <button class=\"g_close\" @click=\"$emit('update:opened', false)\">\n <i aria-hidden=\"true\" class=\"fn_close\"></i>\n <span class=\"g_visually_hidden\" v-text=\"voices.close\"></span>\n </button>\n <p class=\"g_visually_hidden\" v-text=\"voices.howTo\"></p>\n <form role=\"form\" @submit.prevent>\n <div class=\"g_productRow\">\n <div class=\"g_product\">\n <div class=\"g_productImage\" v-if=\"isTouch\" :style=\"`background-image: url(${product.images.icon})`\"></div>\n <span v-html=\"product.name\"></span>\n <p class=\"g_productPrice\" v-text=\"product.displayedPrice\" v-show=\"showPriceInQS\" :data-disabled=\"!product.inStock\"></p>\n </div>\n </div>\n <div class=\"g_quantitySelectorRow\">\n <ul class=\"g_quantitySelector\">\n <li v-for=\"quantity in quantities\">\n <button @click=\"set(quantity)\" :class=\"{g_activeQuantity: quantity === activeQuantity }\" :disabled=\"quantity > maxQuantity\">\n <span class=\"g_visually_hidden\" v-text=\"btnLabelAdd\"></span>\n <span v-text=\"quantity\"></span>\n <span v-html=\"product.name\" class=\"g_visually_hidden\"></span>\n </button>\n </li>\n </ul>\n </div>\n <div class=\"g_quantityOtherRow\">\n <div class=\"g_quantityOther\">\n <label v-if=\"maxQuantity < Infinity\" v-text=\"warningProductLimit\"></label>\n <template v-else>\n <label :for=\"'g_quantity_selector_other' + _uid\" v-text=\"voices.chooseQuantity\" class=\"g_visually_hidden\"></label><!--\n --><input v-if=\"isTouch\" v-model=\"customQuantity\" type=\"number\" :step=\"step\" :min=\"0\" pattern=\"[0-9]*\" inputmode=\"numeric\" :id=\"'g_quantity_selector_other' + _uid\" :placeholder=\"voices.otherQuantity\" :aria-describedby=\"'g_quantity_selector_hint' + _uid\" maxlength=\"4\"><!--\n --><input v-else v-model=\"customQuantity\" type=\"text\" :step=\"step\" :min=\"0\" pattern=\"[0-9]*\" inputmode=\"numeric\" :id=\"'g_quantity_selector_other' + _uid\" :placeholder=\"voices.otherQuantity\" :aria-describedby=\"'g_quantity_selector_hint' + _uid\" maxlength=\"4\"><!--\n --><span :id=\"'g_quantity_selector_hint' + _uid\" class=\"g_visually_hidden\" v-text=\"voices.otherQuantity\"></span><!--\n --><button class=\"g_valid\" @click=\"set(customQuantity)\">\n <span>OK</span>\n </button>\n </template>\n </div>\n </div>\n </form>\n </template>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { on, off, toggleClass, contains } from 'gaspard'\nimport dataLayer from 'nespresso-library/src/core/dataLayer'\nimport isTouch from 'nespresso-library/src/utils/isTouch'\n\nconst html = document.documentElement\n\nexport default {\n props: {\n opened: Boolean,\n product: Object,\n quantities: Array,\n voices: Object,\n activeQuantity: Number,\n step: Number,\n btnLabelAdd: String,\n showPriceInQS: {\n type: Boolean,\n default: false\n }\n },\n data () {\n return {\n customQuantity: null,\n // voiceClickToRemove: null,\n warningProductLimit: null,\n maxQuantity: Infinity,\n isTouch\n }\n },\n created () {\n this.setRule()\n },\n watch: {\n product (value, oldValue) {\n if (value.sku !== oldValue.sku) {\n this.setRule()\n }\n },\n opened (value) {\n this.$emit('update:opened', value)\n window.setTimeout(() => (value ? on : off)(document, 'click', this.clickOutside))\n if (value) {\n toggleClass(html, 'QSOpened', true)\n if (isTouch) {\n this._lastPageYScroll = window.pageYOffset\n }\n } else {\n window.setTimeout(() => toggleClass(html, 'QSOpened', false), 1500)\n if (isTouch && (this._lastPageYScroll !== window.pageYOffset)) {\n window.scrollTo(0, this._lastPageYScroll)\n }\n }\n },\n activeQuantity (value) {\n this.customQuantity = ~this.quantities.indexOf(value) ? null : value\n }\n },\n methods: {\n set (quantity) {\n quantity = Number(quantity)\n if (isNaN(quantity)) {\n quantity = this.quantities[this.quantities.length - 1]\n } else if (quantity > this.maxQuantity) {\n quantity = this.maxQuantity\n }\n if (Number(this.customQuantity) === 0) {\n this.customQuantity = null\n }\n this.$emit('setQuantity', quantity, true)\n },\n clickOutside (e) {\n if (this.opened && !contains(this.$refs.quantityPopin, e.target)) {\n this.$emit('update:opened', false)\n }\n },\n setRule () {\n window.napi\n .market()\n .getPackagingRules()\n .then(packagingRules => {\n for (const packagingRule of packagingRules) {\n for (const product of packagingRule.products) {\n if (product === this.product.id) {\n if (packagingRule.type === 'MAX') {\n this.maxQuantity = packagingRule.value / this.product.unitQuantity\n let warningProductLimit = window.config\n if (dataLayer.isMobile) {\n warningProductLimit = warningProductLimit.warningProductLimit\n } else if (dataLayer.isResponsive || dataLayer.isMosaic) {\n warningProductLimit = warningProductLimit.labels.quantitySelector.warningProductLimit\n } else {\n warningProductLimit = ''\n }\n this.warningProductLimit = warningProductLimit.replace('{0}', packagingRule.value)\n }\n break\n }\n }\n }\n })\n }\n }\n}\n</script>\n","import mod from \"-!../../cache-loader/dist/cjs.js??ref--12-0!../../thread-loader/dist/cjs.js!../../babel-loader/lib/index.js!../../cache-loader/dist/cjs.js??ref--0-0!../../vue-loader/lib/index.js??vue-loader-options!./QuantitySelector.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../cache-loader/dist/cjs.js??ref--12-0!../../thread-loader/dist/cjs.js!../../babel-loader/lib/index.js!../../cache-loader/dist/cjs.js??ref--0-0!../../vue-loader/lib/index.js??vue-loader-options!./QuantitySelector.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./QuantitySelector.vue?vue&type=template&id=9aa9ae18&lang=html&\"\nimport script from \"./QuantitySelector.vue?vue&type=script&lang=js&\"\nexport * from \"./QuantitySelector.vue?vue&type=script&lang=js&\"\nimport style0 from \"./QuantitySelector.vue?vue&type=style&index=0&id=9aa9ae18&prod&lang=sass&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","export default !!(('ontouchstart' in window) || (window.DocumentTouch && document instanceof window.DocumentTouch))\n","export * from \"-!../../mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../css-loader/index.js??ref--9-oneOf-1-1!../../vue-loader/lib/loaders/stylePostLoader.js!../../postcss-loader/src/index.js??ref--9-oneOf-1-2!../../sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../style-resources-loader/lib/index.js??ref--9-oneOf-1-4!../../cache-loader/dist/cjs.js??ref--0-0!../../vue-loader/lib/index.js??vue-loader-options!./QuantitySelector.vue?vue&type=style&index=0&id=9aa9ae18&prod&lang=sass&\""],"sourceRoot":""}