@postnord/pn-marketweb-components 1.0.26 → 1.0.27

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.
Files changed (40) hide show
  1. package/cjs/{MarketWebContextService-420668a7.js → MarketWebContextService-f4d6fac4.js} +12 -4
  2. package/cjs/pn-marketweb-sitefooter.cjs.entry.js +15 -10
  3. package/cjs/pn-marketweb-siteheader.cjs.entry.js +10 -8
  4. package/cjs/pn-site-footer_2.cjs.entry.js +2 -2
  5. package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js +14 -9
  6. package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.stories.js +8 -5
  7. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +9 -7
  8. package/collection/components/navigation/pn-site-footer/pn-site-footer-col.css +1 -1
  9. package/collection/components/navigation/pn-site-footer/pn-site-footer.css +1 -0
  10. package/collection/globals/MarketWebContextService.js +14 -4
  11. package/custom-elements/index.js +37 -22
  12. package/esm/{MarketWebContextService-9a201388.js → MarketWebContextService-c1b6617e.js} +12 -4
  13. package/esm/pn-marketweb-sitefooter.entry.js +15 -10
  14. package/esm/pn-marketweb-siteheader.entry.js +10 -8
  15. package/esm/pn-site-footer_2.entry.js +2 -2
  16. package/esm-es5/MarketWebContextService-c1b6617e.js +1 -0
  17. package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
  18. package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
  19. package/esm-es5/pn-site-footer_2.entry.js +1 -1
  20. package/package.json +1 -1
  21. package/pn-market-web-components/p-19816bb1.js +1 -0
  22. package/pn-market-web-components/p-25bdf3f8.system.js +1 -1
  23. package/pn-market-web-components/p-4f070b1a.entry.js +1 -0
  24. package/pn-market-web-components/p-79611456.system.entry.js +1 -0
  25. package/pn-market-web-components/{p-68139d23.entry.js → p-88d82a49.entry.js} +1 -1
  26. package/pn-market-web-components/p-a0fa9f7d.system.js +1 -0
  27. package/pn-market-web-components/p-a15fb8b0.system.entry.js +1 -0
  28. package/pn-market-web-components/p-aaf8f3c0.entry.js +1 -0
  29. package/pn-market-web-components/p-eb91e455.system.entry.js +1 -0
  30. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  31. package/types/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.d.ts +1 -0
  32. package/types/globals/MarketWebContextService.d.ts +1 -1
  33. package/esm-es5/MarketWebContextService-9a201388.js +0 -1
  34. package/pn-market-web-components/p-02eed66e.system.entry.js +0 -1
  35. package/pn-market-web-components/p-441c80e7.system.entry.js +0 -1
  36. package/pn-market-web-components/p-64dc840d.js +0 -1
  37. package/pn-market-web-components/p-88ab0d91.system.entry.js +0 -1
  38. package/pn-market-web-components/p-a320fe58.system.js +0 -1
  39. package/pn-market-web-components/p-ae0e5fd8.entry.js +0 -1
  40. 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://com-production.postnord.com/"
34
+ "url": "https://www.postnord.xx/"
35
35
  },
36
36
  "preproduction": {
37
37
  "name": "preproduction",
@@ -59,11 +59,19 @@ 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
- return this.environments[environmentName].url;
65
+ url = this.environments[environmentName].url;
66
+ if (environmentName === this.environments.production.name) {
67
+ console.log('market 1', marketName);
68
+ console.log('market 2', marketName);
69
+ url = url.replace(".xx", "." + marketName);
70
+ console.log('url', url);
71
+ }
72
+ console.log('this.environments.production.url', this.environments.production.url);
65
73
  }
66
- return this.environments.production.url;
74
+ return url;
67
75
  }
68
76
  async getEnvironmentName() {
69
77
  const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(('-' + x)) !== -1)[0];
