{"version":3,"sources":["webpack:///scripts/plugin--product-listing-page--0b27665e19921793a3df.js","webpack:///./client/src/core/components/product-listing-page/product-listing-page.js"],"names":["webpackJsonpHairCare","D:\\a\\1\\s\\node_modules\\babel-loader\\lib\\index.js??ref--12-0!D:\\a\\1\\s\\node_modules\\eslint-loader\\index.js??ref--12-1!D:\\a\\1\\s\\client\\src\\core\\components\\product-listing-page\\product-listing-page.js","module","exports","__webpack_require__","_interopRequireDefault","obj","__esModule","default","_toConsumableArray","arr","Array","isArray","i","arr2","length","from","_classCallCheck","instance","Constructor","TypeError","Object","defineProperty","value","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","key","protoProps","staticProps","prototype","_jquery2","_jquery","_debug2","_debug","log","ProductListingPage","element","options","this","wideResults","querySelector","wideResultsEl","narrowResults","narrowResultsEl","wideFilters","wideFiltersEl","narrowFilters","narrowFiltersEl","searchResultsFacetsTabsEl","document","pageNumber","sort","pageSize","searchQuery","startPageId","language","currentFilterGroup","selectedFilters","isSearchPage","pageUrl","resetUrl","ajaxLoading","querySelectorAll","ajaxLoadingSelector","ajaxLoadingFilters","ajaxLoadingFiltersSelector","fetchData","watch","updateViewOnStartFilter","Promise","all","loadSearchResults","loadFilters","finally","updateViewOnEndFilter","bind","on","event","preventDefault","currentTarget","form","closest","onFilter","dataset","name","trigger","onReset","getForm","hideFilterPanelNarrow","removeClass","prop","scrollIntoView","applyFilterFormToURL","updateDataSearch","updateLoadingDisplay","hidden","updateLoadingFiltersDisplay","trackingPLP","formData","FormData","append","params","URLSearchParams","url","window","location","origin","pathname","toString","history","pushState","find","toArray","reduce","acc","input","attr","filterName","query","join","serializeArray","cur","Sort","PageSize","CurrentFilterGroup","q","productsTotal","blogTotal","pagesDocsTotal","blogUrl","pagesDocsUrl","href","tabCount","tabSpan","mod","each","text","hide","removeAttr","css","show","endpointFilters","fetch","then","response","ok","reject","html","parser","DOMParser","staleCart","remove","staleCart2","freshCart","parseFromString","freshCart2","freshCart3","body","parent","catch","isLoading","forEach","indicator","classList","add","endpoint","htmlText","updateSearchResults","resultsDocument","wideResultsHtml","narrowResultsHtml","staleWideResults","staleNarrowResults","setSearchPageTabs","PLPtrackings","el","$el","viewport","data","isMobile","GAServices","viewItemTracking","index","selectItem","DEFAULTS"],"mappings":"AAAAA,sBAAsB,iCAEhBC,4NACA,SAAUC,EAAQC,EAASC,GAEjC,YAmBA,SAASC,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,QAASF,GAEvF,QAASG,GAAmBC,GAAO,GAAIC,MAAMC,QAAQF,GAAM,CAAE,IAAK,GAAIG,GAAI,EAAGC,EAAOH,MAAMD,EAAIK,QAASF,EAAIH,EAAIK,OAAQF,IAAOC,EAAKD,GAAKH,EAAIG,EAAM,OAAOC,GAAe,MAAOH,OAAMK,KAAKN,GAE1L,QAASO,GAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCApBhHC,OAAOC,eAAenB,EAAS,cAC9BoB,OAAO,GAGR,IAAIC,GAAe,WAAc,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAId,GAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IAAK,CAAE,GAAIe,GAAaD,EAAMd,EAAIe,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMV,OAAOC,eAAeI,EAAQE,EAAWI,IAAKJ,IAAiB,MAAO,UAAUT,EAAac,EAAYC,GAAiJ,MAA9HD,IAAYR,EAAiBN,EAAYgB,UAAWF,GAAiBC,GAAaT,EAAiBN,EAAae,GAAqBf,MCZhiB,yBDgBIiB,EAAW/B,EAAuBgC,GCftC,yLDmBIC,EAAUjC,EAAuBkC,GClBrC,gMAEMC,GAAM,aAAM,wBAEZC,E,WACL,WAAYC,EAASC,GAAS,UAC7BC,KAAKF,QAAUA,EACfE,KAAKD,QAAUA,EAEfC,KAAKC,YAAcH,EAAQI,cA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E,GACxBnI,KAAKI,cAAc0D,OAAOsE,GAC1BpI,KAAKuI,uBD3DLnJ,IAAK,cACLT,MAAO,WC8DP,GAAM6J,IAAe,aAAExI,KAAKF,SAAS2E,KAAK,oBAC1C1G,OAAMK,KAAKoK,GAAcb,QAAQ,SAACc,GACjC,GAAMC,IAAM,aAAED,GACRE,EAAWD,EAAIE,KAAK,aACtBC,YAAyB,WAAbF,IAA0BE,YAAyB,YAAbF,KACrDG,aAAWC,iBAAiBN,GAC5BC,EAAIjE,KAAK,sBAAsBwB,KAAK,SAAC+C,EAAOP,GAC3CK,aAAWG,WAAWR,GAAI,MAE3B,aAAEvE,QAAQ5B,GAAG,SAAU,WACtBwG,aAAWC,iBAAiBN,YDtDzB5I,IC8DRA,GAAmBqJ,YDzDnB3L,EAAQK,QC2DOiC","file":"scripts/plugin--product-listing-page--0b27665e19921793a3df.js","sourcesContent":["webpackJsonpHairCare([\"plugin--product-listing-page\"],{\n\n/***/ \"D:\\\\a\\\\1\\\\s\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js??ref--12-0!D:\\\\a\\\\1\\\\s\\\\node_modules\\\\eslint-loader\\\\index.js??ref--12-1!D:\\\\a\\\\1\\\\s\\\\client\\\\src\\\\core\\\\components\\\\product-listing-page\\\\product-listing-page.js\":\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _jquery = __webpack_require__(\"external \\\"jQuery\\\"\");\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _debug = __webpack_require__(\"D:\\\\a\\\\1\\\\s\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js??ref--12-0!D:\\\\a\\\\1\\\\s\\\\node_modules\\\\eslint-loader\\\\index.js??ref--12-1!D:\\\\a\\\\1\\\\s\\\\node_modules\\\\debug\\\\src\\\\browser.js\");\n\nvar _debug2 = _interopRequireDefault(_debug);\n\nvar _gaServices = __webpack_require__(\"D:\\\\a\\\\1\\\\s\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js??ref--12-0!D:\\\\a\\\\1\\\\s\\\\node_modules\\\\eslint-loader\\\\index.js??ref--12-1!D:\\\\a\\\\1\\\\s\\\\client\\\\src\\\\core\\\\services\\\\ga-services.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar log = (0, _debug2.default)(\"product-listing-page\");\n\nvar ProductListingPage = function () {\n\tfunction ProductListingPage(element, options) {\n\t\t_classCallCheck(this, ProductListingPage);\n\n\t\tthis.element = element;\n\t\tthis.options = options;\n\n\t\tthis.wideResults = element.querySelector(this.options.wideResultsEl);\n\t\tthis.narrowResults = element.querySelector(this.options.narrowResultsEl);\n\t\tthis.wideFilters = element.querySelector(this.options.wideFiltersEl);\n\t\tthis.narrowFilters = element.querySelector(this.options.narrowFiltersEl);\n\t\tthis.searchResultsFacetsTabsEl = document.querySelector(this.options.searchResultsFacetsTabsEl);\n\n\t\tthis.pageNumber = this.options.pageNumber;\n\t\tthis.sort = this.options.sort;\n\t\tthis.pageSize = this.options.pageSize;\n\t\tthis.searchQuery = this.options.searchQuery;\n\t\tthis.startPageId = this.options.startPageId;\n\t\tthis.language = this.options.language;\n\t\tthis.currentFilterGroup = this.options.currentFilterGroup;\n\t\tthis.selectedFilters = this.options.selectedFilters;\n\t\tthis.isSearchPage = this.options.isSearchPage;\n\t\tthis.pageUrl = this.options.pageUrl;\n\t\tthis.resetUrl = this.options.resetUrl;\n\n\t\t// Shipping Form portion - updated with ajax upon\n\t\tthis.ajaxLoading = Array.from(document.querySelectorAll(this.options.ajaxLoadingSelector));\n\t\tthis.ajaxLoadingFilters = Array.from(document.querySelectorAll(this.options.ajaxLoadingFiltersSelector));\n\n\t\tthis.fetchData();\n\t\tthis.watch();\n\t\tlog(this);\n\t}\n\n\t_createClass(ProductListingPage, [{\n\t\tkey: \"fetchData\",\n\t\tvalue: function fetchData() {\n\t\t\tthis.updateViewOnStartFilter();\n\t\t\tPromise.all([this.loadSearchResults(), this.loadFilters()]).finally(this.updateViewOnEndFilter.bind(this));\n\t\t}\n\t}, {\n\t\tkey: \"watch\",\n\t\tvalue: function watch() {\n\t\t\tvar _this = this;\n\n\t\t\t(0, _jquery2.default)(\"body\").on(\"click\", \".filter-panel-pagination__link\", function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tvar currentTarget = event.currentTarget;\n\n\t\t\t\tvar form = (0, _jquery2.default)(currentTarget).closest(\"form\")[0];\n\t\t\t\tvar pageNumber = currentTarget.value;\n\t\t\t\t_this.onFilter(form, pageNumber);\n\t\t\t}).on(\"click\", \"[data-remove-filter-trigger]\", function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tvar currentTarget = event.currentTarget;\n\t\t\t\tvar _currentTarget$datase = currentTarget.dataset,\n\t\t\t\t name = _currentTarget$datase.name,\n\t\t\t\t value = _currentTarget$datase.value;\n\n\t\t\t\t(0, _jquery2.default)(\"[data-filter-trigger][name=\\\"\" + name + \"\\\"][value=\\\"\" + value + \"\\\"]\").trigger(\"click\");\n\t\t\t}).on(\"click\", \".filter-panel-applied-filters__reset\", function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t_this.onReset(_this.getForm(event));\n\t\t\t}).on(\"click\", \".filter-panel-wide__reset, .filter-panel-narrow__reset\", function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t_this.onReset(_this.getForm(event));\n\t\t\t\t_this.hideFilterPanelNarrow();\n\t\t\t}).on(\"change\", \"[data-search-filter-form='mobile'] select[name='Sort']\", function (event) {\n\t\t\t\t_this.onFilter(_this.getForm(event));\n\t\t\t});\n\n\t\t\t(0, _jquery2.default)(\"[data-search-filter-form='mobile']\").on(\"submit\", function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t_this.hideFilterPanelNarrow();\n\t\t\t\t_this.onFilter(event.currentTarget);\n\t\t\t});\n\n\t\t\t(0, _jquery2.default)(\"[data-search-filter-api='desktop']\").on(\"change\", function (event) {\n\t\t\t\t_this.onFilter(event.currentTarget);\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"getForm\",\n\t\tvalue: function getForm(event) {\n\t\t\tvar currentTarget = event.currentTarget;\n\n\t\t\treturn (0, _jquery2.default)(currentTarget).closest(\"form\")[0];\n\t\t}\n\t}, {\n\t\tkey: \"hideFilterPanelNarrow\",\n\t\tvalue: function hideFilterPanelNarrow() {\n\t\t\t(0, _jquery2.default)(\".filter-panel-narrow__filters\").removeClass(\"active\");\n\t\t\t(0, _jquery2.default)(\"body\").removeClass(\"filter-panel-no-scroll\");\n\t\t}\n\t}, {\n\t\tkey: \"onReset\",\n\t\tvalue: function onReset(form) {\n\t\t\t(0, _jquery2.default)(\"[data-filter-trigger]\").prop(\"checked\", false);\n\t\t\t(0, _jquery2.default)(\"[data-filter-trigger][name='']\").prop(\"checked\", true);\n\t\t\tthis.onFilter(form);\n\t\t}\n\t}, {\n\t\tkey: \"onFilter\",\n\t\tvalue: function onFilter(currentTarget) {\n\t\t\tvar pageNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n\n\t\t\tthis.searchResultsFacetsTabsEl && this.searchResultsFacetsTabsEl.scrollIntoView();\n\t\t\tthis.pageNumber = pageNumber;\n\n\t\t\tthis.applyFilterFormToURL(currentTarget);\n\t\t\tthis.updateDataSearch(currentTarget);\n\t\t\tthis.fetchData();\n\t\t}\n\t}, {\n\t\tkey: \"updateViewOnStartFilter\",\n\t\tvalue: function updateViewOnStartFilter() {\n\t\t\tthis.updateLoadingDisplay(true);\n\t\t}\n\t}, {\n\t\tkey: \"updateViewOnEndFilter\",\n\t\tvalue: function updateViewOnEndFilter() {\n\t\t\tthis.wideResults.hidden = false;\n\t\t\tthis.wideFilters.hidden = false;\n\t\t\tthis.narrowResults.hidden = false;\n\t\t\tthis.updateLoadingDisplay(false);\n\t\t\tthis.updateLoadingFiltersDisplay(false);\n\t\t\t(0, _jquery2.default)(document).trigger(\"filter-groups-loaded\");\n\t\t\t(0, _jquery2.default)(document).trigger(\"product-teasers-loaded\");\n\t\t\tthis.trackingPLP();\n\t\t}\n\t}, {\n\t\tkey: \"applyFilterFormToURL\",\n\t\tvalue: function applyFilterFormToURL(currentTarget) {\n\t\t\tvar formData = new FormData(currentTarget);\n\t\t\tformData.append(\"p\", this.pageNumber);\n\t\t\tvar params = new URLSearchParams(formData);\n\t\t\tvar url = \"\" + window.location.origin + window.location.pathname + \"?\" + params.toString();\n\t\t\twindow.history.pushState({}, \"\", url);\n\t\t}\n\t}, {\n\t\tkey: \"updateDataSearch\",\n\t\tvalue: function updateDataSearch(currentTarget) {\n\t\t\tvar selectedFilters = (0, _jquery2.default)(currentTarget).find('[data-filter-trigger]:checked').toArray().reduce(function (acc, input) {\n\t\t\t\tvar value = (0, _jquery2.default)(input).attr('value');\n\t\t\t\tvar name = (0, _jquery2.default)(input).attr('name');\n\t\t\t\tvar filterName = (0, _jquery2.default)(input).attr('data-analytics-trigger-filter-name');\n\t\t\t\tvar query = value + \":\" + name + \":\" + filterName;\n\t\t\t\treturn name ? [].concat(_toConsumableArray(acc), [query]) : acc;\n\t\t\t}, []).join(',');\n\n\t\t\tvar options = (0, _jquery2.default)(currentTarget).serializeArray().reduce(function (acc, cur) {\n\t\t\t\tacc[cur.name] = cur.value;\n\t\t\t\treturn acc;\n\t\t\t}, {});\n\n\t\t\t// Update by form change\n\t\t\tthis.sort = options.Sort || this.sort;\n\t\t\tthis.pageSize = options.PageSize || this.pageSize;\n\t\t\tthis.currentFilterGroup = options.CurrentFilterGroup || this.currentFilterGroup;\n\t\t\tthis.searchQuery = options.q || this.searchQuery;\n\t\t\tthis.selectedFilters = selectedFilters;\n\t\t}\n\t}, {\n\t\tkey: \"setSearchPageTabs\",\n\t\tvalue: function setSearchPageTabs() {\n\t\t\tvar productsTotalSelector = \"data-product-listing-page-products-total\";\n\t\t\tvar blogTotalSelector = \"data-product-listing-page-blog-total\";\n\t\t\tvar pagesDocsTotalSelector = \"data-product-listing-page-pages-documents-total\";\n\t\t\tvar blogUrlSelector = \"data-product-listing-page-blog-url\";\n\t\t\tvar pagesDocsUrlSelector = \"data-product-listing-page-pages-documents-url\";\n\t\t\tthis.productsTotal = (0, _jquery2.default)(this.wideResults).find(\"[\" + productsTotalSelector + \"]\").attr(productsTotalSelector);\n\t\t\tthis.blogTotal = (0, _jquery2.default)(this.wideResults).find(\"[\" + blogTotalSelector + \"]\").attr(blogTotalSelector);\n\t\t\tthis.pagesDocsTotal = (0, _jquery2.default)(this.wideResults).find(\"[\" + pagesDocsTotalSelector + \"]\").attr(pagesDocsTotalSelector);\n\t\t\tthis.blogUrl = (0, _jquery2.default)(this.wideResults).find(\"[\" + blogUrlSelector + \"]\").attr(blogUrlSelector);\n\t\t\tthis.pagesDocsUrl = (0, _jquery2.default)(this.wideResults).find(\"[\" + pagesDocsUrlSelector + \"]\").attr(pagesDocsUrlSelector);\n\n\t\t\tif (this.isSearchPage && this.productsTotal == 0) {\n\t\t\t\tif (this.blogTotal > 0 && this.blogUrl.length > 0) {\n\t\t\t\t\twindow.location.href = this.blogUrl;\n\t\t\t\t} else if (this.pagesDocsTotal > 0 && this.pagesDocsUrl.length > 0) {\n\t\t\t\t\twindow.location.href = this.pagesDocsUrl;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar tabCount = \".search-results__facet-tab-count\";\n\t\t\tvar tabSpan = \".tabs-title__label\";\n\t\t\tvar mod = this;\n\t\t\t(0, _jquery2.default)(\"[data-search-facet]\").each(function () {\n\t\t\t\tvar facet = (0, _jquery2.default)(this).attr(\"data-search-facet\");\n\t\t\t\tswitch (facet) {\n\t\t\t\t\tcase \"product\":\n\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabCount).text(\"(\" + mod.productsTotal + \")\");\n\t\t\t\t\t\tif (mod.productsTotal > 0) {\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabSpan).hide();\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(\"a\").removeAttr(\"hidden\").css(\"display\", \"block\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabSpan).removeAttr(\"hidden\").css(\"display\", \"block\");\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(\"a\").hide();\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).removeClass(\"is-active\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"blog\":\n\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabCount).text(\"(\" + mod.blogTotal + \")\");\n\t\t\t\t\t\tif (mod.blogTotal > 0) {\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabSpan).hide();\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(\"a\").removeAttr(\"hidden\").css(\"display\", \"block\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabSpan).removeAttr(\"hidden\").css(\"display\", \"block\");\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(\"a\").hide();\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).removeClass(\"is-active\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"pages-documents\":\n\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabCount).text(\"(\" + mod.pagesDocsTotal + \")\");\n\t\t\t\t\t\tif (mod.pagesDocsTotal > 0) {\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabSpan).hide();\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(\"a\").show().removeAttr(\"hidden\").css(\"display\", \"block\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(tabSpan).removeAttr(\"hidden\").css(\"display\", \"block\");\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).find(\"a\").hide();\n\t\t\t\t\t\t\t(0, _jquery2.default)(this).removeClass(\"is-active\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"loadFilters\",\n\t\tvalue: function loadFilters() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar url = this.options.endpointFilters + \"&pageNumber=\" + this.pageNumber + \"&sort=\" + this.sort + \"&pageSize=\" + this.pageSize + \"&searchQuery=\" + this.searchQuery + \"¤tFilterGroup=\" + this.currentFilterGroup + \"&selectedFilters=\" + this.selectedFilters + \"&startPageId=\" + this.startPageId + \"&language=\" + this.language + \"&pageUrl=\" + this.pageUrl + \"&resetUrl=\" + this.resetUrl + \"&isSearchPage=\" + this.isSearchPage;\n\t\t\treturn fetch(url).then(function (response) {\n\t\t\t\tif (response.ok) {\n\t\t\t\t\treturn response.text();\n\t\t\t\t}\n\t\t\t\treturn Promise.reject(response);\n\t\t\t}).then(function (html) {\n\t\t\t\tvar parser = new DOMParser();\n\n\t\t\t\tvar staleCart = _this2.wideFilters.querySelector(\"*\");\n\t\t\t\tstaleCart && staleCart.remove();\n\n\t\t\t\tvar staleCart2 = _this2.narrowFilters.querySelector(\"*\");\n\t\t\t\tstaleCart2 && staleCart2.remove();\n\n\t\t\t\tvar freshCart = parser.parseFromString(html, \"text/html\");\n\t\t\t\tvar freshCart2 = parser.parseFromString(html, \"text/html\");\n\t\t\t\tvar freshCart3 = parser.parseFromString(html, \"text/html\");\n\t\t\t\t_this2.wideFilters.append(freshCart.body.querySelector(\"[data-product-listing-page-filter-wide-results-container]\"));\n\t\t\t\t_this2.narrowFilters.append(freshCart2.body.querySelector(\"[data-product-listing-page-filter-narrow-results-container]\"));\n\t\t\t\t_this2.narrowFilters.hidden = false;\n\t\t\t\tvar index = freshCart3.body.querySelector(\".filter-panel-wide__header\");\n\t\t\t\tif (index == null) {\n\t\t\t\t\tvar parent = (0, _jquery2.default)(_this2.wideFilters).parent();\n\t\t\t\t\t(0, _jquery2.default)(parent).hide();\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\t// If invalid disable the proceed button\n\t\t\t\tlog(\"error\");\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"updateLoadingDisplay\",\n\t\tvalue: function updateLoadingDisplay(isLoading) {\n\t\t\tthis.ajaxLoading.forEach(function (indicator) {\n\t\t\t\tindicator.hidden = !isLoading;\n\t\t\t\t!isLoading && indicator.classList.add('not-first-load');\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"updateLoadingFiltersDisplay\",\n\t\tvalue: function updateLoadingFiltersDisplay(isLoading) {\n\t\t\tthis.ajaxLoadingFilters.forEach(function (indicator) {\n\t\t\t\tindicator.hidden = !isLoading;\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"loadSearchResults\",\n\t\tvalue: function loadSearchResults() {\n\t\t\tvar url = this.options.endpoint + \"&pageNumber=\" + this.pageNumber + \"&sort=\" + this.sort + \"&pageSize=\" + this.pageSize + \"&searchQuery=\" + this.searchQuery + \"¤tFilterGroup=\" + this.currentFilterGroup + \"&selectedFilters=\" + this.selectedFilters + \"&startPageId=\" + this.startPageId + \"&language=\" + this.language + \"&pageUrl=\" + this.pageUrl + \"&resetUrl=\" + this.resetUrl + \"&isSearchPage=\" + this.isSearchPage;\n\t\t\treturn fetch(url).then(function (response) {\n\t\t\t\tif (response.ok) {\n\t\t\t\t\treturn response.text();\n\t\t\t\t}\n\t\t\t\treturn Promise.reject(response);\n\t\t\t}).then(function (htmlText) {\n\t\t\t\tvar parser = new DOMParser();\n\t\t\t\treturn parser.parseFromString(htmlText, \"text/html\");\n\t\t\t}).then(this.updateSearchResults.bind(this)).catch(function () {\n\t\t\t\t// If invalid disable the proceed button\n\t\t\t\tlog(\"error\");\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"updateSearchResults\",\n\t\tvalue: function updateSearchResults(resultsDocument) {\n\t\t\tvar wideResultsHtml = resultsDocument.body.querySelector(this.options.wideResults);\n\t\t\tvar narrowResultsHtml = resultsDocument.body.querySelector(this.options.narrowResults);\n\n\t\t\tvar staleWideResults = this.wideResults.querySelector(\"*\");\n\t\t\tstaleWideResults && staleWideResults.remove();\n\n\t\t\tvar staleNarrowResults = this.narrowResults.querySelector(\"*\");\n\t\t\tstaleNarrowResults && staleNarrowResults.remove();\n\n\t\t\tthis.wideResults.append(wideResultsHtml);\n\t\t\tthis.narrowResults.append(narrowResultsHtml);\n\t\t\tthis.setSearchPageTabs();\n\t\t}\n\t}, {\n\t\tkey: \"trackingPLP\",\n\t\tvalue: function trackingPLP() {\n\t\t\tvar PLPtrackings = (0, _jquery2.default)(this.element).find('[ga-tracking-plp]');\n\t\t\tArray.from(PLPtrackings).forEach(function (el) {\n\t\t\t\tvar $el = (0, _jquery2.default)(el);\n\t\t\t\tvar viewport = $el.data('viewport');\n\t\t\t\tif (_gaServices.isMobile && viewport === 'mobile' || !_gaServices.isMobile && viewport === 'desktop') {\n\t\t\t\t\t_gaServices.GAServices.viewItemTracking(el);\n\t\t\t\t\t$el.find('[ga-tracking-link]').each(function (index, el) {\n\t\t\t\t\t\t_gaServices.GAServices.selectItem(el, false);\n\t\t\t\t\t});\n\t\t\t\t\t(0, _jquery2.default)(window).on('scroll', function () {\n\t\t\t\t\t\t_gaServices.GAServices.viewItemTracking(el);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}]);\n\n\treturn ProductListingPage;\n}();\n\nProductListingPage.DEFAULTS = {};\n\nexports.default = ProductListingPage;\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// scripts/plugin--product-listing-page--0b27665e19921793a3df.js","import $ from \"jquery\";\r\nimport debug from \"debug\";\r\nimport { GAServices, isMobile } from \"../../services/ga-services\";\r\n\r\nconst log = debug(\"product-listing-page\");\r\n\r\nclass ProductListingPage {\r\n\tconstructor(element, options) {\r\n\t\tthis.element = element;\r\n\t\tthis.options = options;\r\n\r\n\t\tthis.wideResults = element.querySelector(this.options.wideResultsEl);\r\n\t\tthis.narrowResults = element.querySelector(\r\n\t\t\tthis.options.narrowResultsEl\r\n\t\t);\r\n\t\tthis.wideFilters = element.querySelector(this.options.wideFiltersEl);\r\n\t\tthis.narrowFilters = element.querySelector(\r\n\t\t\tthis.options.narrowFiltersEl\r\n\t\t);\r\n\t\tthis.searchResultsFacetsTabsEl = document.querySelector(\r\n\t\t\tthis.options.searchResultsFacetsTabsEl\r\n\t\t);\r\n\r\n\t\tthis.pageNumber = this.options.pageNumber;\r\n\t\tthis.sort = this.options.sort;\r\n\t\tthis.pageSize = this.options.pageSize;\r\n\t\tthis.searchQuery = this.options.searchQuery;\r\n\t\tthis.startPageId = this.options.startPageId;\r\n\t\tthis.language = this.options.language;\r\n\t\tthis.currentFilterGroup = this.options.currentFilterGroup;\r\n\t\tthis.selectedFilters = this.options.selectedFilters;\r\n\t\tthis.isSearchPage = this.options.isSearchPage;\r\n\t\tthis.pageUrl = this.options.pageUrl;\r\n\t\tthis.resetUrl = this.options.resetUrl;\r\n\r\n\t\t// Shipping Form portion - updated with ajax upon\r\n\t\tthis.ajaxLoading = Array.from(document.querySelectorAll(\r\n\t\t\tthis.options.ajaxLoadingSelector\r\n\t\t));\r\n\t\tthis.ajaxLoadingFilters = Array.from(document.querySelectorAll(\r\n\t\t\tthis.options.ajaxLoadingFiltersSelector\r\n\t\t));\r\n\r\n\t\tthis.fetchData();\r\n\t\tthis.watch();\r\n\t\tlog(this);\r\n\t}\r\n\r\n\tfetchData() {\r\n\t\tthis.updateViewOnStartFilter();\r\n\t\tPromise.all([\r\n\t\t\tthis.loadSearchResults(),\r\n\t\t\tthis.loadFilters(),\r\n\t\t]).finally(this.updateViewOnEndFilter.bind(this));\r\n\t}\r\n\r\n\twatch() {\r\n\t\t$(\"body\")\r\n\t\t\t.on(\"click\", \".filter-panel-pagination__link\", (event) => {\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t\tconst { currentTarget } = event;\r\n\t\t\t\tconst form = $(currentTarget).closest(\"form\")[0];\r\n\t\t\t\tconst pageNumber = currentTarget.value;\r\n\t\t\t\tthis.onFilter(form, pageNumber);\r\n\t\t\t}).on(\"click\", \"[data-remove-filter-trigger]\", (event) => {\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t\tconst { currentTarget } = event;\r\n\t\t\t\tconst { name, value } = currentTarget.dataset;\r\n\t\t\t\t$(`[data-filter-trigger][name=\"${name}\"][value=\"${value}\"]`).trigger(\"click\");\r\n\t\t\t}).on(\"click\", \".filter-panel-applied-filters__reset\", (event) => {\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t\tthis.onReset(this.getForm(event));\r\n\t\t\t}).on(\"click\", \".filter-panel-wide__reset, .filter-panel-narrow__reset\", (event) => {\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t\tthis.onReset(this.getForm(event));\r\n\t\t\t\tthis.hideFilterPanelNarrow();\r\n\t\t\t}).on(\"change\", \"[data-search-filter-form='mobile'] select[name='Sort']\", (event) => {\r\n\t\t\t\tthis.onFilter(this.getForm(event));\r\n\t\t\t});\r\n\r\n\t\t$(\"[data-search-filter-form='mobile']\").on(\"submit\", (event) => {\r\n\t\t\tevent.preventDefault();\r\n\t\t\tthis.hideFilterPanelNarrow();\r\n\t\t\tthis.onFilter(event.currentTarget);\r\n\t\t});\r\n\r\n\t\t$(\"[data-search-filter-api='desktop']\").on(\"change\", (event) => {\r\n\t\t\tthis.onFilter(event.currentTarget);\r\n\t\t});\r\n\t}\r\n\r\n\tgetForm(event) {\r\n\t\tconst { currentTarget } = event;\r\n\t\treturn $(currentTarget).closest(\"form\")[0];\r\n\t}\r\n\r\n\thideFilterPanelNarrow() {\r\n\t\t$(\".filter-panel-narrow__filters\").removeClass(\"active\");\r\n\t\t$(\"body\").removeClass(\"filter-panel-no-scroll\");\r\n\t}\r\n\r\n\tonReset(form) {\r\n\t\t$(\"[data-filter-trigger]\").prop(\"checked\", false);\r\n\t\t$(\"[data-filter-trigger][name='']\").prop(\"checked\", true);\r\n\t\tthis.onFilter(form);\r\n\t}\r\n\r\n\tonFilter(currentTarget, pageNumber = 1) {\r\n\t\tthis.searchResultsFacetsTabsEl && this.searchResultsFacetsTabsEl.scrollIntoView();\r\n\t\tthis.pageNumber = pageNumber;\r\n\r\n\t\tthis.applyFilterFormToURL(currentTarget);\r\n\t\tthis.updateDataSearch(currentTarget);\r\n\t\tthis.fetchData();\r\n\t}\r\n\r\n\tupdateViewOnStartFilter() {\r\n\t\tthis.updateLoadingDisplay(true);\r\n\t}\r\n\r\n\tupdateViewOnEndFilter() {\r\n\t\tthis.wideResults.hidden = false;\r\n\t\tthis.wideFilters.hidden = false;\r\n\t\tthis.narrowResults.hidden = false;\r\n\t\tthis.updateLoadingDisplay(false);\r\n\t\tthis.updateLoadingFiltersDisplay(false);\r\n\t\t$(document).trigger(\"filter-groups-loaded\");\r\n\t\t$(document).trigger(\"product-teasers-loaded\");\r\n\t\tthis.trackingPLP();\r\n\t}\r\n\r\n\tapplyFilterFormToURL(currentTarget) {\r\n\t\tconst formData = new FormData(currentTarget);\r\n\t\tformData.append(\"p\", this.pageNumber);\r\n\t\tconst params = new URLSearchParams(formData);\r\n\t\tconst url = `${window.location.origin}${window.location.pathname}?${params.toString()}`;\r\n\t\twindow.history.pushState({}, \"\", url);\r\n\t}\r\n\r\n\tupdateDataSearch(currentTarget) {\r\n\t\tconst selectedFilters = $(currentTarget).find('[data-filter-trigger]:checked').toArray().reduce((acc, input) => {\r\n\t\t\tconst value = $(input).attr('value');\r\n\t\t\tconst name = $(input).attr('name');\r\n\t\t\tconst filterName = $(input).attr('data-analytics-trigger-filter-name');\r\n\t\t\tconst query = `${value}:${name}:${filterName}`;\r\n\t\t\treturn name ? [...acc, query] : acc;\r\n\t\t}, []).join(',');\r\n\r\n\t\tconst options = $(currentTarget).serializeArray().reduce((acc, cur) => {\r\n\t\t\tacc[cur.name] = cur.value;\r\n\t\t\treturn acc;\r\n\t\t}, {});\r\n\r\n\t\t// Update by form change\r\n\t\tthis.sort = options.Sort || this.sort;\r\n\t\tthis.pageSize = options.PageSize || this.pageSize;\r\n\t\tthis.currentFilterGroup = options.CurrentFilterGroup || this.currentFilterGroup;\r\n\t\tthis.searchQuery = options.q || this.searchQuery;\r\n\t\tthis.selectedFilters = selectedFilters;\r\n\t}\r\n\r\n\tsetSearchPageTabs() {\r\n\t\tconst productsTotalSelector =\r\n\t\t\t\"data-product-listing-page-products-total\";\r\n\t\tconst blogTotalSelector = \"data-product-listing-page-blog-total\";\r\n\t\tconst pagesDocsTotalSelector =\r\n\t\t\t\"data-product-listing-page-pages-documents-total\";\r\n\t\tconst blogUrlSelector = \"data-product-listing-page-blog-url\";\r\n\t\tconst pagesDocsUrlSelector =\r\n\t\t\t\"data-product-listing-page-pages-documents-url\";\r\n\t\tthis.productsTotal = $(this.wideResults)\r\n\t\t\t.find(\"[\" + productsTotalSelector + \"]\")\r\n\t\t\t.attr(productsTotalSelector);\r\n\t\tthis.blogTotal = $(this.wideResults)\r\n\t\t\t.find(\"[\" + blogTotalSelector + \"]\")\r\n\t\t\t.attr(blogTotalSelector);\r\n\t\tthis.pagesDocsTotal = $(this.wideResults)\r\n\t\t\t.find(\"[\" + pagesDocsTotalSelector + \"]\")\r\n\t\t\t.attr(pagesDocsTotalSelector);\r\n\t\tthis.blogUrl = $(this.wideResults)\r\n\t\t\t.find(\"[\" + blogUrlSelector + \"]\")\r\n\t\t\t.attr(blogUrlSelector);\r\n\t\tthis.pagesDocsUrl = $(this.wideResults)\r\n\t\t\t.find(\"[\" + pagesDocsUrlSelector + \"]\")\r\n\t\t\t.attr(pagesDocsUrlSelector);\r\n\r\n\t\tif (this.isSearchPage && this.productsTotal == 0) {\r\n\t\t\tif (this.blogTotal > 0 && this.blogUrl.length > 0) {\r\n\t\t\t\twindow.location.href = this.blogUrl;\r\n\t\t\t} else if (\r\n\t\t\t\tthis.pagesDocsTotal > 0 &&\r\n\t\t\t\tthis.pagesDocsUrl.length > 0\r\n\t\t\t) {\r\n\t\t\t\twindow.location.href = this.pagesDocsUrl;\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar tabCount = \".search-results__facet-tab-count\";\r\n\t\tconst tabSpan = \".tabs-title__label\";\r\n\t\tvar mod = this;\r\n\t\t$(\"[data-search-facet]\").each(function () {\r\n\t\t\tvar facet = $(this).attr(\"data-search-facet\");\r\n\t\t\tswitch (facet) {\r\n\t\t\t\tcase \"product\":\r\n\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t.find(tabCount)\r\n\t\t\t\t\t\t.text(\"(\" + mod.productsTotal + \")\");\r\n\t\t\t\t\tif (mod.productsTotal > 0) {\r\n\t\t\t\t\t\t$(this).find(tabSpan).hide();\r\n\t\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t\t.find(\"a\")\r\n\t\t\t\t\t\t\t.removeAttr(\"hidden\")\r\n\t\t\t\t\t\t\t.css(\"display\", \"block\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t\t.find(tabSpan)\r\n\t\t\t\t\t\t\t.removeAttr(\"hidden\")\r\n\t\t\t\t\t\t\t.css(\"display\", \"block\");\r\n\t\t\t\t\t\t$(this).find(\"a\").hide();\r\n\t\t\t\t\t\t$(this).removeClass(\"is-active\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"blog\":\r\n\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t.find(tabCount)\r\n\t\t\t\t\t\t.text(\"(\" + mod.blogTotal + \")\");\r\n\t\t\t\t\tif (mod.blogTotal > 0) {\r\n\t\t\t\t\t\t$(this).find(tabSpan).hide();\r\n\t\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t\t.find(\"a\")\r\n\t\t\t\t\t\t\t.removeAttr(\"hidden\")\r\n\t\t\t\t\t\t\t.css(\"display\", \"block\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t\t.find(tabSpan)\r\n\t\t\t\t\t\t\t.removeAttr(\"hidden\")\r\n\t\t\t\t\t\t\t.css(\"display\", \"block\");\r\n\t\t\t\t\t\t$(this).find(\"a\").hide();\r\n\t\t\t\t\t\t$(this).removeClass(\"is-active\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"pages-documents\":\r\n\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t.find(tabCount)\r\n\t\t\t\t\t\t.text(\"(\" + mod.pagesDocsTotal + \")\");\r\n\t\t\t\t\tif (mod.pagesDocsTotal > 0) {\r\n\t\t\t\t\t\t$(this).find(tabSpan).hide();\r\n\t\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t\t.find(\"a\")\r\n\t\t\t\t\t\t\t.show()\r\n\t\t\t\t\t\t\t.removeAttr(\"hidden\")\r\n\t\t\t\t\t\t\t.css(\"display\", \"block\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t\t.find(tabSpan)\r\n\t\t\t\t\t\t\t.removeAttr(\"hidden\")\r\n\t\t\t\t\t\t\t.css(\"display\", \"block\");\r\n\t\t\t\t\t\t$(this).find(\"a\").hide();\r\n\t\t\t\t\t\t$(this).removeClass(\"is-active\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tloadFilters() {\r\n\t\tvar url =\r\n\t\t\tthis.options.endpointFilters +\r\n\t\t\t\"&pageNumber=\" +\r\n\t\t\tthis.pageNumber +\r\n\t\t\t\"&sort=\" +\r\n\t\t\tthis.sort +\r\n\t\t\t\"&pageSize=\" +\r\n\t\t\tthis.pageSize +\r\n\t\t\t\"&searchQuery=\" +\r\n\t\t\tthis.searchQuery +\r\n\t\t\t\"¤tFilterGroup=\" +\r\n\t\t\tthis.currentFilterGroup +\r\n\t\t\t\"&selectedFilters=\" +\r\n\t\t\tthis.selectedFilters +\r\n\t\t\t\"&startPageId=\" +\r\n\t\t\tthis.startPageId +\r\n\t\t\t\"&language=\" +\r\n\t\t\tthis.language +\r\n\t\t\t\"&pageUrl=\" +\r\n\t\t\tthis.pageUrl +\r\n\t\t\t\"&resetUrl=\" +\r\n\t\t\tthis.resetUrl +\r\n\t\t\t\"&isSearchPage=\" +\r\n\t\t\tthis.isSearchPage;\r\n\t\treturn fetch(url)\r\n\t\t\t.then((response) => {\r\n\t\t\t\tif (response.ok) {\r\n\t\t\t\t\treturn response.text();\r\n\t\t\t\t}\r\n\t\t\t\treturn Promise.reject(response);\r\n\t\t\t})\r\n\t\t\t.then((html) => {\r\n\t\t\t\tconst parser = new DOMParser();\r\n\r\n\t\t\t\tconst staleCart = this.wideFilters.querySelector(\"*\");\r\n\t\t\t\tstaleCart && staleCart.remove();\r\n\r\n\t\t\t\tconst staleCart2 = this.narrowFilters.querySelector(\"*\");\r\n\t\t\t\tstaleCart2 && staleCart2.remove();\r\n\r\n\t\t\t\tconst freshCart = parser.parseFromString(html, \"text/html\");\r\n\t\t\t\tconst freshCart2 = parser.parseFromString(html, \"text/html\");\r\n\t\t\t\tconst freshCart3 = parser.parseFromString(html, \"text/html\");\r\n\t\t\t\tthis.wideFilters.append(\r\n\t\t\t\t\tfreshCart.body.querySelector(\r\n\t\t\t\t\t\t\"[data-product-listing-page-filter-wide-results-container]\"\r\n\t\t\t\t\t)\r\n\t\t\t\t);\r\n\t\t\t\tthis.narrowFilters.append(\r\n\t\t\t\t\tfreshCart2.body.querySelector(\r\n\t\t\t\t\t\t\"[data-product-listing-page-filter-narrow-results-container]\"\r\n\t\t\t\t\t)\r\n\t\t\t\t);\r\n\t\t\t\tthis.narrowFilters.hidden = false;\r\n\t\t\t\tvar index = freshCart3.body.querySelector(\r\n\t\t\t\t\t\".filter-panel-wide__header\"\r\n\t\t\t\t);\r\n\t\t\t\tif (index == null) {\r\n\t\t\t\t\tvar parent = $(this.wideFilters).parent();\r\n\t\t\t\t\t$(parent).hide();\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\t.catch(() => {\r\n\t\t\t\t// If invalid disable the proceed button\r\n\t\t\t\tlog(\"error\");\r\n\t\t\t});\r\n\t}\r\n\r\n\tupdateLoadingDisplay(isLoading) {\r\n\t\tthis.ajaxLoading.forEach((indicator) => {\r\n\t\t\tindicator.hidden = !isLoading;\r\n\t\t\t!isLoading && indicator.classList.add('not-first-load');\r\n\t\t});\r\n\t}\r\n\r\n\tupdateLoadingFiltersDisplay(isLoading) {\r\n\t\tthis.ajaxLoadingFilters.forEach((indicator) => {\r\n\t\t\tindicator.hidden = !isLoading;\r\n\t\t});\r\n\t}\r\n\r\n\tloadSearchResults() {\r\n\t\tconst url =\r\n\t\t\tthis.options.endpoint +\r\n\t\t\t\"&pageNumber=\" +\r\n\t\t\tthis.pageNumber +\r\n\t\t\t\"&sort=\" +\r\n\t\t\tthis.sort +\r\n\t\t\t\"&pageSize=\" +\r\n\t\t\tthis.pageSize +\r\n\t\t\t\"&searchQuery=\" +\r\n\t\t\tthis.searchQuery +\r\n\t\t\t\"¤tFilterGroup=\" +\r\n\t\t\tthis.currentFilterGroup +\r\n\t\t\t\"&selectedFilters=\" +\r\n\t\t\tthis.selectedFilters +\r\n\t\t\t\"&startPageId=\" +\r\n\t\t\tthis.startPageId +\r\n\t\t\t\"&language=\" +\r\n\t\t\tthis.language +\r\n\t\t\t\"&pageUrl=\" +\r\n\t\t\tthis.pageUrl +\r\n\t\t\t\"&resetUrl=\" +\r\n\t\t\tthis.resetUrl +\r\n\t\t\t\"&isSearchPage=\" +\r\n\t\t\tthis.isSearchPage;\r\n\t\treturn fetch(url)\r\n\t\t\t.then((response) => {\r\n\t\t\t\tif (response.ok) {\r\n\t\t\t\t\treturn response.text();\r\n\t\t\t\t}\r\n\t\t\t\treturn Promise.reject(response);\r\n\t\t\t})\r\n\t\t\t.then((htmlText) => {\r\n\t\t\t\tconst parser = new DOMParser();\r\n\t\t\t\treturn parser.parseFromString(htmlText, \"text/html\");\r\n\t\t\t})\r\n\t\t\t.then(this.updateSearchResults.bind(this))\r\n\t\t\t.catch(() => {\r\n\t\t\t\t// If invalid disable the proceed button\r\n\t\t\t\tlog(\"error\");\r\n\t\t\t});\r\n\t}\r\n\r\n\tupdateSearchResults(resultsDocument) {\r\n\t\tconst wideResultsHtml = resultsDocument.body.querySelector(this.options.wideResults);\r\n\t\tconst narrowResultsHtml = resultsDocument.body.querySelector(this.options.narrowResults);\r\n\r\n\t\tconst staleWideResults = this.wideResults.querySelector(\"*\");\r\n\t\tstaleWideResults && staleWideResults.remove();\r\n\r\n\t\tconst staleNarrowResults = this.narrowResults.querySelector(\"*\");\r\n\t\tstaleNarrowResults && staleNarrowResults.remove();\r\n\r\n\t\tthis.wideResults.append(wideResultsHtml);\r\n\t\tthis.narrowResults.append(narrowResultsHtml);\r\n\t\tthis.setSearchPageTabs();\r\n\t}\r\n\r\n\ttrackingPLP() {\r\n\t\tconst PLPtrackings = $(this.element).find('[ga-tracking-plp]');\r\n\t\tArray.from(PLPtrackings).forEach((el) => {\r\n\t\t\tconst $el = $(el);\r\n\t\t\tconst viewport = $el.data('viewport');\r\n\t\t\tif (isMobile && viewport === 'mobile' || !isMobile && viewport === 'desktop') {\r\n\t\t\t\tGAServices.viewItemTracking(el);\r\n\t\t\t\t$el.find('[ga-tracking-link]').each((index, el) => {\r\n\t\t\t\t\tGAServices.selectItem(el, false);\r\n\t\t\t\t});\r\n\t\t\t\t$(window).on('scroll', function() {\r\n\t\t\t\t\tGAServices.viewItemTracking(el);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t}\r\n}\r\n\r\nProductListingPage.DEFAULTS = {};\r\n\r\nexport default ProductListingPage;\r\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/core/components/product-listing-page/product-listing-page.js"],"sourceRoot":""}