{"version":3,"sources":["webpack:///./src/project/app/client-pages/CategoryPage.vue?2832","webpack:///./src/project/app/client-pages/CategoryPage.vue","webpack:///./src/project/app/client-pages/CategoryPage.vue?77de","webpack:///./src/project/app/client-pages/CategoryPage.vue?49e6"],"names":["render","_vm","this","_h","$createElement","_c","_self","attrs","categoryId","pageDataUrl","handlePageDataCallback","handleSearchResultCallback","handleCategoryResultCallback","hideLeftMenu","scopedSlots","_u","key","fn","ref","activeMenuItem","rootMenuItem","menuItems","staticRenderFns","CategoryNavigation","SearchProductControl","previousCategoryId","isFirstRequest","delayLoaderTimer","searchResult","seoInformation","seoCategoryName","seoBreadcrumb","settings","departmentPage","pageUrl","pageData","navigation","activeCategory","getCategoryById","page","getPage","url","includes","pageKey","location","getLocationForPage","query","paramString","Object","entries","map","val","join","setCanonicalUrl","window","servercontext","culture","setOpenGraphUrl","expectedCategoryUrl","siteInfo","setPrerenderRedirectUrlsIfLocationIsWrong","delay","uaIsPrerender","uaIsBot","setTimeout","loadMetadataForPage","category","categoryData","getCategorySeoInformation","then","result","updatePageTitleAndDescription","getBreadCrumbForCategory","categoryValues","cat","catIndex","name","length","selectedMenu","displayLabel","totalHits","seofyNumbers","totalResults","undefined","toString","labelValues","brand","brandName","results","titleLabelKey","title","get","titleFromPage","seoTitle","titleWithParams","getWithNamedValues","setTitle","descriptionLabelKey","description","descriptionFromPage","seoDescription","descriptionWithParams","setDescription","to","from","isSearching","$route","trackGenericPageView","clearTimeout","String","immediate","components","CategoryTileBlock","component"],"mappings":"yHAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,uBAAuB,CAACE,MAAM,CAAC,cAAcN,EAAIO,WAAW,gBAAgBP,EAAIQ,YAAY,4BAA4BR,EAAIS,uBAAuB,yBAAyBT,EAAIU,2BAA2B,2BAA2BV,EAAIW,6BAA6B,iBAAiBX,EAAIY,aAAa,cA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d,EACAjH,EACAsB,GACA,EACA,KACA,KACA,MAIa,aAAA2F,E","file":"js/chunk-2d0ab1a4.7b18f034.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('SearchProductControl',{attrs:{\"category-id\":_vm.categoryId,\"page-data-url\":_vm.pageDataUrl,\"page-data-result-callback\":_vm.handlePageDataCallback,\"search-result-callback\":_vm.handleSearchResultCallback,\"category-result-callback\":_vm.handleCategoryResultCallback,\"hide-left-menu\":_vm.hideLeftMenu,\"context-key\":\"category\",\"with-results-breadcrumb\":\"\"},scopedSlots:_vm._u([{key:\"navigation\",fn:function(ref){\nvar activeMenuItem = ref.activeMenuItem;\nvar rootMenuItem = ref.rootMenuItem;\nvar menuItems = ref.menuItems;\nreturn [_c('CategoryNavigation',{attrs:{\"active-menu-item\":activeMenuItem,\"root-menu-item\":rootMenuItem,\"menu-items\":menuItems}})]}}])})}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\r\nimport { Component, Prop, Vue, Watch } from 'vue-property-decorator';\r\nimport gtmService from '@/project/tracking/gtm/GTM.service';\r\nimport { Route } from 'vue-router';\r\nimport megaMenuService from '@/project/shared/megaMenu.service';\r\nimport dictionaryService, { NamedLabelArgument } from '@/core/translation/dictionary.service';\r\nimport domService from '@/core/dom/dom.service';\r\nimport { upperFirst } from 'lodash';\r\nimport { PageData } from '@/types/contentServerContract';\r\nimport CategoryTileBlock from '@/project/app/blocks/categories/CategoryTileBlock.vue';\r\nimport botService from '@/project/site/bot.service';\r\nimport {\r\n CategorySeoInformationViewModel,\r\n CategoryTreeViewModel,\r\n MenuItem,\r\n SearchViewModel\r\n} from '@/types/apiServerContract';\r\nimport Api from '@/project/http/Api.service';\r\nimport urlHelper from '@/core/urlHelper.service';\r\nimport { UrlQueryKey } from '@/core/urlQueryKey';\r\nimport serverContextService from '@/core/serverContext.service';\r\nconst CategoryNavigation = () => import('@/project/search/navigation/CategoryNavigation.vue');\r\nconst SearchProductControl = () => import('@/project/search/SearchProductControl.vue');\r\n\r\n@Component({\r\n components: { CategoryTileBlock, SearchProductControl, CategoryNavigation }\r\n})\r\nexport default class CategoryPage extends Vue {\r\n @Prop(String)\r\n categoryId!: string;\r\n\r\n previousCategoryId: string = '';\r\n isFirstRequest: boolean = true;\r\n delayLoaderTimer: number = 0;\r\n\r\n searchResult: SearchViewModel | null = null;\r\n seoInformation: CategorySeoInformationViewModel | null = null;\r\n seoCategoryName: null | string = null;\r\n seoBreadcrumb: MenuItem[] = [];\r\n hideLeftMenu: boolean = false;\r\n categoryData?: CategoryTreeViewModel;\r\n\r\n get pageDataUrl() {\r\n if (serverContextService.settings?.departmentPage) {\r\n const pageUrl = `${serverContextService.settings?.departmentPage}?categoryId=${this.categoryId}`;\r\n return pageUrl;\r\n }\r\n }\r\n\r\n async handlePageDataCallback(pageData?: PageData) {\r\n this.hideLeftMenu = pageData?.navigation?.hideLeftMenu ?? false;\r\n const activeCategory = this.categoryId ? await megaMenuService.getCategoryById(this.categoryId) : null;\r\n\r\n const page = urlHelper.getPage();\r\n if (activeCategory?.url && page > 1 && !activeCategory?.url.includes(`${UrlQueryKey.pageKey}=`)) {\r\n const location = urlHelper.getLocationForPage(page) as any;\r\n const query = location.query || {};\r\n const paramString = Object.entries(query).map(([key, val]) => `${key}=${val}`).join('&');\r\n activeCategory.url = `${activeCategory.url}${(activeCategory.url.includes('?') ? '&' : '?')}${paramString}`;\r\n }\r\n\r\n domService.setCanonicalUrl(window.servercontext.culture + activeCategory?.url ?? '', true);\r\n domService.setOpenGraphUrl(window.servercontext.culture + activeCategory?.url ?? '', true);\r\n const expectedCategoryUrl = activeCategory?.url ? `${serverContextService.siteInfo.url}${activeCategory.url}` : null;\r\n botService.setPrerenderRedirectUrlsIfLocationIsWrong(expectedCategoryUrl);\r\n }\r\n\r\n async handleSearchResultCallback(searchResult: SearchViewModel) {\r\n const delay = (botService.uaIsPrerender() || botService.uaIsBot()) ? 0 : this.isFirstRequest ? 1500 : 750;\r\n this.isFirstRequest = false;\r\n this.searchResult = searchResult;\r\n this.delayLoaderTimer = setTimeout(() => {\r\n this.loadMetadataForPage();\r\n }, delay);\r\n }\r\n\r\n async handleCategoryResultCallback(category: CategoryTreeViewModel) {\r\n this.categoryData = category;\r\n }\r\n\r\n async loadMetadataForPage() {\r\n if (this.categoryId !== this.previousCategoryId) {\r\n Api.category.getCategorySeoInformation(this.categoryId).then(result => {\r\n this.seoInformation = result;\r\n this.updatePageTitleAndDescription();\r\n });\r\n megaMenuService.getBreadCrumbForCategory(this.categoryId).then(result => {\r\n this.seoBreadcrumb = result || [];\r\n this.updatePageTitleAndDescription();\r\n });\r\n this.previousCategoryId = this.categoryId;\r\n }\r\n }\r\n\r\n updatePageTitleAndDescription() {\r\n const categoryValues = {};\r\n this.seoBreadcrumb.map((cat, catIndex) => {\r\n categoryValues[`categoryLevel${catIndex + 1}`] = cat.name;\r\n });\r\n const activeCategory = this.categoryId && this.seoBreadcrumb.length > 0 ? this.seoBreadcrumb[this.seoBreadcrumb.length - 1] : null;\r\n this.seoCategoryName = upperFirst(activeCategory?.name ?? (this.categoryData?.selectedMenu?.name || this.categoryData?.selectedMenu?.displayLabel || ''));\r\n\r\n const totalHits = dictionaryService.seofyNumbers(this.searchResult?.totalHits);\r\n const totalResults = totalHits !== undefined ? totalHits.toString(10) : undefined;\r\n const labelValues: NamedLabelArgument = {\r\n brand: this.searchResult?.brandName || undefined,\r\n totalResults: totalResults,\r\n results: totalResults,\r\n category: this.seoCategoryName,\r\n ...categoryValues\r\n };\r\n\r\n const titleLabelKey = 'Category.SEO.Title';\r\n const title = dictionaryService.get(titleLabelKey, [this.seoCategoryName]);\r\n const titleFromPage = this.seoInformation?.seoTitle;\r\n const titleWithParams = dictionaryService.getWithNamedValues(titleFromPage || titleLabelKey, labelValues, true, !!titleFromPage);\r\n domService.setTitle(titleWithParams || title);\r\n\r\n const descriptionLabelKey = 'Category.SEO.Description';\r\n const description = dictionaryService.get(descriptionLabelKey, [this.seoCategoryName]);\r\n const descriptionFromPage = this.seoInformation?.seoDescription;\r\n const descriptionWithParams = dictionaryService.getWithNamedValues(descriptionFromPage || descriptionLabelKey, labelValues, true, !!descriptionFromPage);\r\n domService.setDescription(descriptionWithParams || description);\r\n }\r\n\r\n @Watch('$route', {\r\n immediate: true\r\n })\r\n onRouteChange(to: Route, from?: Route) {\r\n const isSearching = urlHelper.isSearching(to) || urlHelper.isSearching(from);\r\n if (isSearching) return;\r\n\r\n if (this.$route.name) {\r\n gtmService.trackGenericPageView(this.$route.name);\r\n }\r\n }\r\n\r\n destroyed() {\r\n if (this.delayLoaderTimer) {\r\n clearTimeout(this.delayLoaderTimer);\r\n }\r\n }\r\n}\r\n","import mod from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/ts-loader/index.js??ref--15-3!../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CategoryPage.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/ts-loader/index.js??ref--15-3!../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CategoryPage.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./CategoryPage.vue?vue&type=template&id=36116d53&\"\nimport script from \"./CategoryPage.vue?vue&type=script&lang=ts&\"\nexport * from \"./CategoryPage.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}