@@ -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-420668a7.js');
6
+ const MarketWebContextService = require('./MarketWebContextService-f4d6fac4.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 === null) {
81
+ if (!this.market) {
82
82
  const resolvedMarket = await marketWebContextService.getMarket();
83
83
  this.market = resolvedMarket;
84
84
  }
85
- if (this.language === null) {
85
+ if (!this.language) {
86
86
  const resolvedMarket = await marketWebContextService.getLanguage();
87
87
  this.language = resolvedMarket;
88
88
  }
89
- if (this.environment === null) {
89
+ if (!this.environment) {
90
90
  this.environment = await marketWebContextService.getEnvironmentName();
91
91
  }
92
- if (this.endpoint === null && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
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 === null) {
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
- var linkText = link.linkText;
170
+ let linkText = link.linkText;
168
171
  if (link.linkType) {
169
172
  linkText = this.getLinkContentByType(link.linkType);
170
173
  }
171
- return (index.h("li", null, index.h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText }))));
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
- return (index.h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText }), link.linkText));
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-420668a7.js');
6
+ const MarketWebContextService = require('./MarketWebContextService-f4d6fac4.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 === null) {
108
+ if (!this.market) {
109
109
  const resolvedMarket = await marketWebContextService.getMarket();
110
110
  this.market = resolvedMarket;
111
111
  }
112
- if (this.language === null) {
112
+ if (!this.language) {
113
113
  const resolvedMarket = await marketWebContextService.getLanguage();
114
114
  this.language = resolvedMarket;
115
115
  }
116
- if (this.environment === null) {
116
+ if (!this.environment) {
117
117
  this.environment = await marketWebContextService.getEnvironmentName();
118
118
  }
119
- if (this.endpoint === null && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
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 === null) {
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-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:20%;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}";
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) {
@@ -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 === null) {
26
+ if (!this.market) {
27
27
  const resolvedMarket = await marketWebContextService.getMarket();
28
28
  this.market = resolvedMarket;
29
29
  }
30
- if (this.language === null) {
30
+ if (!this.language) {
31
31
  const resolvedMarket = await marketWebContextService.getLanguage();
32
32
  this.language = resolvedMarket;
33
33
  }
34
- if (this.environment === null) {
34
+ if (!this.environment) {
35
35
  this.environment = await marketWebContextService.getEnvironmentName();
36
36
  }
37
- if (this.endpoint === null && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
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 === null) {
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
- var linkText = link.linkText;
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
- return (h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText }), link.linkText));
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 : "se",
52
- language: 'sv',
53
- endpoint: 'https://com-integration.postnord.com'
53
+ market : "com",
54
+ language: 'en',
55
+ environment: "production",
56
+ endpoint: "",// 'https://www.postnord.se'
54
57
  };
55
58
 
56
59
 
@@ -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 === null) {
51
+ if (!this.market) {
52
52
  const resolvedMarket = await marketWebContextService.getMarket();
53
53
  this.market = resolvedMarket;
54
54
  }
55
- if (this.language === null) {
55
+ if (!this.language) {
56
56
  const resolvedMarket = await marketWebContextService.getLanguage();
57
57
  this.language = resolvedMarket;
58
58
  }
59
- if (this.environment === null) {
59
+ if (!this.environment) {
60
60
  this.environment = await marketWebContextService.getEnvironmentName();
61
61
  }
62
- if (this.endpoint === null && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
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 === null) {
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
  }
@@ -1,5 +1,5 @@
1
1
  pn-site-footer-col {
2
- min-width: 20%;
2
+ min-width: 15em;
3
3
  padding: 2.5em 1.5rem 0;
4
4
  }
5
5
  @media screen and (min-width: 48em) {
@@ -37,6 +37,7 @@ pn-site-footer > div {
37
37
 
38
38
  .pn-sitefooter-cols {
39
39
  align-self: center;
40
+ justify-content: center;
40
41
  display: flex;
41
42
  flex-flow: row wrap;
42
43
  margin: 0 auto;
@@ -29,7 +29,7 @@ class MarketWebContextService {
29
29
  this.environments = {
30
30
  "production": {
31
31
  "name": "production",
32
- "url": "https://com-production.postnord.com/"
32
+ "url": "https://www.postnord.xx/"
33
33
  },
34
34
  "preproduction": {
35
35
  "name": "preproduction",
@@ -57,11 +57,21 @@ 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
- return this.environments[environmentName].url;
63
+ url = this.environments[environmentName].url;
64
+ if (environmentName === this.environments.production.name) {
65
+ console.log('market 1', marketName);
66
+ if (marketName) {
67
+ }
68
+ console.log('market 2', marketName);
69
+ url = url.replace(".xx", "." + marketName);
70
+ console.log('url', url);
71
+ }
72
+ console.log('this.environments.production.url', this.environments.production.url);
63
73
  }
64
- return this.environments.production.url;
74
+ return url;
65
75
  }
66
76
  async getEnvironmentName() {
67
77
  const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(('-' + x)) !== -1)[0];
@@ -2826,7 +2826,7 @@ class MarketWebContextService {
2826
2826
  this.environments = {
2827
2827
  "production": {
2828
2828
  "name": "production",
2829
- "url": "https://com-production.postnord.com/"
2829
+ "url": "https://www.postnord.xx/"
2830
2830
  },
2831
2831
  "preproduction": {
2832
2832
  "name": "preproduction",
@@ -2854,11 +2854,19 @@ class MarketWebContextService {
2854
2854
  await this.resolveMarket();
2855
2855
  return this.market;
2856
2856
  }
2857
- async getEndpoint(environmentName) {
2857
+ async getEndpoint(environmentName, marketName = "") {
2858
+ let url = this.environments.production.url;
2858
2859
  if (this.environments[environmentName]) {
2859
- return this.environments[environmentName].url;
2860
+ url = this.environments[environmentName].url;
2861
+ if (environmentName === this.environments.production.name) {
2862
+ console.log('market 1', marketName);
2863
+ console.log('market 2', marketName);
2864
+ url = url.replace(".xx", "." + marketName);
2865
+ console.log('url', url);
2866
+ }
2867
+ console.log('this.environments.production.url', this.environments.production.url);
2860
2868
  }
2861
- return this.environments.production.url;
2869
+ return url;
2862
2870
  }
2863
2871
  async getEnvironmentName() {
2864
2872
  const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(('-' + x)) !== -1)[0];
@@ -2984,21 +2992,21 @@ let PnMarketwebSiteheader$2 = class extends HTMLElement {
2984
2992
  async setInitialValues(href = window.location.href) {
2985
2993
  var _a;
2986
2994
  const marketWebContextService = new MarketWebContextService(href);
2987
- if (this.market === null) {
2995
+ if (!this.market) {
2988
2996
  const resolvedMarket = await marketWebContextService.getMarket();
2989
2997
  this.market = resolvedMarket;
2990
2998
  }
2991
- if (this.language === null) {
2999
+ if (!this.language) {
2992
3000
  const resolvedMarket = await marketWebContextService.getLanguage();
2993
3001
  this.language = resolvedMarket;
2994
3002
  }
2995
- if (this.environment === null) {
3003
+ if (!this.environment) {
2996
3004
  this.environment = await marketWebContextService.getEnvironmentName();
2997
3005
  }
2998
- if (this.endpoint === null && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
2999
- this.endpoint = await marketWebContextService.getEndpoint(this.environment);
3006
+ if ((!this.endpoint) && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
3007
+ this.endpoint = await marketWebContextService.getEndpoint(this.environment, this.market);
3000
3008
  }
3001
- if (this.endpoint === null) {
3009
+ if (!this.endpoint) {
3002
3010
  this.endpoint = "";
3003
3011
  }
3004
3012
  }
@@ -3067,19 +3075,24 @@ let PnMarketwebSiteheader$2 = class extends HTMLElement {
3067
3075
  this.gotData = true;
3068
3076
  this.fetchingData = true;
3069
3077
  }
3078
+ uniqueId(text) {
3079
+ return "footer-" + text.replace(/[^A-Za-z0-9.\\\/]/igm, "");
3080
+ }
3070
3081
  render() {
3071
3082
  var _a, _b, _c, _d, _e;
3072
3083
  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) => {
3073
- var linkText = link.linkText;
3084
+ let linkText = link.linkText;
3074
3085
  if (link.linkType) {
3075
3086
  linkText = this.getLinkContentByType(link.linkType);
3076
3087
  }
3077
- return (h("li", null, h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText }))));
3088
+ let linkId = this.uniqueId(linkText);
3089
+ return (h("li", null, h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText, id: linkId }))));
3078
3090
  }))) : null, column.body ? (h("div", { innerHTML: column.body })) : null))) : null, h("div", { slot: "bottom" }, (this.gotData && ((_d = this.footerContent) === null || _d === void 0 ? void 0 : _d.copyrightText)) ? (h("span", null, this.footerContent.copyrightText)) : null, (this.gotData && ((_e = this.footerContent) === null || _e === void 0 ? void 0 : _e.bottomLinks)) ? (h("span", null, this.footerContent.bottomLinks.map((link) => {
3079
3091
  if (!link.linkHref) {
3080
3092
  return (h("span", null, link.linkText));
3081
3093
  }
3082
- return (h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText }), link.linkText));
3094
+ let linkId = this.uniqueId(link.linkText);
3095
+ return (h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, id: linkId }), link.linkText));
3083
3096
  }))) : null))));
