is important, see: http://vuejs.org/guide/components.html#Named-Slots\n // template: '
',\n // NOTE: Instead of using `template` we can use the `render` function like so:\n render(h)\n {\n return h(\"div\", { style: \"display:none\" }, this.$slots.default);\n },\n mounted()\n {\n const parent = this.$el.parentElement;\n\n if (!this.src)\n {\n Script2.p = Script2.p.then(() =>\n {\n const s = document.createElement(\"script\");\n\n let h = this.$el.innerHTML;\n\n h = h.replace(/</gi, \"<\").replace(/>/gi, \">\").replace(/&/gi, \"&\");\n s.type = this.type || \"text/javascript\";\n s.appendChild(document.createTextNode(h));\n parent.appendChild(s);\n this.$emit(\"loaded\"); // any other proper way to do this or emit error?\n });\n }\n else\n {\n const opts = _.omitBy(_.pick(this, props), _.isUndefined);\n\n opts.parent = parent;\n // this syntax results in an implicit return\n const load = () => Script2.load(this.src, opts).then(\n () => this.$emit(\"loaded\"),\n (err) => this.$emit(\"error\", err)\n );\n\n _.isUndefined(this.async) || this.async === \"false\"\n ? Script2.p = Script2.p.then(load) // serialize execution\n : load(); // inject immediately\n }\n // see: https://vuejs.org/v2/guide/migration.html#ready-replaced\n this.$nextTick(() =>\n {\n // code that assumes this.$el is in-document\n // NOTE: we could've done this.$el.remove(), but IE sucks, see:\n // https://github.com/taoeffect/vue-script2/pull/17\n this.$el.parentElement.removeChild(this.$el); // remove dummy template \n });\n },\n destroyed()\n {\n if (this.unload)\n {\n new Function(this.unload)() // eslint-disable-line\n delete Script2.loaded[this.src];\n }\n }\n });\n Script2.installed = true;\n },\n load(src, opts = { parent: document.head })\n {\n if (!Script2.loaded[src])\n {\n Script2.loaded[src] = new Promise((resolve, reject) =>\n {\n const s = document.createElement(\"script\");\n // omit the special options that Script2 supports\n\n _.defaults2(s, _.omit(opts, [\"unload\", \"parent\"]), { type: \"text/javascript\" });\n // according to: http://www.html5rocks.com/en/tutorials/speed/script-loading/\n // async does not like 'document.write' usage, which we & vue.js make\n // heavy use of based on the SPA style. Also, async can result\n // in code getting executed out of order from how it is inlined on the page.\n s.async = false; // therefore set this to false\n s.src = src;\n // crossorigin in HTML and crossOrigin in the DOM per HTML spec\n // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-crossorigin\n if (opts.crossorigin)\n {\n s.crossOrigin = opts.crossorigin;\n }\n // inspiration from: https://github.com/eldargab/load-script/blob/master/index.js\n // and: https://github.com/ded/script.js/blob/master/src/script.js#L70-L82\n s.onload = () => resolve(src);\n // IE should now support onerror and onload. If necessary, take a look\n // at this to add older IE support: http://stackoverflow.com/a/4845802/1781435\n s.onerror = () => reject(new Error(src));\n opts.parent.appendChild(s);\n });\n }\n return Script2.loaded[src];\n }\n};\n\nconst _ = {\n isUndefined(x)\n {\n return x === undefined;\n },\n pick(o, props)\n {\n const x = {};\n\n props.forEach(k =>\n {\n x[k] = o[k];\n });\n return x;\n },\n omit(o, props)\n {\n const x = {};\n\n Object.keys(o).forEach((k) =>\n {\n if (props.indexOf(k) === -1) x[k] = o[k];\n });\n return x;\n },\n omitBy(o, pred)\n {\n const x = {};\n\n Object.keys(o).forEach((k) =>\n {\n if (!pred(o[k])) x[k] = o[k];\n });\n return x;\n },\n // custom defaults function suited to our specific purpose\n defaults2(o, ...sources)\n {\n sources.forEach((s) =>\n {\n Object.keys(s).forEach((k) =>\n {\n if (_.isUndefined(o[k]) || o[k] === \"\") o[k] = s[k];\n });\n });\n }\n};\n\nexport default Script2;\n","import Vue from \"vue\";\n\nVue.mixin({\n props: {\n // used to override the sfc template - takes an html elements id (#el-id)\n templateOverride: {\n type: String,\n default: \"\"\n }\n },\n\n created()\n {\n if (this.$props && this.$props.template)\n {\n this.$options.template = this.$props.template;\n }\n }\n});\n","import { isNullOrUndefined } from \"../helper/utils\";\nimport Vue from \"vue\";\n\nVue.config.optionMergeStrategies.jsonDataFields = function(parent, child, vm)\n{\n return child || [];\n};\n\nVue.mixin({\n created()\n {\n if (!isNullOrUndefined(this.$options.jsonDataFields))\n {\n this.$options.jsonDataFields.forEach(dataField =>\n {\n const attrKey = dataField.replace(/([a-z])([A-Z])/g, \"$1-$2\")\n .replace(/\\s+/g, \"-\")\n .toLowerCase();\n\n const uid = this.$attrs[attrKey];\n\n if (typeof document !== \"undefined\")\n {\n // read json data from dom element on client side\n const element = document.getElementById(uid);\n\n if (!isNullOrUndefined(element))\n {\n this[dataField] = JSON.parse(element.textContent);\n }\n }\n else if (typeof jsonData !== \"undefined\")\n {\n // read json data from global object during ssr\n this[dataField] = jsonData[uid];\n }\n });\n }\n }\n});\n","import { floatLength } from \"../../helper/number\";\nimport { defaultValue } from \"../../helper/utils\";\nimport Vue from \"vue\";\n\nVue.directive(\"basket-item-quantity\",\n {\n update(el, binding)\n {\n const value = defaultValue(binding.value, 0);\n const decimals = floatLength(value);\n\n el.innerHTML = value.toFixed(decimals).replace(\".\", App.decimalSeparator);\n }\n });\n","import Vue from \"vue\";\n\nVue.directive(\"basket-item-sum\",\n {\n update(el, binding)\n {\n el.innerHTML = Vue.filter(\"currency\").apply(Object, [binding.value]);\n }\n });\n","import Vue from \"vue\";\n\nconst BASKET_PREVIEW_COMPONENT_NAME = \"basket-preview\";\n\nVue.directive(\"toggle-basket-preview\",\n {\n bind(el)\n {\n el.addEventListener(\"click\", event =>\n {\n let timeout = 0;\n\n // trigger the lazyloading of the basket-preview\n if (!vueApp.$store.state.lazyComponent.components.hasOwnProperty(BASKET_PREVIEW_COMPONENT_NAME))\n {\n vueApp.$store.dispatch(\"loadComponent\", BASKET_PREVIEW_COMPONENT_NAME);\n timeout = 100;\n }\n\n // postpone the opening for 100ms, to prevent markup jumps\n setTimeout(() =>\n {\n document.body.classList.toggle(\"basket-open\");\n }, timeout);\n\n event.preventDefault();\n event.stopPropagation();\n });\n }\n });\n","import Vue from \"vue\";\n\nVue.directive(\"open-filter-toolbar\",\n {\n bind(el)\n {\n const openFilterToolbar = window.localStorage.getItem(\"openFilterToolbar\") === \"true\";\n\n if (openFilterToolbar)\n {\n window.localStorage.removeItem(\"openFilterToolbar\");\n\n Vue.nextTick(() =>\n {\n $(el).collapse(\"show\");\n });\n }\n }\n });\n","import { debounce } from \"../../helper/debounce\";\nimport Vue from \"vue\";\n\n/**\n * @deprecated since version 5.0.29\n */\nVue.directive(\"truncate-tooltip\",\n {\n inserted(element)\n {\n const tooltip = function()\n {\n const outer = element.offsetWidth;\n const inner = element.children[0].scrollWidth;\n const title = element.children[0].title;\n\n if (title)\n {\n element.children[0].dataset.originalTitle = title;\n }\n else if (inner > outer)\n {\n element.children[0].dataset.originalTitle = element.children[0].text;\n }\n else\n {\n element.children[0].dataset.originalTitle = \"\";\n }\n };\n\n document.addEventListener(\"DOMContentLoaded\", event =>\n {\n tooltip();\n });\n\n window.addEventListener(\"resize\", debounce( event =>\n {\n tooltip();\n }, 500));\n }\n });\n","import { navigateTo } from \"../../services/UrlService\";\nimport Vue from \"vue\";\n\nconst ApiService = require(\"../../services/ApiService\");\n\nVue.directive(\"logout\",\n {\n bind(el)\n {\n /**\n * Logout the current user\n */\n $(el).click(\n function(event)\n {\n $(el).addClass(\"disabled\");\n\n ApiService.post(\"/rest/io/customer/logout\")\n .done(\n function()\n {\n let url = window.location.origin;\n\n if (App.defaultLanguage != App.language)\n {\n url = url + \"/\" + App.language;\n if (App.urlTrailingSlash)\n {\n url += \"/\";\n }\n }\n navigateTo(url);\n })\n .fail(\n function()\n {\n $(el).removeClass(\"disabled\");\n });\n\n event.preventDefault();\n });\n }\n });\n","import dayjs from \"dayjs\";\n\nconst ApiService = require(\"../../services/ApiService\");\n\nconst state = () => ({\n billingAddressId: null,\n billingAddress: null,\n billingAddressList: [],\n deliveryAddressId: null,\n deliveryAddress: null,\n deliveryAddressList: []\n});\n\nconst mutations =\n {\n setBillingAddressList(state, billingAddressList)\n {\n if (Array.isArray(billingAddressList))\n {\n state.billingAddressList = billingAddressList;\n }\n },\n\n selectBillingAddress(state, billingAddress)\n {\n if (billingAddress)\n {\n state.billingAddressId = billingAddress.id;\n state.billingAddress = billingAddress;\n }\n },\n\n selectBillingAddressById(state, billingAddressId)\n {\n if (billingAddressId)\n {\n const billingAddress = state.billingAddressList.find(address => address.id === billingAddressId);\n\n if (billingAddress)\n {\n state.billingAddressId = billingAddress.id;\n state.billingAddress = billingAddress;\n document.dispatchEvent(new CustomEvent(\"billingAddressChanged\", state.billingAddress));\n }\n }\n },\n\n selectDeliveryAddressById(state, deliveryAddressId)\n {\n if (!deliveryAddressId)\n {\n deliveryAddressId = -99;\n }\n\n if (deliveryAddressId)\n {\n const deliveryAddress = state.deliveryAddressList.find(address => address.id === deliveryAddressId);\n\n if (deliveryAddress)\n {\n state.deliveryAddressId = deliveryAddress.id;\n state.deliveryAddress = deliveryAddress;\n document.dispatchEvent(new CustomEvent(\"deliveryAddressChanged\", state.deliveryAddress));\n }\n }\n },\n\n setDeliveryAddressList(state, deliveryAddressList)\n {\n if (Array.isArray(deliveryAddressList))\n {\n state.deliveryAddressList = deliveryAddressList;\n }\n },\n\n selectDeliveryAddress(state, deliveryAddress)\n {\n if (deliveryAddress)\n {\n state.deliveryAddressId = deliveryAddress.id;\n state.deliveryAddress = deliveryAddress;\n }\n },\n\n removeBillingAddress(state, billingAddress)\n {\n const index = state.billingAddressList.indexOf(billingAddress);\n\n if (index !== -1)\n {\n state.billingAddressList.splice(index, 1);\n\n if (state.billingAddress === billingAddress)\n {\n state.billingAddress = null;\n state.billingAddressId = null;\n document.dispatchEvent(new CustomEvent(\"billingAddressChanged\", null));\n }\n }\n },\n\n removeDeliveryAddress(state, deliveryAddress)\n {\n const index = state.deliveryAddressList.indexOf(deliveryAddress);\n\n if (index !== -1)\n {\n state.deliveryAddressList.splice(index, 1);\n\n if (state.deliveryAddress === deliveryAddress)\n {\n state.deliveryAddress = state.deliveryAddressList.find(address => address.id === -99);\n state.deliveryAddressId = -99;\n document.dispatchEvent(new CustomEvent(\"deliveryAddressChanged\", state.deliveryAddress));\n }\n }\n },\n\n addBillingAddress(state, { billingAddress, addressIndex })\n {\n\n if (billingAddress)\n {\n if (addressIndex)\n {\n state.billingAddressList.splice(addressIndex, 0, billingAddress);\n }\n else\n {\n const indexToUpdate = state.billingAddressList.findIndex(entry => entry.id === billingAddress.id);\n\n if (indexToUpdate === -1)\n {\n state.billingAddressList.push(billingAddress);\n }\n state.billingAddressId = billingAddress.id;\n state.billingAddress = billingAddress;\n document.dispatchEvent(new CustomEvent(\"billingAddressChanged\", state.billingAddress));\n }\n }\n },\n\n addDeliveryAddress(state, { deliveryAddress, addressIndex })\n {\n if (deliveryAddress)\n {\n if (addressIndex)\n {\n state.deliveryAddressList.splice(addressIndex, 0, deliveryAddress);\n }\n else\n {\n const indexToUpdate = state.deliveryAddressList.findIndex(entry => entry.id === deliveryAddress.id);\n\n if (indexToUpdate === -1)\n {\n state.deliveryAddressList.push(deliveryAddress);\n }\n state.deliveryAddressId = deliveryAddress.id;\n state.deliveryAddress = deliveryAddress;\n document.dispatchEvent(new CustomEvent(\"deliveryAddressChanged\", state.deliveryAddress));\n }\n }\n },\n\n updateBillingAddress(state, billingAddress)\n {\n if (billingAddress)\n {\n const indexToUpdate = state.billingAddressList.findIndex(entry => entry.id === billingAddress.id);\n\n // using this \"trick\" to trigger the address list to render again\n state.billingAddressList.splice(indexToUpdate, 1);\n state.billingAddressList.splice(indexToUpdate, 0, billingAddress);\n\n if (billingAddress.id === state.billingAddressId)\n {\n state.billingAddress = billingAddress;\n document.dispatchEvent(new CustomEvent(\"billingAddressChanged\", state.billingAddress));\n }\n }\n },\n\n updateDeliveryAddress(state, deliveryAddress)\n {\n if (deliveryAddress)\n {\n const indexToUpdate = state.deliveryAddressList.findIndex(entry => entry.id === deliveryAddress.id);\n\n // using this \"trick\" to trigger the address list to render again\n state.deliveryAddressList.splice(indexToUpdate, 1);\n state.deliveryAddressList.splice(indexToUpdate, 0, deliveryAddress);\n\n if (deliveryAddress.id === state.deliveryAddressId)\n {\n state.deliveryAddress = deliveryAddress;\n document.dispatchEvent(new CustomEvent(\"deliveryAddressChanged\", state.deliveryAddress));\n }\n\n }\n },\n\n resetAddress(state, addressType)\n {\n if (addressType === \"1\")\n {\n state.billingAddress = null;\n state.billingAddressId = null;\n state.billingAddressList = [];\n document.dispatchEvent(new CustomEvent(\"billingAddressChanged\", null));\n }\n else if (addressType === \"2\")\n {\n state.deliveryAddressList = [{ id: -99 }];\n state.deliveryAddress = state.deliveryAddressList[0];\n state.deliveryAddressId = state.deliveryAddressList[0].id;\n document.dispatchEvent(new CustomEvent(\"deliveryAddressChanged\", state.deliveryAddress));\n }\n }\n };\n\nconst actions =\n {\n initBillingAddress({ commit }, { id, addressList })\n {\n // format dates from the old ui into ISO\n addressList.forEach(address =>\n {\n const option = address.options.find(option => option.typeId === 9);\n\n if (option && isNaN(Date.parse(option.value)))\n {\n option.value = dayjs(option.value * 1000).format(\"YYYY-MM-DD\");\n }\n });\n\n commit(\"setBillingAddressList\", addressList);\n commit(\"selectBillingAddress\", addressList.find(address => address.id === id));\n document.dispatchEvent(new CustomEvent(\"billingAddressChanged\", state.billingAddress));\n },\n\n initDeliveryAddress({ commit }, { id, addressList })\n {\n addressList.unshift({ id: -99 });\n if (addressList.every(address => address.id !== id))\n {\n id = -99;\n }\n\n commit(\"setDeliveryAddressList\", addressList);\n commit(\"selectDeliveryAddress\", addressList.find(address => address.id === id));\n document.dispatchEvent(new CustomEvent(\"deliveryAddressChanged\", state.deliveryAddress));\n },\n\n selectAddress({ commit, state, rootState, dispatch }, { selectedAddress, addressType })\n {\n return new Promise((resolve, reject) =>\n {\n let oldAddress = {};\n\n if (addressType === \"1\")\n {\n oldAddress = state.billingAddress;\n commit(\"selectBillingAddress\", selectedAddress);\n }\n else if (addressType === \"2\")\n {\n oldAddress = state.deliveryAddress;\n commit(\"selectDeliveryAddress\", selectedAddress);\n }\n\n commit(\"setIsBasketLoading\", true);\n\n ApiService.put(\"/rest/io/customer/address/\" + selectedAddress.id + \"?typeId=\" + addressType, { supressNotifications: true })\n .done(response =>\n {\n commit(\"setIsBasketLoading\", false);\n if (addressType === \"1\")\n {\n document.dispatchEvent(new CustomEvent(\"billingAddressChanged\", state.billingAddress));\n }\n else if (addressType === \"2\")\n {\n document.dispatchEvent(new CustomEvent(\"deliveryAddressChanged\", state.deliveryAddress));\n }\n return resolve(response);\n })\n .fail(error =>\n {\n if (addressType === \"1\")\n {\n commit(\"selectBillingAddress\", oldAddress);\n }\n else if (addressType === \"2\")\n {\n commit(\"selectDeliveryAddress\", oldAddress);\n }\n\n commit(\"setIsBasketLoading\", false);\n reject(error);\n });\n });\n },\n\n deleteAddress({ dispatch, state, commit }, { address, addressType })\n {\n return new Promise((resolve, reject) =>\n {\n let addressIndex = -1;\n\n if (addressType === \"1\")\n {\n addressIndex = state.billingAddressList.indexOf(address);\n commit(\"removeBillingAddress\", address);\n }\n else if (addressType === \"2\")\n {\n addressIndex = state.deliveryAddressList.indexOf(address);\n commit(\"removeDeliveryAddress\", address);\n }\n\n ApiService.del(\"/rest/io/customer/address/\" + address.id + \"?typeId=\" + addressType, null, { keepOriginalResponse: true })\n .done(response =>\n {\n if (addressType === \"1\" && response.events && response.events.CheckoutChanged && response.events.CheckoutChanged.checkout)\n {\n const billingAddressId = response.events.CheckoutChanged.checkout.billingAddressId;\n\n commit(\"selectBillingAddressById\", billingAddressId);\n }\n\n resolve(response);\n })\n .fail(error =>\n {\n if (addressType === \"1\")\n {\n commit(\"addBillingAddress\", { billingAddress: address, addressIndex });\n }\n else if (addressType === \"2\")\n {\n commit(\"addDeliveryAddress\", { deliveryAddress: address, addressIndex });\n }\n reject(error);\n });\n });\n },\n\n createAddress({ commit, dispatch }, { address, addressType })\n {\n return new Promise((resolve, reject) =>\n {\n ApiService.post(\"/rest/io/customer/address?typeId=\" + addressType, address, { supressNotifications: true })\n .done(response =>\n {\n if (addressType === \"1\")\n {\n commit(\"addBillingAddress\", { billingAddress: response });\n }\n else if (addressType === \"2\")\n {\n commit(\"addDeliveryAddress\", { deliveryAddress: response });\n }\n\n resolve(response);\n })\n .fail(error =>\n {\n reject(error);\n });\n });\n },\n\n updateAddress({ commit, dispatch }, { address, addressType })\n {\n return new Promise((resolve, reject) =>\n {\n ApiService.post(\"/rest/io/customer/address?typeId=\" + addressType, address, { supressNotifications: true, keepOriginalResponse: true })\n .done(response =>\n {\n if (addressType === \"1\")\n {\n if (response.events\n && response.events.CheckoutChanged\n && response.events.CheckoutChanged.checkout)\n {\n address.id = response.events.CheckoutChanged.checkout.billingAddressId;\n commit(\"addBillingAddress\", { billingAddress: address });\n }\n\n commit(\"updateBillingAddress\", address);\n }\n else if (addressType === \"2\")\n {\n if (response.events\n && response.events.CheckoutChanged\n && response.events.CheckoutChanged.checkout)\n {\n address.id = response.events.CheckoutChanged.checkout.deliveryAddressId;\n commit(\"addDeliveryAddress\", { deliveryAddress: address });\n }\n\n commit(\"updateDeliveryAddress\", address);\n }\n\n resolve(response);\n })\n .fail(error =>\n {\n reject(error);\n });\n });\n }\n };\n\nconst getters =\n {\n getSelectedAddress: state => addressType =>\n {\n let selectedAddress;\n\n if (addressType === \"1\")\n {\n selectedAddress = state.billingAddress;\n }\n else if (addressType === \"2\")\n {\n selectedAddress = state.deliveryAddress;\n }\n\n return selectedAddress;\n },\n\n getAddressList: state => addressType =>\n {\n let addressList = [];\n\n if (addressType === \"1\")\n {\n addressList = state.billingAddressList;\n }\n else if (addressType === \"2\")\n {\n addressList = state.deliveryAddressList;\n }\n\n return addressList;\n }\n };\n\nexport default\n{\n state,\n mutations,\n actions,\n getters\n};\n","import Vue from \"vue\";\nimport { navigateTo } from \"../../services/UrlService\";\nimport { pathnameEquals } from \"../../helper/url\";\nimport { isNullOrUndefined, isDefined } from \"../../helper/utils\";\nconst ApiService = require(\"../../services/ApiService\");\n\n// cache updated base prices for performance purposes\nconst updatedItemBasePriceCache = {};\nconst state = () => ({\n data: {},\n items: [],\n showNetPrices: false,\n isBasketLoading: false,\n isBasketInitiallyLoaded: false,\n isBasketItemQuantityUpdate: false,\n basketNotifications: []\n});\n\nconst mutations =\n {\n setBasket(state, basket)\n {\n if (state.data.sessionId && JSON.stringify(basket) !== JSON.stringify(state.data))\n {\n document.dispatchEvent(new CustomEvent(\"afterBasketChanged\", { detail: basket }));\n }\n\n state.data = basket;\n },\n\n setBasketItems(state, basketItems)\n {\n state.items = basketItems;\n },\n\n updateBasketItems(state, basketItems)\n {\n if (basketItems && state.items.length)\n {\n const newItems = [];\n\n for (const item of basketItems)\n {\n _fillMissingData(state, item);\n newItems.push(item);\n }\n\n state.items = newItems;\n }\n },\n\n addBasketItem(state, basketItems)\n {\n for (let i = 0; i < basketItems.length; i++)\n {\n const basketItem = basketItems[i];\n const basketItemIndex = state.items.findIndex(item => basketItem.id === item.id);\n\n if (basketItemIndex !== -1)\n {\n state.items.splice(basketItemIndex, 1, basketItem);\n }\n else\n {\n // use array clone to keep activity, could be removed with usage of vue3\n const clonedItems = state.items.slice(0);\n\n clonedItems.push(basketItem);\n state.items = clonedItems;\n }\n }\n },\n\n updateBasketItem(state, basketItem)\n {\n const entry = state.items.find(item => item.id === basketItem.id);\n\n if (!isNullOrUndefined(entry))\n {\n entry.price = basketItem.price;\n entry.quantity = basketItem.quantity;\n\n // check if the 'AfterBasketItemUpdate' contains a new base price for the item (graduated prices)\n if (!isNullOrUndefined(basketItem.basePrice))\n {\n Vue.set(entry, \"updatedBasePrice\", basketItem.basePrice);\n updatedItemBasePriceCache[basketItem.id] = basketItem.basePrice;\n }\n }\n },\n\n addBasketNotification(state, { type, message })\n {\n state.basketNotifications.push({ type: type, message: message });\n },\n\n clearOldestNotification(state)\n {\n state.basketNotifications.splice(0, 1);\n },\n\n updateBasketItemQuantity(state, basketItem)\n {\n const item = state.items.find(item => basketItem.id === item.id);\n\n item.quantity = basketItem.quantity;\n },\n\n setIsBasketItemQuantityUpdate(state, isBasketItemQuantityUpdate)\n {\n state.isBasketItemQuantityUpdate = isBasketItemQuantityUpdate;\n },\n\n removeBasketItem(state, basketItemId)\n {\n state.items = state.items.filter(item => item.id !== basketItemId);\n },\n\n setCouponCode(state, couponCode)\n {\n state.data.couponCode = couponCode;\n },\n\n setIsBasketLoading(state, isBasketLoading)\n {\n state.isBasketLoading = !!isBasketLoading;\n },\n\n setIsBasketInitiallyLoaded(state)\n {\n state.isBasketInitiallyLoaded = true;\n },\n\n setShowNetPrices(state, showNetPrices)\n {\n state.showNetPrices = showNetPrices;\n }\n };\n\nconst actions =\n {\n loadBasketData({ state, commit })\n {\n console.warn(\"This action is not in use anymore and should not be committed anymore.\");\n },\n\n addBasketNotification({ commit }, { type, message })\n {\n commit(\"addBasketNotification\", { type, message });\n\n setTimeout(() =>\n {\n commit(\"clearOldestNotification\");\n }, 5000);\n },\n\n addBasketItem({ commit }, basketItem)\n {\n return new Promise((resolve, reject) =>\n {\n commit(\"setIsBasketLoading\", true);\n\n basketItem.template = \"Ceres::Basket.Basket\";\n ApiService.post(\"/rest/io/basket/items/\", basketItem)\n .done(response =>\n {\n commit(\"setIsBasketLoading\", false);\n resolve(response);\n })\n .fail(error =>\n {\n commit(\"setIsBasketLoading\", false);\n reject(error);\n });\n });\n },\n\n updateBasketItemQuantity({ commit }, basketItem)\n {\n return new Promise((resolve, reject) =>\n {\n commit(\"updateBasketItemQuantity\", basketItem);\n commit(\"setIsBasketItemQuantityUpdate\", true);\n commit(\"setIsBasketLoading\", true);\n\n basketItem.template = \"Ceres::Basket.Basket\";\n ApiService.put(\"/rest/io/basket/items/\" + basketItem.id, basketItem)\n .done(response =>\n {\n commit(\"setIsBasketLoading\", false);\n resolve(response);\n })\n .fail(error =>\n {\n commit(\"setIsBasketLoading\", false);\n reject(error);\n });\n });\n },\n\n removeBasketItem({ state, commit }, basketItemId)\n {\n return new Promise((resolve, reject) =>\n {\n commit(\"setIsBasketLoading\", true);\n\n ApiService.del(\"/rest/io/basket/items/\" + basketItemId, { template: \"Ceres::Basket.Basket\" })\n .done(response =>\n {\n commit(\"setIsBasketLoading\", false);\n commit(\"removeBasketItem\", basketItemId);\n resolve(response);\n\n if (pathnameEquals(App.urls.checkout) && state.items.length === 0)\n {\n navigateTo(App.urls.basket);\n }\n })\n .fail(error =>\n {\n commit(\"setIsBasketLoading\", false);\n reject(error);\n });\n });\n },\n\n redeemCouponCode({ state, commit }, couponCode)\n {\n return new Promise((resolve, reject) =>\n {\n commit(\"setIsBasketLoading\", true);\n\n ApiService.post(\"/rest/io/coupon\", { couponCode }, { supressNotifications: true })\n .done(data =>\n {\n commit(\"setCouponCode\", couponCode);\n commit(\"setIsBasketLoading\", false);\n resolve(data);\n })\n .fail(error =>\n {\n commit(\"setIsBasketLoading\", false);\n reject(error);\n });\n });\n },\n\n removeCouponCode({ state, commit }, couponCode)\n {\n return new Promise((resolve, reject) =>\n {\n commit(\"setIsBasketLoading\", true);\n\n ApiService.del(\"/rest/io/coupon/\" + couponCode)\n .done(data =>\n {\n commit(\"setCouponCode\", null);\n commit(\"setIsBasketLoading\", false);\n resolve(data);\n })\n .fail(error =>\n {\n commit(\"setIsBasketLoading\", false);\n reject(error);\n });\n });\n },\n\n refreshBasket({ commit })\n {\n return new Promise((resolve, reject) =>\n {\n ApiService.get(\"/rest/io/basket/\")\n .done(basket =>\n {\n commit(\"setBasket\", basket);\n resolve(basket);\n })\n .fail(error =>\n {\n reject(error);\n });\n });\n }\n };\n\nfunction _fillMissingData(state, item)\n{\n let oldBasketItem = null;\n\n if (isNullOrUndefined(item.variation))\n {\n oldBasketItem = state.items.find(i => i.id === item.id);\n item.variation = oldBasketItem.variation;\n }\n\n if (isDefined(item.basketItemOrderParams))\n {\n item.basketItemOrderParams.forEach(param =>\n {\n const propToUpdate = item.variation.data.properties.find(prop => prop.propertyId === Number(param.propertyId));\n\n propToUpdate.property.surcharge = param.price || propToUpdate.property.surcharge;\n });\n }\n\n if (isNullOrUndefined(item.basketItemOrderParams))\n {\n oldBasketItem = oldBasketItem || state.items.find(i => i.id === item.id);\n item.basketItemOrderParams = oldBasketItem.basketItemOrderParams;\n }\n\n if (isDefined(item.setComponents) &&\n item.setComponents.length > 0 &&\n isNullOrUndefined(item.setComponents[0].variation))\n {\n oldBasketItem = oldBasketItem || state.items.find(i => i.id === item.id);\n\n if (oldBasketItem.setComponents && oldBasketItem.setComponents.length > 0)\n {\n for (const setComponent of item.setComponents)\n {\n const oldComp = oldBasketItem.setComponents.find(comp => comp.variationId === setComponent.variationId);\n\n setComponent.variation = oldComp.variation;\n\n if (isNullOrUndefined(setComponent.basketItemOrderParams))\n {\n setComponent.basketItemOrderParams = oldComp.basketItemOrderParams;\n }\n }\n }\n }\n\n if (updatedItemBasePriceCache.hasOwnProperty(item.id))\n {\n item.updatedBasePrice = updatedItemBasePriceCache[item.id];\n delete updatedItemBasePriceCache[item.id];\n }\n}\n\nexport default\n{\n state,\n mutations,\n actions\n};\n","import { isNullOrUndefined } from \"../../helper/utils\";\n\nconst ApiService = require(\"../../services/ApiService\");\n\nconst state = () => ({\n shipping: {\n isParcelBoxAvailable: false,\n isPostOfficeAvailable: false,\n selectedShippingProfile: null,\n shippingProfileId: null,\n shippingProfileList: [],\n maxDeliveryDays: null\n },\n payment: {\n methodOfPaymentId: null,\n methodOfPaymentList: []\n },\n contactWish: null,\n customerSign: null,\n shippingPrivacyHintAccepted: false,\n validation: {\n gtc: {\n showError: false,\n validate: null\n },\n invoiceAddress: {\n showError: false,\n validate: null\n },\n paymentProvider: {\n showError: false,\n validate: null\n },\n shippingProfile: {\n showError: false,\n validate: null\n },\n deliveryAddress: {\n showError: false,\n validate: null\n }\n },\n newsletterSubscription: {},\n readOnly: false\n});\n\nconst mutations =\n {\n setShippingProfile(state, shippingProfileId)\n {\n if (shippingProfileId)\n {\n state.shipping.shippingProfileId = shippingProfileId;\n\n const selectedShippingProfile = state.shipping.shippingProfileList.find(shipping => shipping.parcelServicePresetId === shippingProfileId);\n\n state.shipping.selectedShippingProfile = selectedShippingProfile;\n }\n },\n\n setSelectedShippingProfile(state, shippingProfile)\n {\n state.shipping.selectedShippingProfile = shippingProfile;\n state.shipping.shippingProfileId = shippingProfile.parcelServicePresetId;\n },\n\n setShippingProfileList(state, shippingProfileList)\n {\n if (Array.isArray(shippingProfileList))\n {\n state.shipping.shippingProfileList = shippingProfileList;\n }\n },\n\n setMaxDeliveryDays(state, maxDeliveryDays)\n {\n state.shipping.maxDeliveryDays = maxDeliveryDays;\n },\n\n setMethodOfPayment(state, methodOfPaymentId)\n {\n if (methodOfPaymentId)\n {\n state.payment.methodOfPaymentId = methodOfPaymentId;\n }\n },\n\n setMethodOfPaymentList(state, methodOfPaymentList)\n {\n if (Array.isArray(methodOfPaymentList))\n {\n state.payment.methodOfPaymentList = methodOfPaymentList;\n }\n },\n\n setContactWish(state, contactWish)\n {\n state.contactWish = contactWish;\n },\n\n setCustomerSign(state, customerSign)\n {\n state.customerSign = customerSign;\n },\n\n setShippingPrivacyHintAccepted(state, value)\n {\n state.shippingPrivacyHintAccepted = value;\n },\n\n setPaymentProviderValidator(state, paymentProviderValidator)\n {\n state.validation.paymentProvider.validate = paymentProviderValidator;\n },\n\n setPaymentProviderShowError(state, showError)\n {\n state.validation.paymentProvider.showError = showError;\n },\n\n setShippingProfileValidator(state, shippingProfileValidator)\n {\n state.validation.shippingProfile.validate = shippingProfileValidator;\n },\n\n setShippingProfileShowError(state, showError)\n {\n state.validation.shippingProfile.showError = showError;\n },\n\n setGtcValidator(state, gtcValidator)\n {\n state.validation.gtc.validate = gtcValidator;\n },\n\n setGtcShowError(state, showError)\n {\n state.validation.gtc.showError = showError;\n },\n\n setInvoiceAddressValidator(state, invoiceAddressValidator)\n {\n state.validation.invoiceAddress.validate = invoiceAddressValidator;\n },\n\n setDeliveryAddressValidator(state, deliveryAdrressValidator)\n {\n state.validation.deliveryAddress.validate = deliveryAdrressValidator;\n },\n\n setDeliveryAddressShowError(state, showError)\n {\n state.validation.deliveryAddress.showError = showError;\n },\n\n setInvoiceAddressShowError(state, showError)\n {\n state.validation.invoiceAddress.showError = showError;\n },\n\n setParcelBoxAvailability(state, availability)\n {\n state.shipping.isParcelBoxAvailable = availability;\n },\n\n setPostOfficeAvailability(state, availability)\n {\n state.shipping.isPostOfficeAvailable = availability;\n },\n\n setSubscribeNewsletterCheck(state, { emailFolder, value })\n {\n Vue.set(state.newsletterSubscription, emailFolder, value);\n },\n\n addSubscribeNewsletterValidate(state, { emailFolder, validator })\n {\n Vue.set(state.validation, `subscribeNewsletter_${emailFolder}`, { validate: validator, showError: false });\n },\n\n setSubscribeNewsletterShowErr(state, { emailFolder, showError })\n {\n Vue.set(state.validation[`subscribeNewsletter_${emailFolder}`], \"showError\", showError);\n },\n\n addDynamicCheckoutValidator(state, { name, validator })\n {\n Vue.set(state.validation, `${name}`, { validate: validator, showError: false });\n },\n\n setDynamicCheckoutShowError(state, { name, showError })\n {\n Vue.set(state.validation[name], \"showError\", showError);\n },\n\n setIsCheckoutReadonly(state, readOnly)\n {\n state.readOnly = !!readOnly;\n }\n };\n\nconst actions =\n {\n setCheckout({ commit, dispatch }, checkout)\n {\n commit(\"setShippingCountryId\", checkout.shippingCountryId);\n commit(\"setShippingProfile\", checkout.shippingProfileId);\n commit(\"setShippingProfileList\", checkout.shippingProfileList);\n commit(\"setMaxDeliveryDays\", checkout.maxDeliveryDays);\n commit(\"setMethodOfPaymentList\", checkout.paymentDataList);\n commit(\"setMethodOfPayment\", checkout.methodOfPaymentId);\n commit(\"setIsCheckoutReadonly\", checkout.readOnly);\n commit(\"setContactWish\", checkout.contactWish);\n\n dispatch(\"setShippingProfileById\", checkout.shippingProfileId);\n dispatch(\"initProfileAvailabilities\");\n },\n\n setShippingProfileById({ state, commit }, shippingProfileId)\n {\n const shippingProfile = state.shipping.shippingProfileList.find(profile =>\n {\n return profile.parcelServicePresetId === shippingProfileId;\n });\n\n if (!isNullOrUndefined(shippingProfile))\n {\n commit(\"setSelectedShippingProfile\", shippingProfile);\n }\n },\n\n selectMethodOfPayment({ commit, state }, methodOfPaymentId)\n {\n return new Promise((resolve, reject) =>\n {\n const oldMethodOfPayment = state.payment.methodOfPaymentId;\n\n commit(\"setIsBasketLoading\", true);\n commit(\"setMethodOfPayment\", methodOfPaymentId);\n\n ApiService.post(\"/rest/io/checkout/paymentId/\", { paymentId: methodOfPaymentId })\n .done(response =>\n {\n commit(\"setIsBasketLoading\", false);\n resolve(response);\n })\n .fail(error =>\n {\n commit(\"setIsBasketLoading\", false);\n commit(\"setMethodOfPayment\", oldMethodOfPayment);\n reject(error);\n });\n });\n },\n\n selectShippingProfile({ commit, state }, shippingProfile)\n {\n return new Promise((resolve, reject) =>\n {\n const oldShippingProfile = state.shipping.shippingProfileId;\n\n const params = { shippingId: shippingProfile.parcelServicePresetId };\n\n commit(\"setIsBasketLoading\", true);\n commit(\"setShippingProfile\", shippingProfile.parcelServicePresetId);\n\n if (shippingProfile.excludedPaymentMethodIds.includes(state.payment.methodOfPaymentId))\n {\n const methodOfPaymentList = state.payment.methodOfPaymentList;\n\n for (let i = 0; i < methodOfPaymentList.length; i++)\n {\n const methodOfPayment = methodOfPaymentList[i];\n\n if (!shippingProfile.excludedPaymentMethodIds.includes(methodOfPayment.id))\n {\n params.methodOfPaymentId = methodOfPayment.id;\n break;\n }\n }\n }\n\n ApiService.post(\"/rest/io/checkout/shippingId/\", params)\n .done(response =>\n {\n commit(\"setSelectedShippingProfile\", shippingProfile);\n commit(\"setIsBasketLoading\", false);\n resolve(response);\n })\n .fail(error =>\n {\n commit(\"setIsBasketLoading\", false);\n commit(\"setShippingProfile\", oldShippingProfile);\n reject(error);\n });\n });\n },\n\n refreshCheckout({ commit, dispatch })\n {\n return new Promise((resolve, reject) =>\n {\n ApiService.get(\"/rest/io/checkout/\")\n .done(checkout =>\n {\n dispatch(\"setCheckout\", checkout);\n resolve(checkout);\n })\n .fail(error =>\n {\n reject(error);\n });\n });\n },\n\n initProfileAvailabilities({ commit, state })\n {\n commit(\"setParcelBoxAvailability\", !isNullOrUndefined(state.shipping.shippingProfileList.find(shipping => shipping.isParcelBox)));\n\n commit(\"setPostOfficeAvailability\", !isNullOrUndefined(state.shipping.shippingProfileList.find(shipping => shipping.isPostOffice)));\n }\n };\n\nconst getters =\n {\n isParcelOrOfficeAvailable: state =>\n {\n return state.shipping.isParcelBoxAvailable || state.shipping.isPostOfficeAvailable;\n }\n };\n\nexport default\n{\n state,\n mutations,\n actions,\n getters\n};\n","function _setConsent(state, { key, value })\n{\n const groupKey = key.split(\".\")[0];\n const consentKey = key.split(\".\")[1];\n\n state.consents[groupKey] = state.consents[groupKey] || {};\n if (consentKey === \"*\")\n {\n Object.keys(state.consents[groupKey]).forEach((cKey) =>\n {\n state.consents[groupKey][cKey] = value;\n });\n }\n else\n {\n state.consents[groupKey][consentKey] = value;\n }\n}\n\nfunction setStateForConsents(state, changeTo)\n{\n Object.keys((state.consents || {})).forEach((groupKey) =>\n {\n if (typeof state.consents[groupKey] === \"object\")\n {\n Object.keys(state.consents[groupKey]).forEach((consentKey) =>\n {\n\n state.consents[groupKey] = state.consents[groupKey] || {};\n if (window.ConsentManager && !window.ConsentManager.isNecessary(`${groupKey}.${consentKey}`))\n {\n state.consents[groupKey][consentKey] = changeTo;\n }\n });\n }\n });\n\n if (window.ConsentManager)\n {\n window.ConsentManager.setResponse(state.consents);\n state.hasResponse = true;\n }\n}\n\nconst state = () => ({\n consents: {},\n hasResponse: false\n});\n\nconst mutations =\n {\n toggleConsent(state, key)\n {\n _setConsent(state, { key: key, value: !this.getters.isConsented(key) });\n },\n setConsent(state, key, value)\n {\n _setConsent(state, { key, value });\n },\n acceptAll(state)\n {\n setStateForConsents(state, true);\n },\n denyAll(state)\n {\n setStateForConsents(state, false);\n },\n initConsents(state)\n {\n if (window.ConsentManager)\n {\n state.consents = window.ConsentManager.getConsents();\n state.hasResponse = window.ConsentManager.hasResponse();\n }\n },\n storeConsents(state)\n {\n if (window.ConsentManager)\n {\n window.ConsentManager.setResponse(state.consents);\n state.hasResponse = true;\n }\n }\n };\n\nconst getters =\n {\n isConsented: state => (key) =>\n {\n const groupKey = key.split(\".\")[0];\n const consentKey = key.split(\".\")[1];\n\n if (consentKey === \"*\")\n {\n return Object.keys(state.consents[groupKey] || {}).some((consentKey) =>\n {\n return (state.consents[groupKey] || {})[consentKey];\n });\n }\n\n return (state.consents[groupKey] || {})[consentKey];\n }\n };\n\nexport default\n{\n state,\n mutations,\n getters\n};\n\n\n","import { isDefined } from \"./utils\";\n\nfunction _readElement(inputElement)\n{\n let name = inputElement.name;\n\n let label = getLabel(inputElement);\n\n let value = inputElement.value;\n\n if (inputElement.type === \"checkbox\")\n {\n if (name.substr(-2, 2) === \"[]\")\n {\n value = _readCheckboxGroup(name);\n name = name.substr(0, name.length - 2);\n label = getLabelForId(name);\n }\n else\n {\n value = inputElement.checked;\n }\n }\n else if (inputElement.type === \"radio\")\n {\n const selectedRadio = document.querySelector(\"[name=\\\"\" + name + \"\\\"]:checked\");\n\n value = selectedRadio ? getLabel(selectedRadio) : null;\n label = getLabelForId(name);\n }\n else if (inputElement.tagName.toLocaleLowerCase() === \"select\")\n {\n const optionElement = inputElement.querySelector(\"option[value=\\\"\" + value + \"\\\"]\");\n\n value = optionElement ? optionElement.textContent : \"\";\n }\n\n return {\n name: name,\n label: label,\n value: value\n };\n}\n\nfunction _readCheckboxGroup(groupName)\n{\n const results = [];\n\n const checkboxes = document.querySelectorAll(\"[name=\\\"\" + groupName + \"\\\"]\");\n\n for (const checkbox of checkboxes)\n {\n if (checkbox.checked)\n {\n results.push(\n getLabel(checkbox)\n );\n }\n }\n\n return results;\n}\n\nexport function getLabel(inputElement)\n{\n if (!inputElement)\n {\n return \"\";\n }\n\n const labelElement = (inputElement.labels || Array.prototype.slice.call(inputElement.querySelectorAll(\"label\")))[0];\n\n if (isDefined(labelElement))\n {\n const label = labelElement.textContent.trim();\n\n return label.charAt(label.length - 1) === \"*\" ? label.substr(0, label.length - 1) : label;\n }\n\n return getLabelForId(inputElement.id || inputElement.name);\n\n}\n\nexport function getLabelForId(id)\n{\n if (!id)\n {\n return \"\";\n }\n\n const labelElement = document.querySelector(\"label[for=\\\"\" + id + \"\\\"]\");\n\n if (isDefined(labelElement))\n {\n const label = labelElement.textContent.trim();\n\n return label.charAt(label.length - 1) === \"*\" ? label.substr(0, label.length - 1) : label;\n }\n return \"\";\n}\n\nexport function serializeForm(form)\n{\n const formData = {};\n const formElements = form.querySelectorAll(\"[name]:not(.g-recaptcha-response):not([type=file])\");\n\n for (const formElement of formElements)\n {\n const element = _readElement(formElement);\n\n if (element.name)\n {\n formData[element.name] = {\n label: element.label,\n value: element.value\n };\n }\n }\n\n return formData;\n}\n","import ValidationService from \"../../services/ValidationService\";\nimport NotificationService from \"../../services/NotificationService\";\nimport TranslationService from \"../../services/TranslationService\";\nimport { serializeForm, getLabel } from \"../../helper/serializeForm\";\nimport { isMail } from \"../../helper/strings\";\nimport { executeReCaptcha } from \"../../helper/executeReCaptcha\";\n\nconst ApiService = require(\"../../services/ApiService\");\n\nfunction readFormOptions(form, formData)\n{\n const formOptions = {\n recipient: \"\",\n subject: \"\",\n cc: [],\n bcc: [],\n replyTo: {\n mail: null,\n name: \"\"\n }\n };\n const formOptionElements = form.querySelectorAll(\"[data-mail]\");\n\n for (const element of formOptionElements)\n {\n if (element.type !== \"checkbox\" || element.checked)\n {\n switch (element.dataset.mail)\n {\n case \"cc\":\n if (element.value)\n {\n if (isMail(element.value))\n {\n formOptions.cc.push(element.value);\n }\n else if (formData.hasOwnProperty(element.value) && isMail(formData[element.value].value))\n {\n formOptions.cc.push(formData[element.value].value);\n }\n }\n break;\n case \"bcc\":\n if (element.value)\n {\n if (isMail(element.value))\n {\n formOptions.bcc.push(element.value);\n }\n else if (formData.hasOwnProperty(element.value) && isMail(formData[element.value].value))\n {\n formOptions.bcc.push(formData[element.value].value);\n }\n }\n break;\n case \"reply-to-address\":\n if (element.value)\n {\n if (isMail(element.value))\n {\n formOptions.replyTo.mail = element.value;\n }\n else if (formData.hasOwnProperty(element.value) && isMail(formData[element.value].value))\n {\n formOptions.replyTo.mail = formData[element.value].value;\n }\n }\n break;\n case \"reply-to-name\":\n if (element.value)\n {\n if (formData.hasOwnProperty(element.value))\n {\n formOptions.replyTo.name = formData[element.value].value;\n }\n else\n {\n formOptions.replyTo.name = element.value;\n }\n }\n break;\n case \"subject\":\n if (element.value)\n {\n if (formData.hasOwnProperty(element.value))\n {\n formOptions.subject = formData[element.value].value;\n }\n else\n {\n formOptions.subject = element.value;\n }\n }\n break;\n case \"recipient\":\n if (element.value)\n {\n if (formData.hasOwnProperty(element.value))\n {\n formOptions.recipient = formData[element.value].value;\n }\n else\n {\n formOptions.recipient = element.value;\n }\n }\n break;\n default:\n break;\n }\n }\n }\n\n return formOptions;\n}\n\nfunction disableForm(form, disabled)\n{\n Array.prototype.slice.call(\n form.querySelectorAll(\"input, select, textarea, button\")\n ).forEach(input => input.disabled = disabled);\n}\n\nconst actions =\n {\n sendContactForm(state, event)\n {\n event.preventDefault();\n event.stopPropagation();\n\n const btnClassName = event.submitter.className;\n const btnSendContactForm = \"btn-send-contact-form\";\n\n if (event.target.tagName !== \"FORM\" || !btnClassName.includes(btnSendContactForm))\n {\n return;\n }\n\n const recaptchaEl = event.target.querySelector(\"[data-recaptcha]\");\n\n if (App.config.global.googleRecaptchaApiKey && (!window.grecaptcha || !recaptchaEl))\n {\n NotificationService.error(TranslationService.translate(\"Ceres::Template.contactAcceptRecaptchaCookie\"));\n return;\n }\n\n executeReCaptcha(event.target)\n .then((recaptchaResponse) =>\n {\n ValidationService.validate(event.target)\n .done(() =>\n {\n disableForm(event.target, true);\n\n const formData = serializeForm(event.target);\n const formOptions = readFormOptions(event.target, formData);\n\n sendFile(event, recaptchaResponse).then((response) =>\n {\n resetRecaptcha(recaptchaEl);\n executeReCaptcha(event.target).then((recaptchaToken2) =>\n {\n ApiService.post(\n \"/rest/io/customer/contact/mail\",\n {\n data: formData,\n recipient: formOptions.recipient,\n subject: formOptions.subject || \"\",\n cc: formOptions.cc,\n bcc: formOptions.bcc,\n replyTo: formOptions.replyTo,\n recaptchaToken: recaptchaToken2,\n fileKeys: response.fileKeys\n }\n )\n .done(response =>\n {\n resetRecaptcha(recaptchaEl);\n event.target.reset();\n disableForm(event.target, false);\n NotificationService.success(\n TranslationService.translate(\"Ceres::Template.contactSendSuccess\")\n ).closeAfter(3000);\n document.dispatchEvent(\n new CustomEvent(\n \"contactFormSent\",\n {\n detail: formData\n }\n )\n );\n })\n .fail(response =>\n {\n resetRecaptcha(recaptchaEl);\n disableForm(event.target, false);\n NotificationService.error(TranslationService.translate(\"Ceres::Template.contactSendFail\"));\n });\n });\n },\n (response) =>\n {\n resetRecaptcha(recaptchaEl);\n disableForm(event.target, false);\n response.error.message = response.error.message || TranslationService.translate(\"Ceres::Template.contactFileUploadFail\");\n NotificationService.error(response.error);\n });\n })\n .fail(invalidFields =>\n {\n resetRecaptcha(recaptchaEl);\n\n const fieldNames = [];\n\n for (const field of invalidFields)\n {\n fieldNames.push(getLabel(field));\n }\n\n ValidationService.markInvalidFields(invalidFields, \"error\");\n NotificationService.error(\n TranslationService.translate(\"Ceres::Template.checkoutCheckAddressFormFields\", { fields: fieldNames.join(\", \") })\n );\n });\n })\n .catch((error) =>\n {\n NotificationService.error(\n TranslationService.translate(\"Ceres::Template.contactReCaptchaFailed\")\n );\n });\n }\n };\n\nfunction sendFile(event, recaptchaToken)\n{\n return new Promise((resolve, reject) =>\n {\n const formData = new FormData();\n const fileInputs = event.target.querySelectorAll(\"input[type=file]\");\n\n let containsFiles = false;\n\n for (const fileInput of fileInputs)\n {\n for (const file of fileInput.files)\n {\n containsFiles = true;\n formData.append(\"fileData[]\", file);\n }\n }\n\n if (!containsFiles)\n {\n resolve({});\n return;\n }\n\n formData.append(\"recaptchaToken\", recaptchaToken);\n\n ApiService.post(\"/rest/io/customer/contact/mail/file\",\n formData,\n { processData: false, contentType: false, cache: false, async: true, timeout: 60000, supressNotifications: true })\n .done((response) =>\n {\n resolve(response);\n })\n .fail((error) =>\n {\n reject(error);\n });\n });\n}\n\nfunction resetRecaptcha(recaptchaEl)\n{\n if (App.config.global.googleRecaptchaVersion === 2 && window.grecaptcha)\n {\n window.grecaptcha.reset(recaptchaEl);\n }\n}\n\nexport default\n{\n actions\n};\n","import UrlService from \"./UrlService\";\n\nexport function getItemListUrlParams(searchParams)\n{\n const urlParams = {};\n const defaultItemsPerPage = App.config.pagination.itemsPerPage;\n\n urlParams.query = (searchParams.query && searchParams.query.length > 0) ? searchParams.query : null;\n urlParams.items = (searchParams.items !== defaultItemsPerPage) ? searchParams.items : null;\n urlParams.page = searchParams.page > 1 ? searchParams.page : null;\n urlParams.facets = searchParams.facets?.length > 0 ? searchParams.facets : null;\n urlParams.priceMin = searchParams.priceMin ? searchParams.priceMin : null;\n urlParams.priceMax = searchParams.priceMax ? searchParams.priceMax : null;\n\n if (App.isSearch)\n {\n urlParams.sorting = (searchParams.sorting !== App.config.sorting.defaultSortingSearch) && searchParams.sorting.length > 0 ? searchParams.sorting : null;\n }\n else\n {\n urlParams.sorting = (searchParams.sorting !== App.config.sorting.defaultSorting) && searchParams.sorting.length > 0? searchParams.sorting : null;\n }\n\n const newUrlParams = UrlService.getUrlParams(document.location.search);\n\n for (const urlParamKey in urlParams)\n {\n if (urlParams[urlParamKey] !== null)\n {\n newUrlParams[urlParamKey] = urlParams[urlParamKey];\n }\n else\n {\n delete newUrlParams[urlParamKey];\n }\n }\n\n return newUrlParams;\n}\n\nexport default {\n getItemListUrlParams\n};\n","import { getItemListUrlParams } from \"../../services/ItemListUrlService\";\nimport { navigateToParams } from \"../../services/UrlService\";\nimport TranslationService from \"../../services/TranslationService\";\n\nconst state = () => ({\n facets: [],\n selectedFacets: [],\n page: null,\n sorting: \"\",\n isLoading: false,\n itemsPerPage: null,\n searchString: null,\n items: [],\n totalItems: null\n});\n\nconst mutations =\n {\n addFacets(state, facets)\n {\n for (const facet of facets)\n {\n if (!state.facets.find(fac => fac.id === facet.id))\n {\n state.facets.push(facet);\n state.selectedFacets = state.selectedFacets.concat(_getSelectedFacetValues(facet));\n }\n }\n },\n\n /**\n * @deprecated use addFacets instead\n */\n setFacets(state, facets)\n {\n state.facets = facets || [];\n },\n\n setPriceFacet(state, { priceMin, priceMax })\n {\n const priceFacet = {\n id: \"price\",\n priceMin,\n priceMax\n };\n\n priceFacet.name = _getPriceFacetName(priceMin, priceMax);\n\n state.facets.find(facet => facet.type === \"price\").values[0] = priceFacet;\n },\n\n setPriceFacetTag(state)\n {\n const priceFacet = state.facets.find(facet => facet.type === \"price\").values[0];\n const selectedPriceFacet = state.selectedFacets.find(facet => facet.id === \"price\");\n\n if (selectedPriceFacet)\n {\n Object.assign(selectedPriceFacet, priceFacet);\n }\n else\n {\n state.selectedFacets.push(priceFacet);\n }\n },\n\n removePriceFacet(state)\n {\n state.selectedFacets = state.selectedFacets.filter(facet => facet.id !== \"price\");\n },\n\n setSelectedFacetsByIds(state, selectedFacetIds)\n {\n let selectedFacets = [];\n\n if (selectedFacetIds.length > 0)\n {\n for (const facet of state.facets)\n {\n selectedFacets = selectedFacets.concat(\n facet.values.filter(facetValue =>\n {\n return selectedFacetIds.some(facetId => facetId === facetValue.id + \"\");\n })\n );\n }\n }\n\n state.selectedFacets = selectedFacets;\n },\n\n toggleSelectedFacet(state, facetValue)\n {\n if (!state.selectedFacets.find(selectedFacet => selectedFacet.id === facetValue.id))\n {\n state.selectedFacets.push(facetValue);\n }\n else\n {\n state.selectedFacets = state.selectedFacets.filter(selectedFacet => selectedFacet.id !== facetValue.id);\n }\n },\n\n resetAllSelectedFacets(state)\n {\n state.selectedFacets = [];\n },\n\n setItemListPage(state, page)\n {\n state.page = page;\n },\n\n setItemListSorting(state, sorting)\n {\n state.sorting = sorting;\n },\n\n setItemsPerPage(state, itemsPerPage)\n {\n state.itemsPerPage = parseInt(itemsPerPage);\n },\n\n setIsItemListLoading(state, isLoading)\n {\n state.isLoading = isLoading;\n },\n\n setItemListSearchString(state, searchString)\n {\n state.searchString = searchString;\n },\n\n setItemListItems(state, items)\n {\n state.items = items;\n },\n\n setItemListTotalItems(state, totalItems)\n {\n state.totalItems = totalItems;\n }\n };\n\nconst actions =\n {\n selectFacet({ dispatch, commit }, { facetValue })\n {\n if (facetValue.id === \"price\")\n {\n commit(\"removePriceFacet\");\n }\n else\n {\n commit(\"toggleSelectedFacet\", facetValue);\n }\n\n commit(\"setItemListPage\", 1);\n dispatch(\"loadItemList\");\n },\n\n selectPriceFacet({ dispatch, commit }, { priceMin, priceMax })\n {\n commit(\"setPriceFacet\", { priceMin: priceMin, priceMax: priceMax });\n commit(\"setPriceFacetTag\");\n commit(\"setItemListPage\", 1);\n dispatch(\"loadItemList\");\n },\n\n selectItemListPage({ dispatch, commit }, page)\n {\n commit(\"setItemListPage\", page);\n\n dispatch(\"loadItemList\");\n },\n\n selectItemListSorting({ dispatch, commit }, sorting)\n {\n commit(\"setItemListSorting\", sorting);\n commit(\"setItemListPage\", 1);\n\n dispatch(\"loadItemList\");\n },\n\n selectItemsPerPage({ dispatch, commit }, itemsPerPage)\n {\n commit(\"setItemsPerPage\", itemsPerPage);\n commit(\"setItemListPage\", 1);\n\n dispatch(\"loadItemList\");\n },\n\n searchItems({ dispatch, commit }, searchString)\n {\n commit(\"setItemListSearchString\", searchString);\n commit(\"setItemListPage\", 1);\n commit(\"setSelectedFacetsByIds\", []);\n\n dispatch(\"loadItemList\");\n },\n\n loadItemList({ state, commit, getters })\n {\n const selectedPriceFacet = state.selectedFacets.find(facet => facet.id === \"price\");\n const searchParams =\n {\n query : state.searchString,\n items : parseInt(state.itemsPerPage),\n sorting : state.sorting,\n page : state.page,\n facets : getters.selectedFacetIdsForUrl.toString(),\n priceMin : selectedPriceFacet ? selectedPriceFacet.priceMin : \"\",\n priceMax : selectedPriceFacet ? selectedPriceFacet.priceMax : \"\"\n };\n\n commit(\"setIsItemListLoading\", true);\n navigateToParams(getItemListUrlParams(searchParams));\n }\n };\n\nconst getters =\n {\n selectedFacetIds(state)\n {\n const selectedFacetIds = [];\n\n state.selectedFacets.every(facet => selectedFacetIds.push(facet.id));\n\n return selectedFacetIds;\n },\n\n selectedFacetIdsForUrl(state)\n {\n const selectedFacetIds = [];\n\n state.selectedFacets.every(facet => selectedFacetIds.push(facet.id));\n\n return selectedFacetIds.filter(facet => facet !== \"price\");\n }\n };\n\nfunction _getSelectedFacetValues(facet)\n{\n if (!facet.values && facet.values.length <= 0)\n {\n return [];\n }\n\n const selectedFacets = [];\n\n facet.values.forEach((value) =>\n {\n if (value.id === \"price\")\n {\n value.name = _getPriceFacetName(value.priceMin, value.priceMax);\n }\n\n if (value.selected || value.id === \"price\")\n {\n selectedFacets.push(value);\n }\n });\n\n return selectedFacets;\n}\n\nfunction _getPriceFacetName(priceMin, priceMax)\n{\n const priceMinFormatted = Vue.filter(\"currency\").apply(Object, [priceMin]);\n const priceMaxFormatted = Vue.filter(\"currency\").apply(Object, [priceMax]);\n\n let priceFacetName = \"\";\n\n if (!!priceMax && !!priceMin)\n {\n priceFacetName = priceMinFormatted + \" - \" + priceMaxFormatted;\n }\n else if (priceMin)\n {\n priceFacetName = TranslationService.translate(\"Ceres::Template.itemFrom\") + priceMinFormatted;\n }\n else if (priceMax)\n {\n priceFacetName = TranslationService.translate(\"Ceres::Template.itemTo\") + priceMaxFormatted;\n }\n\n return priceFacetName;\n}\n\nexport default\n{\n state,\n mutations,\n actions,\n getters\n};\n","import { isNullOrUndefined } from \"../../helper/utils\";\nimport ApiService from \"../../services/ApiService\";\nimport Vue from \"vue\";\n\nconst state = () => ({\n autocompleteRequest: null,\n autocompleteResult: { item: [], category: [], suggestion: [] },\n autocompleteSearchString: \"\",\n autocompleteTypes: [],\n autocompleteIsLoading: false\n});\n\nconst mutations =\n {\n setAutocompleteRequest(state, request)\n {\n state.autocompleteRequest = request;\n },\n\n setAutocompleteResult(state, data)\n {\n Vue.set(state, \"autocompleteResult\", data);\n },\n\n setAutocompleteSearchString(state, searchString)\n {\n state.autocompleteSearchString = searchString;\n },\n\n addAutocompleteType(state, type)\n {\n state.autocompleteTypes.push(type);\n },\n\n setAutocompleteIsLoading(state, value)\n {\n Vue.set(state, \"autocompleteIsLoading\", !!value);\n }\n };\n\nconst actions =\n {\n loadItemSearchAutocomplete({ state, commit }, searchString)\n {\n commit(\"setAutocompleteSearchString\", searchString);\n commit(\"setAutocompleteIsLoading\", true);\n\n if (!isNullOrUndefined(state.autocompleteRequest) && typeof state.autocompleteRequest.abort === \"function\")\n {\n state.autocompleteRequest.abort();\n }\n\n const newRequest = ApiService.get(\n \"/rest/io/item/search/autocomplete\",\n {\n template: \"Ceres::ItemList.Components.ItemSearch\",\n query: searchString,\n types: [...new Set(state.autocompleteTypes)]\n }\n );\n\n commit(\"setAutocompleteRequest\", newRequest);\n\n newRequest.done(response =>\n {\n commit(\"setAutocompleteRequest\", null);\n commit(\"setAutocompleteResult\", response);\n commit(\"setAutocompleteIsLoading\", false);\n });\n }\n };\n\nexport default\n{\n state,\n actions,\n mutations\n};\n","import { isDefined } from \"../../helper/utils\";\n\nconst ApiService = require(\"../../services/ApiService\");\n\nconst state = () => ({\n containers: {},\n isLastSeenItemsLoading: false,\n lastSeenItems: []\n});\n\nconst mutations =\n {\n setLastSeenItems(state, lastSeenItems)\n {\n state.lastSeenItems = lastSeenItems;\n },\n\n setIsLastSeenItemsLoading(state, isLoading)\n {\n state.isLastSeenItemsLoading = isLoading;\n },\n\n setLastSeenItemContainers(state, containers)\n {\n state.containers = containers;\n }\n };\n\nconst actions =\n {\n addLastSeenItem({ commit, state }, variationId)\n {\n console.warn(\"This action is not in use anymore and should not be committed anymore.\");\n },\n\n getLastSeenItems({ commit })\n {\n if (!state.isLastSeenItemsLoading)\n {\n return new Promise((resolve, reject) =>\n {\n commit(\"setIsLastSeenItemsLoading\", true);\n ApiService.get(\"/rest/io/item/last_seen\")\n .done(response =>\n {\n if (isDefined(response) && isDefined(response.lastSeenItems))\n {\n commit(\"setLastSeenItems\", response.lastSeenItems.documents);\n commit(\"setLastSeenItemContainers\", response.containers);\n commit(\"setIsLastSeenItemsLoading\", false);\n\n resolve(response.lastSeenItems.documents);\n }\n else\n {\n resolve(null);\n }\n })\n .fail(error =>\n {\n commit(\"setIsLastSeenItemsLoading\", false);\n reject(error);\n });\n });\n }\n\n return null;\n }\n };\n\nexport default\n{\n state,\n actions,\n mutations\n};\n","const state = () => ({\n components: {\n // comp tag -> loaded bool\n }\n});\n\nconst mutations =\n {\n setComponent(state, { component, loaded })\n {\n Vue.set(state.components, component, loaded);\n }\n };\n\nconst actions =\n {\n loadComponent({ commit }, component)\n {\n commit(\"setComponent\", { component, loaded: true });\n },\n\n addComponent({ commit }, component)\n {\n commit(\"setComponent\", { component, loaded: false });\n }\n };\n\nexport default\n{\n state,\n actions,\n mutations\n};\n","const ApiService = require(\"../../services/ApiService\");\n\nconst state = () => ({\n liveShoppingOffers: {}\n});\n\nconst mutations =\n {\n setLiveShoppingOffer(state, { uid, liveShoppingOffer })\n {\n Vue.set(state.liveShoppingOffers, uid, liveShoppingOffer);\n }\n };\n\nconst actions =\n {\n retrieveLiveShoppingOffer({ commit }, { liveShoppingId, sorting, uid })\n {\n return new Promise((resolve, reject) =>\n {\n ApiService.get(\"/rest/io/live-shopping/\" + liveShoppingId + \"?sorting=\" + sorting)\n .done(liveShoppingOffer =>\n {\n if (liveShoppingOffer.item)\n {\n commit(\"setLiveShoppingOffer\", { uid, liveShoppingOffer });\n }\n else\n {\n commit(\"setLiveShoppingOffer\", { uid, liveShoppingOffer: null });\n }\n\n resolve(liveShoppingOffer);\n })\n .fail(error =>\n {\n reject(error);\n });\n });\n }\n };\n\nexport default\n{\n state,\n actions,\n mutations\n};\n","import { isNullOrUndefined } from \"../../helper/utils\";\nimport { setUrlParam } from \"../../services/UrlService\";\n\nconst ApiService = require(\"../../services/ApiService\");\n\nconst state = () => ({\n shippingCountries: [],\n shippingCountryId: null,\n euShippingCountries: []\n});\n\nconst mutations =\n {\n setShippingCountries(state, shippingCountries)\n {\n state.shippingCountries = shippingCountries;\n },\n\n setEuShippingCountries(state, euShippingCountries)\n {\n state.euShippingCountries = euShippingCountries;\n },\n\n setShippingCountryId(state, shippingCountryId)\n {\n if (shippingCountryId !== state.shippingCountryId && !App.isSSR)\n {\n document.dispatchEvent(new CustomEvent(\"afterShippingCountryChanged\", { detail: shippingCountryId }));\n }\n\n state.shippingCountryId = shippingCountryId;\n }\n };\n\nconst actions =\n {\n selectShippingCountry({ commit, state }, { shippingCountryId, openBasketPreview })\n {\n return new Promise((resolve, reject) =>\n {\n const oldShippingCountryId = state.shippingCountryId;\n\n commit(\"setShippingCountryId\", shippingCountryId);\n ApiService.post(\"/rest/io/shipping/country\", { \"shippingCountryId\": shippingCountryId })\n .done(data =>\n {\n if (isNullOrUndefined(oldShippingCountryId) || oldShippingCountryId !== data)\n {\n if (openBasketPreview)\n {\n setUrlParam({ openBasketPreview: 1 });\n }\n\n window.location.reload();\n }\n resolve(data);\n })\n .fail(error =>\n {\n commit(\"setShippingCountryId\", oldShippingCountryId);\n reject(error);\n });\n });\n }\n };\n\nconst getters =\n {\n getCountryName: state => countryId =>\n {\n if (countryId > 0)\n {\n let country = state.shippingCountries.find(country => country.id === countryId);\n\n if (isNullOrUndefined(country))\n {\n country = state.euShippingCountries.find(country => country.id === countryId);\n }\n\n if (!isNullOrUndefined(country))\n {\n return country.currLangName;\n }\n }\n\n return \"\";\n },\n getStateName: state => (countryId, stateId) =>\n {\n if (countryId > 0 && stateId > 0)\n {\n const country = state.shippingCountries.find(country => country.id === countryId);\n\n if (country)\n {\n const state = country.states.find((countryState) => countryState.id === stateId);\n\n return state.name;\n }\n return \"\";\n }\n return \"\";\n }\n };\n\nexport default\n{\n state,\n mutations,\n actions,\n getters\n};\n","import { isNullOrUndefined } from \"../../helper/utils\";\n\nconst ApiService = require(\"../../services/ApiService\");\n\nconst state = () => ({\n tree: [],\n cachedTrees: {},\n currentCategory: null,\n categoryChildren: [],\n isMobileNavigationOpen: false\n});\n\nconst mutations =\n {\n setNavigationTree(state, navigationTree)\n {\n state.tree = navigationTree;\n },\n\n setCurrentCategory(state, category)\n {\n state.currentCategory = category;\n },\n\n addCachedPartialTree(state, { tree, categoryId })\n {\n state.cachedTrees[categoryId] = tree;\n },\n\n addCategoryChildren(state, children)\n {\n for (const category of children)\n {\n if (!state.categoryChildren.find(cat => cat.id === category.id))\n {\n state.categoryChildren.push(category);\n }\n }\n },\n\n setIsMobileNavigationOpen(state, value)\n {\n state.isMobileNavigationOpen = value;\n\n if (value)\n {\n document.querySelector(\"body\")?.classList.add(\"menu-is-visible\");\n }\n else\n {\n document.querySelector(\"body\")?.classList.remove(\"menu-is-visible\");\n }\n }\n };\n\nconst actions =\n {\n loadPartialNavigationTree({ dispatch, commit, state }, categoryId)\n {\n return new Promise((resolve, reject) =>\n {\n if (isNullOrUndefined(state.cachedTrees[categoryId]))\n {\n ApiService\n .get(\"/rest/io/categorytree\", { type: App.config.header.showCategoryTypes, categoryId })\n .done(response =>\n {\n dispatch(\"buildNavigationTreeItem\", { navigationTree: response });\n commit(\"addCachedPartialTree\", { tree: response, categoryId });\n resolve(response);\n })\n .fail(error =>\n {\n reject(error);\n });\n }\n else\n {\n resolve(state.cachedTrees[categoryId]);\n }\n });\n },\n\n buildNavigationTreeItem({ dispatch }, { navigationTree, parent })\n {\n for (const category of navigationTree)\n {\n category.parent = parent;\n\n if (category.children)\n {\n dispatch(\"buildNavigationTreeItem\", { navigationTree: category.children, parent: category });\n }\n }\n },\n\n setCurrentCategoryById({ state, commit, dispatch }, { categoryId, categories })\n {\n categories = categories || state.tree;\n\n for (const category of categories)\n {\n if (category.id === categoryId)\n {\n commit(\"setCurrentCategory\", category);\n return;\n }\n else if (category.children)\n {\n dispatch(\"setCurrentCategoryById\", { categoryId, categories: category.children });\n }\n }\n },\n\n loadCategoryChildrenChunk({ state, commit }, { categoryId, size })\n {\n return new Promise((resolve, reject) =>\n {\n ApiService\n .get(\"/rest/io/categorytree/children\", { categoryId, indexStart: state.categoryChildren.length, maxCount: size })\n .done(response =>\n {\n commit(\"addCategoryChildren\", response);\n resolve(response);\n })\n .fail(error =>\n {\n reject(error);\n });\n });\n }\n };\n\nconst getters =\n {\n breadcrumbs(state)\n {\n const breadcrumbs = [];\n\n if (state.currentCategory)\n {\n let currentIteration = state.currentCategory;\n\n while (currentIteration)\n {\n breadcrumbs.unshift(currentIteration);\n currentIteration = currentIteration.parent;\n }\n }\n\n return breadcrumbs;\n }\n };\n\nexport default\n{\n state,\n mutations,\n actions,\n getters\n};\n","import ExceptionMap from \"../../exceptions/ExceptionMap\";\n\nconst ApiService = require(\"../../services/ApiService\");\nconst NotificationService = require(\"../../services/NotificationService\");\n\nconst state = () => ({\n orderData: {},\n orderAccessKey: \"\",\n orderReturnItems: [],\n orderReturnNote: \"\"\n});\n\nconst mutations =\n {\n setOrderReturnData(state, orderData)\n {\n orderData.order.orderItems = orderData.order.orderItems.filter(orderItem => orderItem.quantity !== 0);\n\n state.orderData = orderData;\n },\n\n setOrderAccessKey(state, orderAccessKey)\n {\n state.orderAccessKey = orderAccessKey;\n },\n\n updateOrderReturnItems(state, { quantity, orderItem })\n {\n if (quantity <= orderItem.quantity)\n {\n const orderItemIndex = state.orderReturnItems.findIndex(entry => entry.orderItem.itemVariationId === orderItem.itemVariationId);\n\n if (quantity !== 0)\n {\n if (orderItemIndex === -1)\n {\n state.orderReturnItems.push({ quantity, orderItem });\n }\n else\n {\n state.orderReturnItems.splice(orderItemIndex, 1);\n state.orderReturnItems.splice(orderItemIndex, 0, { quantity, orderItem });\n }\n }\n else\n {\n state.orderReturnItems.splice(orderItemIndex, 1);\n }\n }\n },\n\n updateOrderReturnNote(state, orderReturnNote)\n {\n state.orderReturnNote = orderReturnNote;\n }\n };\n\nconst actions =\n {\n sendOrderReturn({ state })\n {\n return new Promise((resolve, reject) =>\n {\n if (state.orderReturnItems.length > 0)\n {\n const variationIds = {};\n\n for (const index in state.orderReturnItems)\n {\n variationIds[state.orderReturnItems[index].orderItem.itemVariationId] = state.orderReturnItems[index].quantity;\n }\n\n ApiService.post(\"/rest/io/order/return\", { orderId: state.orderData.order.id, orderAccessKey: state.orderAccessKey, variationIds, returnNote: state.orderReturnNote })\n .done(data =>\n {\n resolve(data);\n })\n .fail(error =>\n {\n if (error.data)\n {\n NotificationService.error(\n this.$translate(\n \"Ceres::Template.\" + ExceptionMap.get(error.data.exceptionCode.toString()),\n error.data.placeholder\n )\n ).closeAfter(5000);\n }\n reject(error);\n });\n }\n else\n {\n reject();\n }\n });\n }\n };\n\nconst getters =\n {\n getOrderItemImage: state => orderItemId => state.orderData.itemImages[orderItemId],\n\n getOrderItemURL: state => orderItemId => state.orderData.itemURLs[orderItemId],\n\n getOrderItemVariation: state => orderItemId => state.orderData.variations[orderItemId]\n };\n\nexport default\n{\n state,\n mutations,\n actions,\n getters\n};\n","import { isDefined } from \"../../helper/utils\";\n\nconst state = () => ({\n userData: null\n});\n\nconst mutations =\n {\n setUserData(state, userData)\n {\n state.userData = userData;\n }\n };\n\nconst getters =\n {\n username(state)\n {\n let username = \"\";\n\n if (isDefined(state.userData))\n {\n if (state.userData.firstName.length)\n {\n username = state.userData.firstName + \" \";\n }\n if (state.userData.lastName.length)\n {\n username += state.userData.lastName;\n }\n if (!username.length)\n {\n const emailOption = state.userData.options.find(option => option.typeId === 2 && option.subTypeId === 4);\n\n if (emailOption)\n {\n username = emailOption.value;\n }\n }\n }\n\n return username.trim();\n },\n\n isLoggedIn(state)\n {\n return isDefined(state.userData) && state.userData.id > 0;\n }\n };\n\nexport default\n{\n state,\n mutations,\n getters\n};\n","const ApiService = require(\"../../services/ApiService\");\n\nconst state = () => ({\n wishListIds: [],\n wishListItems: [],\n inactiveVariationIds: [],\n isWishListInitiallyLoading: false,\n isLoading: false\n});\n\nconst mutations =\n {\n setWishListItems(state, wishListItems)\n {\n state.wishListItems = wishListItems;\n },\n\n setWishListIds(state, wishListIds)\n {\n state.wishListIds = wishListIds.map(Number);\n },\n\n setInactiveVariationIds(state, inactiveVariationIds)\n {\n state.inactiveVariationIds = inactiveVariationIds?.map(Number);\n },\n\n removeWishListItem(state, wishListItem)\n {\n state.wishListItems = state.wishListItems.filter(item => item !== wishListItem);\n },\n\n removeWishListId(state, id)\n {\n state.wishListIds = state.wishListIds.filter(wishListId => wishListId !== id);\n },\n\n removeInactiveVariationId(state, id)\n {\n state.inactiveVariationIds = state.inactiveVariationIds.filter(inactiveVarationId => inactiveVarationId !== id);\n },\n\n addWishListItemToIndex(state, wishListItem, index)\n {\n state.wishListItems.splice(index, 0, wishListItem);\n },\n\n addWishListId(state, id)\n {\n state.wishListIds.push(id);\n },\n\n setIsWishListInitiallyLoading(state)\n {\n state.isWishListInitiallyLoading = true;\n },\n\n setIsWishListLoading(state, isLoading)\n {\n state.isLoading = !!isLoading;\n }\n };\n\nconst actions =\n {\n initWishListItems({ commit, state })\n {\n return new Promise((resolve, reject) =>\n {\n if (!state.isWishListInitiallyLoading)\n {\n commit(\"setIsWishListInitiallyLoading\");\n commit(\"setIsWishListLoading\", true);\n\n ApiService.get(\"/rest/io/itemWishList\")\n .done(response =>\n {\n commit(\"setInactiveVariationIds\", response.inactiveVariationIds);\n commit(\"setWishListItems\", response.documents);\n resolve(response);\n })\n .fail(error =>\n {\n reject(error);\n })\n .always(() =>\n {\n commit(\"setIsWishListLoading\", false);\n });\n }\n else\n {\n resolve(state.wishListItems);\n }\n });\n },\n\n removeInactiveWishListItem({ commit }, { id })\n {\n return new Promise((resolve, reject) =>\n {\n ApiService.del(\"/rest/io/itemWishList/\" + id)\n .done(data =>\n {\n commit(\"removeWishListId\", id);\n commit(\"removeInactiveVariationId\", id);\n resolve(data);\n })\n .fail(error =>\n {\n reject(error);\n })\n .always(() =>\n {\n commit(\"setIsWishListLoading\", false);\n });\n });\n },\n\n removeWishListItem({ commit }, { id, wishListItem, index })\n {\n return new Promise((resolve, reject) =>\n {\n if (wishListItem)\n {\n commit(\"removeWishListItem\", wishListItem);\n }\n ApiService.del(\"/rest/io/itemWishList/\" + id)\n .done(data =>\n {\n commit(\"removeWishListId\", id);\n resolve(data);\n })\n .fail(error =>\n {\n if (index)\n {\n commit(\"addWishListItemToIndex\", wishListItem, index);\n }\n reject(error);\n });\n });\n },\n\n addToWishList({ commit }, id)\n {\n return new Promise((resolve, reject) =>\n {\n commit(\"addWishListId\", id);\n ApiService.post(\"/rest/io/itemWishList\", { variationId: id })\n .done(data =>\n {\n resolve(data);\n })\n .fail(error =>\n {\n commit(\"removeWishListId\", id);\n reject(error);\n });\n });\n }\n };\n\nconst getters =\n {\n wishListCount: state => state.wishListIds.length\n };\n\nexport default\n{\n state,\n mutations,\n actions,\n getters\n};\n","import { isNullOrUndefined } from \"../../../helper/utils\";\nimport { setUrlByItem } from \"../../../services/UrlService\";\nimport { hasVat, isAdditionalCosts, isOrderProperty } from \"../../../helper/OrderPropertyHelper\";\nimport Vue from \"vue\";\n\nconst ApiService = require(\"../../../services/ApiService\");\n\nconst state = () => ({\n variation: {},\n variationCache: {},\n variationMarkInvalidProperties: false,\n variationOrderQuantity: 1,\n initialVariationId: 0,\n pleaseSelectVariationId: 0\n});\n\nconst mutations =\n {\n setVariation(state, variation)\n {\n variation = normalizeOrderQuantities(variation);\n\n state.variationOrderQuantity = variation.documents[0].data.variation.minimumOrderQuantity;\n\n state.variation = variation;\n state.variationCache[variation.documents[0].id] = variation;\n\n if (state.initialVariationId <= 0)\n {\n state.initialVariationId = variation.documents[0].id;\n }\n },\n\n setPleaseSelectVariationId(state, variationId)\n {\n if (state.pleaseSelectVariationId <= 0 && variationId > 0)\n {\n state.pleaseSelectVariationId = variationId;\n }\n },\n\n setVariationOrderProperty(state, { propertyId, value })\n {\n\n const properties = state.variation.documents[0].data.properties;\n const index = properties.findIndex(property => property.property.id === propertyId);\n\n if (index >= 0)\n {\n const group = properties[index].group;\n const property = properties.find(prop => prop.property.id === propertyId);\n\n if (property && property.property.valueType === \"empty\" && group && group.orderPropertyGroupingType === \"single\")\n {\n // reset all other radios in the group\n properties.filter(prop => prop.group && prop.group.id === group.id && prop.property.id !== propertyId && prop.property.valueType === \"empty\")\n .forEach(prop =>\n {\n prop.property.value = null;\n });\n }\n\n Vue.set(properties[index], \"property\",\n {\n ...properties[index].property,\n value: value\n });\n }\n },\n\n setVariationOrderQuantity(state, quantity)\n {\n state.variationOrderQuantity = quantity;\n },\n\n setVariationMarkInvalidProps(state, markFields)\n {\n state.variationMarkInvalidProperties = !!markFields;\n },\n\n setVariationPropertySurcharges(state, basePrice)\n {\n if (state.variation.documents[0].data.properties)\n {\n for (const property of state.variation.documents[0].data.properties)\n {\n if (!isNullOrUndefined(property.property.percentage) && (property.surcharge <= 0))\n {\n property.property.surcharge = basePrice * property.property.percentage / 100;\n }\n }\n }\n }\n };\n\nconst actions =\n {\n loadVariation({ state, commit, getters, rootState, rootGetters }, variationId)\n {\n return new Promise(resolve =>\n {\n const variation = variationId <= 0\n ? state.variationCache[state.pleaseSelectVariationId > 0 ? state.pleaseSelectVariationId : state.initialVariationId]\n : state.variationCache[variationId];\n\n if (variation)\n {\n commit(\"setVariation\", variation);\n\n if (!rootState.items.isItemSet)\n {\n setUrlByItem(variation.documents[0].data, variationId > 0);\n }\n\n resolve(variation);\n }\n else\n {\n let keepVariationId = true;\n\n if (variationId <= 0)\n {\n variationId = state.pleaseSelectVariationId;\n keepVariationId = false;\n }\n\n const addToBasketLoadingId = rootState.items.isItemSet ? rootGetters[`${ rootState.items.itemSetId }/currentItemVariation`].variation.id : getters.currentItemVariation.variation.id;\n\n commit(\"setIsAddToBasketLoading\", addToBasketLoadingId, { root: true });\n\n ApiService\n .get(`/rest/io/variations/${variationId}`, { template: \"Ceres::Item.SingleItem\", setPriceOnly: rootState.items.isItemSet })\n .done(response =>\n {\n // check if set component and replace relevant data\n if (rootState.items.itemSetId > 0)\n {\n const itemSetId = rootState.items.itemSetId;\n const setComponentMeta = rootState.items[itemSetId].variation.documents[0].data.setComponents.find(\n (setComponent) => setComponent.itemId === response.documents[0].data.item.id\n );\n\n response.documents[0].data.variation.minimumOrderQuantity = setComponentMeta.minimumOrderQuantity;\n response.documents[0].data.variation.maximumOrderQuantity = setComponentMeta.maximumOrderQuantity;\n }\n\n // store received variation data for later reuse\n commit(\"setVariation\", response);\n commit(\"setIsAddToBasketLoading\", 0, { root: true });\n\n if (!rootState.items.isItemSet)\n {\n setUrlByItem(response.documents[0].data, keepVariationId);\n }\n\n resolve(response);\n });\n }\n });\n }\n };\n\nconst getters =\n {\n variationPropertySurcharge(state, getters)\n {\n if (!state || !state.variation.documents)\n {\n return 0;\n }\n\n let sum = 0;\n\n if (state.variation.documents[0].data.properties)\n {\n const addedProperties = state.variation.documents[0].data.properties.filter(property =>\n {\n return !!property.property.value;\n });\n\n for (const property of addedProperties)\n {\n if (isAdditionalCosts(property) || ( isOrderProperty(property) && !hasVat(property)))\n {\n continue;\n }\n if (!isNullOrUndefined(property.property.percentage) && (property.surcharge <= 0))\n {\n const surcharge = getters.variationBasePrice * property.property.percentage / 100;\n\n sum += surcharge;\n }\n else\n {\n sum += property.surcharge || property.property.surcharge;\n }\n }\n }\n\n return sum;\n },\n\n variationGraduatedPrice(state)\n {\n if (!state || !state.variation.documents)\n {\n return null;\n }\n\n const calculatedPrices = state.variation.documents[0].data.prices;\n const graduatedPrices = calculatedPrices.graduatedPrices;\n\n let returnPrice;\n\n if (graduatedPrices && graduatedPrices[0])\n {\n const prices = graduatedPrices.filter(price =>\n {\n return parseFloat(state.variationOrderQuantity) >= price.minimumOrderQuantity;\n });\n\n if (prices[0])\n {\n returnPrice = prices.reduce((prev, current) => (prev.minimumOrderQuantity > current.minimumOrderQuantity) ? prev : current);\n // returnPrice = returnPrice.unitPrice.value;\n }\n }\n\n return returnPrice || calculatedPrices.default;\n },\n\n variationBasePrice(state, getters, rootState, rootGetters)\n {\n if (getters.currentItemVariation.item.itemType === \"set\")\n {\n return rootGetters.itemSetTotalPrice;\n }\n else if (getters.currentItemVariation.item.itemType !== \"set\" && rootState.items.isItemSet)\n {\n return state.variation.documents[0].data.prices.set.price.value;\n }\n else\n {\n const graduatedPrice = getters.variationGraduatedPrice ? getters.variationGraduatedPrice.unitPrice.value : 0;\n\n if (!isNullOrUndefined(graduatedPrice) && state.variation.documents)\n {\n return Vue.filter(\"specialOffer\").apply(Object, [graduatedPrice, state.variation.documents[0].data.prices, \"price\", \"value\"]);\n }\n }\n\n return null;\n },\n\n variationTotalPrice(state, getters)\n {\n return getters.variationBasePrice + getters.variationPropertySurcharge;\n },\n\n variationGroupedProperties(state)\n {\n if (!state || !state.variation.documents)\n {\n return [];\n }\n\n if (state.variation.documents[0].data.properties)\n {\n const orderPropertyList = state.variation.documents[0].data.properties.filter((property) =>\n {\n return property.property.isShownOnItemPage && property.property.isOderProperty &&\n !(property.property.isShownAsAdditionalCosts && property.property.isRequired && property.property.isPreSelected);\n });\n const groupIds = [...new Set(orderPropertyList.map(property => property.group && property.group.id))];\n const groups = [];\n\n for (const id of groupIds)\n {\n const groupProperties = orderPropertyList.filter(property =>\n {\n return property.group === id || property.group && property.group.id === id;\n });\n\n groups.push({\n touched: false,\n group: groupProperties[0].group,\n properties: groupProperties.map(property =>\n {\n return { ...property.property, itemSurcharge: property.surcharge };\n })\n });\n }\n\n return groups;\n }\n\n return [];\n },\n\n variationMissingProperties(state, getters, rootState, rootGetters)\n {\n if (getters.currentItemVariation.item.itemType === \"set\")\n {\n let setMissingProperties = [];\n\n for (const itemId of rootState.items.setComponentIds)\n {\n const componentMissingProperties = rootGetters[`${ itemId }/variationMissingProperties`];\n\n setMissingProperties = [...setMissingProperties, ...componentMissingProperties];\n }\n\n return setMissingProperties;\n }\n else\n {\n if (state && state.variation.documents && state.variation.documents[0].data.properties)\n {\n let missingProperties = [];\n\n if (App.config.item.requireOrderProperties)\n {\n missingProperties = state.variation.documents[0].data.properties.filter(property =>\n {\n return property.property.isShownOnItemPage && !property.property.value && property.property.isOderProperty;\n });\n }\n else if (state.variation.documents[0].data.hasRequiredOrderProperty)\n {\n missingProperties = state.variation.documents[0].data.properties.filter(property =>\n {\n return property.property.isRequired &&\n property.property.isShownOnItemPage &&\n !property.property.value &&\n property.property.isOderProperty;\n });\n }\n\n missingProperties = _removeRadioValueProperties(state.variation, missingProperties);\n\n return missingProperties;\n }\n\n return [];\n }\n },\n\n currentItemVariation(state)\n {\n return state.variation.documents && state.variation.documents[0] && state.variation.documents[0].data;\n }\n };\n\nfunction normalizeOrderQuantities(variation)\n{\n if (variation.documents.length > 0 && variation.documents[0].data.variation)\n {\n if (isNullOrUndefined(variation.documents[0].data.variation.intervalOrderQuantity)\n || variation.documents[0].data.variation.intervalOrderQuantity <= 0)\n {\n variation.documents[0].data.variation.intervalOrderQuantity = 1;\n }\n\n if (isNullOrUndefined(variation.documents[0].data.variation.minimumOrderQuantity)\n || variation.documents[0].data.variation.minimumOrderQuantity <= 0)\n {\n variation.documents[0].data.variation.minimumOrderQuantity = 1;\n }\n }\n\n return variation;\n}\n\n/**\n * Check all properties if a radio in a group is selected. If so, remove the group from the validation.\n */\nfunction _removeRadioValueProperties(variation, missingProperties = [])\n{\n if (missingProperties.length)\n {\n let radioInformation = variation.documents[0].data.properties.map(property =>\n {\n if (property.group && property.group.orderPropertyGroupingType === \"single\" && property.property.valueType === \"empty\")\n {\n return {\n groupId: property.group.id,\n propertyId: property.property.id,\n hasValue: !!property.property.value\n };\n }\n return null;\n });\n\n radioInformation = [...new Set(radioInformation.filter(id => id))];\n\n const radioIdsToRemove = [];\n\n for (const radioGroupId of [...new Set(radioInformation.map(radio => radio.groupId))])\n {\n const radioGroupToClean = radioInformation.find(radio => radio.groupId === radioGroupId && radio.hasValue);\n\n if (radioGroupToClean)\n {\n for (const radio of radioInformation.filter(radio => radio.groupId === radioGroupToClean.groupId && !radio.hasValue))\n {\n radioIdsToRemove.push(radio.propertyId);\n }\n }\n }\n\n missingProperties = missingProperties.filter(property => !radioIdsToRemove.includes(property.property.id));\n }\n\n return missingProperties;\n}\n\nexport default\n{\n namespaced: true,\n state,\n mutations,\n actions,\n getters\n};\n","const ApiService = require(\"../../../services/ApiService\");\n\nconst state = () => ({\n attributes: [],\n isVariationSelected: true,\n selectedAttributes: {},\n selectedUnit: null,\n units: [],\n variations: [],\n variationsLoading: false\n});\n\nconst mutations =\n {\n setIsVariationSelected(state, isVariationSelected)\n {\n state.isVariationSelected = !!isVariationSelected;\n },\n\n setItemAttributes(state, attributes)\n {\n state.attributes = attributes;\n },\n\n setItemSelectedAttributes(state, selectedAttributes)\n {\n state.selectedAttributes = selectedAttributes;\n },\n\n selectItemAttribute(state, { attributeId, attributeValueId })\n {\n state.selectedAttributes[attributeId] = attributeValueId;\n },\n\n selectItemUnit(state, selectedUnit)\n {\n state.selectedUnit = selectedUnit;\n },\n\n setItemVariations(state, variations)\n {\n state.variations = variations;\n },\n\n addItemVariations(state, variations)\n {\n state.variations = state.variations || [];\n state.variations.push(...variations);\n\n state.units = state.units || [];\n for (const variation of variations)\n {\n state.units[variation.unitCombinationId] = variation.unitName;\n }\n },\n\n setVariationsLoading(state, loading)\n {\n state.variationsLoading = loading;\n },\n\n setUnits(state, units)\n {\n state.units = units;\n }\n };\n\nconst actions =\n {\n // eslint-disable-next-line complexity\n setVariationSelect({ commit, dispatch }, variationSelect)\n {\n const attributes = variationSelect.attributes;\n const variations = variationSelect.variations;\n const initialVariation = variations.find(variation => variationSelect.initialVariationId === parseInt(variation.variationId));\n const initialUnit = initialVariation && initialVariation.unitCombinationId || null;\n const selectedAttributes = {};\n const units = {};\n\n for (const attribute of attributes)\n {\n let variationAttribute;\n\n if ((App.config.item.showPleaseSelect && variationSelect.isPleaseSelectOption) || !initialVariation)\n {\n selectedAttributes[attribute.attributeId] = -1;\n }\n else\n {\n variationAttribute = initialVariation.attributes.find(variationAttribute => variationAttribute.attributeId === attribute.attributeId);\n selectedAttributes[attribute.attributeId] = variationAttribute ? variationAttribute.attributeValueId : null;\n }\n\n }\n\n for (const variation of variations)\n {\n units[variation.unitCombinationId] = variation.unitName;\n }\n\n if (variationSelect.afterKey)\n {\n dispatch(\"fetchVariations\", {\n itemId: variationSelect.itemId,\n afterKey: variationSelect.afterKey\n });\n }\n\n commit(\"selectItemUnit\", initialUnit);\n commit(\"setItemAttributes\", attributes);\n commit(\"setItemSelectedAttributes\", selectedAttributes);\n commit(\"setItemVariations\", variations);\n commit(\"setUnits\", units);\n },\n\n fetchVariations({ commit, dispatch }, { afterKey, itemId })\n {\n return new Promise((resolve, reject) =>\n {\n commit(\"setVariationsLoading\", true);\n ApiService\n .get(\"/rest/io/variations/map\", {\n itemId: itemId,\n afterKey: afterKey\n })\n .done(response =>\n {\n if (response.variations && response.variations.length)\n {\n commit(\"addItemVariations\", response.variations);\n }\n if (response.afterKey)\n {\n dispatch(\"fetchVariations\", {\n itemId: itemId,\n afterKey: response.afterKey\n });\n }\n else\n {\n commit(\"setVariationsLoading\", false);\n }\n\n resolve();\n })\n .fail(error =>\n {\n commit(\"setVariationsLoading\", false);\n reject(error);\n });\n });\n }\n };\n\nconst getters =\n {\n };\n\nexport default\n{\n namespaced: true,\n state,\n actions,\n mutations,\n getters\n};\n","import ApiService from \"../../../services/ApiService\";\nimport ItemModule from \"./ItemModule\";\nimport VariationSelectModule from \"./VariationSelectModule\";\nimport { store } from \"../../index\";\n\nconst state = () => ({\n isItemSet: false,\n itemSetId: 0,\n isSetLoading: false,\n isAddToBasketLoading: 0,\n previewItemId: 0,\n setComponentIds: [],\n mainItemId: null\n});\n\nconst mutations =\n {\n setIsSetLoading(state, isSetLoading)\n {\n state.isSetLoading = isSetLoading;\n },\n\n setIsAddToBasketLoading(state, isAddToBasketLoading)\n {\n state.isAddToBasketLoading = isAddToBasketLoading;\n },\n\n setIsItemSet(state, isItemSet)\n {\n state.isItemSet = !!isItemSet;\n },\n\n setItemSetId(state, itemSetId)\n {\n state.itemSetId = itemSetId;\n },\n\n setPreviewItemId(state, itemId)\n {\n state.previewItemId = itemId;\n },\n\n addComponent(state, itemId)\n {\n state.setComponentIds = state.setComponentIds || [];\n state.setComponentIds.push(itemId);\n },\n\n setMainItemId(state, itemId)\n {\n state.mainItemId = itemId;\n }\n };\n\nconst actions =\n {\n initVariation({ commit, dispatch }, variation)\n {\n // register a nested module for the main item\n dispatch(\"registerItem\", variation.documents[0]);\n commit(\"setMainItemId\", variation.documents[0].data.item.id);\n\n const setComponents = variation.documents[0].data.setComponents;\n\n if (!App.isShopBuilder && setComponents && setComponents.length)\n {\n commit(\"setIsItemSet\", true);\n commit(\"setItemSetId\", variation.documents[0].data.item.id);\n }\n },\n\n initSetComponents({ commit, dispatch, state, getters })\n {\n const setComponentIds = (getters.currentItemVariation.setComponents || []).map(component => component.defaultVariationId);\n\n commit(\"setIsSetLoading\", true);\n\n ApiService.get(\"/rest/io/variations\", { variationIds: setComponentIds, resultFieldTemplate: \"SingleItem\", setPriceOnly: true })\n .done(components =>\n {\n commit(\"setIsSetLoading\", false);\n\n for (const component of components.documents)\n {\n const itemId = component.data.item.id;\n const variationId = component.data.variation.id;\n\n const setComponentMeta = getters.currentItemVariation.setComponents.find((setComponent) => setComponent.itemId === itemId );\n\n if (setComponentMeta.minimumOrderQuantity <= 0)\n {\n setComponentMeta.minimumOrderQuantity = 1;\n }\n\n component.data.variation.minimumOrderQuantity = setComponentMeta.minimumOrderQuantity;\n component.data.variation.maximumOrderQuantity = setComponentMeta.maximumOrderQuantity;\n setComponentMeta.manufacturer = component.data.item.manufacturer;\n setComponentMeta.manufacturerId = component.data.item.manufacturerId;\n setComponentMeta.texts = component.data.texts;\n\n\n // register a module for every set item\n dispatch(\"registerItem\", component);\n commit(`${itemId}/setPleaseSelectVariationId`, variationId);\n commit(\"addComponent\", itemId);\n }\n });\n },\n\n registerItem({ commit }, item)\n {\n const itemId = item.data.item.id;\n // extend the structur of the object to match the old objects\n const extendedData = { documents: [item] };\n\n store.registerModule([\"items\", itemId], ItemModule, { preserveState: !!this.state.items[itemId] });\n store.registerModule([\"items\", itemId, \"variationSelect\"], VariationSelectModule, { preserveState: !!this.state.items[itemId][\"variationSelect\"] });\n commit(`${itemId}/setVariation`, extendedData);\n }\n };\n\nconst getters =\n {\n itemSetTotalPrice(state, getters)\n {\n if (!state.isSetLoading)\n {\n let totalPrice = 0;\n\n for (const itemId of state.setComponentIds)\n {\n const price = getters[`${ itemId }/variationTotalPrice`] * state[itemId].variationOrderQuantity;\n\n totalPrice += price;\n }\n\n return totalPrice;\n }\n else\n {\n return state[state.itemSetId].variation.documents[0].data.prices.default.price.value;\n }\n },\n\n itemSetAllVariationSelected(state)\n {\n let allVariationSelected = true;\n\n for (const itemId of state.setComponentIds)\n {\n const isSelected = state[itemId].variationSelect.isVariationSelected;\n\n allVariationSelected = allVariationSelected && isSelected;\n }\n\n return allVariationSelected;\n },\n\n currentItemVariation(state, getters)\n {\n return getters[`${state.mainItemId}/currentItemVariation`];\n }\n };\n\nexport default\n{\n state,\n mutations,\n actions,\n getters\n};\n","import Vue from \"vue\";\nimport Vuex from \"vuex\";\n\nimport ApiService from \"../services/ApiService\";\n\nimport address from \"./modules/AddressModule\";\nimport basket from \"./modules/BasketModule\";\nimport checkout from \"./modules/CheckoutModule\";\nimport consents from \"./modules/ConsentModule\";\nimport contactForm from \"./modules/ContactFormModule\";\nimport itemList from \"./modules/ItemListModule\";\nimport itemSearch from \"./modules/ItemSearchModule\";\nimport lastSeen from \"./modules/LastSeenModule\";\nimport lazyComponent from \"./modules/LazyComponentModule\";\nimport liveShopping from \"./modules/LiveShoppingModule\";\nimport localization from \"./modules/LocalizationModule\";\nimport navigation from \"./modules/NavigationModule\";\nimport orderReturn from \"./modules/OrderReturnModule\";\nimport user from \"./modules/UserModule\";\nimport wishList from \"./modules/WishListModule\";\nimport items from \"./modules/singleItem/BaseItemModule\";\n\nimport eventPropagation from \"./plugins/EventPropagationPlugin\";\nimport { isDefined } from \"../helper/utils\";\nimport { getUrlParams } from \"../services/UrlService\";\nimport TranslationService from \"../services/TranslationService\";\nimport NotificationService from \"../services/NotificationService\";\n\nexport let store;\n\n// TODO: add code comment\nexport function createStore()\n{\n // =========================\n // init vuex store\n // =========================\n\n Vue.options.delimiters = [\"${\", \"}\"];\n Vue.use(Vuex);\n\n // eslint-disable-next-line\n store = new Vuex.Store(\n {\n modules:\n {\n address,\n basket,\n checkout,\n consents,\n contactForm,\n itemList,\n items,\n itemSearch,\n lastSeen,\n lazyComponent,\n liveShopping,\n localization,\n navigation,\n orderReturn,\n user,\n wishList\n },\n\n plugins: !App.isSSR ? [eventPropagation] : []\n });\n\n return store;\n}\n\n// TODO: add code comment\nexport function initServerStore(store)\n{\n store.commit(\"setShippingCountries\", App.initialData.shippingCountries);\n store.commit(\"setShippingCountryId\", App.initialData.shippingCountryId);\n store.commit(\"setShowNetPrices\", App.initialData.showNetPrices);\n if ( App.initialData.euShippingCountries)\n {\n store.commit(\"setEuShippingCountries\", App.initialData.euShippingCountries);\n }\n}\n\n// TODO: add code comment\nexport function initClientListeners(store)\n{\n ApiService.listen(\"LocalizationChanged\", data =>\n {\n store.commit(\"setShippingCountries\", data.localization.activeShippingCountries);\n store.commit(\"setShippingCountryId\", data.localization.currentShippingCountryId);\n });\n\n ApiService.listen(\"AfterBasketChanged\", data =>\n {\n store.commit(\"setBasket\", data.basket);\n store.commit(\"setShowNetPrices\", data.showNetPrices);\n store.commit(\"updateBasketItems\", data.basketItems);\n store.commit(\"setWishListIds\", data.basket.itemWishListIds);\n });\n\n ApiService.listen(\"AfterBasketItemAdd\", data =>\n {\n store.commit(\"addBasketItem\", data.basketItems);\n });\n\n ApiService.listen(\"AfterBasketItemUpdate\", data =>\n {\n store.commit(\"updateBasketItem\", data.basketItems[0]);\n });\n\n ApiService.after(() =>\n {\n // unset flag that indicates a basket item quantity update after each request.\n store.commit(\"setIsBasketItemQuantityUpdate\", false);\n });\n\n /**\n * Adds login/logout event listeners\n */\n ApiService.listen(\"AfterAccountAuthentication\", userData =>\n {\n store.commit(\"setUserData\", userData.accountContact);\n });\n ApiService.listen(\"AfterAccountContactLogout\", () =>\n {\n store.commit(\"setUserData\", null);\n });\n}\n\n// TODO: add code comment\nexport function initClientStore(store)\n{\n store.commit(\"initConsents\");\n\n if (App.isSearch)\n {\n store.dispatch(\"loadComponent\", \"item-search\");\n }\n\n // Use DOMContentLoaded to load session data after app has been initialized\n document.addEventListener(\"DOMContentLoaded\", () =>\n {\n const urlParams = getUrlParams();\n\n if (store.getters.currentItemVariation)\n {\n urlParams.lastSeenVariationId = store.getters.currentItemVariation.variation.id;\n }\n\n ApiService.get(\"/rest/io/session\", urlParams, { cache: false, keepOriginalResponse: true })\n .done(response =>\n {\n if (isDefined(response.data.customer))\n {\n store.commit(\"setUserData\", response.data.customer);\n }\n\n if (!response.events.hasOwnProperty(\"AfterBasketChanged\"))\n {\n // only set basket if not change event is emitted. In this case, the basket will be set by the event listener.\n store.commit(\"setBasket\", response.data.basket);\n store.commit(\"setWishListIds\", response.data.basket.itemWishListIds);\n }\n\n store.commit(\"setIsBasketInitiallyLoaded\");\n store.commit(\"setBasketItems\", response.data.basketItems);\n })\n .catch((error, status) =>\n {\n console.log(error, status);\n\n if (status > 0)\n {\n NotificationService.error(\n TranslationService.translate(\"Ceres::Template.basketOops\")\n ).closeAfter(10000);\n }\n });\n });\n}\n\nexport default { createStore, initServerStore, initClientListeners, initClientStore, store };\n","const NotificationService = require(\"../../services/NotificationService\");\nconst cloneDeep = require(\"lodash/cloneDeep\");\n\nexport default function(store)\n{\n const useDeepClone = App.config.log.performanceEventPropagation;\n\n let oldState = useDeepClone ? cloneDeep(store.state) : {};\n\n store.subscribe((mutation, state) =>\n {\n const nextState = useDeepClone ? cloneDeep(state) : {};\n const eventName = \"on\" + mutation.type.charAt(0).toUpperCase() + mutation.type.substr(1);\n const event = new CustomEvent(eventName, { detail: { payload: mutation.payload, newState: nextState, oldState } });\n\n document.dispatchEvent(event);\n document.dispatchEvent(\n new CustomEvent(\"storeChanged\", { detail: { payload: mutation.payload, newState: nextState, oldState } })\n );\n\n NotificationService.log(eventName);\n oldState = nextState;\n });\n}\n","import { store } from \"../../store/index\";\nimport { isDefined } from \"../../helper/utils\";\nimport Vue from \"vue\";\n\nVue.directive(\"populate-store\", {\n\n bind(el, binding)\n {\n const name = binding.value.name;\n const data = binding.value.data;\n const type = binding.arg;\n\n if (isDefined(name))\n {\n if (type === \"action\")\n {\n store.dispatch(name, data);\n }\n else if (type === \"mutation\")\n {\n store.commit(name, data);\n }\n }\n }\n});\n","import Vue from \"vue\";\n\nVue.directive(\"validate\", {\n\n bind(el, binding)\n {\n if (binding.value !== false)\n {\n el.dataset.validate = binding.arg || \"\";\n }\n },\n\n update(el, binding)\n {\n if (binding.value === false)\n {\n delete el.dataset.validate;\n }\n else\n {\n el.dataset.validate = binding.arg || \"\";\n }\n }\n});\n","import Vue from \"vue\";\n\nVue.directive(\"waiting-animation\", {\n bind(el)\n {\n console.warn(`Directive \"v-waiting-animation\" is deprecated. Please use \"icon\" component instead.`);\n }\n});\n","import Vue from \"vue\";\n\nVue.directive(\"waiting-animation-infinite\", {\n\n bind(el)\n {\n $(el).click(event =>\n {\n event.currentTarget.classList.add(\"disabled\");\n\n event.currentTarget.children[0].className = \"\";\n event.currentTarget.children[0].className = \"fa fa-circle-o-notch fa-spin\";\n });\n }\n});\n","import Vue from \"vue\";\n\nVue.directive(\"navigation-touch-handler\", {\n bind(el)\n {\n if (document.body.classList.contains(\"touch\"))\n {\n const className = \"hover\";\n\n el.addEventListener(\"click\", event =>\n {\n const isHover = el.classList.contains(className);\n\n for (const element of document.querySelectorAll(\".ddown.hover\"))\n {\n element.classList.remove(className);\n }\n\n if (isHover)\n {\n el.classList.remove(className);\n }\n else\n {\n el.classList.add(className);\n event.preventDefault();\n }\n });\n }\n }\n});\n","import Vue from \"vue\";\n\nVue.directive(\"open-mobile-navigation\",\n {\n bind(el)\n {\n el.onclick = () => ceresStore.commit(\"setIsMobileNavigationOpen\", true);\n }\n });\n","import Vue from \"vue\";\n\nVue.directive(\"scroll-to-top\",\n {\n bind(el, binding)\n {\n el.onclick = event =>\n {\n $(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\n };\n }\n });\n","import { isNullOrUndefined } from \"./utils\";\nimport { applyStyles } from \"./dom\";\nimport { detectPassiveEvents } from \"./featureDetect\";\nimport { repeatAnimationFrame } from \"./repeatAnimationFrame\";\n\nconst STICKY_EVENTS = [\n \"resize\",\n \"scroll\",\n \"touchstart\",\n \"touchmove\",\n \"touchend\",\n \"pageshow\",\n \"load\",\n \"move-sticky\"\n];\n\nconst STICKY_EVENTS_PASSIVE = [\n \"scroll\",\n \"touchstart\",\n \"touchmove\"\n];\n\nexport class StickyElement\n{\n constructor(el, vm, minWidth)\n {\n this.el = el;\n this.vm = vm;\n this.offsetTop = 0;\n this.minWidth = minWidth;\n this.isMinWidth = true;\n this.checkMinWidth();\n\n this.resizeListener = this.checkMinWidth.bind(this);\n\n window.addEventListener(\"resize\", this.resizeListener);\n\n this.vm.$nextTick(() =>\n {\n const containerElement = this.getContainerElement();\n\n containerElement.__stickyElements = this.getContainerElement().__stickyElements || [];\n containerElement.__stickyElements.push(this);\n containerElement.__stickyElements.forEach(stickyElement => stickyElement.calculateOffset());\n });\n\n el.classList.add(\"sticky-element\");\n\n const updateHandler = () =>\n {\n if (this.enabled)\n {\n this.checkElement();\n this.updateStyles();\n }\n };\n\n // Update if height of sticky element changes\n if (\"ResizeObserver\" in window)\n {\n this.resizeObserver = new ResizeObserver(updateHandler.bind(this));\n this.resizeObserver.observe(this.el);\n }\n // IE11 + Safari < 13.0\n else\n {\n this.el.addEventListener(\"updateStickyContainer\", () =>\n {\n const stop = repeatAnimationFrame(updateHandler.bind(this));\n\n setTimeout(stop, 500);\n });\n }\n }\n\n enable()\n {\n this.vm.$nextTick(() =>\n {\n if (this.enabled || App.isShopBuilder)\n {\n return;\n }\n\n this.animationFrame = 0;\n this.placeholder = document.createElement(\"DIV\");\n this.el.parentNode.insertBefore(this.placeholder, this.el);\n this.eventListener = () =>\n {\n if (this.shouldUpdate())\n {\n if (this.checkElement())\n {\n if (this.animationFrame > 0)\n {\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = 0;\n }\n this.animationFrame = requestAnimationFrame(this.updateStyles.bind(this));\n }\n }\n };\n\n const isPassiveEventSupported = detectPassiveEvents();\n\n document.addEventListener(\"storeChanged\", this.eventListener);\n STICKY_EVENTS.forEach(event =>\n {\n window.addEventListener(event, this.eventListener,\n isPassiveEventSupported && !!STICKY_EVENTS_PASSIVE.includes(event) ? { passive: true } : false);\n });\n\n this.enabled = true;\n this.calculateOffset();\n });\n }\n\n disable()\n {\n this.vm.$nextTick(() =>\n {\n if (!isNullOrUndefined(this.placeholder))\n {\n this.getContainerElement().removeChild(this.placeholder);\n }\n this.placeholder = null;\n });\n\n applyStyles(this.el, {\n position: null,\n top: null,\n left: null,\n width: null,\n zIndex: null\n });\n\n document.removeEventListener(\"storeChanged\", this.eventListener);\n STICKY_EVENTS.forEach(event =>\n {\n window.removeEventListener(event, this.eventListener);\n });\n this.eventListener = null;\n if (this.animationFrame > 0)\n {\n cancelAnimationFrame(this.animationFrame);\n }\n this.animationFrame = 0;\n this.enabled = false;\n }\n\n shouldUpdate()\n {\n return (this.enabled && this.isMinWidth) || (this.position || {}).isSticky;\n }\n\n checkElement(skipOffsetCalculation)\n {\n if (!this.enabled)\n {\n return false;\n }\n\n const oldValue = this.position || {};\n const elementRect = this.el.getBoundingClientRect();\n const placeholderRect = this.placeholder.getBoundingClientRect();\n const containerRect = this.getContainerElement().getBoundingClientRect();\n const maxBottom = Math.min(containerRect.bottom - elementRect.height - this.offsetTop - this.offsetBottom, 0);\n\n if (oldValue.height !== elementRect.height && !skipOffsetCalculation)\n {\n this.calculateOffset();\n }\n\n this.position = {\n height: elementRect.height,\n width: placeholderRect.width,\n // eslint-disable-next-line id-length\n x: placeholderRect.left,\n // eslint-disable-next-line id-length\n y: maxBottom + this.offsetTop,\n origY: placeholderRect.top,\n isSticky: elementRect.height < containerRect.height && placeholderRect.top <= this.offsetTop\n };\n\n // check if any property has changed\n return [\"width\", \"height\", \"x\", \"y\", \"origY\", \"isSticky\"]\n .some(property => oldValue[property] !== this.position[property]);\n }\n\n calculateOffset()\n {\n if (!this.enabled)\n {\n return;\n }\n\n this.offsetTop = 0;\n\n // Check if Custom Header\n if (document.querySelector(\"[data-header-offset]\"))\n {\n const headerChildren = document.querySelector(\"[data-header-offset]\").children;\n\n for (let i = 0; i < headerChildren.length; i++)\n {\n if (!headerChildren[i].classList.contains(\"unfixed\"))\n {\n this.offsetTop += headerChildren[i].getBoundingClientRect().height;\n }\n }\n }\n else\n {\n this.offsetTop += document.getElementById(\"page-header\").getBoundingClientRect().height;\n }\n\n this.offsetBottom = 0;\n if (isNullOrUndefined(this.position))\n {\n this.checkElement(true);\n }\n\n this.getSiblingStickies()\n .forEach(stickyElement =>\n {\n if (isNullOrUndefined(stickyElement.position))\n {\n stickyElement.checkElement(true);\n }\n\n if (stickyElement.position.origY + stickyElement.position.height <= this.position.origY)\n {\n this.offsetTop += stickyElement.position.height;\n }\n else if (stickyElement.position.origY >= this.position.origY + this.position.height)\n {\n this.offsetBottom += stickyElement.position.height;\n }\n });\n }\n\n updateStyles()\n {\n let styles = {\n position: null,\n top: null,\n left: null,\n width: null,\n zIndex: null,\n transform: null\n };\n\n let placeholderStyles = {\n paddingTop: null\n };\n\n if (this.position.isSticky)\n {\n // Fix blur while gpu accelerated\n const roundedPosition = Math.round(this.position.y / 2) * 2;\n\n styles = {\n position: \"fixed\",\n top: 0,\n transform: \"translate3d(0, \" + roundedPosition + \"px, 0)\",\n left: this.position.x + \"px\",\n width: this.position.width + \"px\"\n };\n\n placeholderStyles = {\n paddingTop: this.position.height + \"px\"\n };\n\n this.el.classList.add(\"is-sticky\");\n }\n else\n {\n this.el.classList.remove(\"is-sticky\");\n }\n\n applyStyles(this.el, styles);\n applyStyles(this.placeholder, placeholderStyles);\n }\n\n checkMinWidth()\n {\n this.isMinWidth = window.matchMedia(\"(min-width: \" + this.minWidth + \"px)\").matches;\n }\n\n getSiblingStickies()\n {\n const container = this.getContainerElement();\n\n if (isNullOrUndefined(container))\n {\n return [];\n }\n\n if (isNullOrUndefined(container.__stickyElements))\n {\n container.__stickyElements = [];\n }\n\n return container.__stickyElements;\n }\n\n getContainerElement()\n {\n if (this.el.dataset.hasOwnProperty(\"stickyContainer\"))\n {\n const container = document.querySelector(this.el.dataset.stickyContainer);\n\n if (!isNullOrUndefined(container))\n {\n return container;\n }\n }\n return this.el.parentElement;\n }\n\n destroy()\n {\n window.removeEventListener(\"resize\", this.resizeListener);\n const idx = this.getSiblingStickies().indexOf(this);\n\n if (idx >= 0)\n {\n this.getContainerElement().__stickyElements.splice(idx, 1);\n }\n\n if (this.resizeObserver)\n {\n this.resizeObserver.unobserve(this.el);\n }\n\n this.el.classList.remove(\"sticky-element\");\n }\n}\n","/**\n * Request animation frames calling a handler function repeatingly until the returned callback is called.\n *\n * @param {function} handler The handler to be executed when running each animation frame\n * @returns {function(): void} Callback function to stop execution of animation frames.\n */\nexport function repeatAnimationFrame(handler)\n{\n let currentAnimationFrame;\n\n const next = () =>\n {\n currentAnimationFrame = requestAnimationFrame(animationFrameHandler);\n };\n\n const animationFrameHandler = () =>\n {\n handler();\n next();\n };\n\n next();\n\n return () =>\n {\n cancelAnimationFrame(currentAnimationFrame);\n };\n}\n","import { isNullOrUndefined } from \"../../helper/utils\";\nimport { StickyElement } from \"../../helper/StickyElement\";\nimport Vue from \"vue\";\n\nVue.directive(\"stick-in-parent\",\n {\n bind(el, binding, vnode)\n {\n el.__sticky = new StickyElement(\n el,\n vnode.context,\n parseInt(binding.arg) || 768\n );\n\n if (binding.value === false)\n {\n el.__sticky.disable();\n }\n else\n {\n el.__sticky.enable();\n }\n },\n update(el, binding)\n {\n if (!isNullOrUndefined(el.__sticky))\n {\n el.__sticky.minWidth = parseInt(binding.arg) || 768;\n if (binding.value === false)\n {\n el.__sticky.disable();\n }\n else\n {\n el.__sticky.enable();\n }\n el.__sticky.checkMinWidth();\n }\n },\n unbind(el)\n {\n if (!isNullOrUndefined(el.__sticky))\n {\n el.__sticky.destroy();\n el.__sticky = null;\n }\n }\n });\n","import Vue from \"vue\";\nimport ApiService from \"../../services/ApiService\";\nimport { isDefined, isNull } from \"../../helper/utils\";\n\nclass SidenavigationChildrenLoader\n{\n constructor(element, categoryId, currentUrl, isActive, showItemCount, childCount, openClassName, spacingPadding, inlinePadding)\n {\n this.categoryId = categoryId;\n this.element = element;\n this.currentUrl = currentUrl;\n this.showItemCount = showItemCount;\n this.childCount = childCount;\n this.openClassName = openClassName || \"is-open\";\n this.spacingPadding = spacingPadding || \"\";\n this.inlinePadding = inlinePadding || \"\";\n\n this.template = \"\";\n this.placeholders = [];\n\n if (isActive)\n {\n this.firstChildrenLoad = true;\n setTimeout(() =>\n {\n this.parent.classList.add(this.openClassName);\n }, 0);\n }\n }\n\n get parent()\n {\n return this.element.parentElement;\n }\n\n createElement(tag, classes, width, innerText, child, spacingPadding, inlinePadding)\n {\n const element = document.createElement(tag);\n\n if (isDefined(classes))\n {\n element.classList.add(classes);\n }\n\n if (isDefined(width))\n {\n element.style.width = width;\n }\n\n if (!isNull(innerText))\n {\n element.innerText = innerText;\n }\n\n if (isDefined(child))\n {\n element.appendChild(child);\n }\n\n if (isDefined(spacingPadding) && spacingPadding.length > 0)\n {\n const paddingClasses = spacingPadding.split(\" \");\n\n element.classList.add(paddingClasses);\n }\n\n if (isDefined(inlinePadding) && inlinePadding.length > 0)\n {\n element.style = inlinePadding;\n }\n\n return element;\n }\n\n createPlaceholder()\n {\n for (let i = 0; i < this.childCount; i++)\n {\n const placeholder = this.createElement(\"ul\", null, null, null,\n this.createElement(\"li\", \"nav-item\", null, null,\n this.createElement(\"a\", \"nav-link\", null, null,\n this.createElement(\"span\", \"placeholder\",\n Math.floor((Math.random() * 20) + 10) + \"%\", \".\"), this.spacingPadding, this.inlinePadding)));\n\n this.placeholders.push(placeholder);\n this.parent.appendChild(placeholder);\n }\n }\n\n removePlaceholder()\n {\n for (const placeholder of this.placeholders)\n {\n placeholder.parentNode.removeChild(placeholder);\n }\n }\n\n loadChildren()\n {\n return new Promise(resolve =>\n {\n ApiService.get(\"/rest/io/categorytree/template_for_children\", {\n categoryId: this.categoryId,\n currentUrl: this.currentUrl,\n showItemCount: this.showItemCount ? 1 : 0,\n spacingPadding: this.spacingPadding,\n inlinePadding: this.inlinePadding\n })\n .then(result =>\n {\n this.template = result;\n resolve(this.template);\n });\n });\n }\n\n createChildren()\n {\n for (const template of this.getSplitMarkup())\n {\n const ul = document.createElement(\"ul\");\n\n this.parent.appendChild(ul);\n\n // IE11 linebreak entity in string bricks vue compile\n while (template.includes(\"
\"))\n {\n template = template.replace(\"
\", \"\");\n }\n\n const compiled = Vue.compile(template);\n\n new Vue({\n store: window.ceresStore,\n render: compiled.render,\n staticRenderFns: compiled.staticRenderFns\n }).$mount(ul);\n }\n }\n\n getSplitMarkup()\n {\n const fragment = document.createRange().createContextualFragment(this.template);\n const elements = fragment.childNodes;\n const children = [];\n\n let i = 0;\n\n let node;\n\n while (node = elements[i++])\n {\n if (node.nodeType === 1)\n {\n children.push(node.outerHTML);\n }\n }\n\n return children;\n }\n\n toggle()\n {\n if (!this.firstChildrenLoad)\n {\n this.firstChildrenLoad = true;\n this.createPlaceholder();\n this.loadChildren().then(() =>\n {\n this.removePlaceholder();\n this.createChildren();\n });\n }\n\n this.parent.classList.toggle(this.openClassName);\n }\n}\n\nVue.directive(\"sidenavigation-children\", {\n bind(el, binding)\n {\n const categoryId = binding.value.categoryId;\n const currentUrl = binding.value.currentUrl;\n const isActive = binding.value.isActive;\n const showItemCount = binding.value.showItemCount;\n const childCount = binding.value.childCount;\n const openClassName = binding.value.openClassName;\n const spacingPadding = binding.value.spacingPadding;\n const inlinePadding = binding.value.inlinePadding;\n\n const sidenavigationChildrenLoader = new SidenavigationChildrenLoader(\n el,\n categoryId,\n currentUrl,\n isActive,\n showItemCount,\n childCount,\n openClassName,\n spacingPadding,\n inlinePadding\n );\n\n el.addEventListener(\"click\", () =>\n {\n sidenavigationChildrenLoader.toggle();\n });\n }\n});\n","import Vue from \"vue\";\n\nconst toggleTooltip = (el, disable) =>\n{\n if (disable)\n {\n $(el).tooltip(\"disable\");\n }\n else\n {\n // reinitialize tooltip, to update the title value\n $(el).tooltip(\"dispose\");\n $(el).tooltip();\n }\n};\n\nVue.directive(\"tooltip\", {\n\n unbind(el)\n {\n $(el).tooltip(\"dispose\");\n },\n\n update(el, binding)\n {\n toggleTooltip(el, binding.value === false);\n },\n\n bind(el, binding)\n {\n if (window.matchMedia(\"(min-width: 768px)\").matches)\n {\n setTimeout(() =>\n {\n $(el).tooltip();\n toggleTooltip(el, binding.value === false);\n }, 1);\n }\n\n }\n});\n","import TranslationService from \"../services/TranslationService\";\nimport Vue from \"vue\";\n\nVue.filter(\"ageRestriction\", age =>\n{\n if (age === 0)\n {\n return TranslationService.translate(\"Ceres::Template.singleItemAgeRestrictionNone\");\n }\n else if (age > 0 && age <= 18)\n {\n return TranslationService.translate(\"Ceres::Template.singleItemAgeRestriction\", { age });\n }\n else if (age === 50)\n {\n return TranslationService.translate(\"Ceres::Template.singleItemAgeRestrictionNotFlagged\");\n }\n else if (age === 88)\n {\n return TranslationService.translate(\"Ceres::Template.singleItemAgeRestrictionNotRequired\");\n }\n else\n {\n return TranslationService.translate(\"Ceres::Template.singleItemAgeRestrictionUnknown\");\n }\n});\n","import Vue from \"vue\";\n\n/**\n * @deprecated since version 4.2.0\n * Will be deleted in version 5.0.0\n */\nVue.filter(\"arrayFirst\", function(array)\n{\n console.warn(\"arrayFirst is a deprecated vue filter!\");\n return array[0];\n});\n","import Vue from \"vue\";\n\n/**\n * @deprecated since version 4.2.0\n *\n * Will be deleted in version 5.0.0\n */\nVue.filter(\"attachText\", function(item, text)\n{\n console.warn(\"attachText is a deprecated vue filter!\");\n return text + item;\n});\n","import MonetaryFormatter from \"../helper/MonetaryFormatter\";\nimport Vue from \"vue\";\n\nconst formatter = new MonetaryFormatter();\n\nVue.filter(\"currency\", function(price, currency = App.activeCurrency)\n{\n if (price === \"N / A\")\n {\n return price;\n }\n\n return formatter.format(parseFloat(price), currency);\n});\n","import { isNullOrUndefined } from \"./utils\";\n\nconst MonetaryFormatter = (function()\n{\n const T_DIGIT = 0;\n const T_DECIMAL = 1;\n const T_CURRENCY = 2;\n const T_SIGN = 3;\n const T_CHAR = 4;\n\n function MonetaryFormatter()\n {\n this.setPattern(App.currencyPattern.pattern);\n this.separatorThousands = App.currencyPattern.separator_thousands;\n this.separatorDecimals = App.currencyPattern.separator_decimal;\n this.sign = \"-\";\n }\n\n function _parse(pattern)\n {\n const parsed = [];\n\n while (pattern.length > 0)\n {\n if (pattern.indexOf(\"\\u00a4\") === 0)\n {\n parsed.push({\n type: T_CURRENCY\n });\n pattern = pattern.substr(1);\n }\n else if (pattern.indexOf(\"#,##0\") === 0)\n {\n parsed.push({\n type: T_DIGIT\n });\n pattern = pattern.substr(5);\n }\n else if (/^\\.0+/.test(pattern))\n {\n const match = /^\\.(0+)/.exec(pattern);\n\n parsed.push({\n type: T_DECIMAL,\n value: match[1].length\n });\n pattern = pattern.substr(match[0].length);\n }\n else if (pattern.indexOf(\"-\") === 0)\n {\n parsed.push({\n type: T_SIGN\n });\n pattern = pattern.substr(1);\n }\n else\n {\n parsed.push({\n type: T_CHAR,\n value: pattern.charAt(0)\n });\n pattern = pattern.substr(1);\n }\n }\n\n return parsed;\n }\n\n MonetaryFormatter.prototype.setPattern = function(pattern)\n {\n this.pattern = [];\n pattern.split(\";\").forEach(subpattern =>\n {\n this.pattern.push(\n _parse(subpattern)\n );\n });\n };\n\n MonetaryFormatter.prototype.setSeparators = function(separatorThousands, separatorDecimals)\n {\n this.separatorThousands = separatorThousands;\n this.separatorDecimals = separatorDecimals;\n };\n\n MonetaryFormatter.prototype.setSign = function(sign)\n {\n this.sign = sign;\n };\n\n MonetaryFormatter.prototype.format = function(value, currency)\n {\n let patternIndex = 0;\n\n let prefix = \"\";\n\n const displayCurrency = App.config.currency.format === \"symbol\"\n ? App.currencyPattern.symbols[currency]\n : Object.keys(App.currencyPattern.symbols).find(isoCode => App.currencyPattern.symbols[isoCode] === currency);\n\n currency = displayCurrency || currency;\n\n if (isNullOrUndefined(value) || (parseFloat(value) !== parseFloat(value)))\n {\n value = 0;\n }\n\n if (value < 0)\n {\n if (this.pattern.length > 1)\n {\n patternIndex = 1;\n }\n else\n {\n prefix = this.sign;\n }\n }\n\n const formatDecimals = (value, numberOfDecimals) =>\n {\n // FIX: add smallest number next to 0 to value to avoid float conversion errors, eg 0.005 => 0.004999999.\n // 9007199254740991 = Number.MAX_SAFE_INTEGER\n let result = Math.round((value + (1/9007199254740991)) * Math.pow(10, numberOfDecimals))\n .toFixed(0)\n .substr(-1 * numberOfDecimals, numberOfDecimals);\n\n while (result.length < numberOfDecimals)\n {\n result = \"0\" + result;\n }\n\n return result;\n };\n\n return prefix + this.pattern[patternIndex].map((partial, index, pattern) =>\n {\n switch (partial.type)\n {\n case T_DIGIT: {\n if (value < 0)\n {\n value *= -1;\n }\n // check if pattern include decimals to decide if digits should be rounded or not\n const roundDigits = !pattern.some(subpattern =>\n {\n\n return subpattern.type === T_DECIMAL\n && parseInt(formatDecimals(value, parseInt(subpattern.value))) !== 0;\n });\n\n // cut decimal places instead of rounding\n // revert the value to insert thousands separators next\n let digits = (roundDigits ? Math.round(value * 100) / 100 : parseInt(value))\n .toFixed(0)\n .split(\"\").reverse().join(\"\");\n\n // insert thousands separator\n for (let i = 3; i < digits.length; i += 4)\n {\n digits = digits.substr(0, i) + this.separatorThousands + digits.substr(i);\n }\n\n // revert back again\n digits = digits.split(\"\").reverse().join(\"\");\n\n return digits;\n }\n case T_DECIMAL: {\n const numberOfDecimals = parseInt(partial.value);\n\n return this.separatorDecimals + formatDecimals(value, numberOfDecimals);\n }\n case T_CURRENCY: {\n return currency;\n }\n case T_SIGN: {\n return this.sign;\n }\n case T_CHAR: {\n return partial.value;\n }\n default: {\n console.warn(\"Unknown pattern type: \" + partial.type);\n return \"\";\n }\n }\n }).join(\"\");\n };\n\n return MonetaryFormatter;\n})();\n\nexport default MonetaryFormatter;\n","// for docs see https://github.com/brockpetrie/vue-moment\nimport TranslationService from \"../services/TranslationService\";\nimport Vue from \"vue\";\nimport dayjs from \"dayjs\";\n\nconst dateFilter = function()\n{\n const args = Array.prototype.slice.call(arguments);\n const input = args.shift();\n\n let date;\n\n if (isNaN(new Date(input).getTime()))\n {\n return input;\n }\n\n if (Array.isArray(input) && typeof input[0] === \"string\")\n {\n // If input is array, assume we're being passed a format pattern to parse against.\n // Format pattern will accept an array of potential formats to parse against.\n // Date string should be at [0], format pattern(s) should be at [1]\n date = dayjs(input[0], input[1]);\n }\n else\n {\n // Otherwise, throw the input at moment and see what happens...\n date = dayjs(input);\n }\n\n if (!date.isValid())\n {\n // Log a warning if moment couldn't reconcile the input. Better than throwing an error?\n console.warn(\"Could not build a valid `dayjs` object from input.\");\n return input;\n }\n\n return date.format(args.shift() || TranslationService.translate(\"Ceres::Template.devDateFormatMoment\"));\n};\n\nVue.filter(\"moment\", dateFilter);\nVue.filter(\"date\", dateFilter);\n","import Vue from \"vue\";\n\n// =========================\n// COMPONENTS\n// =========================\n\n// BASE\nimport LazyImg from \"./app/components/common/LazyImg.vue\";\nimport Intersect from \"./app/components/common/Intersect.vue\";\nimport TabList from \"./app/components/common/TabList.vue\";\nimport TabItem from \"./app/components/common/TabItem.vue\";\nimport LazyLoad from \"./app/components/common/LazyLoad.vue\";\n\nimport ReCaptcha from \"./app/components/customer/ReCaptcha.vue\";\n// legacy non-shopbuilder component\nimport UserLoginHandler from \"./app/components/customer/login/UserLoginHandler.vue\";\n\n/* NK import CategoryItem from \"./app/components/itemList/CategoryItem.vue\"; */\nimport ItemSearch from \"./app/components/itemList/ItemSearch.vue\";\n\nimport CookieBar from \"./app/components/pageDesign/CookieBar.vue\";\n/* NK import Carousel from \"./app/components/pageDesign/Carousel.vue\"; */\n/* NK import Icon from \"./app/components/pageDesign/Icon.vue\"; */\nimport LanguageDetection from \"./app/components/pageDesign/LanguageDetection.vue\";\n/* NK import MobileNavigation from \"./app/components/pageDesign/MobileNavigation.vue\"; */\nimport Notifications from \"./app/components/pageDesign/Notifications.vue\";\nimport Popper from \"./app/components/pageDesign/Popper.vue\";\nimport LoadingAnimation from \"./app/components/pageDesign/LoadingAnimation.vue\";\n\n/* NK import WishListCount from \"./app/components/wishList/WishListCount.vue\"; */\n\nimport SingleItem from \"./app/components/item/SingleItem.vue\";\nimport SingleItemSetComponent from \"./app/components/item/SingleItemSetComponent.vue\";\n\n// EXTERNAL\nimport LazyHydrate from \"vue-lazy-hydration\";\nimport ClientOnly from \"./app/components/common/ClientOnly.vue\";\nimport script2 from \"./app/plugins/script2\";\n\n\n// =========================\n// SERVICES\n// =========================\nimport TranslationService from \"./app/services/TranslationService\";\n\n// =========================\n// MIXINS\n// =========================\nimport \"./app/mixins/template.mixin\";\nimport \"./app/mixins/getJsonData.mixin\";\n\n// =========================\n// DIRECTIVES\n// =========================\nimport \"./app/directives/basket/basketItemQuantity\";\nimport \"./app/directives/basket/basketItemSum\";\nimport \"./app/directives/basket/toggleBasketPreview\";\nimport \"./app/directives/category/openFilterToolbar\";\nimport \"./app/directives/common/truncateTooltip\";\nimport \"./app/directives/customer/logout\";\nimport \"./app/directives/helper/populateStore\";\nimport \"./app/directives/helper/validate\";\nimport \"./app/directives/helper/waitingAnimation\";\nimport \"./app/directives/helper/waitingAnimationInfinite\";\nimport \"./app/directives/navigation/navigationTouchHandler\";\nimport \"./app/directives/navigation/openMobileNavigation\";\nimport \"./app/directives/pageDesign/scrollToTop\";\nimport \"./app/directives/pageDesign/stickInParent\";\nimport \"./app/directives/navigation/sidenavigationChildrenLoader\";\nimport \"./app/directives/pageDesign/tooltip\";\n\n\n// =========================\n// FILTERS\n// =========================\nimport \"./app/filters/ageRestriction.filter\";\nimport \"./app/filters/arrayFirst.filter\";\nimport \"./app/filters/attachText.filter\";\nimport \"./app/filters/currency.filter\";\nimport \"./app/filters/date.filter\";\nimport \"./app/filters/fileName.filter\";\nimport \"./app/filters/fileUploadPath.filter\";\nimport \"./app/filters/graduatedPrice.filter\";\nimport \"./app/filters/hasItemDefaultPrice.filter\";\nimport \"./app/filters/inputUnit.filter\";\nimport \"./app/filters/itemBundleName.filter\";\nimport \"./app/filters/itemCrossPrice.filter\";\nimport \"./app/filters/itemImage.filter\";\nimport \"./app/filters/itemImageHeight.filter\";\nimport \"./app/filters/itemImageWidth.filter\";\nimport \"./app/filters/itemImageAlternativeText.filter\";\nimport \"./app/filters/itemImages.filter\";\nimport \"./app/filters/itemName.filter\";\nimport \"./app/filters/itemPrice.filter\";\nimport \"./app/filters/itemUrl.filter\";\nimport \"./app/filters/numberFormat.filter\";\nimport \"./app/filters/propertySurcharge.filter\";\nimport \"./app/filters/propertyFileUrl.filter\";\nimport \"./app/filters/translate.filter\";\nimport \"./app/filters/truncate.filter\";\n\n// =========================\n// Irritop Additions NK\n// =========================\n// import \"../../../../MyWidgets/resources/js/src/mywidgets\";\n/* NK */ import \"./app/extra/components\";\n\n\nexport function beforeCreate(context)\n{\n // =========================\n // COMPONENTS\n // =========================\n /* NK */ Vue.component(\"breadcrumbs\", () => import(\"./app/extra/myWidgets/structuredData/Breadcrumbs.vue\"));\n // BASE\n Vue.component(\"add-item-to-basket-overlay\", () => import(\"./app/components/basket/AddItemToBasketOverlay.vue\"));\n /* NK */ Vue.component(\"add-to-basket\", () => import(\"./app/extra/overrides/components/basket/AddToBasket.vue\"));\n Vue.component(\"basket-preview\", () => import(\"./app/components/basket/BasketPreview.vue\"));\n Vue.component(\"basket-totals\", () => import(\"./app/components/basket/BasketTotals.vue\"));\n Vue.component(\"mail-changed-info\", () => import(\"./app/components/basket/MailChangedInfo.vue\"));\n Vue.component(\"coupon\", () => import(\"./app/components/basket/Coupon.vue\"));\n Vue.component(\"basket-list\", () => import(\"./app/components/basket/list/BasketList.vue\"));\n Vue.component(\"step-by-step-navigation\", () => import(\"./app/components/category/StepByStepNavigation.vue\"));\n Vue.component(\"google-maps-widget\", () => import(\"./app/components/common/GoogleMaps.vue\"));\n Vue.component(\"lazy-img\", LazyImg);\n Vue.component(\"intersect\", Intersect);\n Vue.component(\"tab-list\", TabList);\n Vue.component(\"tab-item\", TabItem);\n /* NK */ Vue.component(\"last-seen-item-list\", () => import(\"./app/extra/overrides/components/containers/LastSeenItemList.vue\"));\n Vue.component(\"change-email-form\", () => import(\"./app/components/customer/ChangeEmailForm.vue\"));\n Vue.component(\"recaptcha\", ReCaptcha);\n Vue.component(\"registration\", () => import(\"./app/components/customer/Registration.vue\"));\n Vue.component(\"reset-password-form\", () => import(\"./app/components/customer/ResetPasswordForm.vue\"));\n Vue.component(\"forgot-password-modal\", () => import(\"./app/components/customer/login/ForgotPassword.vue\"));\n Vue.component(\"guest-login\", () => import(\"./app/components/customer/login/GuestLogin.vue\"));\n Vue.component(\"login\", () => import(\"./app/components/customer/login/Login.vue\"));\n Vue.component(\"login-view\", () => import(\"./app/components/customer/login/LoginView.vue\"));\n Vue.component(\"user-login-handler\", UserLoginHandler);\n Vue.component(\"item-bundle\", () => import(\"./app/components/item/ItemBundle.vue\"));\n /* NK */ Vue.component(\"quantity-input\", () => import(\"./app/extra/overrides/components/item/QuantityInput.vue\"));\n Vue.component(\"tag-list\", () => import(\"./app/components/item/TagList.vue\"));\n /* NK */ Vue.component(\"category-item\", () => import(\"./app/extra/overrides/components/itemList/CategoryItem.vue\"));\n Vue.component(\"item-search\", ItemSearch);\n Vue.component(\"search-suggestion-item\", () => import(\"./app/components/itemList/SearchSuggestionItem.vue\"));\n Vue.component(\"item-filter-list\", () => import(\"./app/components/itemList/filter/ItemFilterList.vue\"));\n Vue.component(\"item-filter-tag-list\", () => import(\"./app/components/itemList/filter/ItemFilterTagList.vue\"));\n Vue.component(\"live-shopping-item\", () => import(\"./app/components/liveShopping/LiveShoppingItem.vue\"));\n /* NK */ Vue.component(\"newsletter-input\", () => import(\"./app/extra/overrides/components/newsletter/NewsletterInput.vue\"));\n Vue.component(\"newsletter-unsubscribe-input\", () => import(\"./app/components/newsletter/NewsletterUnsubscribeInput.vue\"));\n Vue.component(\"order-return\", () => import(\"./app/components/orderReturn/OrderReturn.vue\"));\n Vue.component(\"cookie-bar\", CookieBar);\n Vue.component(\"privacy-settings\", () => import(\"./app/components/pageDesign/PrivacySettings.vue\"));\n /* NK */ Vue.component(\"carousel\", () => import(\"./app/extra/overrides/components/pageDesign/Carousel.vue\"));\n /* NK */ Vue.component(\"icon\", () => import(\"./app/extra/overrides/components/pageDesign/Icon.vue\"));\n Vue.component(\"language-detection\", LanguageDetection);\n /* NK */Vue.component(\"mobile-navigation\", () => import(\"./app/extra/overrides/components/pageDesign/MobileNavigation.vue\"));\n Vue.component(\"notifications\", Notifications);\n Vue.component(\"popper\", Popper);\n Vue.component(\"shipping-country-select\", () => import(\"./app/components/pageDesign/ShippingCountrySelect.vue\"));\n Vue.component(\"loading-animation\", LoadingAnimation);\n Vue.component(\"wish-list\", () => import(\"./app/components/wishList/WishList.vue\"));\n /* NK */Vue.component(\"wish-list-count\", () => import(\"./app/extra/overrides/components/wishList/WishListCount.vue\"));\n Vue.component(\"lazy-load\", LazyLoad);\n /* NK */ Vue.component(\"add-to-wish-list\", () => import(\"./app/extra/overrides/components/item/AddToWishList.vue\"));\n Vue.component(\"graduated-prices\", () => import(\"./app/components/item/GraduatedPrices.vue\"));\n Vue.component(\"item-data-table\", () => import(\"./app/components/item/ItemDataTable.vue\"));\n /* NK */ Vue.component(\"item-image-carousel\", () => import(\"./app/extra/overrides/components/item/ItemImageCarousel.vue\"));\n Vue.component(\"item-price\", () => import(\"./app/components/item/ItemPrice.vue\"));\n Vue.component(\"set-price\", () => import(\"./app/components/item/SetPrice.vue\"));\n Vue.component(\"order-property-list\", () => import(\"./app/components/item/OrderPropertyList.vue\"));\n /* NK */ Vue.component(\"variation-select\", () => import(\"./app/extra/overrides/components/item/VariationSelect.vue\"));\n Vue.component(\"item-availability\", () => import(\"./app/components/item/ItemAvailability.vue\"));\n Vue.component(\"single-item-bundle\", () => import(\"./app/components/item/SingleItemBundle.vue\"));\n Vue.component(\"item-manufacturer\", () => import(\"./app/components/item/ItemManufacturer.vue\"));\n Vue.component(\"item-manufacturer-data-list\", () => import(\"./app/components/item/ItemManufacturerDataList.vue\"));\n Vue.component(\"manufacturer-details\", () => import(\"./app/components/item/ManufacturerDetails.vue\"));\n Vue.component(\"eu-responsible-details\", () => import(\"./app/components/item/EuResponsibleDetails.vue\"));\n Vue.component(\"item-eu-responsible-data-list\", () => import(\"./app/components/item/ItemEuResponsibleDataList.vue\"));\n /* NK */ Vue.component(\"single-add-to-basket\", () => import(\"./app/extra/overrides/components/item/SingleAddToBasket.vue\"));\n Vue.component(\"set-quantity-input\", () => import(\"./app/components/item/SetQuantityInput.vue\"));\n Vue.component(\"single-item\", SingleItem);\n Vue.component(\"single-item-set-component\", SingleItemSetComponent);\n Vue.component(\"form-attachment\", () => import(\"./app/components/form/FormAttachment.vue\"));\n Vue.component(\"client-only\", ClientOnly);\n Vue.component(\"background-img\", () => import(\"./app/components/common/BackgroundImg.vue\"));\n\n // EXTERNAL\n Vue.component(\"lazy-hydrate\", LazyHydrate);\n Vue.use(script2);\n\n Vue.prototype.$translate = TranslationService.translate;\n Vue.prototype.$ceres = App;\n}\n\nexport function createApp(options, store)\n{\n const defaultOptions = {\n store,\n ...options\n };\n\n const app = new Vue(defaultOptions);\n\n return app;\n}\n","import { isNullOrUndefined } from \"../helper/utils\";\nimport Vue from \"vue\";\n\nVue.filter(\"fileName\", path =>\n{\n const splitPath = path.split(\"/\");\n const fileName = splitPath[splitPath.length - 1];\n\n let match = /^(Item\\w+)_(Char\\d+)_(\\d{4})_(.*)$/.exec(fileName);\n\n if (!isNullOrUndefined(match) && !isNullOrUndefined(match[4]))\n {\n return match[4];\n }\n\n match = /^\\w+_\\d+_(.*)$/.exec(fileName);\n if (!isNullOrUndefined(match) && !isNullOrUndefined(match[1]))\n {\n return match[1];\n }\n\n return fileName;\n});\n","import Vue from \"vue\";\n\nVue.filter(\"fileUploadPath\", path =>\n{\n const position = path.lastIndexOf(\"/\");\n const prefix = App.urls.includeLanguage ? \"/\" + App.language : \"\";\n\n if (position <= 0)\n {\n return prefix + \"/?GetOrderParamsFileName=\" + path;\n }\n\n return prefix + \"/order-property-file/\" + path.substring(0, position) + \"?filename=\" + path.substring(position + 1);\n});\n","import Vue from \"vue\";\n\nVue.filter(\"graduatedPrice\", function(item, quantity)\n{\n const graduatedPrices = item.prices.graduatedPrices;\n\n let returnPrice;\n\n if (graduatedPrices && graduatedPrices[0])\n {\n const prices = graduatedPrices.filter(price =>\n {\n return parseFloat(quantity) >= price.minimumOrderQuantity;\n });\n\n if (prices[0])\n {\n returnPrice = prices.reduce((prev, current) => (prev.minimumOrderQuantity > current.minimumOrderQuantity) ? prev : current);\n returnPrice = returnPrice.unitPrice.value;\n }\n }\n\n return returnPrice || item.prices.default.unitPrice.value;\n});\n","import { isDefined } from \"../helper/utils\";\nimport Vue from \"vue\";\n\nVue.filter(\"hasItemDefaultPrice\", itemData =>\n{\n const defaultPrice = itemData.prices.default;\n\n return isDefined(defaultPrice) && !isNaN(defaultPrice.price.value) || itemData.item.itemType === \"set\";\n});\n","import TranslationService from \"../services/TranslationService\";\nimport Vue from \"vue\";\n\nVue.filter(\"inputUnit\", function(basketItem, shortString = false)\n{\n let result = \"\";\n\n if (shortString)\n {\n if (basketItem.inputWidth > 0)\n {\n result = \"(\" + TranslationService.translate(\"Ceres::Template.itemInputWidth\");\n if (basketItem.inputLength > 0)\n {\n result += \"/\" + TranslationService.translate(\"Ceres::Template.itemInputLength\") + \")\";\n }\n else\n {\n result += \")\";\n }\n }\n else if (basketItem.inputLength > 0)\n {\n result = \"(\" + TranslationService.translate(\"Ceres::Template.Length\") + \")\";\n }\n }\n else\n if (basketItem.inputWidth > 0)\n {\n result = basketItem.inputWidth + basketItem.variation.data.unit.htmlUnit;\n if (basketItem.inputLength > 0)\n {\n result += \" * \" + basketItem.inputLength + basketItem.variation.data.unit.htmlUnit;\n }\n }\n else if (basketItem.inputLength > 0)\n {\n result = basketItem.inputLength + basketItem.variation.data.unit.htmlUnit;\n }\n return result;\n});\n","import TranslationService from \"../services/TranslationService\";\nimport Vue from \"vue\";\n\nVue.filter(\"itemBundleName\", item =>\n{\n let prefixName;\n\n if (item.bundleType === \"bundle\")\n {\n prefixName = item.orderItemName.replace(App.bundlePrefix, \"\").trim();\n\n prefixName = TranslationService.translate(\"Ceres::Template.itemBundleName\", { itemName: prefixName });\n }\n else if (item.bundleType == \"bundle_item\")\n {\n prefixName = item.orderItemName.replace(App.bundleComponentPrefix, \"\").trim();\n }\n else\n {\n prefixName = item.orderItemName;\n }\n\n return prefixName;\n});\n","import TranslationService from \"../services/TranslationService\";\nimport Vue from \"vue\";\n\nVue.filter(\"itemCrossPrice\", function(crossPrice, isSpecialOffer)\n{\n if (isSpecialOffer)\n {\n return TranslationService.translate(\n \"Ceres::Template.crossPriceSpecialOffer\",\n {\n price: crossPrice\n }\n );\n }\n\n return TranslationService.translate(\n \"Ceres::Template.crossPriceRRP\",\n {\n price: crossPrice\n }\n );\n});\n","import Vue from \"vue\";\n\nVue.filter(\"itemImage\", function(itemImages, highestPosition)\n{\n if (itemImages.length === 0)\n {\n return \"\";\n }\n\n if (itemImages.length === 1)\n {\n return itemImages[0].url;\n }\n\n if (highestPosition)\n {\n return itemImages.reduce((prev, current) => (prev.position > current.position) ? prev : current).url;\n }\n\n return itemImages.reduce((prev, current) => (prev.position < current.position) ? prev : current).url;\n});\n","import Vue from \"vue\";\n\nVue.filter(\"itemImageHeight\", function(itemImages, highestPosition)\n{\n if (itemImages.length === 0)\n {\n return null;\n }\n\n if (itemImages.length === 1)\n {\n return itemImages[0].height ?? null;\n }\n\n if (highestPosition)\n {\n return itemImages.reduce((prev, current) => (prev.position > current.position) ? prev : current).height ?? null;\n }\n\n return itemImages.reduce((prev, current) => (prev.position < current.position) ? prev : current).height ?? null;\n});\n","import Vue from \"vue\";\n\nVue.filter(\"itemImageWidth\", function(itemImages, highestPosition)\n{\n if (itemImages.length === 0)\n {\n return null;\n }\n\n if (itemImages.length === 1)\n {\n return itemImages[0].width ?? null;\n }\n\n if (highestPosition)\n {\n return itemImages.reduce((prev, current) => (prev.position > current.position) ? prev : current).width ?? null;\n }\n\n return itemImages.reduce((prev, current) => (prev.position < current.position) ? prev : current).width ?? null;\n});\n","import Vue from \"vue\";\n\nVue.filter(\"itemImageAlternativeText\", function(itemImages, highestPosition)\n{\n if (itemImages.length === 0)\n {\n return \"\";\n }\n\n if (itemImages.length === 1)\n {\n return itemImages[0].alternate;\n }\n\n if (highestPosition)\n {\n return itemImages.reduce((prev, current) => (prev.position > current.position) ? prev : current).alternate;\n }\n\n return itemImages.reduce((prev, current) => (prev.position < current.position) ? prev : current).alternate;\n});\n","import Vue from \"vue\";\n\nVue.filter(\"itemImages\", function(images, accessor)\n{\n if (!images)\n {\n return [];\n }\n\n const imageUrls = [];\n\n let imagesAccessor = \"all\";\n\n if (images.variation && images.variation.length)\n {\n imagesAccessor = \"variation\";\n }\n\n for (const image in images[imagesAccessor])\n {\n const imageUrl = images[imagesAccessor][image][accessor];\n const alternate = images[imagesAccessor][image].names ? images[imagesAccessor][image].names.alternate : null;\n const name = images[imagesAccessor][image].names ? images[imagesAccessor][image].names.name : null;\n const width = images[imagesAccessor][image].width ?? null;\n const height = images[imagesAccessor][image].height ?? null;\n\n imageUrls.push({ url: imageUrl, position: images[imagesAccessor][image].position, alternate, name, width, height });\n }\n\n return imageUrls;\n});\n","import TranslationService from \"../services/TranslationService\";\nimport Vue from \"vue\";\n\nVue.filter(\"itemName\", ({ texts:{ name1, name2, name3 }, variation:{ name, bundleType } }, selectedName = App.config.item.itemName, itemDisplayName = App.config.item.displayName) =>\n{\n let itemName = \"\";\n\n if (selectedName === 1 && name2 !== \"\")\n {\n itemName = name2;\n }\n else if (selectedName === 2 && name3 !== \"\")\n {\n itemName = name3;\n }\n else\n {\n itemName = name1;\n }\n\n if (itemDisplayName === \"itemNameVariationName\" && name && name.length)\n {\n itemName = `${itemName} ${name}`;\n }\n\n if (itemDisplayName === \"variationName\" && name && name.length)\n {\n itemName = name;\n }\n\n if (bundleType === \"bundle\")\n {\n itemName = TranslationService.translate(\"Ceres::Template.itemBundleName\", { itemName });\n }\n\n return itemName;\n});\n","import Vue from \"vue\";\n\nVue.filter(\"specialOffer\", function(defaultPrice, prices, priceType, exact)\n{\n let price;\n\n if (prices.specialOffer)\n {\n if (exact)\n {\n price = prices.specialOffer[priceType][exact] ? prices.specialOffer[priceType][exact] : defaultPrice;\n }\n else\n {\n price = prices.specialOffer[priceType] ? prices.specialOffer[priceType] : defaultPrice;\n }\n }\n else\n {\n price = defaultPrice;\n }\n\n return price;\n});\n","import { isNullOrUndefined } from \"../helper/utils\";\nimport Vue from \"vue\";\n\nVue.filter(\"itemURL\", function(item, withVariationId = true)\n{\n const enableOldUrlPattern = App.config.global.enableOldUrlPattern;\n const urlPath = item.texts.urlPath || \"\";\n const includeLanguage = !isNullOrUndefined(item.texts.lang) && App.defaultLanguage != item.texts.lang;\n\n let link = \"\";\n\n if (urlPath.charAt(0) !== \"/\")\n {\n link = \"/\";\n }\n\n if (includeLanguage)\n {\n link += item.texts.lang + \"/\";\n }\n\n if (urlPath && urlPath.length)\n {\n link += urlPath;\n }\n\n let suffix = \"\";\n\n if (enableOldUrlPattern)\n {\n suffix = \"/a-\" + item.item.id;\n }\n else if (withVariationId)\n {\n suffix = \"_\" + item.item.id + \"_\" + item.variation.id;\n }\n else\n {\n suffix = \"_\" + item.item.id;\n }\n\n let trailingSlash = \"\";\n\n if (App.urlTrailingSlash)\n {\n trailingSlash = \"/\";\n if (link.length > 1 && link.charAt(link.length - 1) === \"/\")\n {\n link = link.substr(0, link.length - 1);\n }\n }\n\n if (link.substr(link.length - suffix.length, suffix.length) === suffix)\n {\n return link + trailingSlash;\n }\n\n return link + suffix + trailingSlash;\n});\n","import { isNullOrUndefined } from \"../helper/utils\";\nimport { floatLength } from \"../helper/number\";\nimport Vue from \"vue\";\n\nVue.filter(\"numberFormat\", function(number, decimals, separator)\n{\n number = parseFloat(number);\n if (isNaN(number))\n {\n return \"\";\n }\n if (isNullOrUndefined(decimals))\n {\n decimals = floatLength(number);\n }\n if (isNullOrUndefined(separator))\n {\n separator = App.decimalSeparator;\n }\n return number.toFixed(decimals).replace(\".\", separator);\n});\n","import Vue from \"vue\";\n\nVue.filter(\"propertySurcharge\", function(properties, propertyId, rebate)\n{\n const property = properties.find(prop => prop.property.id === parseInt(propertyId));\n\n rebate = rebate || 0;\n if (property)\n {\n if (property.surcharge > 0)\n {\n return property.surcharge * (1 - (rebate / 100));\n }\n else if (property.property.surcharge > 0)\n {\n return property.property.surcharge * (1 - (rebate / 100));\n }\n }\n\n return 0;\n});\n","import Vue from \"vue\";\n\nVue.filter(\"propertyFileUrl\", function(value)\n{\n return App.propertyFileUrl + value;\n});\n","import TranslationService from \"../services/TranslationService\";\nimport Vue from \"vue\";\n\nVue.filter(\"translate\", (value, params) =>\n{\n return TranslationService.translate(value, params);\n});\n","import Vue from \"vue\";\n\nVue.filter(\"truncate\", function(string, value)\n{\n if (string.length > value)\n {\n return string.substring(0, value) + \"...\";\n }\n return string;\n});\n","import Vue from \"vue\";\n\n/* Import New myWidgets components */\n\nVue.component(\"b2bregistration\", () => import(\"./myWidgets/app/components/customer/B2bRegistration.vue\"));\nVue.component(\"basket-elements\", () => import(\"./myWidgets/app/components/basket/BasketElements.vue\"));\nVue.component(\"basket-slots\", () => import(\"./myWidgets/app/components/basket/BasketSlots.vue\"));\nVue.component(\"inline-step-by-step-navigation\", () => import(\"./myWidgets/app/components/category/InlineStepByStepNavigation.vue\"));\nVue.component(\"irri-login-handler\", () => import(\"./myWidgets/app/components/customer/login/UserLoginHandler.vue\"));\n\n// import \".myWidgets/app/components/pageDesign/MobileNavigation\";\n\n/* Import Overriden Ceres components. */\n// All overriden Ceres components are placed directly to base.js (SSR Off) and app.js(SSR On)\n","import Vue from \"vue\";\nimport { isNullOrUndefined } from \"./app/helper/utils\";\nimport { compileToFunctions, ssrCompileToFunctions } from \"vue-template-compiler\";\n\nconst kebabCase = require(\"lodash/kebabCase\");\n\nconst originalMountFn = Vue.prototype.$mount;\nconst originalComponentFn = Vue.component;\n\n/**\n * Custom mount function to inject component template from theme plugins before mounting vue components.\n *\n * @param {Element} el\n * @param {boolean} hydrating\n * @returns {Vue}\n */\nfunction mount(el, hydrating)\n{\n let componentTemplate;\n\n if (this.$props && this.$props.templateOverride)\n {\n // template element is references from property for current component instance\n const rawTemplate = getTemplateOverride(this.$props.templateOverride);\n\n if (isNullOrUndefined(rawTemplate))\n {\n console.warn(\"Overriding a component template has failed. Did you import the template into the DOM?\");\n }\n else\n {\n componentTemplate = replaceDelimiters(rawTemplate);\n }\n }\n else if (this.$options && this.$options._componentTag)\n {\n // check for global template override\n componentTemplate = getComponentTemplate(this.$options._componentTag);\n }\n\n if (componentTemplate)\n {\n Object.assign(\n this.$options,\n Vue.compile(componentTemplate)\n );\n }\n\n return originalMountFn.call(this, el, hydrating);\n}\n\n/**\n * Custom component function the override template before registering the component.\n * @param {string} id Id/selector of the component\n * @param {object|function} definition Component definition or async load callback.\n * @return {*}\n */\nfunction component(id, definition)\n{\n return originalComponentFn.call(this, id, applyOverride(definition, id));\n}\n\n/**\n * Compile and assign custom template to component if defined.\n * Recursively apply overrides for defined child components.\n *\n * @param {Object|Function} component The vue component to apply the override to.\n * @param {string} name Tag name of the component. Used to query custom templates by. If not defined, the name property of the component object will be used. (Optional)\n */\nfunction applyOverride(component, name)\n{\n // use ssr optimized compiler function if document is not defined\n const compileFn = typeof document !== \"undefined\" ? compileToFunctions : ssrCompileToFunctions;\n\n if (typeof component === \"object\")\n {\n if (component.components)\n {\n applyOverrideToChildren(component);\n }\n\n const customTemplate = getComponentTemplate(name || component.name);\n\n // overridden component is defined in the common way: Vue.component('...', { ... })\n return Object.assign(\n component,\n customTemplate ? compileFn(customTemplate) : {}\n );\n }\n else if (typeof component === \"function\")\n {\n // overridden component is defined asynchronously\n return () =>\n {\n // invoke async loading function\n const asyncComponent = component();\n const customTemplate = getComponentTemplate(name || component.name);\n\n if (asyncComponent instanceof Promise)\n {\n return asyncComponent.then((module) =>\n {\n if (module.default.components)\n {\n applyOverrideToChildren(module.default);\n }\n\n if (customTemplate)\n {\n // override template after resolving external chunk\n delete module.default.render;\n module.default.template = replaceDelimiters(customTemplate);\n }\n\n return module;\n });\n }\n else\n {\n // may never gets called\n if (asyncComponent && asyncComponent.components)\n {\n applyOverrideToChildren(asyncComponent);\n }\n\n if (customTemplate)\n {\n // override component definition of already loaded async component\n Object.assign(\n asyncComponent,\n compileFn(customTemplate)\n );\n }\n\n return asyncComponent;\n }\n };\n }\n\n return component;\n}\n\n/**\n * Check if component has the components field set and calls applyOverride for each entry.\n * @param {Object} component\n * @return {Object}\n */\nfunction applyOverrideToChildren(component)\n{\n component.components = Object.keys(component.components).reduce((components, key) =>\n {\n return {\n ...components,\n [key]: applyOverride(component.components[key], kebabCase(key))\n };\n }, {});\n\n return component;\n}\n\n/**\n * Get overridden template for a vue component.\n * During ssr templates are queried from global object, during clientside render related script tags will be queried.\n * @param {string} templateOverride The component tag to get the override for\n * @return {string}\n */\nfunction getTemplateOverride(templateOverride)\n{\n if (typeof document !== \"undefined\")\n {\n return (document.querySelector(templateOverride) || {}).innerHTML;\n }\n else if (typeof templates !== \"undefined\")\n {\n return templates[templateOverride];\n }\n\n return \"\";\n}\n\n/**\n * Collection of custom vue component templates read from script elements on first mount.\n *\n * @type {?Object}\n */\nlet componentTemplates = null;\n\n/**\n * Read component templates from script elements.\n * Query elements only once on first component mount\n *\n * @param {string} tagName\n * @returns {string}\n */\nfunction getComponentTemplate(tagName)\n{\n if (isNullOrUndefined(componentTemplates))\n {\n if (typeof document !== \"undefined\")\n {\n componentTemplates = [].slice.call(document.querySelectorAll(\"script[data-component], template[data-component]\"))\n .reduce(\n (obj, el) =>\n {\n return {\n ...obj,\n [el.dataset.component]: replaceDelimiters(el.innerHTML)\n };\n },\n {}\n );\n }\n else if (typeof templates !== \"undefined\")\n {\n componentTemplates = Object.keys(templates || {}).reduce((result, key) =>\n {\n return {\n ...result,\n [key]: replaceDelimiters(templates[key])\n };\n }, {});\n }\n }\n\n return componentTemplates[tagName];\n}\n\n/**\n * Replace ES2015 delimiters ['${', '}'] with default vue delimiters ['{{', '}}']\n *\n * @param {string} template\n * @returns {string}\n */\nfunction replaceDelimiters(template)\n{\n let posStart = 0;\n\n const offset = 0;\n\n let content;\n\n while ((posStart = template.indexOf(\"${\", offset)) >= 0 && posStart <= template.length)\n {\n // read delimiter content from template starting behind opening delimiter (= posStart + \"${\".length)\n content = readDelimiterContent(template, posStart + 2);\n\n /* eslint-disable */\n template = template.substr(0, posStart) // template content before opening delimiter\n + \"{{\" // new opening delimiter\n + content // content between delimiters\n + \"}}\" // new closing delimiter\n + template.substr(posStart + content.length + 3); // template content after closing delimiter (skip \"${\" and \"}\")\n /* eslint-enable */\n }\n\n return template;\n}\n\n/**\n * Read string until closing delimiter occurs.\n *\n * @param {string} input\n * @param {number} offset\n * @returns string\n */\nfunction readDelimiterContent(input, offset)\n{\n let count = 0;\n\n let i = offset;\n\n let current;\n\n while ((current = input.charAt(i)) !== \"\")\n {\n if (current === \"}\" && count === 0)\n {\n return input.substr(offset, i - offset);\n }\n\n if (current === \"{\")\n {\n count++;\n }\n else if (current === \"}\")\n {\n count--;\n }\n i++;\n }\n\n return \"\";\n}\n\nexport { mount, component };\n","import jQuery from \"jquery\";\n\nlet _jQuery;\n\nfunction setJQuery(newJQuery)\n{\n if (_jQuery && _jQuery !== newJQuery)\n {\n console.warn(`jQuery ${ _jQuery.fn.jquery } is already included in plentyShop LTS. It\\'s not recommended to register new instances of jQuery.`);\n\n // Copy ajax config to new jQuery instance\n newJQuery.ajaxSetup(_jQuery.ajaxSetup());\n\n // Copy registered jQuery plugins to new jQuery instance\n Object.keys(_jQuery.fn).forEach(jQueryFn =>\n {\n if (!newJQuery.fn.hasOwnProperty(jQueryFn))\n {\n newJQuery.fn[jQueryFn] = _jQuery.fn[jQueryFn];\n }\n });\n\n // unset existing setter to avoid endless loop\n delete window.jQuery;\n }\n\n // Store new jQuery instance in global object\n _jQuery = newJQuery;\n\n // Add new setter to catch new assignments of jQuery instances\n if (!window.__defineGetter__)\n {\n Object.defineProperty(window, \"jQuery\", {\n get: () => _jQuery,\n set: setJQuery\n });\n Object.defineProperty(window, \"$\", {\n get: () => _jQuery,\n set: setJQuery\n });\n }\n else\n {\n window.__defineGetter__(\"jQuery\", () => _jQuery);\n window.__defineSetter__(\"jQuery\", setJQuery);\n\n window.__defineGetter__(\"$\", () => _jQuery);\n window.__defineSetter__(\"$\", setJQuery);\n }\n}\n\n// assign initial jQuery instance\nsetJQuery(jQuery);\n","import { debounce } from \"./debounce\";\nimport { detectPassiveEvents } from \"./featureDetect\";\nimport { isDefined } from \"./utils\";\n\n/**\n * This class is used to fixate the shop header when scrolling.\n */\nexport default class HeaderScroller\n{\n constructor(headerParent = null)\n {\n // the header element\n this._headerParent = headerParent;\n // the height of all header elements\n this.headerHeight = 0;\n // array of the header element heights\n this.allHeaderChildrenHeights = [];\n // indicates, if the scrolling behavior has been initialized\n this.initialized = false;\n // last requested animation frame\n this.animationFrameTimeout = null;\n // indicates, if the user is in the shopbuilder and the header is fixed\n this.isShopBuilderHeaderFixated = false;\n\n if (isDefined(this.headerParent))\n {\n if (!App.isShopBuilder)\n {\n this.registerEventsListeners();\n }\n else\n {\n this.registerSBEventsListeners();\n }\n }\n }\n\n // The header parent element.\n get headerParent()\n {\n // Check if the element _headerParent is still a child of the document. Also check if document.contains is defined (IE11).\n if (this._headerParent && document.contains && document.contains(this._headerParent))\n {\n return this._headerParent;\n }\n\n this._headerParent = document.querySelector(\"[data-header-offset]\");\n return this._headerParent;\n }\n\n /**\n * Initialize the fixed header scrolling behavior. Collect the heights of the elements and update their zindexes.\n * Is called on 'load'; when the fonts have load; when the images in the header have load, on window resize.\n */\n initialize()\n {\n this.addBrowserClass();\n const hasStickyTop = document.querySelector(\"#page-header\").classList.contains(\"sticky-top\");\n\n if (hasStickyTop)return;\n\n this.collectHeaderElementHeights();\n this.updateZIndexes();\n\n // Initialize only, if the user has scrolled down from the top and is not in the shopbuilder.\n if (!App.isShopBuilder && window.pageYOffset > 0)\n {\n this.calculateBodyOffset();\n this.scrollHeaderElements();\n // If the header content gets active in the shopbuilder, the event listener for 'shopbuilder.after.activate-container' will fixate the header.\n this.fixateHeader();\n\n this.initialized = true;\n }\n }\n\n addBrowserClass()\n {\n const browser = window.navigator.userAgent;\n const isIE11 = /Trident.*rv[ :]*11\\./.test(browser);\n\n if (isIE11)\n {\n document.body.classList.add(\"ie11\");\n }\n }\n // Collect heights of header elements for later use\n collectHeaderElementHeights()\n {\n this.headerHeight = 0;\n this.allHeaderChildrenHeights = [];\n\n Array.from(this.headerParent?.children).forEach(element =>\n {\n let elementHeight = 0;\n\n // skip elements with the data attribute \"data-scroll-void\" and interpret their height as zero\n if (!element.dataset.hasOwnProperty(\"scrollVoid\"))\n {\n elementHeight = element.getBoundingClientRect().height;\n }\n\n this.allHeaderChildrenHeights.push(elementHeight);\n this.headerHeight += elementHeight;\n });\n }\n\n // Set descending z-index for all header elements and create list of elements with unfixed class for later use.\n updateZIndexes()\n {\n if (!App.isShopBuilder)\n {\n let zIndex = 100;\n\n Array.from(this.headerParent?.children).forEach(element =>\n {\n element.style.zIndex = zIndex--;\n });\n }\n }\n\n // Calculate top offset for vue-app node because header is not part of document flow.\n calculateBodyOffset(unset = false)\n {\n if (this.headerParent)\n {\n const app = document.getElementById(\"vue-app\");\n\n app.style.marginTop = unset ? null : this.headerHeight + \"px\";\n app.style.minHeight = unset ? null : window.innerHeight - this.headerHeight + \"px\";\n }\n }\n\n // Scroll header elements depending on if they are unfixed or not\n scrollHeaderElements()\n {\n let absolutePos = 0;\n\n let fixedElementsHeight = 0;\n\n let offset = 0;\n\n for (let i = 0; i < this.headerParent.children.length; i++)\n {\n const elem = this.headerParent.children[i];\n const elemHeight = this.allHeaderChildrenHeights[i];\n\n offset = absolutePos - window.pageYOffset;\n elem.style.position = \"absolute\";\n\n // Element should not be considerd in height calculation of following elements\n if (elem.dataset.hasOwnProperty(\"scrollVoid\"))\n {\n continue;\n }\n // Element is unfixed and should scroll indefinetly\n else if (elem.classList.contains(\"unfixed\"))\n {\n elem.style.top = offset + \"px\";\n }\n // Element is fixed and should scroll until it hits top of header or next fixed element\n else\n {\n elem.style.top = offset < 0 ? 0 : offset + \"px\";\n\n if (fixedElementsHeight > 0 && offset < fixedElementsHeight)\n {\n elem.style.top = fixedElementsHeight + \"px\";\n }\n\n fixedElementsHeight = fixedElementsHeight + elemHeight;\n }\n absolutePos = absolutePos + elemHeight;\n }\n }\n\n // Register all the event listeners, to realize the header scrolling behavior.\n registerEventsListeners()\n {\n window.addEventListener(\"load\", () => this.initialize());\n\n if (document.fonts)\n {\n document.fonts.onloadingdone = () => this.initialize();\n }\n\n this.checkForHeaderImages().then(() => this.initialize());\n\n window.addEventListener(\"resize\", debounce(() => this.initialize(), 50));\n\n // The listener for user scrolling. If this class is not fully initialized, call the initialize method on scroll.\n window.addEventListener(\"scroll\", () =>\n {\n if (this.initialized)\n {\n if (this.animationFrameTimeout)\n {\n window.cancelAnimationFrame(this.animationFrameTimeout);\n }\n\n this.animationFrameTimeout = window.requestAnimationFrame(\n this.scrollHeaderElements.bind(this)\n );\n }\n else\n {\n this.initialize();\n }\n }, detectPassiveEvents() ? { passive: true } : false);\n }\n\n // Register event listeners for the shopbuilder environment.\n registerSBEventsListeners()\n {\n $(document).on(\"shopbuilder.before.viewUpdate shopbuilder.after.viewUpdate\", () =>\n {\n if (this.isShopBuilderHeaderFixated)\n {\n this.collectHeaderElementHeights();\n this.calculateBodyOffset();\n }\n });\n\n // when the active dropzone in the shopbuilder changes\n $(document).on(\"shopbuilder.after.activate-container\", (event, data) =>\n {\n if (data?.container === \"Ceres::Header\")\n {\n this.fixateHeader();\n this.calculateBodyOffset();\n this.isShopBuilderHeaderFixated = true;\n }\n else\n {\n this.unfixHeader();\n this.calculateBodyOffset(true);\n this.isShopBuilderHeaderFixated = false;\n }\n });\n }\n\n // Check all the images present in the header, and recalculate header height, when needed.\n checkForHeaderImages()\n {\n const headerImages = this.headerParent.querySelectorAll(\"img\");\n\n return Promise.all(\n Array.prototype.slice.call(headerImages).map(headerImage =>\n {\n return new Promise((resolve) =>\n {\n if (headerImage.complete)\n {\n resolve();\n }\n else\n {\n headerImage.onload = () => resolve();\n headerImage.onerror = () => resolve();\n }\n });\n })\n );\n }\n\n // Add the class .fixed-top to the header element.\n fixateHeader()\n {\n document.querySelector(\"#page-header\")?.classList.add(\"fixed-top\");\n }\n\n // Remove the class .fixed-top from the header element.\n unfixHeader()\n {\n document.querySelector(\"#page-header\")?.classList.remove(\"fixed-top\");\n }\n}\n","import { getContainingComponent } from \"./helper/utils\";\n\nconst browserDetect = require(\"detect-browser\");\nconst NotificationService = require(\"./services/NotificationService\");\nconst AutoFocusService = require(\"./services/AutoFocusService\");\n\nimport Vue from \"vue\";\nimport { getStyle } from \"./helper/dom\";\nimport { detectPassiveEvents } from \"./helper/featureDetect\";\nimport HeaderScroller from \"./helper/HeaderScroller\";\n\n// Frontend end scripts\n// eslint-disable-next-line\nconst headerCollapses = [];\n\nfunction HeaderCollapse(selector)\n{\n headerCollapses.push(selector);\n $(function()\n {\n $(selector).on(\"show.bs.collapse\", () =>\n {\n headerCollapses.forEach(element =>\n {\n if (!$(element).is(selector))\n {\n $(element).collapse(\"hide\");\n }\n });\n });\n\n });\n}\n\nfunction CeresMain()\n{\n const browser = browserDetect.detect();\n\n if (browser)\n {\n if (browser.name)\n {\n $(\"html\").addClass(browser.name);\n }\n else\n {\n $(\"html\").addClass(\"unknown-browser\");\n }\n if (browser.os)\n {\n $(\"html\").addClass(browser.os.toLowerCase().replace(/[^a-zA-Z0-9\\-]/g, \"-\").replace(\"windows\", \"windows windows\"));\n }\n else\n {\n $(\"html\").addClass(\"unknown-os\");\n }\n }\n else\n {\n $(\"html\").addClass(\"unknown-detect\");\n }\n\n window.onpopstate = function(event)\n {\n if (event.state && event.state.requireReload)\n {\n window.location.reload();\n }\n };\n\n // init bootstrap tooltips\n document.querySelectorAll(\"[data-toggle=\\\"tooltip\\\"]\").forEach(el =>\n {\n $(el).tooltip();\n });\n\n HeaderCollapse(\"#countrySettings\");\n HeaderCollapse(\"#currencySelect\");\n HeaderCollapse(\"#searchBox\");\n // /*NK*/ Transfer the next code to Ceres\\resources\\js\\src\\app\\extra\\components.js\n HeaderCollapse(\"#myAccountMenu\");\n\n const $mainNavbarCollapse = $(\"#mainNavbarCollapse\");\n\n // prevent hidding collapses in the shopbuilder, for editing search bar results\n if (!App.isShopBuilder)\n {\n $(document).on(\"click\", function(evt)\n {\n headerCollapses.forEach(element =>\n {\n if (evt.target !== element && $(evt.target).parents(element).length <= 0)\n {\n $(element).collapse(\"hide\");\n }\n });\n });\n }\n\n $mainNavbarCollapse.collapse(\"hide\");\n\n // Add click listener outside the navigation to close it\n $mainNavbarCollapse.on(\"show.bs.collapse\", function()\n {\n $(\".main\").one(\"click\", closeNav);\n });\n\n $mainNavbarCollapse.on(\"hide.bs.collapse\", function()\n {\n $(\".main\").off(\"click\", closeNav);\n });\n\n function closeNav()\n {\n $(\"#mainNavbarCollapse\").collapse(\"hide\");\n }\n\n $(function()\n {\n const offset = 250;\n const duration = 300;\n\n let isDesktop = window.matchMedia(\"(min-width: 768px)\").matches;\n\n AutoFocusService.autoFocus();\n\n $(\"#searchBox\").on(\"shown.bs.collapse\", function()\n {\n const searchInput = document.querySelector(\"input.search-input\");\n\n if (searchInput)\n {\n searchInput.focus();\n }\n });\n\n window.addEventListener(\"scroll\", function()\n {\n if (isDesktop)\n {\n if ($(window).scrollTop() > offset)\n {\n $(\".back-to-top\").fadeIn(duration);\n $(\".back-to-top-center\").fadeIn(duration);\n }\n else\n {\n $(\".back-to-top\").fadeOut(duration);\n $(\".back-to-top-center\").fadeOut(duration);\n }\n }\n }, detectPassiveEvents() ? { passive: true } : false );\n\n window.addEventListener(\"resize\", function()\n {\n isDesktop = window.matchMedia(\"(min-width: 768px)\").matches;\n });\n\n $(\".back-to-top\").on(\"click\", function(event)\n {\n event.preventDefault();\n\n $(\"html, body\").animate({ scrollTop: 0 }, duration);\n\n return false;\n });\n\n $(\".back-to-top-center\").on(\"click\", function(event)\n {\n event.preventDefault();\n\n $(\"html, body\").animate({ scrollTop: 0 }, duration);\n\n return false;\n });\n\n $(\"#accountMenuList\").on(\"click\", function()\n {\n $(\"#countrySettings\").collapse(\"hide\");\n $(\"#searchBox\").collapse(\"hide\");\n $(\"#currencySelect\").collapse(\"hide\");\n });\n\n fixPopperZIndexes();\n\n // Emit event for Sticky Containers to update\n $(\".collapse\").on(\"show.bs.collapse hide.bs.collapse\", function()\n {\n this.dispatchEvent(new CustomEvent(\"updateStickyContainer\",\n {\n bubbles: true\n }));\n });\n });\n}\n\nwindow.CeresMain = new CeresMain();\nwindow.CeresNotification = NotificationService;\n\nconst showShopNotification = function(event)\n{\n if (event.detail.type)\n {\n switch (event.detail.type)\n {\n case \"info\":\n NotificationService.info(event.detail.message);\n break;\n case \"log\":\n NotificationService.log(event.detail.message);\n break;\n case \"error\":\n NotificationService.error(event.detail.message);\n break;\n case \"success\":\n NotificationService.success(event.detail.message);\n break;\n case \"warning\":\n NotificationService.warn(event.detail.message);\n break;\n default:\n console.log(\"no type such as:\" + event.detail.type);\n break;\n }\n }\n};\n\ndocument.addEventListener(\"showShopNotification\", showShopNotification);\n\n// fixate the header elements\nnew HeaderScroller();\n\n$(document).on(\"shopbuilder.after.drop shopbuilder.after.widget_replace\", function(event, eventData, widgetElement)\n{\n const parent = widgetElement[1];\n\n const parentComponent = getContainingComponent(parent);\n\n const compiled = Vue.compile(widgetElement[0].outerHTML, { delimiters: [\"${\", \"}\"] } );\n const component = new Vue({\n store: window.ceresStore,\n render: compiled.render,\n staticRenderFns: compiled.staticRenderFns,\n parent: parentComponent\n });\n\n component.$mount( widgetElement[0] );\n $(component.$el).find(\"*\").each(function(index, elem)\n {\n $(elem).on(\"click\", function(event)\n {\n event.preventDefault();\n });\n });\n\n $(component.$el).find(\".owl-carousel\").on(\"resized.owl.carousel\", function()\n {\n window.dispatchEvent(new Event(\"resize\"));\n });\n});\n\nfunction fixPopperZIndexes()\n{\n const elements = document.querySelectorAll(\".popover.d-none\");\n\n let counter = elements.length;\n\n elements.forEach(el =>\n {\n let zIndex = parseInt(getStyle(el, \"z-index\"));\n\n if (!isNaN(zIndex))\n {\n zIndex += --counter;\n\n el.style.zIndex = zIndex;\n }\n });\n}\n","import \"./app/publicPath\";\nimport Vue from \"vue\";\nimport Vuex from \"vuex\";\nimport NotificationService from \"./app/services/NotificationService\";\nimport TranslationService from \"./app/services/TranslationService\";\n\n// import \"bootstrap\";\nimport Alert from \"bootstrap/js/src/alert\";\n// import Button from \"bootstrap/js/src/button\";\nimport Carousel from \"bootstrap/js/src/carousel\";\nimport Collapse from \"bootstrap/js/src/collapse\";\nimport Dropdown from \"bootstrap/js/src/dropdown\";\nimport Modal from \"bootstrap/js/src/modal\";\nimport Popover from \"bootstrap/js/src/popover\";\n// import Scrollspy from \"bootstrap/js/src/scrollspy\";\n// import Tab from \"bootstrap/js/src/tab\";\n// import Toast from \"bootstrap/js/src/toast\";\nimport Tooltip from \"bootstrap/js/src/tooltip\";\nimport Util from \"bootstrap/js/src/util\";\nexport {\n // Button,\n Util,\n Alert,\n Carousel,\n Collapse,\n Dropdown,\n Modal,\n Popover,\n // Scrollspy,\n // Tab,\n // Toast,\n Tooltip\n};\n\nimport \"owl.carousel\";\nimport { createApp, beforeCreate } from \"./app\";\nimport \"custom-event-polyfill\";\nimport { initClientListeners, initClientStore, createStore } from \"./app/store\";\nimport { initListener } from \"./app/services/ApiService\";\nimport { mount } from \"./mount\";\nimport \"./app/jQuery\";\n\n/* NK Additions for client only packages*/\n\n// for vue-head usage visit https://bestofvue.com/repo/ktquez-vue-head-vuejs-meta-tags\n// for vue-meta usage visit https://vue-meta.nuxtjs.org/\n// We use it directly in Ceres\\resources\\js\\src\\app\\extra\\overrides\\components\\item\\VariationSelect.vue\n// import VueMeta from \"vue-meta\";\n// Vue.use(VueMeta);\n\n/* NK end of Additions */\n\nVue.prototype.$mount = mount;\n\n// defines if the render location is the client\nApp.isSSR = false;\nApp.isSSREnabled = App.config.log.performanceSsr;\n\nbeforeCreate();\n\nwindow.createApp = (selector) =>\n{\n // client-specific bootstrapping logic...\n const app = createApp({\n template: \"#ssr-script-container\"\n }, store);\n\n app.$mount(selector, true);\n window.vueApp = app;\n\n initListener();\n\n initClientListeners(store);\n initClientStore(store);\n};\n\nconst store = createStore();\n\nif (window.__INITIAL_STATE__)\n{\n store.replaceState(window.__INITIAL_STATE__);\n}\n\nwindow.Vue = Vue;\nwindow.Vuex = Vuex;\nwindow.NotificationService = NotificationService;\nwindow.ceresTranslate = TranslationService.translate;\nwindow.vueEventHub = new Vue();\nwindow.ceresStore = store;\n\nimport \"./app/main\";\n","import { isNullOrUndefined, isDefined } from \"./utils\";\n\nlet _supportsPassive;\n\n/**\n * Function to detect avif support\n * @param callback\n */\nexport function detectAvif(callback)\n{\n if (!isNullOrUndefined(App.features.avif))\n {\n callback(App.features.avif);\n return;\n }\n\n const testUris = {\n \"avif\" : \"AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUEAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABYAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgSAAAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB5tZGF0EgAKBzgADlAgIGkyCR/wAABAAACvcA==\"\n };\n\n const promises = [];\n\n for (const uri in testUris)\n {\n promises.push(new Promise((resolve, reject) =>\n {\n _detectModernImageSupport(\"avif\", testUris[uri], resolve);\n }));\n }\n\n let isSupported = true;\n\n Promise.all(promises)\n .then(values =>\n {\n for (const value of values)\n {\n isSupported = isSupported && value;\n }\n\n App.features.avif = isSupported;\n\n callback(isSupported);\n });\n}\n\n/**\n * Function to detect webP support\n * @param callback\n */\nexport function detectWebP(callback)\n{\n if (!isNullOrUndefined(App.features.webp))\n {\n callback(App.features.webp);\n return;\n }\n\n const testUris = {\n \"webp\": \"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==\"\n };\n\n const promises = [];\n\n for (const uri in testUris)\n {\n promises.push(new Promise((resolve, reject) =>\n {\n _detectModernImageSupport(\"webp\", testUris[uri], resolve);\n }));\n }\n\n let isSupported = true;\n\n Promise.all(promises)\n .then(values =>\n {\n for (const value of values)\n {\n isSupported = isSupported && value;\n }\n\n App.features.webp = isSupported;\n\n callback(isSupported);\n });\n}\n\nfunction _detectModernImageSupport(targetExtension, uri, resolve)\n{\n const img = new Image();\n\n img.onload = function()\n {\n resolve(true);\n };\n\n img.onerror = function()\n {\n resolve(false);\n };\n\n img.src = \"data:image/\" + targetExtension + \";base64,\" + uri;\n}\n\n/**\n * Detect if the parameter passive is supported for the method addEventListener (MSIE is not)\n */\nexport function detectPassiveEvents()\n{\n if (isDefined(_supportsPassive))\n {\n return _supportsPassive;\n }\n\n _supportsPassive = false;\n\n try\n {\n const opts = Object.defineProperty({}, \"passive\", {\n get()\n {\n _supportsPassive = true;\n }\n });\n\n window.addEventListener(\"testPassive\", null, opts);\n window.removeEventListener(\"testPassive\", null, opts);\n }\n catch (error)\n {}\n\n return _supportsPassive;\n}\n\n/**\n * Detect if the IntersectionObserver is supported by the browser\n */\nexport function detectIntersectionObserver()\n{\n return \"IntersectionObserver\" in window;\n}\n","import { isNullOrUndefined } from \"./utils\";\n\nexport function normalizeUrl(url)\n{\n const urlParts = url.split(\"?\");\n const urlParams = urlParts[1];\n\n let urlPath = urlParts[0];\n\n if (App.urlTrailingSlash && urlPath.substr(-1, 1) !== \"/\")\n {\n urlPath += \"/\";\n }\n else if (!App.urlTrailingSlash && urlPath.substr(-1, 1) === \"/\")\n {\n urlPath = urlPath.substr(0, urlPath.length - 1);\n }\n\n let targetUrl = urlPath;\n\n if (!isNullOrUndefined(urlParams) && urlParams.length > 0)\n {\n targetUrl += \"?\" + urlParams;\n }\n\n return targetUrl;\n}\n\nexport function pathnameEquals(pathname)\n{\n return window.location.pathname === pathname ||\n window.location.pathname === pathname + \"/\" ||\n window.location.pathname + \"/\" === pathname;\n}\n","import { isNullOrUndefined } from \"./utils\";\n\n/**\n * Get first parent element which matches a given selector\n *\n * @param {HTMLElement} element The element to get the parent for\n * @param {string} parentSelector Selector to match parent element\n *\n * @returns {HTMLElement}\n */\nexport function findParent(element, parentSelector)\n{\n // eslint-disable-next-line brace-style\n while ((element = element.parentElement) && !is(element, parentSelector)) {}\n return element;\n}\n\n/**\n * Check if element matches a given selector\n *\n * @param {HTMLElement} element The element to check\n * @param {string} selector The selector to match on given element\n *\n * @returns {boolean}\n */\n// eslint-disable-next-line complexity\nexport function is(element, selector)\n{\n // polyfill from https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\n if (!Element.prototype.matches)\n {\n Element.prototype.matches =\n Element.prototype.matchesSelector ||\n Element.prototype.mozMatchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.oMatchesSelector ||\n Element.prototype.webkitMatchesSelector ||\n function(sel)\n {\n const matches = (this.document || this.ownerDocument).querySelectorAll(sel);\n\n let i = matches.length;\n\n // eslint-disable-next-line brace-style\n while (--i >= 0 && matches.item(i) !== this) {}\n return i > -1;\n };\n }\n\n return element.matches(selector);\n}\n\n/**\n * Get the width of a specified text depending on the font-family\n *\n * @param {string} text\n * @param {string} fontFamily\n *\n * @returns {integer}\n */\nexport function textWidth(text, fontFamily)\n{\n const tag = document.createElement(\"div\");\n\n tag.style.position = \"absolute\";\n tag.style.left = \"-99in\";\n tag.style.whiteSpace = \"nowrap\";\n tag.style.font = fontFamily;\n tag.innerHTML = text;\n\n document.body.appendChild(tag);\n\n const result = tag.clientWidth;\n\n document.body.removeChild(tag);\n\n return result;\n}\n\nexport function applyStyles(el, styles)\n{\n Object.keys(styles).forEach(key =>\n {\n const value = styles[key];\n\n if (isNullOrUndefined(value))\n {\n const propertyName = key.replace(/[A-Z]/g, match => \"-\" + match.toLowerCase());\n\n el.style.removeProperty(propertyName);\n }\n else\n {\n el.style[key] = value;\n }\n });\n}\n\nexport function getStyle(el, styleProp)\n{\n let value;\n\n if (window.getComputedStyle)\n {\n value = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);\n }\n else if (el.currentStyle)\n {\n value = el.currentStyle[styleProp];\n }\n\n return value;\n}\n","import { isMail } from \"../helper/strings\";\nimport { isNull } from \"../helper/utils\";\n\nlet $form;\n\nexport function validate(form)\n{\n const deferred = $.Deferred();\n const invalidFields = getInvalidFields(form);\n\n if (invalidFields.length > 0)\n {\n deferred.rejectWith(form, [invalidFields]);\n }\n else\n {\n deferred.resolveWith(form);\n }\n\n return deferred;\n}\n\nexport function getInvalidFields(form)\n{\n $form = $(form);\n const invalidFormControls = [];\n\n $form.find(\"[data-validate]\").each(function(i, elem)\n {\n if (!_validateElement($(elem)))\n {\n invalidFormControls.push(elem);\n }\n });\n\n const salutationSelect = $form.find(\"[data-testing='salutation-select']\");\n\n if (salutationSelect.length > 0 && !_validateSelect(salutationSelect, \"\"))\n {\n invalidFormControls.push(salutationSelect.parent()[0]);\n }\n\n return invalidFormControls;\n}\n\nexport function markInvalidFields(fields, errorClass)\n{\n errorClass = errorClass || \"error\";\n\n $(fields).each(function(i, elem)\n {\n const $elem = $(elem);\n\n $elem.addClass(errorClass);\n _findFormControls($elem).on(\"click.removeErrorClass keyup.removeErrorClass change.removeErrorClass\", function()\n {\n if (_validateElement($elem))\n {\n $elem.removeClass(errorClass);\n if ($elem.is(\"[type=\\\"radio\\\"], [type=\\\"checkbox\\\"]\"))\n {\n const groupName = $elem.attr(\"name\");\n\n $(\".\" + errorClass + \"[name=\\\"\" + groupName + \"\\\"]\").removeClass(errorClass);\n }\n _findFormControls($elem).off(\"click.removeErrorClass keyup.removeErrorClass change.removeErrorClass\");\n }\n });\n });\n}\n\nexport function markFailedValidationFields(form, validationErrors, errorClass)\n{\n $form = $(form);\n\n errorClass = errorClass || \"error\";\n\n $form.find(\"[data-model]\").each((i, elem) =>\n {\n const $elem = $(elem);\n const attribute = $elem.attr(\"data-model\");\n\n if (attribute in validationErrors)\n {\n $elem.addClass(errorClass);\n\n const fieldLabel = $elem.find(\"label\")[0].innerHTML.replace(\"*\", \"\");\n\n if (fieldLabel)\n {\n const attributeCamel = attribute.replace(/([A-Z])/g, \" $1\").toLowerCase();\n\n validationErrors[attribute][0] = validationErrors[attribute][0].replace(attributeCamel.replace(\"_\", \" \"), fieldLabel);\n }\n }\n });\n}\n\nexport function unmarkAllFields(form)\n{\n $form = $(form);\n\n $form.find(\"[data-validate]\").each(function(i, elem)\n {\n const $elem = $(elem);\n\n $elem.removeClass(\"error\");\n\n _findFormControls($elem).off(\"click.removeErrorClass keyup.removeErrorClass change.removeErrorClass\");\n });\n}\n\nfunction _validateElement(elem)\n{\n const $elem = $(elem);\n\n /** return if the attribute data-validate is not present on the element */\n if (!$elem[0].attributes.hasOwnProperty(\"data-validate\"))\n {\n return true;\n }\n\n const validationKeys = $elem.attr(\"data-validate\").split(\"|\").map(function(i)\n {\n return i.trim();\n }) || [\"text\"];\n\n const requiredCount = $elem.attr(\"data-required-count\");\n\n let hasError = false;\n\n _findFormControls($elem).each(function(i, formControl)\n {\n const $formControl = $(formControl);\n const validationKey = validationKeys[i] || validationKeys[0];\n\n if (!_isActive($formControl))\n {\n // continue loop\n return true;\n }\n\n if ($formControl.is(\"[type=\\\"checkbox\\\"], [type=\\\"radio\\\"]\"))\n {\n if (!_validateGroup($formControl, validationKey, requiredCount))\n {\n hasError = true;\n }\n\n return true;\n }\n\n if ($formControl.is(\"select\"))\n {\n if (!_validateSelect($formControl, validationKey))\n {\n hasError = true;\n }\n\n return true;\n }\n\n if (validationKey.startsWith(\"!\"))\n {\n if (_validateInput($formControl, validationKey.replace(\"!\", \"\")))\n {\n hasError = true;\n }\n }\n\n else if (!_validateInput($formControl, validationKey))\n {\n hasError = true;\n }\n\n return false;\n });\n\n return !hasError;\n}\n\nfunction _validateGroup($formControl, validationKey, requiredCount)\n{\n const groupName = $formControl.attr(\"name\");\n const $group = $form.find(\"[name=\\\"\" + groupName + \"\\\"]\");\n\n let range = null;\n\n let min = 1;\n\n let max = 1;\n\n // If no requiredCount is given default to old behaviour\n if (requiredCount)\n {\n min = requiredCount.split(\",\")[0];\n max = requiredCount.split(\",\")[1];\n range = { min, max };\n }\n else\n {\n range = _eval(validationKey) || { min, max };\n }\n\n const checked = $group.filter(\":checked\").length;\n\n return checked >= range.min && checked <= range.max;\n}\n\nfunction _validateSelect($formControl, validationKey)\n{\n const selectedOptionText = $formControl.children(\"option:selected\").text();\n const selectedOptionVal = $formControl.children(\"option:selected\").val();\n\n if (validationKey === \"StateSelect\")\n {\n return $.trim(selectedOptionText) !== \"\" && !isNaN(Number($.trim(selectedOptionVal)));\n }\n return $.trim(selectedOptionText) !== \"\" && $.trim(selectedOptionVal) !== \"please select\";\n}\n\nfunction _validateInput($formControl, validationKey)\n{\n switch (validationKey)\n {\n case \"text\":\n return _hasValue($formControl);\n case \"number\":\n return _hasValue($formControl) && $.isNumeric($.trim($formControl.val()));\n case \"ref\":\n return _compareRef($.trim($formControl.val()), $.trim($formControl.attr(\"data-validate-ref\")));\n case \"date\":\n return _isValidDate($formControl);\n case \"mail\":\n return _isMail($formControl);\n case \"password\":\n return _isPassword($formControl);\n case \"file\":\n return _hasValue($formControl);\n case \"regex\":\n return _regex($formControl);\n default:\n console.error(\"Form validation error: unknown validation property: \\\"\" + validationKey + \"\\\"\");\n return true;\n }\n}\n\nfunction _regex($formControl)\n{\n const ref = $formControl.attr(\"data-validate-ref\");\n const regex = ref.startsWith(\"/\") ? _eval(ref) : new RegExp(ref);\n\n return _hasValue($formControl) && regex.test($.trim($formControl.val()));\n}\n\nfunction _hasValue($formControl)\n{\n return $.trim($formControl.val()).length > 0;\n}\n\n/**\n * @param {any} $formControl - Input inside Formular\n * @returns value is valid date\n */\nfunction _isValidDate($formControl)\n{\n const string = $formControl.val();\n const match = string.match(/^(?:(\\d{1,2})[.\\/-](\\d{1,2})[.\\/-](\\d{4}))|(?:(\\d{4})[.\\/-](\\d{1,2})[.\\/-](\\d{1,2}))$/);\n\n // If match is null date is not valid\n if (isNull(match))\n {\n return false;\n }\n\n const year = match[3] || match[4];\n const month = match[2] || match[5];\n const day = match[1] || match[6];\n\n // Additional checks\n if ((year >= 1901) && (month >= 1 && month <= 12) && (day >= 1 && day <= 31))\n {\n return true;\n }\n\n return false;\n}\n\n/**\n * @param {any} value\n * @returns value is valid mail\n */\nfunction _isMail($formControl)\n{\n return isMail($formControl.val());\n}\n\n/**\n * Minimum eight characters, at least one letter and one number\n *\n * @param {any} value\n * @returns value is valid password\n */\nfunction _isPassword($formControl)\n{\n const passwordRegEx = new RegExp(/^(?=.*[A-Za-z])(?=.*\\d)\\S{8,}$/);\n\n return passwordRegEx.test($formControl.val());\n}\n\nfunction _compareRef(value, ref)\n{\n if ($(ref).length > 0)\n {\n ref = $.trim($(ref).val());\n }\n\n return value === ref;\n}\n\nfunction _findFormControls($elem)\n{\n if ($elem.is(\"input, select, textarea\"))\n {\n return $elem;\n }\n\n return $elem.find(\"input, select, textarea\");\n}\n\nfunction _isActive($elem)\n{\n return $elem.is(\":visible\") && $elem.is(\":enabled\");\n}\n\nfunction _eval(input)\n{\n // eslint-disable-next-line\n return (new Function(`return ${ input };`))();\n}\n\nexport default { validate, getInvalidFields, markInvalidFields, markFailedValidationFields, unmarkAllFields };\n","import { defaultValue, isNullOrUndefined } from \"../helper/utils\";\nimport { replaceAll, capitalize } from \"../helper/strings\";\nimport jQuery from \"jquery\";\n\nconst TranslationService = (function($)\n{\n let _translations = {};\n\n // initialize translations\n if (typeof translations !== \"undefined\")\n {\n _translations = translations;\n }\n else\n {\n _readTranslations();\n }\n\n return {\n translate: _translate\n };\n\n function _readTranslations()\n {\n const identifierPattern = /^(\\w+)::(\\w+)$/;\n const tags = document.querySelectorAll(\"script[data-translation]\");\n\n for (let i = 0; i < tags.length; i++)\n {\n if (!tags[i].dataset || !tags[i].dataset.translation)\n {\n continue;\n }\n\n const identifier = tags[i].dataset.translation;\n\n if (!identifier || !identifierPattern.test(identifier))\n {\n console.error(\"Cannot read translations from script tag. Identifier is not valid\");\n }\n\n const match = identifierPattern.exec(identifier);\n const namespace = match[1];\n const group = match[2];\n\n if (!_translations.hasOwnProperty(namespace))\n {\n _translations[namespace] = {};\n }\n\n if (_translations[namespace].hasOwnProperty(group))\n {\n console.warn(\"Cannot override group \\\"\" + namespace + \"::\" + group);\n continue;\n }\n\n try\n {\n _translations[namespace][group] = JSON.parse(tags[i].innerHTML);\n }\n catch (err)\n {\n console.error(\"Error while parsing translations (\" + identifier + \")\");\n }\n\n }\n }\n\n function _translate(key, params)\n {\n const identifier = _parseKey(key);\n\n if (identifier === null)\n {\n return key;\n }\n\n const namespace = _translations[identifier.namespace];\n\n if (isNullOrUndefined(namespace))\n {\n return key;\n }\n\n const group = namespace[identifier.group];\n\n if (isNullOrUndefined(group))\n {\n return key;\n }\n\n const value = group[identifier.key];\n\n if (!isNullOrUndefined(value))\n {\n return _replacePlaceholders(value, params);\n }\n\n return key;\n }\n\n function _replacePlaceholders(input, values)\n {\n values = values || {};\n\n Object\n .keys(values)\n .sort((keyA, keyB) => keyB.length - keyA.length)\n .forEach(\n key =>\n {\n const value = \"\" + defaultValue(values[key], \"\");\n\n input = replaceAll(\n input,\n \":\" + key,\n value\n );\n input = replaceAll(\n input,\n \":\" + capitalize(key),\n capitalize(value)\n );\n input = replaceAll(\n input,\n \":\" + key.toUpperCase(),\n value.toUpperCase()\n );\n }\n );\n\n return input;\n }\n\n function _parseKey(key)\n {\n const keyPattern = /^(\\w+)::(\\w+)\\.(\\w+)$/;\n\n if (keyPattern.test(key))\n {\n const match = keyPattern.exec(key);\n\n return {\n namespace: match[1],\n group: match[2],\n key: match[3]\n };\n }\n\n return null;\n\n }\n})(jQuery);\n\nexport default TranslationService;\n","import { defaultValue, isNullOrUndefined } from \"./utils\";\n\n/**\n * Makes a function executed after defined timeout.\n *\n * @param {function} callback The function to be executed after timeout\n * @param {number} timeout The timeout in milliseconds\n *\n * @returns {function}\n */\nexport function debounce(callback, timeout)\n{\n timeout = defaultValue(timeout, 0);\n if (timeout > 0)\n {\n return function()\n {\n const args = arguments;\n\n if (!isNullOrUndefined(callback.__timeout))\n {\n window.clearTimeout(callback.__timeout);\n }\n callback.__timeout = window.setTimeout(() =>\n {\n callback(...args);\n }, timeout);\n };\n }\n\n return callback;\n}\n"],"sourceRoot":""}