@postnord/pn-marketweb-components 1.0.32 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/FetchHelper-f80943bf.js +87 -0
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-mainnav-link.cjs.entry.js +1 -1
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +15 -2
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +51 -18
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js +33 -2
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.stories.js +3 -3
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +74 -21
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +7 -1
- package/collection/components/navigation/pn-mainnav/pn-mainnav-link.js +1 -1
- package/collection/globals/FetchHelper.js +84 -0
- package/custom-elements/index.js +151 -23
- package/esm/FetchHelper-a0c8aa54.js +85 -0
- package/esm/loader.js +1 -1
- package/esm/pn-mainnav-link.entry.js +1 -1
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-marketweb-sitefooter.entry.js +15 -2
- package/esm/pn-marketweb-siteheader.entry.js +51 -18
- package/esm-es5/FetchHelper-a0c8aa54.js +1 -0
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-mainnav-link.entry.js +1 -1
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/p-25bdf3f8.system.js +1 -1
- package/pn-market-web-components/p-4921fcc3.entry.js +1 -0
- package/pn-market-web-components/p-4f1a53f4.entry.js +1 -0
- package/pn-market-web-components/p-6d718a66.system.entry.js +1 -0
- package/pn-market-web-components/p-97dc5687.js +1 -0
- package/pn-market-web-components/p-d6a17042.system.js +1 -0
- package/pn-market-web-components/p-daa6ddb3.system.entry.js +1 -0
- package/pn-market-web-components/p-dc471243.entry.js +1 -0
- package/pn-market-web-components/{p-251d44f2.system.entry.js → p-e3fb52a6.system.entry.js} +1 -1
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.d.ts +5 -0
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.d.ts +8 -0
- package/types/components.d.ts +16 -0
- package/types/globals/FetchHelper.d.ts +17 -0
- package/pn-market-web-components/p-031d91aa.entry.js +0 -1
- package/pn-market-web-components/p-134f14eb.system.entry.js +0 -1
- package/pn-market-web-components/p-78560f7a.system.entry.js +0 -1
- package/pn-market-web-components/p-e220ea83.entry.js +0 -1
- package/pn-market-web-components/p-e39aaa0c.entry.js +0 -1
package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, Prop, h, State, Element, Listen, Watch, Host, Event } from "@stencil/core";
|
|
2
2
|
import { translations } from "./translations";
|
|
3
3
|
import { MarketWebContextService } from "../../../globals/MarketWebContextService";
|
|
4
|
+
import { FetchHelper } from "../../../globals/FetchHelper";
|
|
4
5
|
export class PnMarketwebSiteheader {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.endpointPath = "/api/navigation/header";
|
|
@@ -24,10 +25,13 @@ export class PnMarketwebSiteheader {
|
|
|
24
25
|
this.hideLogin = false;
|
|
25
26
|
/** Forward session to backend */
|
|
26
27
|
this.sessionForward = false;
|
|
28
|
+
/** If the component should use cached requests */
|
|
29
|
+
this.cache = false;
|
|
27
30
|
/** Event based only language switch */
|
|
28
31
|
this.spaMode = false;
|
|
29
32
|
this.gotData = false;
|
|
30
33
|
this.fetchingData = false;
|
|
34
|
+
this.homePageLink = "";
|
|
31
35
|
// Menu state
|
|
32
36
|
this.menuItems = [];
|
|
33
37
|
// Search
|
|
@@ -36,9 +40,12 @@ export class PnMarketwebSiteheader {
|
|
|
36
40
|
this.siteSelector = null;
|
|
37
41
|
// Language Selector
|
|
38
42
|
this.languageSelector = null;
|
|
43
|
+
this.languageOptions = [];
|
|
39
44
|
// Login dialog
|
|
40
45
|
this.loginDialog = null;
|
|
41
46
|
this.minimizeSearch = false;
|
|
47
|
+
// FetchHelper
|
|
48
|
+
this.fetchHelper = new FetchHelper("siteheader");
|
|
42
49
|
}
|
|
43
50
|
componentWillLoad() {
|
|
44
51
|
this.setInitialValues().then(() => {
|
|
@@ -96,12 +103,14 @@ export class PnMarketwebSiteheader {
|
|
|
96
103
|
this.fetchingData = true;
|
|
97
104
|
const endpointBase = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
|
|
98
105
|
const fetchUrl = `${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}`;
|
|
99
|
-
const
|
|
106
|
+
const data = await this.fetchHelper.fetchJson(fetchUrl, {
|
|
100
107
|
'mode': 'cors'
|
|
101
|
-
});
|
|
102
|
-
const data = await response.json();
|
|
108
|
+
}, this.cache, this.onFetchRefreshed.bind(this));
|
|
103
109
|
await this.setStateFromData(data);
|
|
104
110
|
}
|
|
111
|
+
onFetchRefreshed(data) {
|
|
112
|
+
this.setStateFromData(data);
|
|
113
|
+
}
|
|
105
114
|
getLanguageVersionUrl(item) {
|
|
106
115
|
if (this.spaMode) {
|
|
107
116
|
return null;
|
|
@@ -115,6 +124,7 @@ export class PnMarketwebSiteheader {
|
|
|
115
124
|
return siteUrl + ((siteUrl.lastIndexOf("/") !== siteUrl.length - 1) ? "/" : "") + item.twoLetterISOLanguageName;
|
|
116
125
|
}
|
|
117
126
|
async setStateFromData(data) {
|
|
127
|
+
var _a, _b, _c;
|
|
118
128
|
if (typeof data !== "object") {
|
|
119
129
|
console.warn('Data was not valid', data);
|
|
120
130
|
}
|
|
@@ -123,26 +133,49 @@ export class PnMarketwebSiteheader {
|
|
|
123
133
|
// Set navigation information
|
|
124
134
|
this.menuItems = data.mainMenu.menuItems;
|
|
125
135
|
// Create the "Home" link
|
|
126
|
-
this.menuItems.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
if (!this.menuItems[0] || ((_a = this.menuItems[0]) === null || _a === void 0 ? void 0 : _a.name) !== this.i18n.menuHomeButton) {
|
|
137
|
+
this.menuItems.unshift({
|
|
138
|
+
href: this.siteDefinition.url,
|
|
139
|
+
name: this.i18n.menuHomeButton,
|
|
140
|
+
id: 'homelink',
|
|
141
|
+
open: false,
|
|
142
|
+
selected: false,
|
|
143
|
+
children: []
|
|
144
|
+
});
|
|
145
|
+
}
|
|
134
146
|
// Set search
|
|
135
147
|
this.search = data.search;
|
|
136
148
|
// Set site selector
|
|
137
149
|
this.siteSelector = data.siteSelectorViewModel;
|
|
138
150
|
// Set language selector
|
|
139
151
|
this.languageSelector = data.languageSelectorViewModel;
|
|
152
|
+
this.setLanguageOptions();
|
|
140
153
|
this.loginDialog = data.loginViewModel;
|
|
141
154
|
await this.spaModeAdjustments();
|
|
142
155
|
this.gotData = true;
|
|
143
156
|
this.fetchingData = true;
|
|
157
|
+
this.homePageLink = (_c = (_b = this.siteDefinition) === null || _b === void 0 ? void 0 : _b.url) !== null && _c !== void 0 ? _c : document.location.hostname;
|
|
144
158
|
window.setTimeout(() => { this.checkMenuOverflow(); }, 100);
|
|
145
159
|
}
|
|
160
|
+
setLanguageOptions() {
|
|
161
|
+
var _a;
|
|
162
|
+
if (!this.languageSelector || !this.languageSelector.languages) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const hrefLangsTags = (_a = Array.prototype.slice.call(document.querySelectorAll('link[rel="alternate"][hreflang]'))) !== null && _a !== void 0 ? _a : [];
|
|
166
|
+
const hrefLangs = hrefLangsTags.map((tag) => { return tag.getAttribute("hreflang"); });
|
|
167
|
+
this.languageSelector.languages.map((languageOption) => {
|
|
168
|
+
// In case there are language links present on the page we only show languages that have those tags
|
|
169
|
+
if (hrefLangs && hrefLangs.length > 0) {
|
|
170
|
+
if (hrefLangs.includes(languageOption.twoLetterISOLanguageName)) {
|
|
171
|
+
this.languageOptions.push(languageOption);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
this.languageOptions.push(languageOption);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
146
179
|
async spaModeAdjustments() {
|
|
147
180
|
if (!this.spaMode) {
|
|
148
181
|
return;
|
|
@@ -187,7 +220,7 @@ export class PnMarketwebSiteheader {
|
|
|
187
220
|
}
|
|
188
221
|
}
|
|
189
222
|
render() {
|
|
190
|
-
var _a, _b, _c, _d, _e, _f
|
|
223
|
+
var _a, _b, _c, _d, _e, _f;
|
|
191
224
|
return (h(Host, { language: this.language, market: this.market, environment: this.environment },
|
|
192
225
|
h("header", null,
|
|
193
226
|
h("div", { class: "siteheader-row" },
|
|
@@ -196,17 +229,17 @@ export class PnMarketwebSiteheader {
|
|
|
196
229
|
!this.hideSiteSelector &&
|
|
197
230
|
h("pn-site-selector", { language: this.language, buttontext: (_b = (_a = this.siteSelector) === null || _a === void 0 ? void 0 : _a.currentSiteTitle) !== null && _b !== void 0 ? _b : 'postnord' },
|
|
198
231
|
(this.gotData && ((_c = this.siteSelector) === null || _c === void 0 ? void 0 : _c.currentSiteTitle)) &&
|
|
199
|
-
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }),
|
|
200
|
-
(this.gotData && ((_d = this.siteSelector) === null || _d === void 0 ? void 0 : _d.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.href, newwindow: site.openInNewWindow })))),
|
|
232
|
+
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle + ' ', description: this.siteSelector.currentSiteDescription }),
|
|
233
|
+
(this.gotData && ((_d = this.siteSelector) === null || _d === void 0 ? void 0 : _d.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText + ' ', description: site.linkDescription, url: site.href, newwindow: site.openInNewWindow })))),
|
|
201
234
|
h("div", { class: "siteheader-logocontainer" },
|
|
202
|
-
h("a", { href:
|
|
235
|
+
h("a", { href: this.homePageLink, title: "Home", class: "siteheader-logolink" },
|
|
203
236
|
h("svg", { class: "siteheader-logo", xmlns: "http://www.w3.org/2000/svg", width: "12.7rem", height: "2.4rem", viewBox: "0 0 141.73 26.65" },
|
|
204
237
|
h("path", { d: "M108.84,13.35c0,6.34-5.17,9-10,9S89,19.76,89,13.63c0-6.28,5.08-9,10-9S108.84,7.25,108.84,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.29,3.29,0,0,0,3.42,3.41A3.24,3.24,0,0,0,102.28,13.54Zm-83,0c0,4.83-3.32,8.82-8.49,8.82a6.54,6.54,0,0,1-4.65-1.57v5.86H0V5.16H6.17V6.8a6.43,6.43,0,0,1,5.11-2.18C16.41,4.62,19.31,8.58,19.31,13.54Zm-6.53,0A3.27,3.27,0,0,0,9.4,10,3.28,3.28,0,0,0,6,13.54,3.29,3.29,0,0,0,9.4,16.95,3.24,3.24,0,0,0,12.78,13.54Zm103.69,0.27c0-2.54,1.54-3.32,3.6-3.32a6.56,6.56,0,0,1,2.08.3L122.3,5.1a3.92,3.92,0,0,0-1.45-.18c-3.45,0-4.38,2.18-4.38,2.18V5.16H110.3V21.84h6.17v-8ZM141.73,0V21.84h-6.16V20.21a6.43,6.43,0,0,1-5.11,2.18c-5.14,0-8-4-8-8.91s3.32-8.82,8.49-8.82a6.54,6.54,0,0,1,4.65,1.57v-5Zm-6,13.48a3.28,3.28,0,0,0-3.41-3.41A3.24,3.24,0,0,0,129,13.47,3.4,3.4,0,1,0,135.75,13.47ZM81.35,4.62c-3.6,0-4.9,2.18-4.9,2.18V5.16H70.29V21.84h6.16V13.29c0-2.11.79-3.08,2.69-3.08s2.18,1.57,2.18,3.57v8.07h6.22V11.6C87.55,7,85.34,4.62,81.35,4.62ZM64.07,1.42H57.9V21.84h6.16V10.36H67l2.81-5.2H64.07V1.42ZM50.26,11.21c-2-.3-2.87-0.3-2.87-1.09s0.81-.94,2.42-0.94a16.15,16.15,0,0,1,5.11.91L56,5.41a24.56,24.56,0,0,0-6.13-.75c-5.89,0-9,2.27-9,5.89,0,2.81,1.66,4.47,6.53,5.11,2.06,0.27,2.81.39,2.81,1.15s-0.82,1-2.24,1a16.67,16.67,0,0,1-6-1.3L40.77,21.3a22.14,22.14,0,0,0,6.68,1c6.35,0,9.28-2.24,9.28-5.89C56.72,13.54,55.15,12,50.26,11.21ZM40.19,13.35c0,6.34-5.17,9-10,9s-9.82-2.6-9.82-8.73c0-6.28,5.08-9,10-9S40.19,7.25,40.19,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.28,3.28,0,0,0,3.41,3.41A3.24,3.24,0,0,0,33.63,13.54Z", fill: "#00A0D6", transform: "translate(0 0)" })))),
|
|
205
238
|
h("div", { class: "siteheader-topright" },
|
|
206
239
|
h("slot", { name: "toprightstart" }),
|
|
207
240
|
(this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })),
|
|
208
|
-
(this.gotData &&
|
|
209
|
-
h("pn-language-selector", { value: this.language }, this.
|
|
241
|
+
(this.gotData && this.languageOptions && this.languageOptions.length) && !this.hideLanguageSelector &&
|
|
242
|
+
h("pn-language-selector", { value: this.language }, this.languageOptions.map(language => h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))),
|
|
210
243
|
h("slot", { name: "toprightend" }))),
|
|
211
244
|
h("div", { class: "siteheader-row" },
|
|
212
245
|
h("div", { class: "siteheader-menu" },
|
|
@@ -228,13 +261,13 @@ export class PnMarketwebSiteheader {
|
|
|
228
261
|
})),
|
|
229
262
|
h("div", { slot: "footer", class: "siteheader-menu-footer" },
|
|
230
263
|
(this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { emitEvents: false, loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })),
|
|
231
|
-
(this.gotData &&
|
|
232
|
-
h("pn-language-selector", { value: this.language }, this.
|
|
264
|
+
(this.gotData && this.languageOptions && this.languageOptions.length) && !this.hideLanguageSelector &&
|
|
265
|
+
h("pn-language-selector", { value: this.language }, this.languageOptions.map(language => h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))),
|
|
233
266
|
!this.hideSiteSelector &&
|
|
234
267
|
h("pn-site-selector", { language: this.language },
|
|
235
|
-
(this.gotData && ((
|
|
268
|
+
(this.gotData && ((_e = this.siteSelector) === null || _e === void 0 ? void 0 : _e.currentSiteTitle)) &&
|
|
236
269
|
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }),
|
|
237
|
-
(this.gotData && ((
|
|
270
|
+
(this.gotData && ((_f = this.siteSelector) === null || _f === void 0 ? void 0 : _f.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.pageLink, newwindow: site.openInNewWindow })))),
|
|
238
271
|
h("div", { slot: "top", class: "siteheader-menu-top" },
|
|
239
272
|
h("pn-marketweb-siteheader-search", { search: this.search, "hide-search": this.hideSearch, i18n: this.i18n }))))),
|
|
240
273
|
h("pn-marketweb-siteheader-search", { search: this.search, "hide-search": this.hideSearch, "show-only-link": this.minimizeSearch, i18n: this.i18n })))));
|
|
@@ -409,6 +442,24 @@ export class PnMarketwebSiteheader {
|
|
|
409
442
|
"reflect": false,
|
|
410
443
|
"defaultValue": "false"
|
|
411
444
|
},
|
|
445
|
+
"cache": {
|
|
446
|
+
"type": "boolean",
|
|
447
|
+
"mutable": false,
|
|
448
|
+
"complexType": {
|
|
449
|
+
"original": "boolean",
|
|
450
|
+
"resolved": "boolean",
|
|
451
|
+
"references": {}
|
|
452
|
+
},
|
|
453
|
+
"required": false,
|
|
454
|
+
"optional": false,
|
|
455
|
+
"docs": {
|
|
456
|
+
"tags": [],
|
|
457
|
+
"text": "If the component should use cached requests"
|
|
458
|
+
},
|
|
459
|
+
"attribute": "cache",
|
|
460
|
+
"reflect": false,
|
|
461
|
+
"defaultValue": "false"
|
|
462
|
+
},
|
|
412
463
|
"spaMode": {
|
|
413
464
|
"type": "boolean",
|
|
414
465
|
"mutable": false,
|
|
@@ -432,11 +483,13 @@ export class PnMarketwebSiteheader {
|
|
|
432
483
|
"i18n": {},
|
|
433
484
|
"gotData": {},
|
|
434
485
|
"fetchingData": {},
|
|
486
|
+
"homePageLink": {},
|
|
435
487
|
"menuItems": {},
|
|
436
488
|
"siteDefinition": {},
|
|
437
489
|
"search": {},
|
|
438
490
|
"siteSelector": {},
|
|
439
491
|
"languageSelector": {},
|
|
492
|
+
"languageOptions": {},
|
|
440
493
|
"loginDialog": {},
|
|
441
494
|
"minimizeSearch": {}
|
|
442
495
|
}; }
|
|
@@ -49,6 +49,7 @@ const PrimaryTemplate = ({ ...args }) => {
|
|
|
49
49
|
hide-language-selector="false"
|
|
50
50
|
hide-search="false"
|
|
51
51
|
hide-login="false"
|
|
52
|
+
cache="true"
|
|
52
53
|
session-forward="true">
|
|
53
54
|
<a href="" class="header-cart" slot="toprightend" style="align-self:center;position:relative;text-decoration:none;">
|
|
54
55
|
<span>Varukorg</span>
|
|
@@ -59,6 +60,11 @@ const PrimaryTemplate = ({ ...args }) => {
|
|
|
59
60
|
Content that is higher than 100% viewport height
|
|
60
61
|
</div>
|
|
61
62
|
</div>
|
|
63
|
+
|
|
64
|
+
<!--
|
|
65
|
+
<link rel="alternate" href="https://www.postnord.se/en/business-solutions" hreflang="en" />
|
|
66
|
+
<link rel="alternate" href="https://www.postnord.se/foretagslosningar" hreflang="sv" />
|
|
67
|
+
-->
|
|
62
68
|
`;
|
|
63
69
|
};
|
|
64
70
|
|
|
@@ -66,7 +72,7 @@ export const Primary = PrimaryTemplate.bind({});
|
|
|
66
72
|
Primary.args = {
|
|
67
73
|
market : "se",
|
|
68
74
|
language: 'sv',
|
|
69
|
-
endpoint: '
|
|
75
|
+
endpoint: 'https://com-production.postnord.com'
|
|
70
76
|
};
|
|
71
77
|
|
|
72
78
|
|
|
@@ -31,7 +31,7 @@ export class PnMainnavLink {
|
|
|
31
31
|
this.hasChildren ? (h("button", { onClick: this.setOpenMenuLevel.bind(this), "aria-controls": this.levelId, "aria-pressed": "", "aria-expanded": ((state.openLevel + "" === this.levelId + "")) + '' },
|
|
32
32
|
this.name,
|
|
33
33
|
h("pn-icon", { class: "first-level_icon", symbol: "angle-small-down", color: "blue700" }),
|
|
34
|
-
h("pn-icon", { class: "first-level_arrow", symbol: "arrow-right", color: "blue700" }))) : (h("a", Object.assign({ href: this.href }, (this.target ? { target: this.target } : {}), (this.linkid ? { id: this.linkid } : {})),
|
|
34
|
+
h("pn-icon", { class: "first-level_arrow", symbol: "arrow-right", color: "blue700" }))) : (h("a", Object.assign({ href: this.href }, (this.target ? { target: this.target } : {}), (this.target === "_blank" ? { rel: "nofollow noopener" } : {}), (this.linkid ? { id: this.linkid } : {})),
|
|
35
35
|
this.name,
|
|
36
36
|
this.target === "_blank" ? (h("pn-icon", { symbol: "open-in-new", color: "blue700" })) : null)),
|
|
37
37
|
h("slot", null)));
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
class FetchHelper {
|
|
2
|
+
constructor(namespace = "") {
|
|
3
|
+
this.storagePrefix = "";
|
|
4
|
+
this.store = {
|
|
5
|
+
get: (key, permanentStorageFirst = false) => {
|
|
6
|
+
const firstProfider = permanentStorageFirst ? window.localStorage : window.sessionStorage;
|
|
7
|
+
const secondProvider = permanentStorageFirst ? window.sessionStorage : window.localStorage;
|
|
8
|
+
let value = firstProfider.getItem(`${this.storagePrefix}-${key}`);
|
|
9
|
+
if (!value) {
|
|
10
|
+
value = secondProvider.getItem(`${this.storagePrefix}-${key}`);
|
|
11
|
+
}
|
|
12
|
+
if (!value) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
if (value.indexOf('{') === 0) {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(value);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (value.indexOf(',') !== -1) {
|
|
23
|
+
return value.split(',');
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
},
|
|
27
|
+
set: (key, value, permanent = false) => {
|
|
28
|
+
const provider = permanent ? window.localStorage : window.sessionStorage;
|
|
29
|
+
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
30
|
+
provider.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
provider.setItem(`${this.storagePrefix}-${key}`, value);
|
|
34
|
+
},
|
|
35
|
+
remove: (key) => {
|
|
36
|
+
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
this.storagePrefix = namespace;
|
|
40
|
+
}
|
|
41
|
+
async fetchJson(input, init = {}, useCache = false, onCacheUpdated = null) {
|
|
42
|
+
const requestPromise = new Promise(async (resolve) => {
|
|
43
|
+
let doFetchRequest = true;
|
|
44
|
+
const url = (typeof input === "string") ? input : input.url;
|
|
45
|
+
const cacheKey = url;
|
|
46
|
+
let jsonData = null;
|
|
47
|
+
let cachedData = null;
|
|
48
|
+
if (useCache) {
|
|
49
|
+
cachedData = this.store.get(cacheKey);
|
|
50
|
+
// If the data was stored in session storage, then we don't need to do a full request
|
|
51
|
+
if (cachedData && !cachedData.permanent) {
|
|
52
|
+
doFetchRequest = false;
|
|
53
|
+
}
|
|
54
|
+
if (cachedData && cachedData.data) {
|
|
55
|
+
jsonData = cachedData.data;
|
|
56
|
+
resolve(jsonData);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (doFetchRequest) {
|
|
60
|
+
const response = await window.fetch(input, init);
|
|
61
|
+
jsonData = await response.json();
|
|
62
|
+
resolve(jsonData);
|
|
63
|
+
if (useCache) {
|
|
64
|
+
if (typeof onCacheUpdated === "function" && cachedData != null) {
|
|
65
|
+
onCacheUpdated(jsonData);
|
|
66
|
+
}
|
|
67
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, true), true);
|
|
68
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, false), false);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return requestPromise;
|
|
73
|
+
}
|
|
74
|
+
wrapJson(data, permanent = false) {
|
|
75
|
+
const now = new Date();
|
|
76
|
+
return {
|
|
77
|
+
timestamp: now.getTime(),
|
|
78
|
+
time: now.toISOString(),
|
|
79
|
+
data: data,
|
|
80
|
+
permanent: permanent
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export { FetchHelper };
|
package/custom-elements/index.js
CHANGED
|
@@ -2722,7 +2722,7 @@ let PnMainnavLink$1 = class extends HTMLElement {
|
|
|
2722
2722
|
state$2.openLevel = (state$2.openLevel + "" === this.levelId + "") ? '' : this.levelId;
|
|
2723
2723
|
}
|
|
2724
2724
|
render() {
|
|
2725
|
-
return (h(Host, { role: "listitem", name: this.name, href: this.href, linkid: this.linkid }, this.hasChildren ? (h("button", { onClick: this.setOpenMenuLevel.bind(this), "aria-controls": this.levelId, "aria-pressed": "", "aria-expanded": ((state$2.openLevel + "" === this.levelId + "")) + '' }, this.name, h("pn-icon", { class: "first-level_icon", symbol: "angle-small-down", color: "blue700" }), h("pn-icon", { class: "first-level_arrow", symbol: "arrow-right", color: "blue700" }))) : (h("a", Object.assign({ href: this.href }, (this.target ? { target: this.target } : {}), (this.linkid ? { id: this.linkid } : {})), this.name, this.target === "_blank" ? (h("pn-icon", { symbol: "open-in-new", color: "blue700" })) : null)), h("slot", null)));
|
|
2725
|
+
return (h(Host, { role: "listitem", name: this.name, href: this.href, linkid: this.linkid }, this.hasChildren ? (h("button", { onClick: this.setOpenMenuLevel.bind(this), "aria-controls": this.levelId, "aria-pressed": "", "aria-expanded": ((state$2.openLevel + "" === this.levelId + "")) + '' }, this.name, h("pn-icon", { class: "first-level_icon", symbol: "angle-small-down", color: "blue700" }), h("pn-icon", { class: "first-level_arrow", symbol: "arrow-right", color: "blue700" }))) : (h("a", Object.assign({ href: this.href }, (this.target ? { target: this.target } : {}), (this.target === "_blank" ? { rel: "nofollow noopener" } : {}), (this.linkid ? { id: this.linkid } : {})), this.name, this.target === "_blank" ? (h("pn-icon", { symbol: "open-in-new", color: "blue700" })) : null)), h("slot", null)));
|
|
2726
2726
|
}
|
|
2727
2727
|
get hostElement() { return this; }
|
|
2728
2728
|
static get style() { return pnMainnavLinkCss; }
|
|
@@ -2962,6 +2962,90 @@ class MarketWebContextService {
|
|
|
2962
2962
|
}
|
|
2963
2963
|
}
|
|
2964
2964
|
|
|
2965
|
+
class FetchHelper {
|
|
2966
|
+
constructor(namespace = "") {
|
|
2967
|
+
this.storagePrefix = "";
|
|
2968
|
+
this.store = {
|
|
2969
|
+
get: (key, permanentStorageFirst = false) => {
|
|
2970
|
+
const firstProfider = permanentStorageFirst ? window.localStorage : window.sessionStorage;
|
|
2971
|
+
const secondProvider = permanentStorageFirst ? window.sessionStorage : window.localStorage;
|
|
2972
|
+
let value = firstProfider.getItem(`${this.storagePrefix}-${key}`);
|
|
2973
|
+
if (!value) {
|
|
2974
|
+
value = secondProvider.getItem(`${this.storagePrefix}-${key}`);
|
|
2975
|
+
}
|
|
2976
|
+
if (!value) {
|
|
2977
|
+
return value;
|
|
2978
|
+
}
|
|
2979
|
+
if (value.indexOf('{') === 0) {
|
|
2980
|
+
try {
|
|
2981
|
+
return JSON.parse(value);
|
|
2982
|
+
}
|
|
2983
|
+
catch (e) {
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
if (value.indexOf(',') !== -1) {
|
|
2987
|
+
return value.split(',');
|
|
2988
|
+
}
|
|
2989
|
+
return value;
|
|
2990
|
+
},
|
|
2991
|
+
set: (key, value, permanent = false) => {
|
|
2992
|
+
const provider = permanent ? window.localStorage : window.sessionStorage;
|
|
2993
|
+
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
2994
|
+
provider.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
2995
|
+
return;
|
|
2996
|
+
}
|
|
2997
|
+
provider.setItem(`${this.storagePrefix}-${key}`, value);
|
|
2998
|
+
},
|
|
2999
|
+
remove: (key) => {
|
|
3000
|
+
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
3001
|
+
},
|
|
3002
|
+
};
|
|
3003
|
+
this.storagePrefix = namespace;
|
|
3004
|
+
}
|
|
3005
|
+
async fetchJson(input, init = {}, useCache = false, onCacheUpdated = null) {
|
|
3006
|
+
const requestPromise = new Promise(async (resolve) => {
|
|
3007
|
+
let doFetchRequest = true;
|
|
3008
|
+
const url = (typeof input === "string") ? input : input.url;
|
|
3009
|
+
const cacheKey = url;
|
|
3010
|
+
let jsonData = null;
|
|
3011
|
+
let cachedData = null;
|
|
3012
|
+
if (useCache) {
|
|
3013
|
+
cachedData = this.store.get(cacheKey);
|
|
3014
|
+
// If the data was stored in session storage, then we don't need to do a full request
|
|
3015
|
+
if (cachedData && !cachedData.permanent) {
|
|
3016
|
+
doFetchRequest = false;
|
|
3017
|
+
}
|
|
3018
|
+
if (cachedData && cachedData.data) {
|
|
3019
|
+
jsonData = cachedData.data;
|
|
3020
|
+
resolve(jsonData);
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
if (doFetchRequest) {
|
|
3024
|
+
const response = await window.fetch(input, init);
|
|
3025
|
+
jsonData = await response.json();
|
|
3026
|
+
resolve(jsonData);
|
|
3027
|
+
if (useCache) {
|
|
3028
|
+
if (typeof onCacheUpdated === "function" && cachedData != null) {
|
|
3029
|
+
onCacheUpdated(jsonData);
|
|
3030
|
+
}
|
|
3031
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, true), true);
|
|
3032
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, false), false);
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
});
|
|
3036
|
+
return requestPromise;
|
|
3037
|
+
}
|
|
3038
|
+
wrapJson(data, permanent = false) {
|
|
3039
|
+
const now = new Date();
|
|
3040
|
+
return {
|
|
3041
|
+
timestamp: now.getTime(),
|
|
3042
|
+
time: now.toISOString(),
|
|
3043
|
+
data: data,
|
|
3044
|
+
permanent: permanent
|
|
3045
|
+
};
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
|
|
2965
3049
|
const pnMarketwebSitefooterCss = "";
|
|
2966
3050
|
|
|
2967
3051
|
let PnMarketwebSiteheader$2 = class extends HTMLElement {
|
|
@@ -2977,8 +3061,12 @@ let PnMarketwebSiteheader$2 = class extends HTMLElement {
|
|
|
2977
3061
|
this.environment = null; //sv
|
|
2978
3062
|
/** Specifies which endpoint domain we should load from */
|
|
2979
3063
|
this.endpoint = null;
|
|
3064
|
+
/** If the component should use cached requests */
|
|
3065
|
+
this.cache = false;
|
|
2980
3066
|
this.gotData = false;
|
|
2981
3067
|
this.fetchingData = false;
|
|
3068
|
+
// FetchHelper
|
|
3069
|
+
this.fetchHelper = new FetchHelper("sitefooter");
|
|
2982
3070
|
}
|
|
2983
3071
|
componentWillLoad() {
|
|
2984
3072
|
this.setInitialValues().then(() => {
|
|
@@ -3030,8 +3118,13 @@ let PnMarketwebSiteheader$2 = class extends HTMLElement {
|
|
|
3030
3118
|
this.fetchingData = true;
|
|
3031
3119
|
const endpointBase = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
|
|
3032
3120
|
const fetchUrl = `${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}`;
|
|
3033
|
-
const
|
|
3034
|
-
|
|
3121
|
+
const data = await this.fetchHelper.fetchJson(fetchUrl, {
|
|
3122
|
+
'mode': 'cors'
|
|
3123
|
+
}, this.cache, this.onFetchRefreshed.bind(this));
|
|
3124
|
+
await this.setStateFromData(data);
|
|
3125
|
+
}
|
|
3126
|
+
onFetchRefreshed(data) {
|
|
3127
|
+
console.log('Data was updated after request', data);
|
|
3035
3128
|
this.setStateFromData(data);
|
|
3036
3129
|
}
|
|
3037
3130
|
getLinkContentByType(linkType = "") {
|
|
@@ -3077,6 +3170,9 @@ let PnMarketwebSiteheader$2 = class extends HTMLElement {
|
|
|
3077
3170
|
render() {
|
|
3078
3171
|
var _a, _b, _c, _d, _e;
|
|
3079
3172
|
return (h(Host, { language: this.language, market: this.market, environment: this.environment }, h("pn-site-footer", { url: (_b = (_a = this.siteDefinition) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : "" }, (this.gotData && ((_c = this.footerContent) === null || _c === void 0 ? void 0 : _c.columns)) ? this.footerContent.columns.map((column) => (h("pn-site-footer-col", null, h("h3", null, column.heading), column.links ? (h("ul", Object.assign({}, ((column.links && column.links[0] && column.links[0].linkType) && { 'class': 'social-media' })), column.links.map((link) => {
|
|
3173
|
+
if (!link.linkHref) {
|
|
3174
|
+
return false;
|
|
3175
|
+
}
|
|
3080
3176
|
let linkText = link.linkText;
|
|
3081
3177
|
if (link.linkType) {
|
|
3082
3178
|
linkText = this.getLinkContentByType(link.linkType);
|
|
@@ -3176,10 +3272,13 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3176
3272
|
this.hideLogin = false;
|
|
3177
3273
|
/** Forward session to backend */
|
|
3178
3274
|
this.sessionForward = false;
|
|
3275
|
+
/** If the component should use cached requests */
|
|
3276
|
+
this.cache = false;
|
|
3179
3277
|
/** Event based only language switch */
|
|
3180
3278
|
this.spaMode = false;
|
|
3181
3279
|
this.gotData = false;
|
|
3182
3280
|
this.fetchingData = false;
|
|
3281
|
+
this.homePageLink = "";
|
|
3183
3282
|
// Menu state
|
|
3184
3283
|
this.menuItems = [];
|
|
3185
3284
|
// Search
|
|
@@ -3188,9 +3287,12 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3188
3287
|
this.siteSelector = null;
|
|
3189
3288
|
// Language Selector
|
|
3190
3289
|
this.languageSelector = null;
|
|
3290
|
+
this.languageOptions = [];
|
|
3191
3291
|
// Login dialog
|
|
3192
3292
|
this.loginDialog = null;
|
|
3193
3293
|
this.minimizeSearch = false;
|
|
3294
|
+
// FetchHelper
|
|
3295
|
+
this.fetchHelper = new FetchHelper("siteheader");
|
|
3194
3296
|
}
|
|
3195
3297
|
componentWillLoad() {
|
|
3196
3298
|
this.setInitialValues().then(() => {
|
|
@@ -3248,12 +3350,14 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3248
3350
|
this.fetchingData = true;
|
|
3249
3351
|
const endpointBase = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
|
|
3250
3352
|
const fetchUrl = `${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}`;
|
|
3251
|
-
const
|
|
3353
|
+
const data = await this.fetchHelper.fetchJson(fetchUrl, {
|
|
3252
3354
|
'mode': 'cors'
|
|
3253
|
-
});
|
|
3254
|
-
const data = await response.json();
|
|
3355
|
+
}, this.cache, this.onFetchRefreshed.bind(this));
|
|
3255
3356
|
await this.setStateFromData(data);
|
|
3256
3357
|
}
|
|
3358
|
+
onFetchRefreshed(data) {
|
|
3359
|
+
this.setStateFromData(data);
|
|
3360
|
+
}
|
|
3257
3361
|
getLanguageVersionUrl(item) {
|
|
3258
3362
|
if (this.spaMode) {
|
|
3259
3363
|
return null;
|
|
@@ -3267,6 +3371,7 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3267
3371
|
return siteUrl + ((siteUrl.lastIndexOf("/") !== siteUrl.length - 1) ? "/" : "") + item.twoLetterISOLanguageName;
|
|
3268
3372
|
}
|
|
3269
3373
|
async setStateFromData(data) {
|
|
3374
|
+
var _a, _b, _c;
|
|
3270
3375
|
if (typeof data !== "object") {
|
|
3271
3376
|
console.warn('Data was not valid', data);
|
|
3272
3377
|
}
|
|
@@ -3275,26 +3380,49 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3275
3380
|
// Set navigation information
|
|
3276
3381
|
this.menuItems = data.mainMenu.menuItems;
|
|
3277
3382
|
// Create the "Home" link
|
|
3278
|
-
this.menuItems.
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3383
|
+
if (!this.menuItems[0] || ((_a = this.menuItems[0]) === null || _a === void 0 ? void 0 : _a.name) !== this.i18n.menuHomeButton) {
|
|
3384
|
+
this.menuItems.unshift({
|
|
3385
|
+
href: this.siteDefinition.url,
|
|
3386
|
+
name: this.i18n.menuHomeButton,
|
|
3387
|
+
id: 'homelink',
|
|
3388
|
+
open: false,
|
|
3389
|
+
selected: false,
|
|
3390
|
+
children: []
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3286
3393
|
// Set search
|
|
3287
3394
|
this.search = data.search;
|
|
3288
3395
|
// Set site selector
|
|
3289
3396
|
this.siteSelector = data.siteSelectorViewModel;
|
|
3290
3397
|
// Set language selector
|
|
3291
3398
|
this.languageSelector = data.languageSelectorViewModel;
|
|
3399
|
+
this.setLanguageOptions();
|
|
3292
3400
|
this.loginDialog = data.loginViewModel;
|
|
3293
3401
|
await this.spaModeAdjustments();
|
|
3294
3402
|
this.gotData = true;
|
|
3295
3403
|
this.fetchingData = true;
|
|
3404
|
+
this.homePageLink = (_c = (_b = this.siteDefinition) === null || _b === void 0 ? void 0 : _b.url) !== null && _c !== void 0 ? _c : document.location.hostname;
|
|
3296
3405
|
window.setTimeout(() => { this.checkMenuOverflow(); }, 100);
|
|
3297
3406
|
}
|
|
3407
|
+
setLanguageOptions() {
|
|
3408
|
+
var _a;
|
|
3409
|
+
if (!this.languageSelector || !this.languageSelector.languages) {
|
|
3410
|
+
return;
|
|
3411
|
+
}
|
|
3412
|
+
const hrefLangsTags = (_a = Array.prototype.slice.call(document.querySelectorAll('link[rel="alternate"][hreflang]'))) !== null && _a !== void 0 ? _a : [];
|
|
3413
|
+
const hrefLangs = hrefLangsTags.map((tag) => { return tag.getAttribute("hreflang"); });
|
|
3414
|
+
this.languageSelector.languages.map((languageOption) => {
|
|
3415
|
+
// In case there are language links present on the page we only show languages that have those tags
|
|
3416
|
+
if (hrefLangs && hrefLangs.length > 0) {
|
|
3417
|
+
if (hrefLangs.includes(languageOption.twoLetterISOLanguageName)) {
|
|
3418
|
+
this.languageOptions.push(languageOption);
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
else {
|
|
3422
|
+
this.languageOptions.push(languageOption);
|
|
3423
|
+
}
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3298
3426
|
async spaModeAdjustments() {
|
|
3299
3427
|
if (!this.spaMode) {
|
|
3300
3428
|
return;
|
|
@@ -3339,11 +3467,11 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3339
3467
|
}
|
|
3340
3468
|
}
|
|
3341
3469
|
render() {
|
|
3342
|
-
var _a, _b, _c, _d, _e, _f
|
|
3470
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3343
3471
|
return (h(Host, { language: this.language, market: this.market, environment: this.environment }, h("header", null, h("div", { class: "siteheader-row" }, h("div", { class: "siteheader-topleft" }, h("slot", { name: "topleft" }), !this.hideSiteSelector &&
|
|
3344
3472
|
h("pn-site-selector", { language: this.language, buttontext: (_b = (_a = this.siteSelector) === null || _a === void 0 ? void 0 : _a.currentSiteTitle) !== null && _b !== void 0 ? _b : 'postnord' }, (this.gotData && ((_c = this.siteSelector) === null || _c === void 0 ? void 0 : _c.currentSiteTitle)) &&
|
|
3345
|
-
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }), (this.gotData && ((_d = this.siteSelector) === null || _d === void 0 ? void 0 : _d.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.href, newwindow: site.openInNewWindow })))), h("div", { class: "siteheader-logocontainer" }, h("a", { href:
|
|
3346
|
-
h("pn-language-selector", { value: this.language }, this.
|
|
3473
|
+
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle + ' ', description: this.siteSelector.currentSiteDescription }), (this.gotData && ((_d = this.siteSelector) === null || _d === void 0 ? void 0 : _d.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText + ' ', description: site.linkDescription, url: site.href, newwindow: site.openInNewWindow })))), h("div", { class: "siteheader-logocontainer" }, h("a", { href: this.homePageLink, title: "Home", class: "siteheader-logolink" }, h("svg", { class: "siteheader-logo", xmlns: "http://www.w3.org/2000/svg", width: "12.7rem", height: "2.4rem", viewBox: "0 0 141.73 26.65" }, h("path", { d: "M108.84,13.35c0,6.34-5.17,9-10,9S89,19.76,89,13.63c0-6.28,5.08-9,10-9S108.84,7.25,108.84,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.29,3.29,0,0,0,3.42,3.41A3.24,3.24,0,0,0,102.28,13.54Zm-83,0c0,4.83-3.32,8.82-8.49,8.82a6.54,6.54,0,0,1-4.65-1.57v5.86H0V5.16H6.17V6.8a6.43,6.43,0,0,1,5.11-2.18C16.41,4.62,19.31,8.58,19.31,13.54Zm-6.53,0A3.27,3.27,0,0,0,9.4,10,3.28,3.28,0,0,0,6,13.54,3.29,3.29,0,0,0,9.4,16.95,3.24,3.24,0,0,0,12.78,13.54Zm103.69,0.27c0-2.54,1.54-3.32,3.6-3.32a6.56,6.56,0,0,1,2.08.3L122.3,5.1a3.92,3.92,0,0,0-1.45-.18c-3.45,0-4.38,2.18-4.38,2.18V5.16H110.3V21.84h6.17v-8ZM141.73,0V21.84h-6.16V20.21a6.43,6.43,0,0,1-5.11,2.18c-5.14,0-8-4-8-8.91s3.32-8.82,8.49-8.82a6.54,6.54,0,0,1,4.65,1.57v-5Zm-6,13.48a3.28,3.28,0,0,0-3.41-3.41A3.24,3.24,0,0,0,129,13.47,3.4,3.4,0,1,0,135.75,13.47ZM81.35,4.62c-3.6,0-4.9,2.18-4.9,2.18V5.16H70.29V21.84h6.16V13.29c0-2.11.79-3.08,2.69-3.08s2.18,1.57,2.18,3.57v8.07h6.22V11.6C87.55,7,85.34,4.62,81.35,4.62ZM64.07,1.42H57.9V21.84h6.16V10.36H67l2.81-5.2H64.07V1.42ZM50.26,11.21c-2-.3-2.87-0.3-2.87-1.09s0.81-.94,2.42-0.94a16.15,16.15,0,0,1,5.11.91L56,5.41a24.56,24.56,0,0,0-6.13-.75c-5.89,0-9,2.27-9,5.89,0,2.81,1.66,4.47,6.53,5.11,2.06,0.27,2.81.39,2.81,1.15s-0.82,1-2.24,1a16.67,16.67,0,0,1-6-1.3L40.77,21.3a22.14,22.14,0,0,0,6.68,1c6.35,0,9.28-2.24,9.28-5.89C56.72,13.54,55.15,12,50.26,11.21ZM40.19,13.35c0,6.34-5.17,9-10,9s-9.82-2.6-9.82-8.73c0-6.28,5.08-9,10-9S40.19,7.25,40.19,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.28,3.28,0,0,0,3.41,3.41A3.24,3.24,0,0,0,33.63,13.54Z", fill: "#00A0D6", transform: "translate(0 0)" })))), h("div", { class: "siteheader-topright" }, h("slot", { name: "toprightstart" }), (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && this.languageOptions && this.languageOptions.length) && !this.hideLanguageSelector &&
|
|
3474
|
+
h("pn-language-selector", { value: this.language }, this.languageOptions.map(language => h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))), h("slot", { name: "toprightend" }))), h("div", { class: "siteheader-row" }, h("div", { class: "siteheader-menu" }, h("pn-mainnav", { market: this.market, language: this.language, onMenuOpenChange: (e) => {
|
|
3347
3475
|
document.body.setAttribute("data-siteheader-menuopen", (e.detail + ''));
|
|
3348
3476
|
} }, h("pn-mainnav-level", null, h("pn-mainnav-list", null, this.menuItems.map((item) => {
|
|
3349
3477
|
var _a, _b;
|
|
@@ -3354,10 +3482,10 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3354
3482
|
return (h("pn-mainnav-link", { name: childitem.name, href: childitem.href, target: (_a = childitem.linkTarget) !== null && _a !== void 0 ? _a : "_self", linkid: childitem.trackingId }));
|
|
3355
3483
|
})), (item.promotedMenuItems && item.promotedMenuItems.length > 0) &&
|
|
3356
3484
|
h("pn-mainnav-list", { heading: item.promotedMenuItemsHeader }, item.promotedMenuItems.map((childitem) => (h("pn-mainnav-link", { href: childitem.href, name: childitem.linkText, target: childitem.openInNewWindow ? "_blank" : "_self", linkid: this.promotedItemId(childitem) })))))));
|
|
3357
|
-
})), h("div", { slot: "footer", class: "siteheader-menu-footer" }, (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { emitEvents: false, loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData &&
|
|
3358
|
-
h("pn-language-selector", { value: this.language }, this.
|
|
3359
|
-
h("pn-site-selector", { language: this.language }, (this.gotData && ((
|
|
3360
|
-
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }), (this.gotData && ((
|
|
3485
|
+
})), h("div", { slot: "footer", class: "siteheader-menu-footer" }, (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { emitEvents: false, loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && this.languageOptions && this.languageOptions.length) && !this.hideLanguageSelector &&
|
|
3486
|
+
h("pn-language-selector", { value: this.language }, this.languageOptions.map(language => h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))), !this.hideSiteSelector &&
|
|
3487
|
+
h("pn-site-selector", { language: this.language }, (this.gotData && ((_e = this.siteSelector) === null || _e === void 0 ? void 0 : _e.currentSiteTitle)) &&
|
|
3488
|
+
h("pn-site-selector-item", { heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription }), (this.gotData && ((_f = this.siteSelector) === null || _f === void 0 ? void 0 : _f.siteSelections)) && this.siteSelector.siteSelections.map((site) => h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.pageLink, newwindow: site.openInNewWindow })))), h("div", { slot: "top", class: "siteheader-menu-top" }, h("pn-marketweb-siteheader-search", { search: this.search, "hide-search": this.hideSearch, i18n: this.i18n }))))), h("pn-marketweb-siteheader-search", { search: this.search, "hide-search": this.hideSearch, "show-only-link": this.minimizeSearch, i18n: this.i18n })))));
|
|
3361
3489
|
}
|
|
3362
3490
|
get hostElement() { return this; }
|
|
3363
3491
|
static get watchers() { return {
|
|
@@ -4427,8 +4555,8 @@ const PnMainnav = /*@__PURE__*/proxyCustomElement(PnMainnav$1, [4,"pn-mainnav",{
|
|
|
4427
4555
|
const PnMainnavLevel = /*@__PURE__*/proxyCustomElement(PnMainnavLevel$1, [4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}]);
|
|
4428
4556
|
const PnMainnavLink = /*@__PURE__*/proxyCustomElement(PnMainnavLink$1, [4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]);
|
|
4429
4557
|
const PnMainnavList = /*@__PURE__*/proxyCustomElement(PnMainnavList$1, [4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}]);
|
|
4430
|
-
const PnMarketwebSitefooter = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheader$2, [0,"pn-marketweb-sitefooter",{"market":[1537],"language":[1537],"environment":[1537],"endpoint":[1],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]);
|
|
4431
|
-
const PnMarketwebSiteheader = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheader$1, [4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"sessionForward":[4,"session-forward"],"spaMode":[4,"spa-mode"],"i18n":[32],"gotData":[32],"fetchingData":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"loginDialog":[32],"minimizeSearch":[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]);
|
|
4558
|
+
const PnMarketwebSitefooter = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheader$2, [0,"pn-marketweb-sitefooter",{"market":[1537],"language":[1537],"environment":[1537],"endpoint":[1],"cache":[4],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]);
|
|
4559
|
+
const PnMarketwebSiteheader = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheader$1, [4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"sessionForward":[4,"session-forward"],"cache":[4],"spaMode":[4,"spa-mode"],"i18n":[32],"gotData":[32],"fetchingData":[32],"homePageLink":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"languageOptions":[32],"loginDialog":[32],"minimizeSearch":[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]);
|
|
4432
4560
|
const PnMarketwebSiteheaderLogin = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheaderLogin$1, [0,"pn-marketweb-siteheader-login",{"endpoint":[1],"i18n":[8,"i-1-8n"],"emitEvents":[4,"emit-events"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32],"username":[32]}]);
|
|
4433
4561
|
const PnMarketwebSiteheaderSearch = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheaderSearch$1, [0,"pn-marketweb-siteheader-search",{"i18n":[8,"i-1-8n"],"showOnlyLink":[1028,"show-only-link"],"hideSearch":[1028,"hide-search"],"search":[1040]}]);
|
|
4434
4562
|
const PnProductPricelist = /*@__PURE__*/proxyCustomElement(PnFindProductPricelist, [4,"pn-product-pricelist",{"source":[1],"language":[1025],"market":[1025],"productid":[1],"filteredItems":[32],"sourceData":[32],"gotData":[32],"loading":[32],"postagetype":[32],"weight":[32],"weightvalue":[32]}]);
|