@postnord/pn-marketweb-components 1.0.26 → 1.0.30
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/MarketWebLoginManager-8b675eb4.js +194 -0
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-language-selector_9.cjs.entry.js +5 -195
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +15 -10
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +12 -10
- package/cjs/pn-profile-selector.cjs.entry.js +101 -0
- package/cjs/pn-site-footer_2.cjs.entry.js +2 -2
- package/collection/collection-manifest.json +1 -0
- 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 +2 -2
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.css +1 -4
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +10 -8
- package/collection/components/navigation/pn-language-selector/pn-language-selector.css +8 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-level.css +4 -0
- package/collection/components/navigation/pn-profile-selector/pn-profile-selector-types.js +1 -0
- package/collection/components/navigation/pn-profile-selector/pn-profile-selector.css +14 -0
- package/collection/components/navigation/pn-profile-selector/pn-profile-selector.js +150 -0
- package/collection/components/navigation/pn-profile-selector/pn-profile-selector.stories.js +25 -0
- package/collection/components/navigation/pn-profile-selector/translations.js +17 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer-col.css +1 -1
- package/collection/components/navigation/pn-site-footer/pn-site-footer.css +1 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector.css +1 -0
- package/collection/globals/MarketWebContextService.js +8 -4
- package/collection/{components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-loginmanager.js → globals/MarketWebLoginManager.js} +2 -2
- package/custom-elements/index.d.ts +6 -0
- package/custom-elements/index.js +154 -48
- package/esm/{MarketWebContextService-9a201388.js → MarketWebContextService-ab7796c6.js} +8 -4
- package/esm/MarketWebLoginManager-dd7ac023.js +192 -0
- package/esm/loader.js +1 -1
- package/esm/pn-language-selector_9.entry.js +5 -195
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-marketweb-sitefooter.entry.js +15 -10
- package/esm/pn-marketweb-siteheader.entry.js +12 -10
- package/esm/pn-profile-selector.entry.js +97 -0
- package/esm/pn-site-footer_2.entry.js +2 -2
- package/esm-es5/MarketWebContextService-ab7796c6.js +1 -0
- package/esm-es5/MarketWebLoginManager-dd7ac023.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-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 -0
- package/esm-es5/pn-site-footer_2.entry.js +1 -1
- package/package.json +1 -1
- 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-2fd1266a.entry.js +1 -0
- package/pn-market-web-components/p-4d6fce0c.js +1 -0
- package/pn-market-web-components/p-4dcea578.js +1 -0
- package/pn-market-web-components/p-51768dc0.system.js +1 -0
- package/pn-market-web-components/p-689b66ef.entry.js +1 -0
- package/pn-market-web-components/p-6d94ea39.system.entry.js +1 -0
- package/pn-market-web-components/p-79611456.system.entry.js +1 -0
- package/pn-market-web-components/p-86fb266b.system.entry.js +1 -0
- package/pn-market-web-components/{p-68139d23.entry.js → p-88d82a49.entry.js} +1 -1
- package/pn-market-web-components/p-95dc0dfa.entry.js +1 -0
- package/pn-market-web-components/p-9860fea8.system.js +1 -0
- package/pn-market-web-components/p-d1f5fe46.system.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-login.d.ts +2 -2
- package/types/components/navigation/pn-profile-selector/pn-profile-selector-types.d.ts +3 -0
- package/types/components/navigation/pn-profile-selector/pn-profile-selector.d.ts +21 -0
- package/types/components/navigation/pn-profile-selector/translations.d.ts +17 -0
- package/types/components.d.ts +19 -0
- package/types/globals/MarketWebContextService.d.ts +1 -1
- package/types/{components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-loginmanager.d.ts → globals/MarketWebLoginManager.d.ts} +4 -4
- 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-441c80e7.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-b27c3539.system.entry.js +0 -1
- package/pn-market-web-components/p-c2b8aa29.entry.js +0 -1
- package/pn-market-web-components/p-d7441208.entry.js +0 -1
|
@@ -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': {
|
|
@@ -53,7 +53,7 @@ const translations = {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
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}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;
|
|
56
|
+
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}@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}}.siteheader-topright pn-language-selector{padding:1rem 0;display:none}@media screen and (min-width: 48em){.siteheader-topright pn-language-selector{display:block}}@media screen and (min-width: 60em){.siteheader-topright pn-language-selector{margin-right:1.6rem}}.siteheader-topright pn-marketweb-siteheader-login{display:none}@media screen and (min-width: 48em){.siteheader-topright pn-marketweb-siteheader-login{display:block}}.siteheader-topright pn-marketweb-siteheader-login .pn-nav-dropdown-label{font-size:0}.siteheader-topright pn-marketweb-siteheader-login .pn-nav-dropdown-label pn-icon{font-size:initial}@media screen and (min-width: 60em){.siteheader-topright pn-marketweb-siteheader-login .pn-nav-dropdown-label{font-size:initial}}.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}";
|
|
57
57
|
|
|
58
58
|
let PnMarketwebSiteheader = class {
|
|
59
59
|
constructor(hostRef) {
|
|
@@ -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
|
}
|
|
@@ -245,7 +247,7 @@ let PnMarketwebSiteheader = class {
|
|
|
245
247
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
246
248
|
return (index.h(index.Host, { language: this.language, market: this.market, environment: this.environment }, index.h("header", null, index.h("div", { class: "siteheader-row" }, index.h("div", { class: "siteheader-topleft" }, index.h("slot", { name: "topleft" }), !this.hideSiteSelector &&
|
|
247
249
|
index.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)) &&
|
|
248
|
-
index.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) => index.h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.href, newwindow: site.openInNewWindow })))), index.h("div", { class: "siteheader-logocontainer" }, index.h("a", { href: (_f = (_e = this.siteDefinition) === null || _e === void 0 ? void 0 : _e.url) !== null && _f !== void 0 ? _f : document.location.hostname, title: "Home", class: "siteheader-logolink" }, index.h("svg", { class: "siteheader-logo", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 141.73 26.65" }, index.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)" })))), index.h("div", { class: "siteheader-topright" }, index.h("slot", { name: "toprightstart" }), (this.gotData && this.loginDialog && !this.hideLogin) && (index.h("pn-marketweb-siteheader-login", { loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && ((_g = this.languageSelector) === null || _g === void 0 ? void 0 : _g.languages)) && !this.hideLanguageSelector &&
|
|
250
|
+
index.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) => index.h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.href, newwindow: site.openInNewWindow })))), index.h("div", { class: "siteheader-logocontainer" }, index.h("a", { href: (_f = (_e = this.siteDefinition) === null || _e === void 0 ? void 0 : _e.url) !== null && _f !== void 0 ? _f : document.location.hostname, title: "Home", class: "siteheader-logolink" }, index.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" }, index.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)" })))), index.h("div", { class: "siteheader-topright" }, index.h("slot", { name: "toprightstart" }), (this.gotData && this.loginDialog && !this.hideLogin) && (index.h("pn-marketweb-siteheader-login", { loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })), (this.gotData && ((_g = this.languageSelector) === null || _g === void 0 ? void 0 : _g.languages)) && !this.hideLanguageSelector &&
|
|
249
251
|
index.h("pn-language-selector", { value: this.language }, this.languageSelector.languages.map(language => index.h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))), index.h("slot", { name: "toprightend" }))), index.h("div", { class: "siteheader-row" }, index.h("div", { class: "siteheader-menu" }, index.h("pn-mainnav", { market: this.market, language: this.language, onMenuOpenChange: (e) => {
|
|
250
252
|
document.body.setAttribute("data-siteheader-menuopen", (e.detail + ''));
|
|
251
253
|
} }, index.h("pn-mainnav-level", null, index.h("pn-mainnav-list", null, this.menuItems.map((item) => {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-0404c97e.js');
|
|
6
|
+
const MarketWebContextService = require('./MarketWebContextService-bdc46f40.js');
|
|
7
|
+
const MarketWebLoginManager = require('./MarketWebLoginManager-8b675eb4.js');
|
|
8
|
+
|
|
9
|
+
const translations = {
|
|
10
|
+
'sv': {
|
|
11
|
+
'loadingTextMessage': `Vi håller på och slutför inloggningen? Du blir snart omdirigerad.`,
|
|
12
|
+
},
|
|
13
|
+
'en': {
|
|
14
|
+
'loadingTextMessage': `We're finalizing your login. You will soon be redirected.`,
|
|
15
|
+
},
|
|
16
|
+
'da': {
|
|
17
|
+
'loadingTextMessage': `We're finalizing your login. You will soon be redirected.`,
|
|
18
|
+
},
|
|
19
|
+
'no': {
|
|
20
|
+
'loadingTextMessage': `We're finalizing your login. You will soon be redirected.`,
|
|
21
|
+
},
|
|
22
|
+
'fi': {
|
|
23
|
+
'loadingTextMessage': `We're finalizing your login. You will soon be redirected.`,
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const pnProfileSelectorCss = "pn-profile-selector{margin:1em auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-width:20em}pn-profile-selector pn-spinner{margin:0 auto}.profileselector-logo svg{display:block;margin:0 auto 1em}";
|
|
28
|
+
|
|
29
|
+
let PnProfileSelector = class {
|
|
30
|
+
constructor(hostRef) {
|
|
31
|
+
index.registerInstance(this, hostRef);
|
|
32
|
+
this.language = null; //sv
|
|
33
|
+
this.returnUrl = "/"; //sv
|
|
34
|
+
this.endpoint = "/api/userprofile/sync"; // Endpoint where we send in the current user session
|
|
35
|
+
this.loginManager = null;
|
|
36
|
+
this.loggedIn = false;
|
|
37
|
+
this.i18n = translations["en"];
|
|
38
|
+
this.isLoading = true;
|
|
39
|
+
this.numberOfProfiles = 1;
|
|
40
|
+
}
|
|
41
|
+
componentWillLoad() {
|
|
42
|
+
this.loginManager = new MarketWebLoginManager.MarketWebLoginManager({ eventTarget: this.hostElement });
|
|
43
|
+
this.loginManager.init(true);
|
|
44
|
+
this.hostElement["loginmanager"] = this.loginManager;
|
|
45
|
+
this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
|
|
46
|
+
this.setInitialValues().then(() => {
|
|
47
|
+
this.init();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async setInitialValues(href = window.location.href) {
|
|
51
|
+
const marketWebContextService = new MarketWebContextService.MarketWebContextService(href);
|
|
52
|
+
if (!this.language) {
|
|
53
|
+
const resolvedMarket = await marketWebContextService.getLanguage();
|
|
54
|
+
this.language = resolvedMarket;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
setTranslations() {
|
|
58
|
+
if (this.language && translations[this.language]) {
|
|
59
|
+
this.i18n = translations[this.language];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
init() {
|
|
63
|
+
this.setTranslations();
|
|
64
|
+
}
|
|
65
|
+
async onLoginStateChange(e) {
|
|
66
|
+
console.log('onLoginStateChange e', e);
|
|
67
|
+
if (this.loggedIn !== e.detail) {
|
|
68
|
+
this.loggedIn = e.detail;
|
|
69
|
+
console.log('this.loggedIn', this.loggedIn);
|
|
70
|
+
const token = this.loginManager.getToken();
|
|
71
|
+
if (this.loggedIn && token) {
|
|
72
|
+
try {
|
|
73
|
+
await fetch(this.endpoint + '?token=' + token);
|
|
74
|
+
if (this.numberOfProfiles === 1) {
|
|
75
|
+
this.redirectUser();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e) { }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async onLoggedIn() {
|
|
83
|
+
}
|
|
84
|
+
redirectUser() {
|
|
85
|
+
if (this.returnUrl) {
|
|
86
|
+
window.location.href = this.returnUrl;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
return (index.h(index.Host, null, index.h("div", { class: "profileselector-logo" }, index.h("svg", { viewBox: "0 0 133 26", fill: "none", xmlns: "http://www.w3.org/2000/svg", width: "13.3rem", height: "2.6rem" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", fill: "#00A0D6", d: "M132.749 0.333618V20.9198H126.976V19.3809C126.976 19.3809 125.475 21.4316 122.191 21.4316C117.381 21.4316 114.662 17.7015 114.662 13.0327C114.662 8.47612 117.776 4.7187 122.617 4.7187C125.589 4.7187 126.976 6.19924 126.976 6.19924V1.47206L132.749 0.333618ZM54.2322 1.67091H60.0055V5.20216H65.3564L62.7235 10.0999H60.0055V20.9198H54.2322V1.67091ZM28.2484 21.4023C32.8051 21.4023 37.6446 18.8974 37.6446 12.9187C37.6446 7.16616 32.9746 4.69042 28.4461 4.69042C23.8042 4.69042 19.049 7.25192 19.049 13.175C19.049 18.9549 23.7199 21.4023 28.2484 21.4023ZM28.3327 9.78608C30.2294 9.78608 31.5032 11.1243 31.5032 13.0902C31.5032 14.9392 30.2575 16.3076 28.3327 16.3076C26.437 16.3076 25.1351 14.9392 25.1351 13.0902C25.1351 11.1243 26.4089 9.78608 28.3327 9.78608ZM47.0708 10.8963C46.8158 10.8574 46.5804 10.8239 46.3639 10.7931C44.9938 10.5979 44.3827 10.5108 44.3827 9.87279C44.3827 9.24608 45.146 8.9888 46.6465 8.9888C49.1941 8.9888 51.4298 9.84357 51.4298 9.84357L52.4488 5.43022C52.4488 5.43022 49.9865 4.71869 46.7027 4.71869C41.1841 4.71869 38.2965 6.85422 38.2965 10.2705C38.2965 12.9187 39.8532 14.485 44.4108 15.0825C46.3355 15.3388 47.0427 15.4519 47.0427 16.1644C47.0427 16.8486 46.2784 17.0757 44.9484 17.0757C42.0608 17.0757 39.3437 15.8515 39.3437 15.8515L38.1832 20.4081C38.1832 20.4081 40.9003 21.375 44.4389 21.375C50.3826 21.375 53.1279 19.2668 53.1279 15.8223C53.1279 13.0902 51.6555 11.6087 47.0708 10.8963ZM76.1968 4.69042C72.8287 4.69042 71.6111 6.74018 71.6111 6.74018V5.20216H65.8369V20.9198H71.6111V12.8612C71.6111 10.8689 72.3483 9.95666 74.1297 9.95666C75.913 9.95666 76.1687 11.4381 76.1687 13.3173V20.9198H81.9982V11.2666C81.9982 6.93903 79.9339 4.69042 76.1968 4.69042ZM123.948 9.8153C125.843 9.8153 127.144 11.1818 127.144 13.0327C127.144 14.9958 125.87 16.335 123.948 16.335C122.051 16.335 120.778 14.9958 120.778 13.0327C120.778 11.1818 122.024 9.8153 123.948 9.8153ZM112.456 10.213C110.53 10.213 109.088 10.9537 109.088 13.3456V20.9198H103.313V5.20216H109.088V7.02479C109.088 7.02479 109.965 4.97409 113.191 4.97409C114.181 4.97409 114.55 5.14467 114.55 5.14467L114.408 10.4976C114.408 10.4976 113.643 10.213 112.456 10.213ZM11.9728 13.0902C11.9728 11.1243 10.699 9.78608 8.80235 9.78608C6.87853 9.78608 5.6038 11.1243 5.6038 13.0902C5.6038 14.9392 6.9057 16.3076 8.80235 16.3076C10.728 16.3076 11.9728 14.9392 11.9728 13.0902ZM10.1333 21.4023C14.9728 21.4023 18.0871 17.6468 18.0871 13.0902C18.0871 8.41958 15.3699 4.69042 10.5576 4.69042C7.27472 4.69042 5.77426 6.74018 5.77426 6.74018V5.20216H0V25.4453H5.77426V19.9227C5.77426 19.9227 7.16139 21.4023 10.1333 21.4023ZM95.7984 13.0902C95.7984 11.1243 94.5246 9.78608 92.6279 9.78608C90.7032 9.78608 89.4284 11.1243 89.4284 13.0902C89.4284 14.9392 90.7322 16.3076 92.6279 16.3076C94.5536 16.3076 95.7984 14.9392 95.7984 13.0902ZM92.5427 21.4023C97.0994 21.4023 101.94 18.8974 101.94 12.9187C101.94 7.16616 97.2698 4.69042 92.7413 4.69042C88.0984 4.69042 83.3442 7.25192 83.3442 13.175C83.3442 18.9549 88.0142 21.4023 92.5427 21.4023Z" }))), this.isLoading ?
|
|
91
|
+
(index.h("div", null, index.h("pn-spinner", { size: "4" }), index.h("div", { class: "profileselector-loadingmessage" }, this.i18n.loadingTextMessage)))
|
|
92
|
+
: null));
|
|
93
|
+
}
|
|
94
|
+
get hostElement() { return index.getElement(this); }
|
|
95
|
+
static get watchers() { return {
|
|
96
|
+
"loggedIn": ["onLoggedIn"]
|
|
97
|
+
}; }
|
|
98
|
+
};
|
|
99
|
+
PnProfileSelector.style = pnProfileSelectorCss;
|
|
100
|
+
|
|
101
|
+
exports.pn_profile_selector = PnProfileSelector;
|
|
@@ -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-top{display:-ms-flexbox;display:flex}.pn-sitefooter-cols{-ms-flex-item-align:center;align-self: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}";
|
|
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) {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"./components/navigation/pn-mainnav/pn-mainnav-link.js",
|
|
14
14
|
"./components/navigation/pn-mainnav/pn-mainnav-list.js",
|
|
15
15
|
"./components/navigation/pn-mainnav/pn-mainnav.js",
|
|
16
|
+
"./components/navigation/pn-profile-selector/pn-profile-selector.js",
|
|
16
17
|
"./components/navigation/pn-sidenav/pn-sidenav-level.js",
|
|
17
18
|
"./components/navigation/pn-sidenav/pn-sidenav-link.js",
|
|
18
19
|
"./components/navigation/pn-sidenav/pn-sidenav.js",
|
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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, Prop, h, State, Element, Watch, Event } from "@stencil/core";
|
|
2
|
-
import {
|
|
2
|
+
import { MarketWebLoginManager } from "../../../globals/MarketWebLoginManager";
|
|
3
3
|
export class PnMarketwebSiteheaderLogin {
|
|
4
4
|
constructor() {
|
|
5
5
|
/** Specifies which endpoint domain we should load from */
|
|
@@ -12,7 +12,7 @@ export class PnMarketwebSiteheaderLogin {
|
|
|
12
12
|
this.toggleButtonText = "";
|
|
13
13
|
}
|
|
14
14
|
componentWillLoad() {
|
|
15
|
-
this.loginManager = new
|
|
15
|
+
this.loginManager = new MarketWebLoginManager({ endpoint: this.endpoint, eventTarget: this.hostElement });
|
|
16
16
|
this.hostElement["loginmanager"] = this.loginManager;
|
|
17
17
|
this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
|
|
18
18
|
this.init();
|
package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.css
CHANGED
|
@@ -11,6 +11,7 @@ body[data-siteheader-menuopen=true] {
|
|
|
11
11
|
|
|
12
12
|
pn-marketweb-siteheader {
|
|
13
13
|
display: block;
|
|
14
|
+
background: #FFFFFF;
|
|
14
15
|
}
|
|
15
16
|
pn-marketweb-siteheader header {
|
|
16
17
|
position: relative;
|
|
@@ -33,7 +34,6 @@ pn-marketweb-siteheader .siteheader-row {
|
|
|
33
34
|
align-items: center;
|
|
34
35
|
width: 100%;
|
|
35
36
|
padding: 0 1.6rem;
|
|
36
|
-
background: #FFFFFF;
|
|
37
37
|
min-height: 2em;
|
|
38
38
|
}
|
|
39
39
|
pn-marketweb-siteheader .siteheader-row:not(:last-child) {
|
|
@@ -71,9 +71,6 @@ pn-marketweb-siteheader .siteheader-logolink {
|
|
|
71
71
|
pn-marketweb-siteheader .siteheader-logolink:hover, pn-marketweb-siteheader .siteheader-logolink:focus, pn-marketweb-siteheader .siteheader-logolink:active {
|
|
72
72
|
box-shadow: none;
|
|
73
73
|
}
|
|
74
|
-
pn-marketweb-siteheader .siteheader-logo {
|
|
75
|
-
height: 2.4rem;
|
|
76
|
-
}
|
|
77
74
|
pn-marketweb-siteheader .siteheader-row > pn-marketweb-siteheader-search {
|
|
78
75
|
display: none;
|
|
79
76
|
}
|
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
|
}
|
|
@@ -198,7 +200,7 @@ export class PnMarketwebSiteheader {
|
|
|
198
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 })))),
|
|
199
201
|
h("div", { class: "siteheader-logocontainer" },
|
|
200
202
|
h("a", { href: (_f = (_e = this.siteDefinition) === null || _e === void 0 ? void 0 : _e.url) !== null && _f !== void 0 ? _f : document.location.hostname, title: "Home", class: "siteheader-logolink" },
|
|
201
|
-
h("svg", { class: "siteheader-logo", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 141.73 26.65" },
|
|
203
|
+
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" },
|
|
202
204
|
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)" })))),
|
|
203
205
|
h("div", { class: "siteheader-topright" },
|
|
204
206
|
h("slot", { name: "toprightstart" }),
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
pn-language-selector {
|
|
2
|
+
max-height: 5.2rem;
|
|
3
|
+
}
|
|
4
|
+
pn-language-selector pn-nav-dropdown:not([data-open]) .nav-dropdown-content-container,
|
|
5
|
+
pn-language-selector pn-nav-dropdown[data-open=false] .nav-dropdown-content-container {
|
|
6
|
+
display: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
.languageselector {
|
|
2
10
|
position: relative;
|
|
3
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { Component, Prop, h, State, Element, Watch, Host } from "@stencil/core";
|
|
2
|
+
import { translations } from "./translations";
|
|
3
|
+
import { MarketWebContextService } from "../../../globals/MarketWebContextService";
|
|
4
|
+
import { MarketWebLoginManager } from "../../../globals/MarketWebLoginManager";
|
|
5
|
+
export class PnProfileSelector {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.language = null; //sv
|
|
8
|
+
this.returnUrl = "/"; //sv
|
|
9
|
+
this.endpoint = "/api/userprofile/sync"; // Endpoint where we send in the current user session
|
|
10
|
+
this.loginManager = null;
|
|
11
|
+
this.loggedIn = false;
|
|
12
|
+
this.i18n = translations["en"];
|
|
13
|
+
this.isLoading = true;
|
|
14
|
+
this.numberOfProfiles = 1;
|
|
15
|
+
}
|
|
16
|
+
componentWillLoad() {
|
|
17
|
+
this.loginManager = new MarketWebLoginManager({ eventTarget: this.hostElement });
|
|
18
|
+
this.loginManager.init(true);
|
|
19
|
+
this.hostElement["loginmanager"] = this.loginManager;
|
|
20
|
+
this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
|
|
21
|
+
this.setInitialValues().then(() => {
|
|
22
|
+
this.init();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async setInitialValues(href = window.location.href) {
|
|
26
|
+
const marketWebContextService = new MarketWebContextService(href);
|
|
27
|
+
if (!this.language) {
|
|
28
|
+
const resolvedMarket = await marketWebContextService.getLanguage();
|
|
29
|
+
this.language = resolvedMarket;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
setTranslations() {
|
|
33
|
+
if (this.language && translations[this.language]) {
|
|
34
|
+
this.i18n = translations[this.language];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
init() {
|
|
38
|
+
this.setTranslations();
|
|
39
|
+
}
|
|
40
|
+
async onLoginStateChange(e) {
|
|
41
|
+
console.log('onLoginStateChange e', e);
|
|
42
|
+
if (this.loggedIn !== e.detail) {
|
|
43
|
+
this.loggedIn = e.detail;
|
|
44
|
+
console.log('this.loggedIn', this.loggedIn);
|
|
45
|
+
const token = this.loginManager.getToken();
|
|
46
|
+
if (this.loggedIn && token) {
|
|
47
|
+
try {
|
|
48
|
+
await fetch(this.endpoint + '?token=' + token);
|
|
49
|
+
if (this.numberOfProfiles === 1) {
|
|
50
|
+
this.redirectUser();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (e) { }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async onLoggedIn() {
|
|
58
|
+
}
|
|
59
|
+
redirectUser() {
|
|
60
|
+
if (this.returnUrl) {
|
|
61
|
+
window.location.href = this.returnUrl;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
return (h(Host, null,
|
|
66
|
+
h("div", { class: "profileselector-logo" },
|
|
67
|
+
h("svg", { viewBox: "0 0 133 26", fill: "none", xmlns: "http://www.w3.org/2000/svg", width: "13.3rem", height: "2.6rem" },
|
|
68
|
+
h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", fill: "#00A0D6", d: "M132.749 0.333618V20.9198H126.976V19.3809C126.976 19.3809 125.475 21.4316 122.191 21.4316C117.381 21.4316 114.662 17.7015 114.662 13.0327C114.662 8.47612 117.776 4.7187 122.617 4.7187C125.589 4.7187 126.976 6.19924 126.976 6.19924V1.47206L132.749 0.333618ZM54.2322 1.67091H60.0055V5.20216H65.3564L62.7235 10.0999H60.0055V20.9198H54.2322V1.67091ZM28.2484 21.4023C32.8051 21.4023 37.6446 18.8974 37.6446 12.9187C37.6446 7.16616 32.9746 4.69042 28.4461 4.69042C23.8042 4.69042 19.049 7.25192 19.049 13.175C19.049 18.9549 23.7199 21.4023 28.2484 21.4023ZM28.3327 9.78608C30.2294 9.78608 31.5032 11.1243 31.5032 13.0902C31.5032 14.9392 30.2575 16.3076 28.3327 16.3076C26.437 16.3076 25.1351 14.9392 25.1351 13.0902C25.1351 11.1243 26.4089 9.78608 28.3327 9.78608ZM47.0708 10.8963C46.8158 10.8574 46.5804 10.8239 46.3639 10.7931C44.9938 10.5979 44.3827 10.5108 44.3827 9.87279C44.3827 9.24608 45.146 8.9888 46.6465 8.9888C49.1941 8.9888 51.4298 9.84357 51.4298 9.84357L52.4488 5.43022C52.4488 5.43022 49.9865 4.71869 46.7027 4.71869C41.1841 4.71869 38.2965 6.85422 38.2965 10.2705C38.2965 12.9187 39.8532 14.485 44.4108 15.0825C46.3355 15.3388 47.0427 15.4519 47.0427 16.1644C47.0427 16.8486 46.2784 17.0757 44.9484 17.0757C42.0608 17.0757 39.3437 15.8515 39.3437 15.8515L38.1832 20.4081C38.1832 20.4081 40.9003 21.375 44.4389 21.375C50.3826 21.375 53.1279 19.2668 53.1279 15.8223C53.1279 13.0902 51.6555 11.6087 47.0708 10.8963ZM76.1968 4.69042C72.8287 4.69042 71.6111 6.74018 71.6111 6.74018V5.20216H65.8369V20.9198H71.6111V12.8612C71.6111 10.8689 72.3483 9.95666 74.1297 9.95666C75.913 9.95666 76.1687 11.4381 76.1687 13.3173V20.9198H81.9982V11.2666C81.9982 6.93903 79.9339 4.69042 76.1968 4.69042ZM123.948 9.8153C125.843 9.8153 127.144 11.1818 127.144 13.0327C127.144 14.9958 125.87 16.335 123.948 16.335C122.051 16.335 120.778 14.9958 120.778 13.0327C120.778 11.1818 122.024 9.8153 123.948 9.8153ZM112.456 10.213C110.53 10.213 109.088 10.9537 109.088 13.3456V20.9198H103.313V5.20216H109.088V7.02479C109.088 7.02479 109.965 4.97409 113.191 4.97409C114.181 4.97409 114.55 5.14467 114.55 5.14467L114.408 10.4976C114.408 10.4976 113.643 10.213 112.456 10.213ZM11.9728 13.0902C11.9728 11.1243 10.699 9.78608 8.80235 9.78608C6.87853 9.78608 5.6038 11.1243 5.6038 13.0902C5.6038 14.9392 6.9057 16.3076 8.80235 16.3076C10.728 16.3076 11.9728 14.9392 11.9728 13.0902ZM10.1333 21.4023C14.9728 21.4023 18.0871 17.6468 18.0871 13.0902C18.0871 8.41958 15.3699 4.69042 10.5576 4.69042C7.27472 4.69042 5.77426 6.74018 5.77426 6.74018V5.20216H0V25.4453H5.77426V19.9227C5.77426 19.9227 7.16139 21.4023 10.1333 21.4023ZM95.7984 13.0902C95.7984 11.1243 94.5246 9.78608 92.6279 9.78608C90.7032 9.78608 89.4284 11.1243 89.4284 13.0902C89.4284 14.9392 90.7322 16.3076 92.6279 16.3076C94.5536 16.3076 95.7984 14.9392 95.7984 13.0902ZM92.5427 21.4023C97.0994 21.4023 101.94 18.8974 101.94 12.9187C101.94 7.16616 97.2698 4.69042 92.7413 4.69042C88.0984 4.69042 83.3442 7.25192 83.3442 13.175C83.3442 18.9549 88.0142 21.4023 92.5427 21.4023Z" }))),
|
|
69
|
+
this.isLoading ?
|
|
70
|
+
(h("div", null,
|
|
71
|
+
h("pn-spinner", { size: "4" }),
|
|
72
|
+
h("div", { class: "profileselector-loadingmessage" }, this.i18n.loadingTextMessage)))
|
|
73
|
+
: null));
|
|
74
|
+
}
|
|
75
|
+
static get is() { return "pn-profile-selector"; }
|
|
76
|
+
static get originalStyleUrls() { return {
|
|
77
|
+
"$": ["pn-profile-selector.scss"]
|
|
78
|
+
}; }
|
|
79
|
+
static get styleUrls() { return {
|
|
80
|
+
"$": ["pn-profile-selector.css"]
|
|
81
|
+
}; }
|
|
82
|
+
static get properties() { return {
|
|
83
|
+
"language": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"mutable": true,
|
|
86
|
+
"complexType": {
|
|
87
|
+
"original": "string",
|
|
88
|
+
"resolved": "string",
|
|
89
|
+
"references": {}
|
|
90
|
+
},
|
|
91
|
+
"required": false,
|
|
92
|
+
"optional": false,
|
|
93
|
+
"docs": {
|
|
94
|
+
"tags": [],
|
|
95
|
+
"text": ""
|
|
96
|
+
},
|
|
97
|
+
"attribute": "language",
|
|
98
|
+
"reflect": true,
|
|
99
|
+
"defaultValue": "null"
|
|
100
|
+
},
|
|
101
|
+
"returnUrl": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "string",
|
|
106
|
+
"resolved": "string",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": ""
|
|
114
|
+
},
|
|
115
|
+
"attribute": "return-url",
|
|
116
|
+
"reflect": false,
|
|
117
|
+
"defaultValue": "\"/\""
|
|
118
|
+
},
|
|
119
|
+
"endpoint": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"complexType": {
|
|
123
|
+
"original": "string",
|
|
124
|
+
"resolved": "string",
|
|
125
|
+
"references": {}
|
|
126
|
+
},
|
|
127
|
+
"required": false,
|
|
128
|
+
"optional": false,
|
|
129
|
+
"docs": {
|
|
130
|
+
"tags": [],
|
|
131
|
+
"text": ""
|
|
132
|
+
},
|
|
133
|
+
"attribute": "endpoint",
|
|
134
|
+
"reflect": false,
|
|
135
|
+
"defaultValue": "\"/api/userprofile/sync\""
|
|
136
|
+
}
|
|
137
|
+
}; }
|
|
138
|
+
static get states() { return {
|
|
139
|
+
"loginManager": {},
|
|
140
|
+
"loggedIn": {},
|
|
141
|
+
"i18n": {},
|
|
142
|
+
"isLoading": {},
|
|
143
|
+
"numberOfProfiles": {}
|
|
144
|
+
}; }
|
|
145
|
+
static get elementRef() { return "hostElement"; }
|
|
146
|
+
static get watchers() { return [{
|
|
147
|
+
"propName": "loggedIn",
|
|
148
|
+
"methodName": "onLoggedIn"
|
|
149
|
+
}]; }
|
|
150
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import readme from "./readme.md";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Web Components/Profile selector",
|
|
5
|
+
parameters: {
|
|
6
|
+
notes: readme,
|
|
7
|
+
layout: 'fullscreen'
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const PrimaryTemplate = ({ ...args }) => {
|
|
12
|
+
return `
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<pn-profile-selector>
|
|
16
|
+
</pn-profile-selector>
|
|
17
|
+
<hr/>
|
|
18
|
+
<a href="https://atportal.postnord.com/api/unified-login/backend/authorization?redirectionUrl=http://localhost:6008/?path=/story/web-components-profile-selector--primary">AT Login </a>
|
|
19
|
+
`;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Primary = PrimaryTemplate.bind({});
|
|
23
|
+
Primary.args = {
|
|
24
|
+
|
|
25
|
+
};
|