@postnord/pn-marketweb-components 1.0.35 → 1.0.39
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/{MarketWebLoginManager-8b675eb4.js → MarketWebLoginManager-859590e2.js} +8 -0
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-language-selector_9.cjs.entry.js +6 -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 +50 -22
- package/cjs/pn-profile-selector.cjs.entry.js +21 -13
- 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-login.js +23 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +95 -23
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +60 -2
- package/collection/components/navigation/pn-mainnav/pn-mainnav-link.js +1 -1
- package/collection/components/navigation/pn-profile-selector/pn-profile-selector.js +26 -18
- package/collection/globals/FetchHelper.js +84 -0
- package/collection/globals/MarketWebLoginManager.js +8 -0
- package/custom-elements/index.js +375 -232
- package/esm/FetchHelper-a0c8aa54.js +85 -0
- package/esm/{MarketWebLoginManager-dd7ac023.js → MarketWebLoginManager-83f2e86a.js} +8 -0
- package/esm/loader.js +1 -1
- package/esm/pn-language-selector_9.entry.js +6 -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 +50 -22
- package/esm/pn-profile-selector.entry.js +21 -13
- package/esm-es5/FetchHelper-a0c8aa54.js +1 -0
- package/esm-es5/MarketWebLoginManager-83f2e86a.js +1 -0
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-language-selector_9.entry.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/esm-es5/pn-profile-selector.entry.js +1 -1
- package/package.json +27 -27
- package/pn-market-web-components/p-02ab0208.entry.js +1 -0
- package/pn-market-web-components/{p-ffdf87ee.entry.js → p-03fb0285.entry.js} +1 -1
- package/pn-market-web-components/p-1649b94a.entry.js +1 -0
- 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-58cdf3a6.system.js +1 -0
- package/pn-market-web-components/{p-6a32362d.system.entry.js → p-7b4c721f.system.entry.js} +1 -1
- package/pn-market-web-components/p-97dc5687.js +1 -0
- package/pn-market-web-components/p-a983c263.system.entry.js +1 -0
- package/pn-market-web-components/p-c254cfdf.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-dade9bdb.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-login.d.ts +2 -0
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.d.ts +11 -0
- package/types/components/navigation/pn-profile-selector/pn-profile-selector.d.ts +2 -1
- package/types/components.d.ts +34 -2
- package/types/globals/FetchHelper.d.ts +17 -0
- package/types/globals/MarketWebLoginManager.d.ts +1 -0
- package/esm-es5/MarketWebLoginManager-dd7ac023.js +0 -1
- 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-2f494f64.system.entry.js +0 -1
- package/pn-market-web-components/p-3562a62f.entry.js +0 -1
- package/pn-market-web-components/p-37efd029.entry.js +0 -1
- package/pn-market-web-components/p-4dcea578.js +0 -1
- package/pn-market-web-components/p-51768dc0.system.js +0 -1
- package/pn-market-web-components/p-db7419be.system.entry.js +0 -1
- package/pn-market-web-components/p-e220ea83.entry.js +0 -1
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);
|
|
@@ -3147,6 +3243,205 @@ const translations$3 = {
|
|
|
3147
3243
|
}
|
|
3148
3244
|
};
|
|
3149
3245
|
|
|
3246
|
+
class MarketWebLoginManager {
|
|
3247
|
+
constructor(options = null) {
|
|
3248
|
+
var _a;
|
|
3249
|
+
this.eventTarget = (window !== null && window !== void 0 ? window : document === null || document === void 0 ? void 0 : document.body);
|
|
3250
|
+
this.endpoint = "";
|
|
3251
|
+
this.storagePrefix = "pn-user";
|
|
3252
|
+
this.baseUrls = {
|
|
3253
|
+
at: 'https://atportal.postnord.com/api/unified-login/backend',
|
|
3254
|
+
prod: 'https://portal.postnord.com/api/unified-login/backend',
|
|
3255
|
+
};
|
|
3256
|
+
this.events = {
|
|
3257
|
+
loginstatechange: "loginstatechange"
|
|
3258
|
+
};
|
|
3259
|
+
this.endpoints = {
|
|
3260
|
+
authorizationEndpoint: `/authorization`,
|
|
3261
|
+
tokenExchangeEndpoint: `/token`,
|
|
3262
|
+
userInfoEndpoint: `/user`,
|
|
3263
|
+
logoutEndpoint: `/logout`,
|
|
3264
|
+
};
|
|
3265
|
+
this.keys = {
|
|
3266
|
+
token: 'token',
|
|
3267
|
+
user: 'user',
|
|
3268
|
+
expire: 'expire',
|
|
3269
|
+
expireDate: 'expiredate'
|
|
3270
|
+
};
|
|
3271
|
+
this.store = {
|
|
3272
|
+
get: (key) => {
|
|
3273
|
+
const value = window.sessionStorage.getItem(`${this.storagePrefix}-${key}`);
|
|
3274
|
+
if (!value) {
|
|
3275
|
+
return value;
|
|
3276
|
+
}
|
|
3277
|
+
if (value.indexOf('{') === 0) {
|
|
3278
|
+
try {
|
|
3279
|
+
return JSON.parse(value);
|
|
3280
|
+
}
|
|
3281
|
+
catch (e) {
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
if (value.indexOf(',') !== -1) {
|
|
3285
|
+
return value.split(',');
|
|
3286
|
+
}
|
|
3287
|
+
return value;
|
|
3288
|
+
},
|
|
3289
|
+
set: (key, value) => {
|
|
3290
|
+
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
3291
|
+
window.sessionStorage.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
3292
|
+
return;
|
|
3293
|
+
}
|
|
3294
|
+
window.sessionStorage.setItem(`${this.storagePrefix}-${key}`, value);
|
|
3295
|
+
},
|
|
3296
|
+
remove: (key) => {
|
|
3297
|
+
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
3298
|
+
},
|
|
3299
|
+
};
|
|
3300
|
+
if (!options) {
|
|
3301
|
+
return;
|
|
3302
|
+
}
|
|
3303
|
+
this.eventTarget = (options.eventTarget) ? options.eventTarget : this.eventTarget;
|
|
3304
|
+
this.endpoint = options.endpoint ? options.endpoint : `${window.location.protocol}//${window.location.host}`;
|
|
3305
|
+
(_a = this.storagePrefix) !== null && _a !== void 0 ? _a : (this.storagePrefix = options.storagePrefix);
|
|
3306
|
+
}
|
|
3307
|
+
init(checkParameters = true) {
|
|
3308
|
+
if (checkParameters) {
|
|
3309
|
+
this.checkParameters();
|
|
3310
|
+
this.checkExpireTime();
|
|
3311
|
+
if (this.store.get(this.keys.token) && !this.store.get(this.keys.user)) {
|
|
3312
|
+
this.fetchUserInfo();
|
|
3313
|
+
}
|
|
3314
|
+
this.loginStateChange();
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
isLoggedIn() {
|
|
3318
|
+
const isLoggedIn = (this.store.get(this.keys.token) && this.store.get(this.keys.user)) ? true : false;
|
|
3319
|
+
return isLoggedIn;
|
|
3320
|
+
}
|
|
3321
|
+
registerToken(token) {
|
|
3322
|
+
if (!token || token === this.getToken()) {
|
|
3323
|
+
return;
|
|
3324
|
+
}
|
|
3325
|
+
this.clearUserData();
|
|
3326
|
+
this.store.set(this.keys.token, token);
|
|
3327
|
+
this.fetchUserInfo();
|
|
3328
|
+
}
|
|
3329
|
+
getLoginUrl(redirectPage = "") {
|
|
3330
|
+
const currentPage = window.location.href;
|
|
3331
|
+
redirectPage = redirectPage ? redirectPage : currentPage;
|
|
3332
|
+
return `${this.getBaseUrl()}${this.endpoints.authorizationEndpoint}?redirectionUrl=${redirectPage}`;
|
|
3333
|
+
}
|
|
3334
|
+
getLogoutUrl(redirectPage = "") {
|
|
3335
|
+
const currentPage = window.location.href;
|
|
3336
|
+
redirectPage = redirectPage ? redirectPage : currentPage;
|
|
3337
|
+
return `${this.getBaseUrl()}${this.endpoints.logoutEndpoint}?redirectionUrl=${redirectPage}&authorization=${this.store.get(this.keys.token)}`;
|
|
3338
|
+
}
|
|
3339
|
+
getUserInfo() {
|
|
3340
|
+
if (this.isLoggedIn()) {
|
|
3341
|
+
return this.store.get(this.keys.user);
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
getEventTarget() {
|
|
3345
|
+
return this.eventTarget;
|
|
3346
|
+
}
|
|
3347
|
+
checkExpireTime() {
|
|
3348
|
+
const expire = this.store.get(this.keys.expire);
|
|
3349
|
+
if (!expire) {
|
|
3350
|
+
return;
|
|
3351
|
+
}
|
|
3352
|
+
const now = new Date();
|
|
3353
|
+
const expireDate = new Date(Math.floor(parseInt(expire, 10) * 1000));
|
|
3354
|
+
if (now > expireDate) {
|
|
3355
|
+
console.info('Login time has expired');
|
|
3356
|
+
this.clearUserData();
|
|
3357
|
+
this.loginStateChange();
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
checkParameters() {
|
|
3361
|
+
if (!(window === null || window === void 0 ? void 0 : window.location)) {
|
|
3362
|
+
return;
|
|
3363
|
+
}
|
|
3364
|
+
const params = new URLSearchParams(window.location.search);
|
|
3365
|
+
if (params.get("oneTimeCode")) {
|
|
3366
|
+
const oneTimeCode = params.get("oneTimeCode");
|
|
3367
|
+
this.exchangeToken(oneTimeCode).then(() => {
|
|
3368
|
+
const currentHref = window.location.href;
|
|
3369
|
+
const paramPrefix = (currentHref.indexOf('?oneTimeCode') !== -1) ? "?" : "&";
|
|
3370
|
+
history.replaceState({}, document.querySelector('title').innerText, currentHref.replace(`${paramPrefix}oneTimeCode=${oneTimeCode}`, ''));
|
|
3371
|
+
});
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
async fetchUserInfo() {
|
|
3375
|
+
const token = this.store.get(this.keys.token);
|
|
3376
|
+
const reqConfig = {
|
|
3377
|
+
method: 'GET',
|
|
3378
|
+
headers: {
|
|
3379
|
+
'Accept': 'application/json',
|
|
3380
|
+
'Content-Type': 'application/json',
|
|
3381
|
+
'Authorization': token
|
|
3382
|
+
},
|
|
3383
|
+
};
|
|
3384
|
+
const response = await fetch(`${this.getBaseUrl()}${this.endpoints.userInfoEndpoint}`, reqConfig);
|
|
3385
|
+
const data = await response.json();
|
|
3386
|
+
if (data) {
|
|
3387
|
+
try {
|
|
3388
|
+
const { idToken, expiryTime } = data;
|
|
3389
|
+
const userInfo = this.parseUserInfo(idToken);
|
|
3390
|
+
this.store.set(this.keys.user, userInfo);
|
|
3391
|
+
// 10 Min early expire
|
|
3392
|
+
this.store.set(this.keys.expire, expiryTime);
|
|
3393
|
+
this.store.set(this.keys.expireDate, new Date(Math.floor(parseInt(expiryTime, 10) * 1000)));
|
|
3394
|
+
this.loginStateChange();
|
|
3395
|
+
}
|
|
3396
|
+
catch (e) {
|
|
3397
|
+
console.error('Unable to get user information', e);
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
clearUserData() {
|
|
3402
|
+
this.store.remove(this.keys.user);
|
|
3403
|
+
this.store.remove(this.keys.token);
|
|
3404
|
+
this.store.remove(this.keys.expire);
|
|
3405
|
+
this.store.remove(this.keys.expireDate);
|
|
3406
|
+
}
|
|
3407
|
+
getToken() {
|
|
3408
|
+
return this.store.get(this.keys.token);
|
|
3409
|
+
}
|
|
3410
|
+
async exchangeToken(oneTimeCode) {
|
|
3411
|
+
this.clearUserData();
|
|
3412
|
+
const response = await fetch(`${this.getBaseUrl()}${this.endpoints.tokenExchangeEndpoint}?oneTimeCode=${oneTimeCode}`);
|
|
3413
|
+
const { token } = await response.json();
|
|
3414
|
+
if (typeof token === "string" && token) {
|
|
3415
|
+
this.store.set(this.keys.token, token);
|
|
3416
|
+
}
|
|
3417
|
+
this.fetchUserInfo();
|
|
3418
|
+
}
|
|
3419
|
+
loginStateChange() {
|
|
3420
|
+
if (!this.eventTarget) {
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3423
|
+
this.eventTarget.dispatchEvent(new CustomEvent(this.events.loginstatechange, {
|
|
3424
|
+
detail: this.isLoggedIn()
|
|
3425
|
+
}));
|
|
3426
|
+
}
|
|
3427
|
+
getBaseUrl() {
|
|
3428
|
+
const atEnvironments = ["localhost", "integration.", 'local.'];
|
|
3429
|
+
const useATEnv = atEnvironments.filter(x => this.endpoint.indexOf(x) !== -1).length > 0;
|
|
3430
|
+
if (useATEnv) {
|
|
3431
|
+
return this.baseUrls.at;
|
|
3432
|
+
}
|
|
3433
|
+
return this.baseUrls.prod;
|
|
3434
|
+
}
|
|
3435
|
+
parseUserInfo(idToken) {
|
|
3436
|
+
var base64Url = idToken.split('.')[1];
|
|
3437
|
+
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
3438
|
+
var jsonPayload = decodeURIComponent(atob(base64).split('').map(function (c) {
|
|
3439
|
+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
3440
|
+
}).join(''));
|
|
3441
|
+
return JSON.parse(jsonPayload);
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3150
3445
|
const pnMarketwebSiteheaderCss = "body[data-siteheader-menuopen=true]{max-height:100vh;overflow:hidden}@media screen and (min-width: 60em){body[data-siteheader-menuopen=true]{max-height:initial;overflow:initial}}pn-marketweb-siteheader{display:block;background:#FFFFFF}pn-marketweb-siteheader header{position:relative;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;-webkit-box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between}@media screen and (min-width: 48em){pn-marketweb-siteheader header{-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:initial;justify-content:initial}}pn-marketweb-siteheader .siteheader-row{display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;-ms-flex-align:center;align-items:center;width:100%;padding:0 1.6rem;min-height:2em}pn-marketweb-siteheader .siteheader-row:not(:last-child){border-bottom:0.1rem solid #F3F2F2}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-row{-ms-flex-pack:justify;justify-content:space-between;min-height:3.2em}}pn-marketweb-siteheader .siteheader-topright{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}pn-marketweb-siteheader .siteheader-logocontainer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:relative;min-height:3em;background:#FFFFFF;z-index:1}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-logocontainer{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}}pn-marketweb-siteheader .siteheader-logolink{height:100%;max-height:6.4rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}pn-marketweb-siteheader .siteheader-logolink:hover,pn-marketweb-siteheader .siteheader-logolink:focus,pn-marketweb-siteheader .siteheader-logolink:active{-webkit-box-shadow:none;box-shadow:none}pn-marketweb-siteheader .siteheader-row>pn-marketweb-siteheader-search{display:none}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-row>pn-marketweb-siteheader-search{display:block}}pn-marketweb-siteheader pn-spinner{display:none}pn-marketweb-siteheader pn-nav-dropdown:not(.hydrated) .nav-dropdown-content-container{display:none}.siteheader-topleft pn-site-selector{padding:1rem 0;display:none}@media screen and (min-width: 48em){.siteheader-topleft pn-site-selector{display:block}}@media screen and (min-width: 60em){.siteheader-topleft pn-site-selector{margin-left:1.3rem}}@media screen and (min-width: 60em){.siteheader-topright{margin-right:1.6rem}}.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{padding:1rem 0;display:none;-ms-flex-item-align:center;align-self:center}@media screen and (min-width: 48em){.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{display:block;margin-left:1rem}}@media screen and (min-width: 60em){.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{margin-left:1.6rem}}.siteheader-topright>pn-language-selector .pn-nav-dropdown-label,.siteheader-topright>pn-language-selector:is(a),.siteheader-topright>pn-marketweb-siteheader-login .pn-nav-dropdown-label,.siteheader-topright>pn-marketweb-siteheader-login:is(a),.siteheader-topright>a .pn-nav-dropdown-label,.siteheader-topright>a:is(a){font-size:0}.siteheader-topright>pn-language-selector .pn-nav-dropdown-label pn-icon,.siteheader-topright>pn-language-selector:is(a) pn-icon,.siteheader-topright>pn-marketweb-siteheader-login .pn-nav-dropdown-label pn-icon,.siteheader-topright>pn-marketweb-siteheader-login:is(a) pn-icon,.siteheader-topright>a .pn-nav-dropdown-label pn-icon,.siteheader-topright>a:is(a) pn-icon{font-size:initial;margin-left:0}@media screen and (min-width: 60em){.siteheader-topright>pn-language-selector .pn-nav-dropdown-label,.siteheader-topright>pn-language-selector:is(a),.siteheader-topright>pn-marketweb-siteheader-login .pn-nav-dropdown-label,.siteheader-topright>pn-marketweb-siteheader-login:is(a),.siteheader-topright>a .pn-nav-dropdown-label,.siteheader-topright>a:is(a){font-size:initial}.siteheader-topright>pn-language-selector .pn-nav-dropdown-label pn-icon,.siteheader-topright>pn-language-selector:is(a) pn-icon,.siteheader-topright>pn-marketweb-siteheader-login .pn-nav-dropdown-label pn-icon,.siteheader-topright>pn-marketweb-siteheader-login:is(a) pn-icon,.siteheader-topright>a .pn-nav-dropdown-label pn-icon,.siteheader-topright>a:is(a) pn-icon{margin-left:0.4em}}.siteheader-menu{max-width:100%;width:100%;overflow:visible;overflow-x:clip}@media screen and (min-width: 60em){.siteheader-menu{margin-top:auto;overflow:visible}}.siteheader-menu pn-mainnav-link a[target]::after{content:none}.siteheader-menu pn-marketweb-siteheader-search{padding:0.3rem 1.6rem;width:100%}.siteheader-menu [slot=top] pn-search-field{width:100%}.siteheader-menu-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center}.siteheader-menu-footer>*{margin:1.6rem}";
|
|
3151
3446
|
|
|
3152
3447
|
let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
@@ -3164,6 +3459,8 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3164
3459
|
this.language = null; //sv
|
|
3165
3460
|
/** Specifies which environment we're fetching data from. (production, preproduction, integration, localhost) */
|
|
3166
3461
|
this.environment = null; //sv
|
|
3462
|
+
/** Access token passed from backend */
|
|
3463
|
+
this.token = "";
|
|
3167
3464
|
/** Specifies which endpoint domain we should load from */
|
|
3168
3465
|
this.endpoint = null;
|
|
3169
3466
|
/** Hides the site selector if set to true*/
|
|
@@ -3176,6 +3473,8 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3176
3473
|
this.hideLogin = false;
|
|
3177
3474
|
/** Forward session to backend */
|
|
3178
3475
|
this.sessionForward = false;
|
|
3476
|
+
/** If the component should use cached requests */
|
|
3477
|
+
this.cache = false;
|
|
3179
3478
|
/** Event based only language switch */
|
|
3180
3479
|
this.spaMode = false;
|
|
3181
3480
|
this.gotData = false;
|
|
@@ -3193,8 +3492,14 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3193
3492
|
// Login dialog
|
|
3194
3493
|
this.loginDialog = null;
|
|
3195
3494
|
this.minimizeSearch = false;
|
|
3495
|
+
this.loggedIn = false;
|
|
3496
|
+
// FetchHelper
|
|
3497
|
+
this.fetchHelper = new FetchHelper("siteheader");
|
|
3498
|
+
// Login manager
|
|
3499
|
+
this.loginManager = null;
|
|
3196
3500
|
}
|
|
3197
3501
|
componentWillLoad() {
|
|
3502
|
+
this.loginManager = new MarketWebLoginManager({ eventTarget: this.hostElement });
|
|
3198
3503
|
this.setInitialValues().then(() => {
|
|
3199
3504
|
this.init();
|
|
3200
3505
|
});
|
|
@@ -3231,7 +3536,9 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3231
3536
|
}
|
|
3232
3537
|
}
|
|
3233
3538
|
onLanguageSelectorChange(e) {
|
|
3539
|
+
console.log('onLanguageSelectorChange(e', e);
|
|
3234
3540
|
this.language = e.detail;
|
|
3541
|
+
window.dispatchEvent(new CustomEvent('marketweb-languagechange', { detail: this.language }));
|
|
3235
3542
|
}
|
|
3236
3543
|
onLanguageChange() {
|
|
3237
3544
|
this.setTranslations();
|
|
@@ -3250,12 +3557,14 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3250
3557
|
this.fetchingData = true;
|
|
3251
3558
|
const endpointBase = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
|
|
3252
3559
|
const fetchUrl = `${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}`;
|
|
3253
|
-
const
|
|
3560
|
+
const data = await this.fetchHelper.fetchJson(fetchUrl, {
|
|
3254
3561
|
'mode': 'cors'
|
|
3255
|
-
});
|
|
3256
|
-
const data = await response.json();
|
|
3562
|
+
}, this.cache, this.onFetchRefreshed.bind(this));
|
|
3257
3563
|
await this.setStateFromData(data);
|
|
3258
3564
|
}
|
|
3565
|
+
onFetchRefreshed(data) {
|
|
3566
|
+
this.setStateFromData(data);
|
|
3567
|
+
}
|
|
3259
3568
|
getLanguageVersionUrl(item) {
|
|
3260
3569
|
if (this.spaMode) {
|
|
3261
3570
|
return null;
|
|
@@ -3269,7 +3578,7 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3269
3578
|
return siteUrl + ((siteUrl.lastIndexOf("/") !== siteUrl.length - 1) ? "/" : "") + item.twoLetterISOLanguageName;
|
|
3270
3579
|
}
|
|
3271
3580
|
async setStateFromData(data) {
|
|
3272
|
-
var _a, _b;
|
|
3581
|
+
var _a, _b, _c;
|
|
3273
3582
|
if (typeof data !== "object") {
|
|
3274
3583
|
console.warn('Data was not valid', data);
|
|
3275
3584
|
}
|
|
@@ -3278,14 +3587,16 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3278
3587
|
// Set navigation information
|
|
3279
3588
|
this.menuItems = data.mainMenu.menuItems;
|
|
3280
3589
|
// Create the "Home" link
|
|
3281
|
-
this.menuItems.
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3590
|
+
if (!this.menuItems[0] || ((_a = this.menuItems[0]) === null || _a === void 0 ? void 0 : _a.name) !== this.i18n.menuHomeButton) {
|
|
3591
|
+
this.menuItems.unshift({
|
|
3592
|
+
href: this.siteDefinition.url,
|
|
3593
|
+
name: this.i18n.menuHomeButton,
|
|
3594
|
+
id: 'homelink',
|
|
3595
|
+
open: false,
|
|
3596
|
+
selected: false,
|
|
3597
|
+
children: []
|
|
3598
|
+
});
|
|
3599
|
+
}
|
|
3289
3600
|
// Set search
|
|
3290
3601
|
this.search = data.search;
|
|
3291
3602
|
// Set site selector
|
|
@@ -3297,7 +3608,7 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3297
3608
|
await this.spaModeAdjustments();
|
|
3298
3609
|
this.gotData = true;
|
|
3299
3610
|
this.fetchingData = true;
|
|
3300
|
-
this.homePageLink = (
|
|
3611
|
+
this.homePageLink = (_c = (_b = this.siteDefinition) === null || _b === void 0 ? void 0 : _b.url) !== null && _c !== void 0 ? _c : document.location.hostname;
|
|
3301
3612
|
window.setTimeout(() => { this.checkMenuOverflow(); }, 100);
|
|
3302
3613
|
}
|
|
3303
3614
|
setLanguageOptions() {
|
|
@@ -3307,17 +3618,19 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3307
3618
|
}
|
|
3308
3619
|
const hrefLangsTags = (_a = Array.prototype.slice.call(document.querySelectorAll('link[rel="alternate"][hreflang]'))) !== null && _a !== void 0 ? _a : [];
|
|
3309
3620
|
const hrefLangs = hrefLangsTags.map((tag) => { return tag.getAttribute("hreflang"); });
|
|
3621
|
+
let languageOptions = []; // Reset language options
|
|
3310
3622
|
this.languageSelector.languages.map((languageOption) => {
|
|
3311
3623
|
// In case there are language links present on the page we only show languages that have those tags
|
|
3312
3624
|
if (hrefLangs && hrefLangs.length > 0) {
|
|
3313
3625
|
if (hrefLangs.includes(languageOption.twoLetterISOLanguageName)) {
|
|
3314
|
-
|
|
3626
|
+
languageOptions.push(languageOption);
|
|
3315
3627
|
}
|
|
3316
3628
|
}
|
|
3317
3629
|
else {
|
|
3318
|
-
|
|
3630
|
+
languageOptions.push(languageOption);
|
|
3319
3631
|
}
|
|
3320
3632
|
});
|
|
3633
|
+
this.languageOptions = languageOptions; // Replace existing language options so we don't trigger a event change on every push.
|
|
3321
3634
|
}
|
|
3322
3635
|
async spaModeAdjustments() {
|
|
3323
3636
|
if (!this.spaMode) {
|
|
@@ -3326,12 +3639,9 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3326
3639
|
return;
|
|
3327
3640
|
}
|
|
3328
3641
|
onLoginStateChange(e) {
|
|
3329
|
-
var _a, _b;
|
|
3330
|
-
if (((_a = e.detail) === null || _a === void 0 ? void 0 : _a.loggedIn) && ((_b = e.detail) === null || _b === void 0 ? void 0 : _b.token)
|
|
3331
|
-
|
|
3332
|
-
fetch('/api/userprofile/sync?token=' + e.detail.token);
|
|
3333
|
-
}
|
|
3334
|
-
catch (e) { }
|
|
3642
|
+
var _a, _b, _c;
|
|
3643
|
+
if (((_a = e.detail) === null || _a === void 0 ? void 0 : _a.loggedIn) && ((_b = e.detail) === null || _b === void 0 ? void 0 : _b.token)) {
|
|
3644
|
+
this.loggedIn = ((_c = e.detail) === null || _c === void 0 ? void 0 : _c.loggedIn) === true;
|
|
3335
3645
|
}
|
|
3336
3646
|
}
|
|
3337
3647
|
promotedItemId(item) {
|
|
@@ -3362,11 +3672,22 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3362
3672
|
this.minimizeSearch = true;
|
|
3363
3673
|
}
|
|
3364
3674
|
}
|
|
3675
|
+
adjustSiteSelectorUrl(href) {
|
|
3676
|
+
if (!this.loggedIn) {
|
|
3677
|
+
return href;
|
|
3678
|
+
}
|
|
3679
|
+
const loginDomains = ['portal.postnord.com'];
|
|
3680
|
+
const matchedHref = loginDomains.filter((domain) => { return href.indexOf(domain) !== -1; });
|
|
3681
|
+
if (matchedHref.length === 0) {
|
|
3682
|
+
return href;
|
|
3683
|
+
}
|
|
3684
|
+
return this.loginManager.getLoginUrl(href);
|
|
3685
|
+
}
|
|
3365
3686
|
render() {
|
|
3366
3687
|
var _a, _b, _c, _d, _e, _f;
|
|
3367
3688
|
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 &&
|
|
3368
3689
|
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)) &&
|
|
3369
|
-
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 &&
|
|
3690
|
+
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: this.adjustSiteSelectorUrl(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", { token: this.token, loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && this.languageOptions && this.languageOptions.length) && !this.hideLanguageSelector &&
|
|
3370
3691
|
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) => {
|
|
3371
3692
|
document.body.setAttribute("data-siteheader-menuopen", (e.detail + ''));
|
|
3372
3693
|
} }, h("pn-mainnav-level", null, h("pn-mainnav-list", null, this.menuItems.map((item) => {
|
|
@@ -3391,197 +3712,6 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
|
|
|
3391
3712
|
static get style() { return pnMarketwebSiteheaderCss; }
|
|
3392
3713
|
};
|
|
3393
3714
|
|
|
3394
|
-
class MarketWebLoginManager {
|
|
3395
|
-
constructor(options = null) {
|
|
3396
|
-
var _a;
|
|
3397
|
-
this.eventTarget = (window !== null && window !== void 0 ? window : document === null || document === void 0 ? void 0 : document.body);
|
|
3398
|
-
this.endpoint = "";
|
|
3399
|
-
this.storagePrefix = "pn-user";
|
|
3400
|
-
this.baseUrls = {
|
|
3401
|
-
at: 'https://atportal.postnord.com/api/unified-login/backend',
|
|
3402
|
-
prod: 'https://portal.postnord.com/api/unified-login/backend',
|
|
3403
|
-
};
|
|
3404
|
-
this.events = {
|
|
3405
|
-
loginstatechange: "loginstatechange"
|
|
3406
|
-
};
|
|
3407
|
-
this.endpoints = {
|
|
3408
|
-
authorizationEndpoint: `/authorization`,
|
|
3409
|
-
tokenExchangeEndpoint: `/token`,
|
|
3410
|
-
userInfoEndpoint: `/user`,
|
|
3411
|
-
logoutEndpoint: `/logout`,
|
|
3412
|
-
};
|
|
3413
|
-
this.keys = {
|
|
3414
|
-
token: 'token',
|
|
3415
|
-
user: 'user',
|
|
3416
|
-
expire: 'expire',
|
|
3417
|
-
expireDate: 'expiredate'
|
|
3418
|
-
};
|
|
3419
|
-
this.store = {
|
|
3420
|
-
get: (key) => {
|
|
3421
|
-
const value = window.sessionStorage.getItem(`${this.storagePrefix}-${key}`);
|
|
3422
|
-
if (!value) {
|
|
3423
|
-
return value;
|
|
3424
|
-
}
|
|
3425
|
-
if (value.indexOf('{') === 0) {
|
|
3426
|
-
try {
|
|
3427
|
-
return JSON.parse(value);
|
|
3428
|
-
}
|
|
3429
|
-
catch (e) {
|
|
3430
|
-
}
|
|
3431
|
-
}
|
|
3432
|
-
if (value.indexOf(',') !== -1) {
|
|
3433
|
-
return value.split(',');
|
|
3434
|
-
}
|
|
3435
|
-
return value;
|
|
3436
|
-
},
|
|
3437
|
-
set: (key, value) => {
|
|
3438
|
-
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
3439
|
-
window.sessionStorage.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
3440
|
-
return;
|
|
3441
|
-
}
|
|
3442
|
-
window.sessionStorage.setItem(`${this.storagePrefix}-${key}`, value);
|
|
3443
|
-
},
|
|
3444
|
-
remove: (key) => {
|
|
3445
|
-
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
3446
|
-
},
|
|
3447
|
-
};
|
|
3448
|
-
if (!options) {
|
|
3449
|
-
return;
|
|
3450
|
-
}
|
|
3451
|
-
this.eventTarget = (options.eventTarget) ? options.eventTarget : this.eventTarget;
|
|
3452
|
-
this.endpoint = options.endpoint ? options.endpoint : `${window.location.protocol}//${window.location.host}`;
|
|
3453
|
-
(_a = this.storagePrefix) !== null && _a !== void 0 ? _a : (this.storagePrefix = options.storagePrefix);
|
|
3454
|
-
}
|
|
3455
|
-
init(checkParameters = true) {
|
|
3456
|
-
if (checkParameters) {
|
|
3457
|
-
this.checkParameters();
|
|
3458
|
-
this.checkExpireTime();
|
|
3459
|
-
if (this.store.get(this.keys.token) && !this.store.get(this.keys.user)) {
|
|
3460
|
-
this.fetchUserInfo();
|
|
3461
|
-
}
|
|
3462
|
-
this.loginStateChange();
|
|
3463
|
-
}
|
|
3464
|
-
}
|
|
3465
|
-
isLoggedIn() {
|
|
3466
|
-
const isLoggedIn = (this.store.get(this.keys.token) && this.store.get(this.keys.user)) ? true : false;
|
|
3467
|
-
return isLoggedIn;
|
|
3468
|
-
}
|
|
3469
|
-
getLoginUrl(redirectPage = "") {
|
|
3470
|
-
const currentPage = window.location.href;
|
|
3471
|
-
redirectPage = redirectPage ? redirectPage : currentPage;
|
|
3472
|
-
return `${this.getBaseUrl()}${this.endpoints.authorizationEndpoint}?redirectionUrl=${redirectPage}`;
|
|
3473
|
-
}
|
|
3474
|
-
getLogoutUrl(redirectPage = "") {
|
|
3475
|
-
const currentPage = window.location.href;
|
|
3476
|
-
redirectPage = redirectPage ? redirectPage : currentPage;
|
|
3477
|
-
return `${this.getBaseUrl()}${this.endpoints.logoutEndpoint}?redirectionUrl=${redirectPage}&authorization=${this.store.get(this.keys.token)}`;
|
|
3478
|
-
}
|
|
3479
|
-
getUserInfo() {
|
|
3480
|
-
if (this.isLoggedIn()) {
|
|
3481
|
-
return this.store.get(this.keys.user);
|
|
3482
|
-
}
|
|
3483
|
-
}
|
|
3484
|
-
getEventTarget() {
|
|
3485
|
-
return this.eventTarget;
|
|
3486
|
-
}
|
|
3487
|
-
checkExpireTime() {
|
|
3488
|
-
const expire = this.store.get(this.keys.expire);
|
|
3489
|
-
if (!expire) {
|
|
3490
|
-
return;
|
|
3491
|
-
}
|
|
3492
|
-
const now = new Date();
|
|
3493
|
-
const expireDate = new Date(Math.floor(parseInt(expire, 10) * 1000));
|
|
3494
|
-
if (now > expireDate) {
|
|
3495
|
-
console.info('Login time has expired');
|
|
3496
|
-
this.clearUserData();
|
|
3497
|
-
this.loginStateChange();
|
|
3498
|
-
}
|
|
3499
|
-
}
|
|
3500
|
-
checkParameters() {
|
|
3501
|
-
if (!(window === null || window === void 0 ? void 0 : window.location)) {
|
|
3502
|
-
return;
|
|
3503
|
-
}
|
|
3504
|
-
const params = new URLSearchParams(window.location.search);
|
|
3505
|
-
if (params.get("oneTimeCode")) {
|
|
3506
|
-
const oneTimeCode = params.get("oneTimeCode");
|
|
3507
|
-
this.exchangeToken(oneTimeCode).then(() => {
|
|
3508
|
-
const currentHref = window.location.href;
|
|
3509
|
-
const paramPrefix = (currentHref.indexOf('?oneTimeCode') !== -1) ? "?" : "&";
|
|
3510
|
-
history.replaceState({}, document.querySelector('title').innerText, currentHref.replace(`${paramPrefix}oneTimeCode=${oneTimeCode}`, ''));
|
|
3511
|
-
});
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
async fetchUserInfo() {
|
|
3515
|
-
const token = this.store.get(this.keys.token);
|
|
3516
|
-
const reqConfig = {
|
|
3517
|
-
method: 'GET',
|
|
3518
|
-
headers: {
|
|
3519
|
-
'Accept': 'application/json',
|
|
3520
|
-
'Content-Type': 'application/json',
|
|
3521
|
-
'Authorization': token
|
|
3522
|
-
},
|
|
3523
|
-
};
|
|
3524
|
-
const response = await fetch(`${this.getBaseUrl()}${this.endpoints.userInfoEndpoint}`, reqConfig);
|
|
3525
|
-
const data = await response.json();
|
|
3526
|
-
if (data) {
|
|
3527
|
-
try {
|
|
3528
|
-
const { idToken, expiryTime } = data;
|
|
3529
|
-
const userInfo = this.parseUserInfo(idToken);
|
|
3530
|
-
this.store.set(this.keys.user, userInfo);
|
|
3531
|
-
// 10 Min early expire
|
|
3532
|
-
this.store.set(this.keys.expire, expiryTime);
|
|
3533
|
-
this.store.set(this.keys.expireDate, new Date(Math.floor(parseInt(expiryTime, 10) * 1000)));
|
|
3534
|
-
this.loginStateChange();
|
|
3535
|
-
}
|
|
3536
|
-
catch (e) {
|
|
3537
|
-
console.error('Unable to get user information', e);
|
|
3538
|
-
}
|
|
3539
|
-
}
|
|
3540
|
-
}
|
|
3541
|
-
clearUserData() {
|
|
3542
|
-
this.store.remove(this.keys.user);
|
|
3543
|
-
this.store.remove(this.keys.token);
|
|
3544
|
-
this.store.remove(this.keys.expire);
|
|
3545
|
-
this.store.remove(this.keys.expireDate);
|
|
3546
|
-
}
|
|
3547
|
-
getToken() {
|
|
3548
|
-
return this.store.get(this.keys.token);
|
|
3549
|
-
}
|
|
3550
|
-
async exchangeToken(oneTimeCode) {
|
|
3551
|
-
this.clearUserData();
|
|
3552
|
-
const response = await fetch(`${this.getBaseUrl()}${this.endpoints.tokenExchangeEndpoint}?oneTimeCode=${oneTimeCode}`);
|
|
3553
|
-
const { token } = await response.json();
|
|
3554
|
-
if (typeof token === "string" && token) {
|
|
3555
|
-
this.store.set(this.keys.token, token);
|
|
3556
|
-
}
|
|
3557
|
-
this.fetchUserInfo();
|
|
3558
|
-
}
|
|
3559
|
-
loginStateChange() {
|
|
3560
|
-
if (!this.eventTarget) {
|
|
3561
|
-
return;
|
|
3562
|
-
}
|
|
3563
|
-
this.eventTarget.dispatchEvent(new CustomEvent(this.events.loginstatechange, {
|
|
3564
|
-
detail: this.isLoggedIn()
|
|
3565
|
-
}));
|
|
3566
|
-
}
|
|
3567
|
-
getBaseUrl() {
|
|
3568
|
-
const atEnvironments = ["localhost", "integration.", 'local.'];
|
|
3569
|
-
const useATEnv = atEnvironments.filter(x => this.endpoint.indexOf(x) !== -1).length > 0;
|
|
3570
|
-
if (useATEnv) {
|
|
3571
|
-
return this.baseUrls.at;
|
|
3572
|
-
}
|
|
3573
|
-
return this.baseUrls.prod;
|
|
3574
|
-
}
|
|
3575
|
-
parseUserInfo(idToken) {
|
|
3576
|
-
var base64Url = idToken.split('.')[1];
|
|
3577
|
-
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
3578
|
-
var jsonPayload = decodeURIComponent(atob(base64).split('').map(function (c) {
|
|
3579
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
3580
|
-
}).join(''));
|
|
3581
|
-
return JSON.parse(jsonPayload);
|
|
3582
|
-
}
|
|
3583
|
-
}
|
|
3584
|
-
|
|
3585
3715
|
const pnMarketwebSiteheaderLoginCss = "pn-marketweb-siteheader-login{padding:1rem 0;max-height:5.2rem;position:relative}pn-marketweb-siteheader-login strong{padding:0.8rem 1.6rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}pn-marketweb-siteheader-login ul,pn-marketweb-siteheader-login li{list-style:none;margin:0;padding:0}pn-marketweb-siteheader-login li{padding:0.8rem 1.6rem}pn-marketweb-siteheader-login li pn-button{display:block;width:100%}pn-marketweb-siteheader-login pn-nav-dropdown{display:none}pn-marketweb-siteheader-login.hydrated pn-nav-dropdown{display:block}";
|
|
3586
3716
|
|
|
3587
3717
|
let PnMarketwebSiteheaderLogin$1 = class extends HTMLElement {
|
|
@@ -3591,6 +3721,8 @@ let PnMarketwebSiteheaderLogin$1 = class extends HTMLElement {
|
|
|
3591
3721
|
this.loginStateChange = createEvent(this, "loginStateChange", 7);
|
|
3592
3722
|
/** Specifies which endpoint domain we should load from */
|
|
3593
3723
|
this.endpoint = "";
|
|
3724
|
+
/** Access token passed from backend */
|
|
3725
|
+
this.token = "";
|
|
3594
3726
|
this.emitEvents = true;
|
|
3595
3727
|
// Login dialog
|
|
3596
3728
|
this.loginDialog = null;
|
|
@@ -3602,6 +3734,9 @@ let PnMarketwebSiteheaderLogin$1 = class extends HTMLElement {
|
|
|
3602
3734
|
componentWillLoad() {
|
|
3603
3735
|
this.loginManager = new MarketWebLoginManager({ endpoint: this.endpoint, eventTarget: this.hostElement });
|
|
3604
3736
|
this.hostElement["loginmanager"] = this.loginManager;
|
|
3737
|
+
if (this.token) {
|
|
3738
|
+
this.loginManager.registerToken(this.token);
|
|
3739
|
+
}
|
|
3605
3740
|
this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
|
|
3606
3741
|
this.init();
|
|
3607
3742
|
}
|
|
@@ -4083,7 +4218,8 @@ let PnProfileSelector$1 = class extends HTMLElement {
|
|
|
4083
4218
|
this.__registerHost();
|
|
4084
4219
|
this.language = null; //sv
|
|
4085
4220
|
this.returnUrl = "/"; //sv
|
|
4086
|
-
|
|
4221
|
+
// @Prop() endpoint = "/api/userprofile/sync"; // Endpoint where we send in the current user session
|
|
4222
|
+
this.spamode = false; // Endpoint where we send in the current user session
|
|
4087
4223
|
this.loginManager = null;
|
|
4088
4224
|
this.loggedIn = false;
|
|
4089
4225
|
this.i18n = translations$1["en"];
|
|
@@ -4092,9 +4228,10 @@ let PnProfileSelector$1 = class extends HTMLElement {
|
|
|
4092
4228
|
}
|
|
4093
4229
|
componentWillLoad() {
|
|
4094
4230
|
this.loginManager = new MarketWebLoginManager({ eventTarget: this.hostElement });
|
|
4095
|
-
this.loginManager.init(
|
|
4231
|
+
this.loginManager.init(this.spamode);
|
|
4096
4232
|
this.hostElement["loginmanager"] = this.loginManager;
|
|
4097
4233
|
this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
|
|
4234
|
+
this.checkLoggedInState();
|
|
4098
4235
|
this.setInitialValues().then(() => {
|
|
4099
4236
|
this.init();
|
|
4100
4237
|
});
|
|
@@ -4114,19 +4251,25 @@ let PnProfileSelector$1 = class extends HTMLElement {
|
|
|
4114
4251
|
init() {
|
|
4115
4252
|
this.setTranslations();
|
|
4116
4253
|
}
|
|
4254
|
+
checkLoggedInState() {
|
|
4255
|
+
if (this.loginManager.getToken() && this.loginManager.getUserInfo()) {
|
|
4256
|
+
this.onLoginStateChange({ detail: true });
|
|
4257
|
+
}
|
|
4258
|
+
}
|
|
4117
4259
|
async onLoginStateChange(e) {
|
|
4118
4260
|
if (this.loggedIn !== e.detail) {
|
|
4119
4261
|
this.loggedIn = e.detail;
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
}
|
|
4262
|
+
this.isLoading = false;
|
|
4263
|
+
this.redirectUser();
|
|
4264
|
+
// const token = this.loginManager.getToken();
|
|
4265
|
+
// if (this.loggedIn && token) {
|
|
4266
|
+
// try {
|
|
4267
|
+
// await fetch(this.endpoint + '?token=' + token);
|
|
4268
|
+
// if (this.numberOfProfiles === 1) {
|
|
4269
|
+
// this.redirectUser();
|
|
4270
|
+
// }
|
|
4271
|
+
// } catch(e) { }
|
|
4272
|
+
// }
|
|
4130
4273
|
}
|
|
4131
4274
|
}
|
|
4132
4275
|
async onLoggedIn() {
|
|
@@ -4451,16 +4594,16 @@ const PnMainnav = /*@__PURE__*/proxyCustomElement(PnMainnav$1, [4,"pn-mainnav",{
|
|
|
4451
4594
|
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]}]);
|
|
4452
4595
|
const PnMainnavLink = /*@__PURE__*/proxyCustomElement(PnMainnavLink$1, [4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]);
|
|
4453
4596
|
const PnMainnavList = /*@__PURE__*/proxyCustomElement(PnMainnavList$1, [4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}]);
|
|
4454
|
-
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]}]);
|
|
4455
|
-
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],"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"]]]);
|
|
4456
|
-
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]}]);
|
|
4597
|
+
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]}]);
|
|
4598
|
+
const PnMarketwebSiteheader = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheader$1, [4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"token":[1],"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],"loggedIn":[32],"loginManager":[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]);
|
|
4599
|
+
const PnMarketwebSiteheaderLogin = /*@__PURE__*/proxyCustomElement(PnMarketwebSiteheaderLogin$1, [0,"pn-marketweb-siteheader-login",{"endpoint":[1],"token":[1],"i18n":[8,"i-1-8n"],"emitEvents":[4,"emit-events"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32],"username":[32]}]);
|
|
4457
4600
|
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]}]);
|
|
4458
4601
|
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]}]);
|
|
4459
4602
|
const PnProductPricelistResult = /*@__PURE__*/proxyCustomElement(PnFindProductPricelistResult, [0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]);
|
|
4460
4603
|
const PnProductTile = /*@__PURE__*/proxyCustomElement(PnProductTile$1, [4,"pn-product-tile"]);
|
|
4461
4604
|
const PnProductTileInfo = /*@__PURE__*/proxyCustomElement(PnProductTileInfo$1, [0,"pn-product-tile-info",{"label":[1],"text":[1],"icon":[1]}]);
|
|
4462
4605
|
const PnProductTilePrice = /*@__PURE__*/proxyCustomElement(PnProductTilePrice$1, [0,"pn-product-tile-price",{"label":[1],"amount":[1],"currency":[1],"url":[1]}]);
|
|
4463
|
-
const PnProfileSelector = /*@__PURE__*/proxyCustomElement(PnProfileSelector$1, [0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"
|
|
4606
|
+
const PnProfileSelector = /*@__PURE__*/proxyCustomElement(PnProfileSelector$1, [0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]);
|
|
4464
4607
|
const PnSidenav = /*@__PURE__*/proxyCustomElement(PnSidenav$1, [4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]);
|
|
4465
4608
|
const PnSidenavLevel = /*@__PURE__*/proxyCustomElement(PnSidenavLevel$1, [4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]);
|
|
4466
4609
|
const PnSidenavLink = /*@__PURE__*/proxyCustomElement(PnSidenavLink$1, [4,"pn-sidenav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"icon":[1],"current":[4],"levelId":[32],"open":[32],"hasChildren":[32]}]);
|