3084
3097
  }
3085
3098
  get hostElement() { return this; }
@@ -3191,21 +3204,21 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
3191
3204
  async setInitialValues(href = window.location.href) {
3192
3205
  var _a;
3193
3206
  const marketWebContextService = new MarketWebContextService(href);
3194
- if (this.market === null) {
3207
+ if (!this.market) {
3195
3208
  const resolvedMarket = await marketWebContextService.getMarket();
3196
3209
  this.market = resolvedMarket;
3197
3210
  }
3198
- if (this.language === null) {
3211
+ if (!this.language) {
3199
3212
  const resolvedMarket = await marketWebContextService.getLanguage();
3200
3213
  this.language = resolvedMarket;
3201
3214
  }
3202
- if (this.environment === null) {
3215
+ if (!this.environment) {
3203
3216
  this.environment = await marketWebContextService.getEnvironmentName();
3204
3217
  }
3205
- if (this.endpoint === null && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
3206
- this.endpoint = await marketWebContextService.getEndpoint(this.environment);
3218
+ if (!this.endpoint && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
3219
+ this.endpoint = await marketWebContextService.getEndpoint(this.environment, this.market);
3207
3220
  }
3208
- if (this.endpoint === null) {
3221
+ if (!this.endpoint) {
3209
3222
  this.endpoint = "";
3210
3223
  }
3211
3224
  }
@@ -3239,7 +3252,9 @@ let PnMarketwebSiteheader$1 = class extends HTMLElement {
3239
3252
  this.fetchingData = true;
3240
3253
  const endpointBase = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
3241
3254
  const fetchUrl = `${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}`;
3242
- const response = await fetch(fetchUrl);
3255
+ const response = await fetch(fetchUrl, {
3256
+ 'mode': 'cors'
3257
+ });
3243
3258
  const data = await response.json();
3244
3259
  await this.setStateFromData(data);
3245
3260
  }
@@ -4160,7 +4175,7 @@ let PnSidenavLink$1 = class extends HTMLElement {
4160
4175
  static get style() { return pnSidenavLinkCss; }
4161
4176
  };
4162
4177
 
4163
- 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}";
4178
+ 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}";
4164
4179
 
4165
4180
  let PnSiteFooter$1 = class extends HTMLElement {
4166
4181
  constructor() {
@@ -4177,7 +4192,7 @@ let PnSiteFooter$1 = class extends HTMLElement {
4177
4192
  static get style() { return pnSiteFooterCss; }
4178
4193
  };
4179
4194
 
4180
- const pnSiteFooterColCss = "pn-site-footer-col{min-width:20%;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}";
4195
+ 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}";
4181
4196
 
4182
4197
  let PnSiteFooterCol$1 = class extends HTMLElement {
4183
4198
  constructor() {
@@ -29,7 +29,7 @@ class MarketWebContextService {
29
29
  this.environments = {
30
30
  "production": {
31
31
  "name": "production",
32
- "url": "https://com-production.postnord.com/"
32
+ "url": "https://www.postnord.xx/"
33
33
  },
34
34
  "preproduction": {
35
35
  "name": "preproduction",
@@ -57,11 +57,19 @@ 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
- return this.environments[environmentName].url;
63
+ url = this.environments[environmentName].url;
64
+ if (environmentName === this.environments.production.name) {
65
+ console.log('market 1', marketName);
66
+ console.log('market 2', marketName);
67
+ url = url.replace(".xx", "." + marketName);
68
+ console.log('url', url);
69
+ }
70
+ console.log('this.environments.production.url', this.environments.production.url);
63
71
  }
64
- return this.environments.production.url;
72
+ return url;
65
73
  }
66
74
  async getEnvironmentName() {
67
75
  const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(('-' + x)) !== -1)[0];
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, a as Host, g as getElement } from './index-1537f439.js';
2
- import { M as MarketWebContextService } from './MarketWebContextService-9a201388.js';
2
+ import { M as MarketWebContextService } from './MarketWebContextService-c1b6617e.js';
3
3
 
4
4
  const translations = {
5
5
  'sv': {
@@ -74,21 +74,21 @@ let PnMarketwebSiteheader = class {
74
74
  async setInitialValues(href = window.location.href) {
75
75
  var _a;
76
76
  const marketWebContextService = new MarketWebContextService(href);
77
- if (this.market === null) {
77
+ if (!this.market) {
78
78
  const resolvedMarket = await marketWebContextService.getMarket();
79
79
  this.market = resolvedMarket;
80
80
  }
81
- if (this.language === null) {
81
+ if (!this.language) {
82
82
  const resolvedMarket = await marketWebContextService.getLanguage();
83
83
  this.language = resolvedMarket;
84
84
  }
85
- if (this.environment === null) {
85
+ if (!this.environment) {
86
86
  this.environment = await marketWebContextService.getEnvironmentName();
87
87
  }
88
- if (this.endpoint === null && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
89
- this.endpoint = await marketWebContextService.getEndpoint(this.environment);
88
+ if ((!this.endpoint) && ((_a = this.environment) === null || _a === void 0 ? void 0 : _a.indexOf('local')) === -1) {
89
+ this.endpoint = await marketWebContextService.getEndpoint(this.environment, this.market);
90
90
  }
91
- if (this.endpoint === null) {
91
+ if (!this.endpoint) {
92
92
  this.endpoint = "";
93
93
  }
94
94
  }
@@ -157,19 +157,24 @@ let PnMarketwebSiteheader = class {
157
157
  this.gotData = true;
158
158
  this.fetchingData = true;
159
159
  }
160
+ uniqueId(text) {
161
+ return "footer-" + text.replace(/[^A-Za-z0-9.\\\/]/igm, "");
162
+ }
160
163
  render() {
161
164
  var _a, _b, _c, _d, _e;
162
165
  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) => {
163
- var linkText = link.linkText;
166
+ let linkText = link.linkText;
164
167
  if (link.linkType) {
165
168
  linkText = this.getLinkContentByType(link.linkType);
166
169
  }
167
- return (h("li", null, h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText }))));
170
+ let linkId = this.uniqueId(linkText);
171
+ return (h("li", null, h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, innerHTML: linkText, id: linkId }))));
168
172
  }))) : null, column.body ? (h("div", { innerHTML: column.body })) : null))) : null, h("div", { slot: "bottom" }, (this.gotData && ((_d = this.footerContent) === null || _d === void 0 ? void 0 : _d.copyrightText)) ? (h("span", null, this.footerContent.copyrightText)) : null, (this.gotData && ((_e = this.footerContent) === null || _e === void 0 ? void 0 : _e.bottomLinks)) ? (h("span", null, this.footerContent.bottomLinks.map((link) => {
169
173
  if (!link.linkHref) {
170
174
  return (h("span", null, link.linkText));
171
175
  }
172
- return (h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText }), link.linkText));
176
+ let linkId = this.uniqueId(link.linkText);
177
+ return (h("a", Object.assign({ href: link.linkHref }, (link.openInNewWindow && { target: '_blank' }), { title: link.linkText, id: linkId }), link.linkText));
173
178
  }))) : null))));
174
179
  }
175
180
  get hostElement() { return getElement(this); }