{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_custom_neuhaus_webshop/cartridge/client/default/js/helpers/urlHelper.js","webpack:///./cartridges/app_custom_neuhaus_webshop_eu/cartridge/client/default/js/fyob.js"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;;AAEb;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;;;;;;;;;;;;ACjBa;AACb,kBAAkB,mBAAO,CAAC,wHAAwB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA,4DAA4D,uDAAuD;AACnH;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,kBAAkB;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI;;AAEb;AACA;AACA;AACA,aAAa;AACb;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,qDAAqD,cAAc;AACnE;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,sBAAsB;AACtB;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA,iCAAiC;AACjC;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA,mCAAmC,8BAA8B;AACjE;AACA,mCAAmC,8BAA8B;AACjE;AACA;;AAEA;AACA,sDAAsD,GAAG;AACzD,4CAA4C,GAAG;AAC/C,KAAK;;AAEL;AACA;AACA,KAAK;AACL,CAAC","file":"default/js/fyob.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/app_custom_neuhaus_webshop_eu/cartridge/client/default/js/fyob.js\");\n","'use strict';\n\n/**\n * appends params to a url\n * @param {string} url - Original url\n * @param {Object} params - Parameters to append\n * @returns {string} result url with appended parameters\n */\nfunction appendToUrl(url, params) {\n var newUrl = url;\n newUrl += (newUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(params).map(function (key) {\n return key + '=' + encodeURIComponent(params[key]);\n }).join('&');\n\n return newUrl;\n}\n\nmodule.exports.appendToUrl = appendToUrl;\n","'use strict';\nconst urlHelper = require('core/helpers/urlHelper');\n\nconst fyobManager = {\n boxArr: [],\n boxAmountOfIrresistibles: null,\n maxAmountOfPralinesPerBox: null,\n filterArr: [],\n isMobile() {\n return window.matchMedia('only screen and (max-width: 960px)').matches;\n },\n /**\n * gets the amount of max irrestibles in box\n */\n getIrresistiblesAmount() {\n const boxAmountOfIrresistibles = parseInt($('.js-selected-box').data('irresistibles-amount'), 10);\n this.boxAmountOfIrresistibles = boxAmountOfIrresistibles || null;\n },\n /**\n * gets the amount of max pralines in box\n */\n getAmountOfPralinesPerBox() {\n this.maxAmountOfPralinesPerBox = parseInt($('.js-selected-box').data('box-size'), 10);\n },\n /**\n * adds data to the next place in the box array\n * @param {Object} data product data\n */\n pushDataIntoArray(data) {\n this.boxArr.push(data);\n },\n /**\n * shows remove button\n * @param {number} boxPlace shows remove button based on place in box\n */\n showRemoveButton(boxPlace) {\n $('.js-close-selected[data-box-place=\"' + boxPlace + '\"]').removeClass('d-none');\n },\n /**\n * hides all remove buttons\n */\n hideRemoveButton() {\n $('.js-close-selected').addClass('d-none');\n },\n /**\n * builds the selected praline from the box\n * @param {Object} productData product data of praline\n * @param {number} index place of praline in array corresponding to grid\n */\n buildSelctedBoxSpot(productData, index) {\n const $boxPlaceSelector = $('.js-selected-' + index);\n\n $boxPlaceSelector.addClass('is-filled')\n .attr('data-pid', productData.pid)\n .attr('data-arr-row', productData.row)\n .attr('data-arr-col', productData.col)\n .addClass('animate-width');\n // $boxPlaceSelector.find('.js-single-praline-name').empty().append(productData.productName);\n $boxPlaceSelector.find('.js-grid-single-praline-image').attr('src', productData.productImage).removeClass('d-none');\n this.showRemoveButton(index);\n },\n /**\n * gets the amount of columns in the box\n * @returns {number} amount of columns in the box\n */\n getAmountOfCol() {\n return $('.js-custom-grid').data('columns');\n },\n /**\n * gets the amount of rows in the box\n * @returns {number} amount of rows in the box\n */\n getAmountOfRow() {\n return $('.js-custom-grid').data('rows');\n },\n /**\n * rebuilds box grid based on the array\n */\n buildBoxGridBasedOnArray() {\n this.boxArr.forEach((box, index) => {\n this.buildSelctedBoxSpot(box, index);\n });\n },\n /**\n * rearranges the entire grid when praline is removed\n */\n clearBoxgrid() {\n const allFilledSpot = $('.js-selected-content[data-pid]');\n\n allFilledSpot.each((index, element) => {\n const $this = $(element);\n const $imageSelector = $this.find('.js-grid-single-praline-image');\n\n $this.attr('data-pid', '')\n .removeClass('is-filled')\n .removeClass('animate-width');\n // .find('.js-single-praline-name')\n // .empty();\n\n $imageSelector.attr('src', '')\n .addClass('d-none');\n\n this.hideRemoveButton(index + 1);\n });\n },\n /**\n * removes praline from the array(box)\n * @param {number} index index\n */\n removeDataFromArray(index) {\n this.boxArr.splice(index, 1);\n },\n /**\n * gets the amount of irrestibles in the box\n * @returns {number} amount of irrestibles\n */\n getAmountOfIrresistiblesInBoxArr() {\n return this.boxArr.reduce((count, product) => {\n return product.productWeight === 3 ? count + 1 : count;\n }, 0);\n },\n /**\n * removes the disabled spot in the box(cross) for irrestibles\n */\n removeDisabledspots() {\n const amountIrresistibles = this.getAmountOfIrresistiblesInBoxArr();\n const amountOfDisabledSpots = $('.js-selected-content.disabled').length;\n if (amountIrresistibles % this.boxAmountOfIrresistibles === 0) {\n if (amountIrresistibles === 0 || (amountIrresistibles / this.boxAmountOfIrresistibles) < amountOfDisabledSpots) {\n $('.js-selected-content.disabled').first().removeClass('disabled');\n }\n }\n },\n /**\n * removes the selected praline from the box\n * @param {number} boxPlace place of the item in the box grid\n */\n removeSelectedBoxSpot(boxPlace) {\n $.spinner().start();\n\n this.removeDataFromArray(boxPlace);\n this.hideRemoveButton(boxPlace);\n this.clearBoxgrid();\n this.buildBoxGridBasedOnArray();\n if (this.pralinesAreDisable() && this.boxArr.length < this.maxAmountOfPralinesPerBox) {\n this.enableAddPralines();\n }\n this.checkToDisableOrEnablePralines();\n this.disableProceedButton();\n this.removeDisabledspots();\n $.spinner().stop();\n },\n productSearch(searchTerm, products) {\n products.each(function (index, product) {\n const productName = $(product).data('product-name').toLowerCase();\n if (!productName.includes(searchTerm.toLowerCase())) {\n $(product).addClass('d-none').removeClass('d-flex');\n } else {\n $(product).addClass('d-flex').removeClass('d-none');\n }\n });\n },\n productRemainingMsg() {\n if ($('.js-praline-selector.d-flex').length === 0) {\n $('.js-no-products').removeClass('d-none');\n } else if ($('.js-praline-selector.d-flex').length > 0 && $('.js-no-products:not(.d-none)')) {\n $('.js-no-products').addClass('d-none');\n }\n },\n /**\n * gets the amount of cornets in the box\n * @returns {number} amount of cornets in the box\n */\n getAmountOfCornetsInBoxArr() {\n return this.boxArr.reduce((count, product) => {\n return product.productWeight === 2 ? count + 1 : count;\n }, 0);\n },\n /**\n * disable pralines based on praline type/weight\n * @param {Array} excludedPraline array of praline types to NOT disbaled\n */\n disableAddPralines(excludedPraline) {\n let selectorString = '.js-praline-selector';\n if (excludedPraline && excludedPraline.length) {\n selectorString += `:not([data-praline-weight=\"${excludedPraline.join('\"]):not([data-praline-weight=\"')}\"])`;\n }\n $(selectorString).addClass('disabled');\n },\n /**\n * enables all pralines\n */\n enableAddPralines() {\n $('.praline-selector-container .praline-box-single.disabled').removeClass('disabled');\n },\n /**\n * check if pralines are disbaled\n * @returns {boolean} returns if pralines are disabled\n */\n pralinesAreDisable() {\n return $('.praline-selector-container .praline-box-single').hasClass('disabled');\n },\n /**\n * gets the amount of irrestibles in order to fill an irrestibles row\n * @returns {number} amount of irresistibles needed to fill the irrestibles row\n */\n extraIrresistiblesNeeded() {\n const remainder = this.getAmountOfIrresistiblesInBoxArr() % this.boxAmountOfIrresistibles;\n return remainder === 0 ? 0 : this.boxAmountOfIrresistibles - remainder;\n },\n /**\n * check if you need to add cornets to finish box\n * @returns {boolean} returns if you need to add cornets to finish box\n */\n needExtraCornet() {\n return this.getAmountOfCornetsInBoxArr() % 2 === 1;\n },\n /**\n * adds a disabled spot to box, if irrestible is added\n */\n disableSpotWhenIrristibles() {\n if (this.extraIrresistiblesNeeded() === (this.boxAmountOfIrresistibles - 1)) {\n $('.js-selected-content:not(.disabled').last().addClass('disabled');\n }\n },\n /**\n * gets the amount of empty spots in the box\n * @returns {number} amount of empty spots in box\n */\n checkAmountLeft() {\n let amountOfIrresistiblesInBoxArr = this.getAmountOfIrresistiblesInBoxArr();\n // let irresistiblesRemainder = amountOfIrresistiblesInBoxArr > 0 ? this.extraIrresistiblesNeeded(amountOfIrresistiblesInBoxArr) : null;\n if (amountOfIrresistiblesInBoxArr > 0) {\n if (amountOfIrresistiblesInBoxArr < this.boxAmountOfIrresistibles) {\n // if the amount of Irresistibles is less then the max amount per col\n return this.maxAmountOfPralinesPerBox - this.boxArr.length - 1;\n }\n // if the amount of irrestibles in the box is more then 1 col\n return this.maxAmountOfPralinesPerBox - this.boxArr.length - (amountOfIrresistiblesInBoxArr / this.boxAmountOfIrresistibles);\n }\n // if no irrestibles are in the box\n return this.maxAmountOfPralinesPerBox - this.boxArr.length;\n },\n /**\n * disables proceed button\n */\n disableProceedButton() {\n $('.js-proceed-fyob').addClass('disabled');\n },\n /**\n * enables proceed button\n */\n enableProceedButton() {\n $('.js-proceed-fyob').removeClass('disabled');\n },\n /**\n * checks of pralines should be disabled/enabled based on praline logic\n */\n checkToDisableOrEnablePralines() {\n const amountLeft = Math.floor(this.checkAmountLeft());\n const amountOfCol = this.getAmountOfCol();\n const extraNeeded = this.extraIrresistiblesNeeded();\n const needExtraCornet = this.needExtraCornet();\n\n if (amountLeft === 0) {\n // hide everything because box is full\n this.disableAddPralines();\n this.enableProceedButton();\n }\n // irristibles are not needed and cornets arn't needed\n // only show pralines weight = 1\n if (amountLeft === 1 && extraNeeded === 0 && !needExtraCornet) {\n this.disableAddPralines([1]);\n }\n\n // only show irristestibles\n if (extraNeeded === amountLeft) {\n this.disableAddPralines([3]);\n }\n\n // only show cornets\n if (needExtraCornet && amountLeft === 1) {\n this.disableAddPralines([2]);\n }\n\n // if irristibles are needed and cornets are needed\n if (needExtraCornet && (amountLeft - extraNeeded === 1)) {\n this.disableAddPralines([2, 3]);\n }\n\n // not enough space for irristibles\n if (extraNeeded === 0 && amountLeft < amountOfCol) {\n this.disableAddPralines([1, 2]);\n }\n\n\n if (needExtraCornet && (extraNeeded === 0) && (amountLeft - 1 === this.boxAmountOfIrresistibles)) {\n this.disableAddPralines([1, 2]);\n }\n\n // if (((amountOfCornets === 1 || amountOfCornets % 2) && amountLeft === 1)) {\n // // hide everything but the cornets, because you always need to have double cornets\n // this.disableAddPralines([2]);\n // }\n // // if ((Math.floor(amountLeft) === extraNeeded) && (extraNeeded < amountOfCol)) {\n // if ((Math.floor(amountLeft) === extraNeeded)) {\n // this.disableAddPralines([3]);\n // }\n\n // // || (extraNeeded && (amountLeft - extraNeeded < 2))\n // if ((amountLeft === 1 && !(amountOfCornets % 2) && !extraNeeded)) {\n // // when you have 1 space left\n // this.disableAddPralines([1]);\n // }\n\n // if (!extraNeeded && amountLeft < amountOfCol) {\n // this.disableAddPralines([1, 2]);\n // }\n\n // if (extraNeeded === 1 && amountLeft === 1) {\n // // when you need to have a certain amount of irrestibles per row\n // this.disableAddPralines([3]);\n // }\n\n // if (extraNeeded === 1 && amountLeft === 2 && (amountOfCornets % 2)) {\n // this.disableAddPralines([2, 3]);\n // }\n\n // if (amountLeft === 2 && extraNeeded > 0) {\n // this.disableAddPralines([2]);\n // }\n },\n /**\n * builds a string of all the pids\n * @returns {string} String array of pids\n */\n getStringArrayOfPids() {\n return this.boxArr.map(function (currentValue) {\n return currentValue.pid.toString();\n }).join(',');\n },\n /**\n * add to cart function\n * @param {string} url url to send to add-to-cart\n */\n addToCart(url) {\n const params = {\n boxPid: $('.js-selected-box').data('pid'),\n selectedIds: this.getStringArrayOfPids()\n };\n const newUrl = urlHelper.appendToUrl(url, params);\n\n $.ajax({\n url: newUrl,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n if (data.success) {\n window.location.href = data.redirectUrl;\n } else {\n $('.js-feedback').removeClass('d-none');\n }\n }\n });\n },\n /**\n * clears the information Modal\n */\n clearModal() {\n $('.js-info-header').empty();\n $('.js-info-description').empty();\n $('.js-allergy-container').hide();\n },\n /**\n * hides or shows information modal\n * @param {Object} element selected element\n */\n showModal(element) {\n const $popupSelector = $('.js-praline-popup');\n $popupSelector.toggleClass('d-none');\n\n if (!fyobManager.isMobile()) {\n $popupSelector.css({ top: 0, left: 0 });\n let $container = $('.praline-selector-container');\n let containerOffset = $container.offset();\n let elementOffset = $(element).offset();\n let topOffset = elementOffset.top - containerOffset.top;\n\n if (elementOffset.top > 800) {\n topOffset -= ($popupSelector.height() + 125);\n }\n let relativeOffset = {\n top: topOffset,\n left: elementOffset.left - containerOffset.left\n };\n\n $popupSelector.css({\n display: 'block',\n top: relativeOffset.top + $(element).outerHeight() + 'px',\n left: relativeOffset.left + 'px'\n });\n }\n },\n /**\n * hides the information modal\n */\n hideModal() {\n const $popupSelector = $('.js-praline-popup');\n $popupSelector.addClass('d-none');\n },\n /**\n * sets the productname as title of modal\n * @param {string} modalName name of selected praline\n */\n setModalName(modalName) {\n $('.js-info-header').text(modalName);\n },\n /**\n * sets the praline description on inforamation description\n * @param {string} modalDescription praline description\n */\n setModalDescription(modalDescription) {\n $('.js-info-description').text(modalDescription);\n },\n /**\n * shows allergies in modal based on praline allergeis\n * @param {arry} allergies array of allergies\n */\n showAllergies(allergies) {\n if (allergies) {\n const allergiesArr = allergies.split(',');\n allergiesArr.forEach(function (allergy) {\n $('.js-allergy-container[data-allergy=\"' + allergy + '\"]').show();\n });\n }\n },\n /**\n * builds the praline info modal\n * @param {array} pralineInfo array of praline info\n * @param {Object} element selected element\n */\n buildPralineInfo(pralineInfo, element) {\n this.clearModal();\n this.setModalName(pralineInfo.productName);\n this.setModalDescription(pralineInfo.description);\n this.showAllergies(pralineInfo.allergies);\n this.showModal(element);\n },\n setupPralineInfo(element) {\n const productInfo = {\n productName: $(element).data('praline-name'),\n description: $(element).data('description'),\n allergies: $(element).data('allergies')\n };\n this.buildPralineInfo(productInfo, element);\n },\n /**\n * sets the amount left on the amount left container above the box\n */\n setAmountLeft() {\n const amountLeft = this.checkAmountLeft();\n $('.js-amount-counter').text(Math.floor(amountLeft));\n },\n /**\n * hide the pralines based on the allergies selected in the filter\n */\n hidePralinesWithAllergy() {\n const allergyArr = [];\n const products = $('.js-praline-selector[data-allergies]:not(.d-none)');\n\n $('.js-allergy-selector:not(:checked)').each(function (index, element) {\n const allergy = $(element).data('filter');\n allergyArr.push(allergy.toLowerCase());\n });\n const allergyCounter = allergyArr.length;\n\n if (allergyCounter > 0) {\n $('.js-filter-count[data-type=\"allergensDropdown\"]').removeClass('d-none').addClass('d-inline-block').text(allergyCounter);\n $('.js-filter-count[data-type=\"collapseAllergies\"]').removeClass('d-none').addClass('d-inline-block').text(allergyCounter);\n } else {\n $('.js-filter-count[data-type=\"allergensDropdown\"]').removeClass('d-inline-block').addClass('d-none');\n $('.js-filter-count[data-type=\"collapseAllergies\"]').removeClass('d-inline-block').addClass('d-none');\n }\n\n if (allergyCounter > 0) {\n products.each(function () {\n const allergiesSelector = $(this).data('allergies') ? $(this).data('allergies').toLowerCase() : '';\n if (allergiesSelector) {\n let allergies = allergiesSelector.split(',').map(allergy => allergy.trim());\n\n const hasMatchingAllergy = allergyArr.some(selectedAllergy =>\n allergies.includes(selectedAllergy.trim().toLowerCase())\n );\n if (hasMatchingAllergy) {\n $(this).removeClass('d-flex').addClass('d-none');\n } else {\n $(this).removeClass('d-none').addClass('d-flex');\n }\n }\n });\n }\n },\n updateFilterCounter(arr) {\n // filling\n const fillingCounter = arr.filter(item => item.option === 'filling').length;\n if (fillingCounter > 0) {\n $('.js-filter-count[data-type=\"fillingDropdown\"]').removeClass('d-none').addClass('d-inline-block').text(fillingCounter);\n $('.js-filter-count[data-type=\"collapseFilling\"]').removeClass('d-none').addClass('d-inline-block').text(fillingCounter);\n } else {\n $('.js-filter-count[data-type=\"fillingDropdown\"]').removeClass('d-inline-block').addClass('d-none');\n $('.js-filter-count[data-type=\"collapseFilling\"]').removeClass('d-inline-block').addClass('d-none');\n }\n\n // type\n const typeCounter = arr.filter(item => item.option === 'type').length;\n if (typeCounter > 0) {\n $('.js-filter-count[data-type=\"typeDropdown\"]').removeClass('d-none').addClass('d-inline-block').text(typeCounter);\n $('.js-filter-count[data-type=\"collapseType\"]').removeClass('d-none').addClass('d-inline-block').text(typeCounter);\n } else {\n $('.js-filter-count[data-type=\"typeDropdown\"]').removeClass('d-inline-block').addClass('d-none');\n $('.js-filter-count[data-type=\"collapseType\"]').removeClass('d-inline-block').addClass('d-none');\n }\n },\n showPralinesWithType() {\n const typeArr = [];\n const products = $('.js-praline-selector');\n\n $('.js-filter-selector:checked').each(function (index, element) {\n const type = $(element).data('filter');\n if (type) {\n typeArr.push({\n filter: type.toLowerCase(),\n option: $(element).data('filter-option')\n });\n }\n });\n this.updateFilterCounter(typeArr);\n\n const groupedFilters = this.filterArr.reduce((acc, filter) => {\n if (!acc[filter.name]) {\n acc[filter.name] = [];\n }\n acc[filter.name].push(filter.value);\n return acc;\n }, {});\n\n products.each(function (index, product) {\n if (typeArr.length === 0) {\n $(product).removeClass('d-none').addClass('d-flex');\n } else {\n const product = $(this);\n\n let matches = true;\n\n if (groupedFilters.type && groupedFilters.filling) {\n const typeMatches = groupedFilters.type.includes(product.data('type'));\n const fillingMatches = groupedFilters.filling.includes(product.data('filling'));\n\n if (!(typeMatches && fillingMatches)) {\n matches = false;\n }\n } else {\n // If only one of the filters exists, handle separately\n for (const [key, values] of Object.entries(groupedFilters)) {\n if (!values.includes(product.data(key))) {\n matches = false; // Disqualify if key doesn't match any value\n break;\n }\n }\n }\n\n if (matches) {\n product.removeClass('d-none').addClass('d-flex');\n } else {\n product.removeClass('d-flex').addClass('d-none');\n }\n }\n });\n },\n updateSelectedFilters() {\n this.showPralinesWithType();\n this.hidePralinesWithAllergy();\n },\n showAllPralines() {\n const hiddenProducts = $('.js-praline-selector.d-none');\n\n hiddenProducts.each(function () {\n $(this).removeClass('d-none').addClass('d-flex');\n });\n },\n showSpecialMsg(pralineWeight) {\n const $msgSelector = $('.js-special-msg');\n const $content = $msgSelector.data(`weight-${pralineWeight}`);\n $msgSelector.text($content);\n $msgSelector.show();\n\n setTimeout(function () {\n $msgSelector.fadeOut(1000);\n }, 3500);\n },\n // addFilterLabel(filterArr) {\n // const $filterSelector = $('.js-filter-container');\n // $filterSelector.append(\n // `\n // ${filterArr.value}\n // ×\n // `);\n // },\n addFilterToArr(filterName, filterValue) {\n const filterArr = {\n name: filterName,\n value: filterValue\n };\n\n this.filterArr.push(filterArr);\n // this.addFilterLabel(filterArr);\n },\n removeFilterFromArr(filterName) {\n const index = this.filterArr.findIndex(function (filter) {\n return filter.value.toLowerCase() === filterName.toLowerCase();\n });\n\n if (index > -1) {\n this.filterArr.splice(index, 1);\n }\n },\n clearFilterArr() {\n this.filterArr = [];\n },\n handleRemovePraline(element) {\n const boxPlace = ($(element).data('box-place'));\n fyobManager.removeSelectedBoxSpot(boxPlace);\n fyobManager.setAmountLeft();\n },\n scrollContainer() {\n if (this.isMobile() && $('.praline-search-panel').length) {\n const $container = document.querySelector('.js-scroll-container');\n const $target = document.querySelector('.js-scroll-container .box-title-container');\n\n const options = {\n root: null,\n rootMargin: '0px',\n threshold: 1\n };\n\n const callback = (entries) => {\n entries.forEach(entry => {\n if (!entry.isIntersecting) {\n $target.classList.add('fixed-container');\n } else if (entry.isIntersecting) {\n $target.classList.remove('fixed-container');\n }\n });\n };\n const observer = new IntersectionObserver(callback, options);\n\n observer.observe($container);\n }\n },\n showPralineAddedNotifcation() {\n if (this.isMobile()) {\n const $msgSelector = $('.js-added-notification');\n $msgSelector.show();\n\n setTimeout(function () {\n $msgSelector.fadeOut(400);\n }, 500);\n }\n },\n setHeightBasedOnBox() {\n if (!this.isMobile()) {\n const heightOfBox = $('.js-box-height-container').height();\n\n if (heightOfBox > 720) {\n $('.praline-selector-container').css('max-height', heightOfBox);\n }\n }\n }\n};\n\n$(document).ready(function () {\n fyobManager.getIrresistiblesAmount();\n fyobManager.getAmountOfPralinesPerBox();\n fyobManager.setAmountLeft();\n fyobManager.scrollContainer();\n fyobManager.setHeightBasedOnBox();\n $('.js-fyob-proceed').on('click', function (e) {\n e.preventDefault();\n let selectedProductId = $(this).data('product-id');\n if (selectedProductId) {\n $('.js-error-msg').addClass('d-none');\n const redicrecturl = $(this).data('href');\n window.location.replace(redicrecturl + '?fyodpid=' + selectedProductId);\n } else {\n $('.js-error-msg').removeClass('d-none');\n }\n });\n\n $('.js-praline-selector').on('click', function () {\n if (!$(this).closest('.js-praline-selector').hasClass('disabled')) {\n const productData = {\n pid: $(this).data('pid'),\n productWeight: $(this).data('praline-weight'),\n productImage: $(this).closest('.js-praline-selector').find('.js-praline-image').attr('src'),\n productName: $(this).closest('.js-praline-selector').find('.js-praline-name').text()\n .trim()\n };\n fyobManager.pushDataIntoArray(productData);\n if (productData.productWeight === 3) {\n fyobManager.disableSpotWhenIrristibles();\n }\n\n if (productData.productWeight === 3 || productData.productWeight === 2) {\n fyobManager.showSpecialMsg(productData.productWeight);\n }\n if (!$('.js-praline-popup').hasClass('d-none')) {\n fyobManager.hideModal();\n }\n fyobManager.showPralineAddedNotifcation();\n fyobManager.buildBoxGridBasedOnArray();\n fyobManager.setAmountLeft();\n fyobManager.checkToDisableOrEnablePralines();\n }\n });\n\n $('.js-selected-content').on('click', function (e) {\n e.preventDefault();\n fyobManager.handleRemovePraline(this);\n });\n\n $('.js-praline-search').on('keyup', function () {\n const searchText = $(this).val();\n const products = $('.js-praline-selector');\n\n fyobManager.productSearch(searchText, products);\n fyobManager.productRemainingMsg();\n });\n\n $('.js-proceed-fyob').on('click', function (e) {\n e.preventDefault();\n const url = $(this).attr('href');\n fyobManager.addToCart(url);\n });\n\n $('.js-praline-info').on('click', function (e) {\n if (fyobManager.isMobile()) {\n e.stopPropagation();\n fyobManager.setupPralineInfo(this);\n }\n });\n\n $('.js-praline-info').on('mouseover', function (e) {\n if (!fyobManager.isMobile()) {\n e.stopPropagation();\n fyobManager.setupPralineInfo(this);\n }\n });\n\n $('.js-praline-info').on('mouseleave', function () {\n if (!fyobManager.isMobile()) {\n fyobManager.hideModal();\n }\n });\n\n $('.js-praline-info-close').on('click', function () {\n fyobManager.hideModal();\n });\n\n $(document).on('keyup', function (evt) {\n if (evt.keyCode === 27) { // escape\n fyobManager.hideModal();\n }\n });\n\n $('.js-allergy-selector').on('change', function (e) {\n const selectedAllergy = $(e.currentTarget).data('filter');\n\n if (!e.target.checked) {\n fyobManager.removeFilterFromArr(selectedAllergy);\n }\n fyobManager.updateSelectedFilters();\n });\n\n $('.js-filter-selector').on('change', function (e) {\n const selectedType = $(e.currentTarget).data('filter');\n const selectedFilterOption = $(e.currentTarget).data('filter-option');\n if (e.target.checked) {\n fyobManager.addFilterToArr(selectedFilterOption, selectedType);\n } else {\n fyobManager.removeFilterFromArr(selectedType);\n }\n\n fyobManager.updateSelectedFilters();\n });\n\n $('.js-reset-filters').on('click', function (e) {\n e.preventDefault();\n $('.js-allergy-selector').prop('checked', true);\n $('.js-filter-selector').prop('checked', false);\n fyobManager.showAllPralines();\n fyobManager.clearFilterArr();\n fyobManager.updateSelectedFilters();\n });\n\n $('.dropdown-item').on('click', function (e) {\n e.stopPropagation();\n });\n\n $('body').on('click', '.js-remove-filter-badge', function (e) {\n const filter = $(e.currentTarget).data('filter');\n $('[data-filter=\"' + filter + '\"]:checked').prop('checked', false);\n\n fyobManager.removeFilterFromArr(filter);\n fyobManager.updateSelectedFilters();\n $(this).remove();\n });\n\n $('#collapsibleContent').on('shown.bs.collapse', function () {\n $('.js-collapse-icon[data-collapsed=true]').show();\n $('.js-collapse-icon[data-collapsed=false]').hide();\n });\n\n $('#collapsibleContent').on('hide.bs.collapse', function () {\n $('.js-collapse-icon[data-collapsed=false]').show();\n $('.js-collapse-icon[data-collapsed=true]').hide();\n });\n\n $('.dropdown-toggle').on('click', function (e) {\n if ($(`.dropdown-content#${$(this).attr('aria-controls')}`).hasClass('show')) {\n e.stopPropagation();\n $(`.dropdown-content#${$(this).attr('aria-controls')}`).removeClass('show');\n }\n $('.filter-container .collapse.show').removeClass('show');\n\n const id = $(this).attr('id');\n $(`.dropdown-menu.show:not([aria-labelledby=${id}])`).removeClass('show');\n $(`.dropdown-menu[aria-labelledby=${id}]`).toggleClass('show');\n });\n\n $('.js-fyob-tile').on('click', function () {\n $(this).find('.js-box-selector').prop('checked', true);\n });\n});\n"],"sourceRoot":""}