@postnord/pn-marketweb-components 1.0.24 → 1.0.28
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/{MarketWebContextService-420668a7.js → MarketWebContextService-bdc46f40.js} +8 -4
- package/cjs/pn-language-selector_9.cjs.entry.js +9 -7
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +15 -10
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +10 -8
- package/cjs/pn-site-footer_2.cjs.entry.js +2 -2
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js +14 -9
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.stories.js +8 -5
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.js +1 -1
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-loginmanager.js +8 -7
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +9 -7
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +1 -1
- package/collection/components/navigation/pn-site-footer/pn-site-footer-col.css +6 -1
- package/collection/components/navigation/pn-site-footer/pn-site-footer.css +6 -0
- package/collection/components/navigation/pn-site-footer/site-footer.stories.js +78 -0
- package/collection/globals/MarketWebContextService.js +8 -4
- package/custom-elements/index.js +42 -29
- package/esm/{MarketWebContextService-9a201388.js → MarketWebContextService-ab7796c6.js} +8 -4
- package/esm/pn-language-selector_9.entry.js +9 -7
- package/esm/pn-marketweb-sitefooter.entry.js +15 -10
- package/esm/pn-marketweb-siteheader.entry.js +10 -8
- package/esm/pn-site-footer_2.entry.js +2 -2
- package/esm-es5/MarketWebContextService-ab7796c6.js +1 -0
- package/esm-es5/pn-language-selector_9.entry.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-site-footer_2.entry.js +1 -1
- package/package.json +2 -2
- package/pn-market-web-components/p-031d91aa.entry.js +1 -0
- package/pn-market-web-components/p-134f14eb.system.entry.js +1 -0
- package/pn-market-web-components/p-25bdf3f8.system.js +1 -1
- package/pn-market-web-components/p-4d6fce0c.js +1 -0
- package/pn-market-web-components/p-79611456.system.entry.js +1 -0
- package/pn-market-web-components/{p-c9e9854e.entry.js → p-88d82a49.entry.js} +1 -1
- package/pn-market-web-components/p-9860fea8.system.js +1 -0
- package/pn-market-web-components/p-a6da9324.system.entry.js +1 -0
- package/pn-market-web-components/{p-eb814816.system.entry.js → p-b27c3539.system.entry.js} +1 -1
- package/pn-market-web-components/{p-96c77769.entry.js → p-c2b8aa29.entry.js} +1 -1
- package/pn-market-web-components/p-d67686ea.entry.js +1 -0
- 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 +1 -0
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-loginmanager.d.ts +1 -1
- package/types/globals/MarketWebContextService.d.ts +1 -1
- package/esm-es5/MarketWebContextService-9a201388.js +0 -1
- package/pn-market-web-components/p-02eed66e.system.entry.js +0 -1
- package/pn-market-web-components/p-6299f92f.system.entry.js +0 -1
- package/pn-market-web-components/p-64dc840d.js +0 -1
- package/pn-market-web-components/p-88ab0d91.system.entry.js +0 -1
- package/pn-market-web-components/p-a320fe58.system.js +0 -1
- package/pn-market-web-components/p-ae0e5fd8.entry.js +0 -1
- package/pn-market-web-components/p-d7441208.entry.js +0 -1
|
@@ -31,7 +31,7 @@ class MarketWebContextService {
|
|
|
31
31
|
this.environments = {
|
|
32
32
|
"production": {
|
|
33
33
|
"name": "production",
|
|
34
|
-
"url": "https://
|
|
34
|
+
"url": "https://www.postnord.xx/"
|
|
35
35
|
},
|
|
36
36
|
"preproduction": {
|
|
37
37
|
"name": "preproduction",
|
|
@@ -59,11 +59,15 @@ class MarketWebContextService {
|
|
|
59
59
|
await this.resolveMarket();
|
|
60
60
|
return this.market;
|
|
61
61
|
}
|
|
62
|
-
async getEndpoint(environmentName) {
|
|
62
|
+
async getEndpoint(environmentName, marketName = "") {
|
|
63
|
+
let url = this.environments.production.url;
|
|
63
64
|
if (this.environments[environmentName]) {
|
|
64
|
-
|
|
65
|
+
url = this.environments[environmentName].url;
|
|
66
|
+
if (environmentName === this.environments.production.name) {
|
|
67
|
+
url = url.replace(".xx", "." + marketName);
|
|
68
|
+
}
|
|
65
69
|
}
|
|
66
|
-
return
|
|
70
|
+
return url;
|
|
67
71
|
}
|
|
68
72
|
async getEnvironmentName() {
|
|
69
73
|
const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(('-' + x)) !== -1)[0];
|
|
@@ -378,13 +378,15 @@ class PNLoginManager {
|
|
|
378
378
|
this.endpoint = options.endpoint ? options.endpoint : `${window.location.protocol}//${window.location.host}`;
|
|
379
379
|
(_a = this.storagePrefix) !== null && _a !== void 0 ? _a : (this.storagePrefix = options.storagePrefix);
|
|
380
380
|
}
|
|
381
|
-
init() {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
this.
|
|
381
|
+
init(checkParameters = true) {
|
|
382
|
+
if (checkParameters) {
|
|
383
|
+
this.checkParameters();
|
|
384
|
+
this.checkExpireTime();
|
|
385
|
+
if (this.store.get(this.keys.token) && !this.store.get(this.keys.user)) {
|
|
386
|
+
this.fetchUserInfo();
|
|
387
|
+
}
|
|
388
|
+
this.loginStateChange();
|
|
386
389
|
}
|
|
387
|
-
this.loginStateChange();
|
|
388
390
|
}
|
|
389
391
|
isLoggedIn() {
|
|
390
392
|
const isLoggedIn = (this.store.get(this.keys.token) && this.store.get(this.keys.user)) ? true : false;
|
|
@@ -529,7 +531,7 @@ let PnMarketwebSiteheaderLogin = class {
|
|
|
529
531
|
}
|
|
530
532
|
async init() {
|
|
531
533
|
this.toggleButtonText = this.loginDialog.loginMenuLinkText;
|
|
532
|
-
this.loginManager.init();
|
|
534
|
+
this.loginManager.init(this.emitEvents);
|
|
533
535
|
this.setToggleButtonText();
|
|
534
536
|
}
|
|
535
537
|
setToggleButtonText() {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0404c97e.js');
|
|
6
|
-
const MarketWebContextService = require('./MarketWebContextService-
|
|
6
|
+
const MarketWebContextService = require('./MarketWebContextService-bdc46f40.js');
|
|
7
7
|
|
|
8
8
|
const translations = {
|
|
9
9
|
'sv': {
|
|
@@ -78,21 +78,21 @@ let PnMarketwebSiteheader = class {
|
|
|
78
78
|
async setInitialValues(href = window.location.href) {
|
|
79
79
|
var _a;
|
|
80
80
|
const marketWebContextService = new MarketWebContextService.MarketWebContextService(href);
|
|
81
|
-
if (this.market
|
|
81
|
+
if (!this.market) {
|
|
82
82
|
const resolvedMarket = await marketWebContextService.getMarket();
|
|
83
83
|
this.market = resolvedMarket;
|
|
84
84
|
}
|
|
85
|
-
if (this.language
|
|
85
|
+
if (!this.language) {
|
|
86
86
|
const resolvedMarket = await marketWebContextService.getLanguage();
|
|
87
87
|
this.language = resolvedMarket;
|
|
88
88
|
}
|
|
89
|
-
if (this.environment
|
|
89
|
+
if (!this.environment) {
|
|
90
90
|
this.environment = await marketWebContextService.getEnvironmentName();
|
|
91
91
|
}
|
|
92
|
-
if (this.endpoint
|
|
93
|
-
this.endpoint = await marketWebContextService.getEndpoint(this.environment);
|
|
92
|
+
if ((!this.endpoint) && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
|
|
93
|
+
this.endpoint = await marketWebContextService.getEndpoint(this.environment, this.market);
|
|
94
94
|
}
|
|
95
|
-
if (this.endpoint
|
|
95
|
+
if (!this.endpoint) {
|
|
96
96
|
this.endpoint = "";
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -161,19 +161,24 @@ let PnMarketwebSiteheader = class {
|
|
|
161
161
|
this.gotData = true;
|
|
162
162
|
this.fetchingData = true;
|
|
163
163
|
}
|
|
164
|
+
uniqueId(text) {
|
|
165
|
+
return "footer-" + text.replace(/[^A-Za-z0-9.\\\/]/igm, "");
|
|
166
|
+
}
|
|
164
167
|
render() {
|
|
165
168
|
var _a, _b, _c, _d, _e;
|
|
166
169
|
return (index.h(index.Host, { language: this.language, market: this.market, environment: this.environment }, index.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) => (index.h("pn-site-footer-col", null, index.h("h3", null, column.heading), column.links ? (index.h("ul", Object.assign({}, ((column.links && column.links[0] && column.links[0].linkType) && { 'class': 'social-media' })), column.links.map((link) => {
|
|
167
|
-
|
|
170
|
+
let linkText = link.linkText;
|
|
168
171
|
if (link.linkType) {
|
|
169
172
|
linkText = this.getLinkContentByType(link.linkType);
|
|
170
173
|
}
|
|
171
|
-
|
|
174
|
+
let linkId = this.uniqueId(linkText);
|
|
175
|
+
return (index.h("li", null, index.h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText, id: linkId }))));
|
|
172
176
|
}))) : null, column.body ? (index.h("div", { innerHTML: column.body })) : null))) : null, index.h("div", { slot: "bottom" }, (this.gotData && ((_d = this.footerContent) === null || _d === void 0 ? void 0 : _d.copyrightText)) ? (index.h("span", null, this.footerContent.copyrightText)) : null, (this.gotData && ((_e = this.footerContent) === null || _e === void 0 ? void 0 : _e.bottomLinks)) ? (index.h("span", null, this.footerContent.bottomLinks.map((link) => {
|
|
173
177
|
if (!link.linkHref) {
|
|
174
178
|
return (index.h("span", null, link.linkText));
|
|
175
179
|
}
|
|
176
|
-
|
|
180
|
+
let linkId = this.uniqueId(link.linkText);
|
|
181
|
+
return (index.h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, id: linkId }), link.linkText));
|
|
177
182
|
}))) : null))));
|
|
178
183
|
}
|
|
179
184
|
get hostElement() { return index.getElement(this); }
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0404c97e.js');
|
|
6
|
-
const MarketWebContextService = require('./MarketWebContextService-
|
|
6
|
+
const MarketWebContextService = require('./MarketWebContextService-bdc46f40.js');
|
|
7
7
|
|
|
8
8
|
const translations = {
|
|
9
9
|
'sv': {
|
|
@@ -105,21 +105,21 @@ let PnMarketwebSiteheader = class {
|
|
|
105
105
|
async setInitialValues(href = window.location.href) {
|
|
106
106
|
var _a;
|
|
107
107
|
const marketWebContextService = new MarketWebContextService.MarketWebContextService(href);
|
|
108
|
-
if (this.market
|
|
108
|
+
if (!this.market) {
|
|
109
109
|
const resolvedMarket = await marketWebContextService.getMarket();
|
|
110
110
|
this.market = resolvedMarket;
|
|
111
111
|
}
|
|
112
|
-
if (this.language
|
|
112
|
+
if (!this.language) {
|
|
113
113
|
const resolvedMarket = await marketWebContextService.getLanguage();
|
|
114
114
|
this.language = resolvedMarket;
|
|
115
115
|
}
|
|
116
|
-
if (this.environment
|
|
116
|
+
if (!this.environment) {
|
|
117
117
|
this.environment = await marketWebContextService.getEnvironmentName();
|
|
118
118
|
}
|
|
119
|
-
if (this.endpoint
|
|
120
|
-
this.endpoint = await marketWebContextService.getEndpoint(this.environment);
|
|
119
|
+
if (!this.endpoint && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
|
|
120
|
+
this.endpoint = await marketWebContextService.getEndpoint(this.environment, this.market);
|
|
121
121
|
}
|
|
122
|
-
if (this.endpoint
|
|
122
|
+
if (!this.endpoint) {
|
|
123
123
|
this.endpoint = "";
|
|
124
124
|
}
|
|
125
125
|
}
|
|
@@ -153,7 +153,9 @@ let PnMarketwebSiteheader = class {
|
|
|
153
153
|
this.fetchingData = true;
|
|
154
154
|
const endpointBase = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
|
|
155
155
|
const fetchUrl = `${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}`;
|
|
156
|
-
const response = await fetch(fetchUrl
|
|
156
|
+
const response = await fetch(fetchUrl, {
|
|
157
|
+
'mode': 'cors'
|
|
158
|
+
});
|
|
157
159
|
const data = await response.json();
|
|
158
160
|
await this.setStateFromData(data);
|
|
159
161
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0404c97e.js');
|
|
6
6
|
|
|
7
|
-
const pnSiteFooterCss = "pn-site-footer{display:block;line-height:1.5}pn-site-footer a{color:#005D92}pn-site-footer a:hover{color:#0D234B;text-decoration:underline}pn-site-footer h3{font-size:2.4rem;margin-bottom:0.5rem;line-height:1.2}pn-site-footer p{font-size:1.6rem}pn-site-footer ul.social-media{display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row}pn-site-footer ul.social-media li{margin-right:1.6rem}pn-site-footer>svg{display:block}pn-site-footer>div{background:#F3F2F2}.pn-sitefooter-cols{display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap;margin:0 auto;max-width:90em}.pn-sitefooter-bottom [slot=bottom]{max-width:90em;margin:0 auto;padding:1.6rem 0;display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;-ms-flex-pack:center;justify-content:center;-ms-flex-wrap:wrap;flex-wrap:wrap;border-top:1px solid #D3CECB;border-bottom:1px solid #D3CECB}.pn-sitefooter-bottom [slot=bottom] span,.pn-sitefooter-bottom [slot=bottom] a{line-height:2;margin:0 1.6rem;text-decoration:none}.pn-sitefooter-bottom [slot=bottom] li{line-height:2em;margin:0 1.6rem}.pn-sitefooter-logo{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:center;justify-content:center;padding:3rem}.pn-sitefooter-logo svg{display:block;width:13.3rem;height:2.6rem}";
|
|
7
|
+
const pnSiteFooterCss = "pn-site-footer{display:block;line-height:1.5}pn-site-footer a{color:#005D92}pn-site-footer a:hover{color:#0D234B;text-decoration:underline}pn-site-footer h3{font-size:2.4rem;margin-bottom:0.5rem;line-height:1.2}pn-site-footer p{font-size:1.6rem}pn-site-footer ul.social-media{display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row}pn-site-footer ul.social-media li{margin-right:1.6rem}pn-site-footer>svg{display:block}pn-site-footer>div{background:#F3F2F2}.pn-sitefooter-top{display:-ms-flexbox;display:flex}.pn-sitefooter-cols{-ms-flex-item-align:center;align-self:center;-ms-flex-pack:center;justify-content:center;display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap;margin:0 auto;max-width:90em}.pn-sitefooter-bottom [slot=bottom]{max-width:90em;margin:0 auto;padding:1.6rem 0;display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;-ms-flex-pack:center;justify-content:center;-ms-flex-wrap:wrap;flex-wrap:wrap;border-top:1px solid #D3CECB;border-bottom:1px solid #D3CECB}.pn-sitefooter-bottom [slot=bottom] span,.pn-sitefooter-bottom [slot=bottom] a{line-height:2;margin:0 1.6rem;text-decoration:none}.pn-sitefooter-bottom [slot=bottom] li{line-height:2em;margin:0 1.6rem}.pn-sitefooter-logo{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:center;justify-content:center;padding:3rem}.pn-sitefooter-logo svg{display:block;width:13.3rem;height:2.6rem}";
|
|
8
8
|
|
|
9
9
|
let PnSiteFooter = class {
|
|
10
10
|
constructor(hostRef) {
|
|
@@ -20,7 +20,7 @@ let PnSiteFooter = class {
|
|
|
20
20
|
};
|
|
21
21
|
PnSiteFooter.style = pnSiteFooterCss;
|
|
22
22
|
|
|
23
|
-
const pnSiteFooterColCss = "pn-site-footer-col{min-width:
|
|
23
|
+
const pnSiteFooterColCss = "pn-site-footer-col{min-width:15em;padding:2.5em 1.5rem 0}@media screen and (min-width: 48em){pn-site-footer-col{max-width:25%}}pn-site-footer-col ul{list-style-type:none;padding:0;margin:0}pn-site-footer-col li{margin-bottom:1.6rem}pn-site-footer-col a{text-decoration:none;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}pn-site-footer-col p{margin-top:0;margin-bottom:1rem}";
|
|
24
24
|
|
|
25
25
|
let PnSiteFooterCol = class {
|
|
26
26
|
constructor(hostRef) {
|
package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js
CHANGED
|
@@ -23,21 +23,21 @@ export class PnMarketwebSiteheader {
|
|
|
23
23
|
async setInitialValues(href = window.location.href) {
|
|
24
24
|
var _a;
|
|
25
25
|
const marketWebContextService = new MarketWebContextService(href);
|
|
26
|
-
if (this.market
|
|
26
|
+
if (!this.market) {
|
|
27
27
|
const resolvedMarket = await marketWebContextService.getMarket();
|
|
28
28
|
this.market = resolvedMarket;
|
|
29
29
|
}
|
|
30
|
-
if (this.language
|
|
30
|
+
if (!this.language) {
|
|
31
31
|
const resolvedMarket = await marketWebContextService.getLanguage();
|
|
32
32
|
this.language = resolvedMarket;
|
|
33
33
|
}
|
|
34
|
-
if (this.environment
|
|
34
|
+
if (!this.environment) {
|
|
35
35
|
this.environment = await marketWebContextService.getEnvironmentName();
|
|
36
36
|
}
|
|
37
|
-
if (this.endpoint
|
|
38
|
-
this.endpoint = await marketWebContextService.getEndpoint(this.environment);
|
|
37
|
+
if ((!this.endpoint) && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
|
|
38
|
+
this.endpoint = await marketWebContextService.getEndpoint(this.environment, this.market);
|
|
39
39
|
}
|
|
40
|
-
if (this.endpoint
|
|
40
|
+
if (!this.endpoint) {
|
|
41
41
|
this.endpoint = "";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -106,6 +106,9 @@ export class PnMarketwebSiteheader {
|
|
|
106
106
|
this.gotData = true;
|
|
107
107
|
this.fetchingData = true;
|
|
108
108
|
}
|
|
109
|
+
uniqueId(text) {
|
|
110
|
+
return "footer-" + text.replace(/[^A-Za-z0-9.\\\/]/igm, "");
|
|
111
|
+
}
|
|
109
112
|
render() {
|
|
110
113
|
var _a, _b, _c, _d, _e;
|
|
111
114
|
return (h(Host, { language: this.language, market: this.market, environment: this.environment },
|
|
@@ -113,12 +116,13 @@ export class PnMarketwebSiteheader {
|
|
|
113
116
|
(this.gotData && ((_c = this.footerContent) === null || _c === void 0 ? void 0 : _c.columns)) ? this.footerContent.columns.map((column) => (h("pn-site-footer-col", null,
|
|
114
117
|
h("h3", null, column.heading),
|
|
115
118
|
column.links ? (h("ul", Object.assign({}, ((column.links && column.links[0] && column.links[0].linkType) && { 'class': 'social-media' })), column.links.map((link) => {
|
|
116
|
-
|
|
119
|
+
let linkText = link.linkText;
|
|
117
120
|
if (link.linkType) {
|
|
118
121
|
linkText = this.getLinkContentByType(link.linkType);
|
|
119
122
|
}
|
|
123
|
+
let linkId = this.uniqueId(linkText);
|
|
120
124
|
return (h("li", null,
|
|
121
|
-
h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText }))));
|
|
125
|
+
h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText, id: linkId }))));
|
|
122
126
|
}))) : null,
|
|
123
127
|
column.body ? (h("div", { innerHTML: column.body })) : null))) : null,
|
|
124
128
|
h("div", { slot: "bottom" },
|
|
@@ -127,7 +131,8 @@ export class PnMarketwebSiteheader {
|
|
|
127
131
|
if (!link.linkHref) {
|
|
128
132
|
return (h("span", null, link.linkText));
|
|
129
133
|
}
|
|
130
|
-
|
|
134
|
+
let linkId = this.uniqueId(link.linkText);
|
|
135
|
+
return (h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, id: linkId }), link.linkText));
|
|
131
136
|
}))) : null))));
|
|
132
137
|
}
|
|
133
138
|
static get is() { return "pn-marketweb-sitefooter"; }
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
title: "Web Components/Market web site Footer",
|
|
5
5
|
parameters: {
|
|
6
6
|
notes: readme,
|
|
7
|
-
layout: 'fullscreen'
|
|
7
|
+
layout: 'fullscreen',
|
|
8
8
|
},
|
|
9
9
|
argTypes: {
|
|
10
10
|
market : {
|
|
@@ -42,15 +42,18 @@ const Template = ({ ...args }) => {
|
|
|
42
42
|
return `<pn-marketweb-sitefooter
|
|
43
43
|
market="${ args.market }"
|
|
44
44
|
language="${ args.language }"
|
|
45
|
-
endpoint="${ args.endpoint }"
|
|
45
|
+
endpoint="${ args.endpoint }"
|
|
46
|
+
environment="${ args.environment }"
|
|
47
|
+
>
|
|
46
48
|
</pn-marketweb-sitefooter>`;
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
export const Primary = Template.bind({});
|
|
50
52
|
Primary.args = {
|
|
51
|
-
market : "
|
|
52
|
-
language: '
|
|
53
|
-
|
|
53
|
+
market : "com",
|
|
54
|
+
language: 'en',
|
|
55
|
+
environment: "production",
|
|
56
|
+
endpoint: "",// 'https://www.postnord.se'
|
|
54
57
|
};
|
|
55
58
|
|
|
56
59
|
|
|
@@ -19,7 +19,7 @@ export class PnMarketwebSiteheaderLogin {
|
|
|
19
19
|
}
|
|
20
20
|
async init() {
|
|
21
21
|
this.toggleButtonText = this.loginDialog.loginMenuLinkText;
|
|
22
|
-
this.loginManager.init();
|
|
22
|
+
this.loginManager.init(this.emitEvents);
|
|
23
23
|
this.setToggleButtonText();
|
|
24
24
|
}
|
|
25
25
|
setToggleButtonText() {
|
|
@@ -59,14 +59,15 @@ class PNLoginManager {
|
|
|
59
59
|
this.endpoint = options.endpoint ? options.endpoint : `${window.location.protocol}//${window.location.host}`;
|
|
60
60
|
(_a = this.storagePrefix) !== null && _a !== void 0 ? _a : (this.storagePrefix = options.storagePrefix);
|
|
61
61
|
}
|
|
62
|
-
init() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
init(checkParameters = true) {
|
|
63
|
+
if (checkParameters) {
|
|
64
|
+
this.checkParameters();
|
|
65
|
+
this.checkExpireTime();
|
|
66
|
+
if (this.store.get(this.keys.token) && !this.store.get(this.keys.user)) {
|
|
67
|
+
this.fetchUserInfo();
|
|
68
|
+
}
|
|
69
|
+
this.loginStateChange();
|
|
68
70
|
}
|
|
69
|
-
this.loginStateChange();
|
|
70
71
|
}
|
|
71
72
|
isLoggedIn() {
|
|
72
73
|
const isLoggedIn = (this.store.get(this.keys.token) && this.store.get(this.keys.user)) ? true : false;
|
package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js
CHANGED
|
@@ -48,21 +48,21 @@ export class PnMarketwebSiteheader {
|
|
|
48
48
|
async setInitialValues(href = window.location.href) {
|
|
49
49
|
var _a;
|
|
50
50
|
const marketWebContextService = new MarketWebContextService(href);
|
|
51
|
-
if (this.market
|
|
51
|
+
if (!this.market) {
|
|
52
52
|
const resolvedMarket = await marketWebContextService.getMarket();
|
|
53
53
|
this.market = resolvedMarket;
|
|
54
54
|
}
|
|
55
|
-
if (this.language
|
|
55
|
+
if (!this.language) {
|
|
56
56
|
const resolvedMarket = await marketWebContextService.getLanguage();
|
|
57
57
|
this.language = resolvedMarket;
|
|
58
58
|
}
|
|
59
|
-
if (this.environment
|
|
59
|
+
if (!this.environment) {
|
|
60
60
|
this.environment = await marketWebContextService.getEnvironmentName();
|
|
61
61
|
}
|
|
62
|
-
if (this.endpoint
|
|
63
|
-
this.endpoint = await marketWebContextService.getEndpoint(this.environment);
|
|
62
|
+
if (!this.endpoint && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
|
|
63
|
+
this.endpoint = await marketWebContextService.getEndpoint(this.environment, this.market);
|
|
64
64
|
}
|
|
65
|
-
if (this.endpoint
|
|
65
|
+
if (!this.endpoint) {
|
|
66
66
|
this.endpoint = "";
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -96,7 +96,9 @@ export class PnMarketwebSiteheader {
|
|
|
96
96
|
this.fetchingData = true;
|
|
97
97
|
const endpointBase = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
|
|
98
98
|
const fetchUrl = `${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}`;
|
|
99
|
-
const response = await fetch(fetchUrl
|
|
99
|
+
const response = await fetch(fetchUrl, {
|
|
100
|
+
'mode': 'cors'
|
|
101
|
+
});
|
|
100
102
|
const data = await response.json();
|
|
101
103
|
await this.setStateFromData(data);
|
|
102
104
|
}
|
|
@@ -85,3 +85,81 @@ export const Primary = Template.bind({});
|
|
|
85
85
|
Primary.args = {
|
|
86
86
|
logoUrl : "https://www.postnord.se"
|
|
87
87
|
};
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
const TemplateNorwegian = ({ ...args }) => {
|
|
92
|
+
return `
|
|
93
|
+
<pn-site-footer url="${args.logoUrl}">
|
|
94
|
+
<pn-site-footer-col>
|
|
95
|
+
<h3>Finn oss</h3>
|
|
96
|
+
<ul></ul>
|
|
97
|
+
<div><a href="https://my.postnord.no/service-points?context=privat"
|
|
98
|
+
title="Søk etter pakkeleveringssted">
|
|
99
|
+
<pn-icon symbol="map-marker" color="blue700" class="pn-icon hydrated"
|
|
100
|
+
innerhtml="<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 2a8 8 0 00-6.857 12.124l.014.022 4.454 6.586a2.884 2.884 0 004.778 0l4.454-6.586.014-.022A8 8 0 0012 2zm-6 8a6 6 0 1111.156 3.07l-4.424 6.541a.883.883 0 01-1.464 0L6.844 13.07A5.968 5.968 0 016 10zm6-2.5a2.5 2.5 0 100 5 2.5 2.5 0 000-5z" fill="#005D92"/></svg>">
|
|
101
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
102
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
103
|
+
d="M12 2a8 8 0 00-6.857 12.124l.014.022 4.454 6.586a2.884 2.884 0 004.778 0l4.454-6.586.014-.022A8 8 0 0012 2zm-6 8a6 6 0 1111.156 3.07l-4.424 6.541a.883.883 0 01-1.464 0L6.844 13.07A5.968 5.968 0 016 10zm6-2.5a2.5 2.5 0 100 5 2.5 2.5 0 000-5z"
|
|
104
|
+
fill="#005D92"></path>
|
|
105
|
+
</svg></pn-icon>Søk etter pakkeleveringssted
|
|
106
|
+
</a>
|
|
107
|
+
<p> </p>
|
|
108
|
+
<p>Besøksadresse:<br>Alfaset, 3. industrivei 25<br>0668 Oslo</p>
|
|
109
|
+
<p>Postadresse:<br>Postboks 6441 Etterstad<br>0605 Oslo</p>
|
|
110
|
+
</div>
|
|
111
|
+
</pn-site-footer-col>
|
|
112
|
+
<pn-site-footer-col>
|
|
113
|
+
<h3>Om oss</h3>
|
|
114
|
+
<ul>
|
|
115
|
+
<li><a href="/om-oss/jobb" title="Jobb og karriere">Jobb og karriere</a></li>
|
|
116
|
+
<li><a href="/nyheter" title="Nyheter og pressemeldinger">Nyheter og pressemeldinger</a></li>
|
|
117
|
+
<li><a href="/om-oss/avdelinger-og-butikker" title="Avdelinger og PostNord-butikker">Avdelinger og
|
|
118
|
+
PostNord-butikker</a></li>
|
|
119
|
+
<li><a href="/om-oss/samfunnsansvar" title="Samfunnsansvar">Samfunnsansvar</a></li>
|
|
120
|
+
</ul>
|
|
121
|
+
</pn-site-footer-col>
|
|
122
|
+
<pn-site-footer-col>
|
|
123
|
+
<h3>Kontakt oss</h3>
|
|
124
|
+
<ul>
|
|
125
|
+
<li><a href="/om-oss/media" title="Pressekontakter">Pressekontakter</a></li>
|
|
126
|
+
<li><a href="/tjenester-bedrift/tilbud" title="Bli kunde">Bli kunde</a></li>
|
|
127
|
+
</ul>
|
|
128
|
+
</pn-site-footer-col>
|
|
129
|
+
<pn-site-footer-col>
|
|
130
|
+
<h3>Følg oss</h3>
|
|
131
|
+
<ul class="social-media">
|
|
132
|
+
<li><a href="https://www.facebook.com/PostNordNorge" title="Facebook"><svg width="56" height="56"
|
|
133
|
+
viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
134
|
+
<circle cx="28" cy="28" r="28" fill="#005D92"></circle>
|
|
135
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
136
|
+
d="M38.6754 16H17.3246C16.593 16 16 16.5929 16 17.3246V38.6754C16 39.407 16.593 40 17.3246 40H28.8191V30.706H25.6915V27.0839H28.8191V24.4127C28.8191 21.3128 30.7124 19.6248 33.4778 19.6248C34.8023 19.6248 35.9409 19.7235 36.2726 19.7675V23.0071L34.3547 23.008C32.8507 23.008 32.5596 23.7226 32.5596 24.7713V27.0839H36.1463L35.6793 30.706H32.5596V40H38.6754C39.407 40 40 39.407 40 38.6754V17.3246C40 16.5929 39.407 16 38.6754 16Z"
|
|
137
|
+
fill="white"></path>
|
|
138
|
+
</svg></a></li>
|
|
139
|
+
<li><a href="https://twitter.com/PostNordNorgeAS" title="Twitter"><svg width="56" height="56"
|
|
140
|
+
viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
141
|
+
<circle cx="28" cy="28" r="28" fill="#005D92"></circle>
|
|
142
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
143
|
+
d="M41.3337 19.8587C40.3525 20.2871 39.2981 20.5766 38.1914 20.7068C39.321 20.0402 40.1884 18.9847 40.5969 17.7272C39.5399 18.3443 38.369 18.7925 37.1228 19.0341C36.1248 17.9874 34.7029 17.3333 33.1294 17.3333C30.1079 17.3333 27.6583 19.7446 27.6583 22.7188C27.6583 23.1409 27.7067 23.552 27.8 23.9461C23.253 23.7216 19.2218 21.5775 16.5234 18.3191C16.0525 19.1146 15.7827 20.0397 15.7827 21.0267C15.7827 22.8951 16.7486 24.5436 18.2166 25.5093C17.3197 25.4814 16.4762 25.2391 15.7385 24.8358C15.7381 24.8582 15.7381 24.8808 15.7381 24.9035C15.7381 27.5129 17.6239 29.6896 20.1267 30.1843C19.6676 30.3074 19.1843 30.3732 18.6853 30.3732C18.3328 30.3732 17.99 30.3395 17.656 30.2766C18.3522 32.4163 20.3726 33.9733 22.7667 34.0168C20.8943 35.4612 18.5353 36.3222 15.9721 36.3222C15.5305 36.3222 15.095 36.2968 14.667 36.2471C17.0881 37.7751 19.9639 38.6666 23.0535 38.6666C33.1166 38.6666 38.6195 30.4602 38.6195 23.3433C38.6195 23.1098 38.6142 22.8776 38.6037 22.6466C39.6725 21.8873 40.6002 20.9387 41.3337 19.8587Z"
|
|
144
|
+
fill="white"></path>
|
|
145
|
+
</svg></a></li>
|
|
146
|
+
<li><a href="https://www.linkedin.com/company/postnord-norge" title="LinkedIn "><svg width="56"
|
|
147
|
+
height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
148
|
+
<circle cx="28" cy="28" r="28" fill="#005D92"></circle>
|
|
149
|
+
<path
|
|
150
|
+
d="M37.5809 16H18.4191C17.0832 16 16 17.0747 16 18.399V37.601C16 38.9267 17.0832 40 18.4191 40H37.5809C38.9182 40 40 38.9253 40 37.601V18.399C40 17.0747 38.9182 16 37.5809 16ZM23.7013 34.9895H20.4725V24.7229H23.7013V34.9895ZM22.0653 23.4634C21.0462 23.4634 20.3874 22.7487 20.3874 21.8672C20.3874 20.965 21.0672 20.2711 22.1085 20.2711C23.1499 20.2711 23.7864 20.9636 23.8074 21.8672C23.8074 22.7501 23.1485 23.4634 22.0653 23.4634ZM35.4912 34.9895H32.2624V29.3002C32.2624 27.9772 31.7948 27.075 30.6264 27.075C29.7344 27.075 29.204 27.6834 28.9695 28.2711C28.8843 28.4808 28.8634 28.7746 28.8634 29.0685V34.9881H25.6332V27.9979C25.6332 26.7177 25.5913 25.6472 25.5481 24.7229H28.3525L28.5018 26.1507H28.566C28.9904 25.4789 30.0318 24.4925 31.7739 24.4925C33.8984 24.4925 35.4912 25.8996 35.4912 28.9222V34.9895Z"
|
|
151
|
+
fill="white"></path>
|
|
152
|
+
</svg></a></li>
|
|
153
|
+
</ul>
|
|
154
|
+
</pn-site-footer-col>
|
|
155
|
+
<div slot="bottom"><span>PostNord AS</span><span><a href="/cookies" title="PostNords cookiepolicy">PostNords
|
|
156
|
+
cookiepolicy</a><a href="/personvernerklaering"
|
|
157
|
+
title="Personvernerklæring">Personvernerklæring</a></span>
|
|
158
|
+
</div>
|
|
159
|
+
</pn-site-footer>
|
|
160
|
+
`;
|
|
161
|
+
};
|
|
162
|
+
export const Norwegian = TemplateNorwegian.bind({});
|
|
163
|
+
Primary.args = {
|
|
164
|
+
logoUrl : "https://www.postnord.no"
|
|
165
|
+
};
|
|
@@ -29,7 +29,7 @@ class MarketWebContextService {
|
|
|
29
29
|
this.environments = {
|
|
30
30
|
"production": {
|
|
31
31
|
"name": "production",
|
|
32
|
-
"url": "https://
|
|
32
|
+
"url": "https://www.postnord.xx/"
|
|
33
33
|
},
|
|
34
34
|
"preproduction": {
|
|
35
35
|
"name": "preproduction",
|
|
@@ -57,11 +57,15 @@ class MarketWebContextService {
|
|
|
57
57
|
await this.resolveMarket();
|
|
58
58
|
return this.market;
|
|
59
59
|
}
|
|
60
|
-
async getEndpoint(environmentName) {
|
|
60
|
+
async getEndpoint(environmentName, marketName = "") {
|
|
61
|
+
let url = this.environments.production.url;
|
|
61
62
|
if (this.environments[environmentName]) {
|
|
62
|
-
|
|
63
|
+
url = this.environments[environmentName].url;
|
|
64
|
+
if (environmentName === this.environments.production.name) {
|
|
65
|
+
url = url.replace(".xx", "." + marketName);
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
|
-
return
|
|
68
|
+
return url;
|
|
65
69
|
}
|
|
66
70
|
async getEnvironmentName() {
|
|
67
71
|
const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(('-' + x)) !== -1)[0];
|