@postnord/pn-marketweb-components 2.3.0 → 2.3.2

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 (45) hide show
  1. package/cjs/{MarketWebContextService-392b4585.js → MarketWebContextService-f77b4a5f.js} +61 -59
  2. package/cjs/pn-language-selector_9.cjs.entry.js +22 -13
  3. package/cjs/pn-marketweb-sitefooter.cjs.entry.js +1 -1
  4. package/cjs/pn-marketweb-siteheader.cjs.entry.js +1 -1
  5. package/cjs/pn-proxio-findprice.cjs.entry.js +13 -7
  6. package/cjs/pn-proxio-pricegroup.cjs.entry.js +1 -1
  7. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +3 -2
  8. package/collection/components/navigation/pn-language-selector/translations.js +22 -13
  9. package/collection/components/widgets/pn-proxio-findprice/pn-proxio-findprice.js +12 -6
  10. package/collection/globals/MarketWebContextService.js +61 -59
  11. package/custom-elements/index.js +95 -78
  12. package/esm/{MarketWebContextService-872043cc.js → MarketWebContextService-3ed3fe80.js} +61 -59
  13. package/esm/pn-language-selector_9.entry.js +22 -13
  14. package/esm/pn-marketweb-sitefooter.entry.js +1 -1
  15. package/esm/pn-marketweb-siteheader.entry.js +1 -1
  16. package/esm/pn-proxio-findprice.entry.js +13 -7
  17. package/esm/pn-proxio-pricegroup.entry.js +1 -1
  18. package/esm-es5/MarketWebContextService-3ed3fe80.js +1 -0
  19. package/esm-es5/pn-language-selector_9.entry.js +1 -1
  20. package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
  21. package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
  22. package/esm-es5/pn-proxio-findprice.entry.js +1 -1
  23. package/esm-es5/pn-proxio-pricegroup.entry.js +1 -1
  24. package/package.json +1 -1
  25. package/pn-market-web-components/p-2e2dfb79.entry.js +1 -0
  26. package/pn-market-web-components/p-67887512.system.js +1 -1
  27. package/pn-market-web-components/{p-befd7c8d.entry.js → p-77c907d9.entry.js} +1 -1
  28. package/pn-market-web-components/p-783b4892.js +1 -0
  29. package/pn-market-web-components/{p-dc714241.entry.js → p-803088a3.entry.js} +1 -1
  30. package/pn-market-web-components/p-861def61.entry.js +1 -0
  31. package/pn-market-web-components/p-8f1b7c70.system.entry.js +1 -0
  32. package/pn-market-web-components/{p-fe417bbb.system.entry.js → p-906719be.system.entry.js} +1 -1
  33. package/pn-market-web-components/{p-dd0b02de.entry.js → p-9c2c1aa2.entry.js} +1 -1
  34. package/pn-market-web-components/{p-5b802a17.system.entry.js → p-bb4f0673.system.entry.js} +1 -1
  35. package/pn-market-web-components/p-cb53b67f.system.js +1 -0
  36. package/pn-market-web-components/{p-9c18464d.system.entry.js → p-efe598a8.system.entry.js} +1 -1
  37. package/pn-market-web-components/{p-ed990629.system.entry.js → p-f008015e.system.entry.js} +1 -1
  38. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  39. package/types/components/navigation/pn-language-selector/translations.d.ts +9 -0
  40. package/esm-es5/MarketWebContextService-872043cc.js +0 -1
  41. package/pn-market-web-components/p-31fd7a95.system.js +0 -1
  42. package/pn-market-web-components/p-5176eaf3.entry.js +0 -1
  43. package/pn-market-web-components/p-74120b9b.js +0 -1
  44. package/pn-market-web-components/p-84193b02.system.entry.js +0 -1
  45. package/pn-market-web-components/p-b3bf353f.entry.js +0 -1
@@ -84,80 +84,80 @@ class FetchHelper {
84
84
 
85
85
  class MarketWebContextService {
86
86
  constructor(href = window.location.href) {
87
- this.href = "";
88
- this.market = "";
89
- this.language = "";
90
- this.environment = "";
87
+ this.href = '';
88
+ this.market = '';
89
+ this.language = '';
90
+ this.environment = '';
91
91
  this.url = null;
92
- this.allowedLanguages = ["sv", "da", "fi", "no", "en", "de"];
93
- this.allowedMarkets = ["se", "dk", "fi", "no", "com", "de", "tpl"];
94
- this.wwwMarkets = ["se", "dk", "fi", "no", "de", "com"];
95
- this.developmentDomains = ["localhost", ".local", "local.", ".dev", "dev."];
92
+ this.allowedLanguages = ['sv', 'da', 'fi', 'no', 'en', 'de', 'zh', 'fr', 'es'];
93
+ this.allowedMarkets = ['se', 'dk', 'fi', 'no', 'com', 'de', 'tpl'];
94
+ this.wwwMarkets = ['se', 'dk', 'fi', 'no', 'de', 'com'];
95
+ this.developmentDomains = ['localhost', '.local', 'local.', '.dev', 'dev.'];
96
96
  this.markets = {
97
- "se": {
98
- fallbackLanguage: "sv",
97
+ se: {
98
+ fallbackLanguage: 'sv',
99
99
  integration: 'se-integration.postnord.com',
100
100
  preproduction: 'se-preproduction.postnord.com',
101
101
  production: 'se-production.postnord.com',
102
- live: 'www.postnord.se'
102
+ live: 'www.postnord.se',
103
103
  },
104
- "dk": {
105
- fallbackLanguage: "da",
104
+ dk: {
105
+ fallbackLanguage: 'da',
106
106
  integration: 'dk-integration.postnord.com',
107
107
  preproduction: 'dk-preproduction.postnord.com',
108
108
  production: 'dk-production.postnord.com',
109
- live: 'www.postnord.dk'
109
+ live: 'www.postnord.dk',
110
110
  },
111
- "fi": {
112
- fallbackLanguage: "fi",
111
+ fi: {
112
+ fallbackLanguage: 'fi',
113
113
  integration: 'fi-integration.postnord.com',
114
114
  preproduction: 'fi-preproduction.postnord.com',
115
115
  production: 'fi-production.postnord.com',
116
- live: 'www.postnord.fi'
116
+ live: 'www.postnord.fi',
117
117
  },
118
- "no": {
119
- fallbackLanguage: "no",
118
+ no: {
119
+ fallbackLanguage: 'no',
120
120
  integration: 'no-integration.postnord.com',
121
121
  preproduction: 'no-preproduction.postnord.com',
122
122
  production: 'no-production.postnord.com',
123
- live: 'www.postnord.no'
123
+ live: 'www.postnord.no',
124
124
  },
125
- "com": {
126
- fallbackLanguage: "en",
125
+ com: {
126
+ fallbackLanguage: 'en',
127
127
  integration: 'com-integration.postnord.com',
128
128
  preproduction: 'com-preproduction.postnord.com',
129
129
  production: 'com-production.postnord.com',
130
- live: 'www.postnord.com'
130
+ live: 'www.postnord.com',
131
131
  },
132
- "de": {
133
- fallbackLanguage: "en",
132
+ de: {
133
+ fallbackLanguage: 'en',
134
134
  integration: 'de-integration.postnord.com',
135
135
  preproduction: 'de-preproduction.postnord.com',
136
136
  production: 'de-production.postnord.com',
137
- live: 'www.postnord.de'
137
+ live: 'www.postnord.de',
138
138
  },
139
- "tpl": {
140
- fallbackLanguage: "sv",
139
+ tpl: {
140
+ fallbackLanguage: 'sv',
141
141
  integration: 'tpl-integration.postnord.com',
142
142
  preproduction: 'tpl-preproduction.postnord.com',
143
143
  production: 'tpl-production.postnord.com',
144
- live: 'tpl.postnord.com'
144
+ live: 'tpl.postnord.com',
145
145
  },
146
146
  };
147
- this.environmentTypes = ["integration", "preproduction", "production"];
147
+ this.environmentTypes = ['integration', 'preproduction', 'production'];
148
148
  this.environments = {
149
- "production": {
150
- "name": "production",
151
- "url": "https://www.postnord.xx/"
149
+ production: {
150
+ name: 'production',
151
+ url: 'https://www.postnord.xx/',
152
152
  },
153
- "preproduction": {
154
- "name": "preproduction",
155
- "url": "https://com-preproduction.postnord.com/"
153
+ preproduction: {
154
+ name: 'preproduction',
155
+ url: 'https://com-preproduction.postnord.com/',
156
+ },
157
+ integration: {
158
+ name: 'integration',
159
+ url: 'https://com-integration.postnord.com/',
156
160
  },
157
- "integration": {
158
- "name": "integration",
159
- "url": "https://com-integration.postnord.com/"
160
- }
161
161
  };
162
162
  this.href = href;
163
163
  this.url = new URL(this.href);
@@ -176,7 +176,7 @@ class MarketWebContextService {
176
176
  await this.resolveMarket();
177
177
  return this.market;
178
178
  }
179
- async getEndpoint(environmentName, marketName = "") {
179
+ async getEndpoint(environmentName, marketName = '') {
180
180
  let url = this.environments.production.url;
181
181
  if (this.markets[marketName] && this.markets[marketName][environmentName]) {
182
182
  if (environmentName === 'production' && window.location.hostname.indexOf(this.markets[marketName]['live']) === 0) {
@@ -193,18 +193,18 @@ class MarketWebContextService {
193
193
  if (environmentName === this.environments.production.name) {
194
194
  if (this.wwwMarkets.indexOf(marketName) !== -1) {
195
195
  // Handles www.postnord.xx domains
196
- url = url.replace(".xx", "." + marketName);
196
+ url = url.replace('.xx', '.' + marketName);
197
197
  }
198
198
  else {
199
- url = url.replace(".xx", ".com"); // Expect URL to end in postnord.com
200
- url = url.replace("www.", marketName + ".");
199
+ url = url.replace('.xx', '.com'); // Expect URL to end in postnord.com
200
+ url = url.replace('www.', marketName + '.');
201
201
  }
202
202
  }
203
203
  }
204
204
  return url;
205
205
  }
206
206
  async getEnvironmentName() {
207
- const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(('-' + x)) !== -1)[0];
207
+ const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf('-' + x) !== -1)[0];
208
208
  if (likelyEnvironment) {
209
209
  this.environment = likelyEnvironment;
210
210
  return this.environment;
@@ -222,17 +222,17 @@ class MarketWebContextService {
222
222
  }
223
223
  async resolveMarket() {
224
224
  // Resolve market from www domains
225
- if (this.href.indexOf("//www.") !== -1) {
225
+ if (this.href.indexOf('//www.') !== -1) {
226
226
  const domainRoot = this.url.hostname.substring(this.url.hostname.lastIndexOf('.') + 1, this.url.hostname.length);
227
227
  if (domainRoot && this.markets[domainRoot]) {
228
228
  this.market = domainRoot;
229
229
  }
230
230
  else {
231
- console.warn("Unable to define market from www. domain", this.href);
231
+ console.warn('Unable to define market from www. domain', this.href);
232
232
  }
233
233
  }
234
234
  // Check if domains are on one of the integration/preproduction/production environments urls
235
- const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(('-' + x)) !== -1);
235
+ const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf('-' + x) !== -1);
236
236
  if (!this.market && likelyEnvironment && likelyEnvironment.length > 0) {
237
237
  const matchedEnvironment = likelyEnvironment[0];
238
238
  const marketPrefix = this.url.hostname.substring(0, this.url.hostname.indexOf('-' + matchedEnvironment));
@@ -240,14 +240,14 @@ class MarketWebContextService {
240
240
  this.market = marketPrefix;
241
241
  }
242
242
  else {
243
- console.warn("Unable to define market from preset environment names", this.href);
243
+ console.warn('Unable to define market from preset environment names', this.href);
244
244
  }
245
245
  }
246
246
  if (!this.market) {
247
247
  if (this.url.hostname.indexOf('www') === -1 && this.url.hostname.indexOf('.postnord.') > 0) {
248
248
  const start = this.url.hostname.indexOf('.') !== this.url.hostname.indexOf('.postnord') ? this.url.hostname.indexOf('.') : 0;
249
249
  const potentialMarket = this.url.hostname.substring(start, this.url.hostname.indexOf('.postnord.'));
250
- // Break down the subdomain to the word closest to .postnord. and take that word.
250
+ // Break down the subdomain to the word closest to .postnord. and take that word.
251
251
  // Supports sub-sub domain down to 1 level.
252
252
  if (this.allowedMarkets.indexOf(potentialMarket) !== -1) {
253
253
  this.market = potentialMarket;
@@ -255,7 +255,7 @@ class MarketWebContextService {
255
255
  }
256
256
  }
257
257
  }
258
- // Check if we're on a development environment
258
+ // Check if we're on a development environment
259
259
  if (!this.market) {
260
260
  const matchedDevEnvironment = this.developmentDomains.filter(x => this.url.hostname.indexOf(x) !== -1)[0];
261
261
  if (!matchedDevEnvironment) {
@@ -263,7 +263,7 @@ class MarketWebContextService {
263
263
  this.market = this.allowedMarkets[0];
264
264
  return;
265
265
  }
266
- const urlWithoutDomain = this.href.replace(matchedDevEnvironment, "");
266
+ const urlWithoutDomain = this.href.replace(matchedDevEnvironment, '');
267
267
  // We see if the dev environment contains something like /dk
268
268
  let matchedMarket = this.allowedMarkets.filter(x => {
269
269
  const typesOfFallback = ['.' + x, x + '.', '/' + x + '/']; // Ex /dk, dk.html, /dk/
@@ -275,7 +275,7 @@ class MarketWebContextService {
275
275
  }
276
276
  else {
277
277
  // We do a similar filter for subpaths but for language this time
278
- let filteredMarket = Object.entries(this.markets).filter((item) => {
278
+ let filteredMarket = Object.entries(this.markets).filter(item => {
279
279
  const typesOfFallback = ['.' + item[1].fallbackLanguage, item[1].fallbackLanguage + '.', '/' + item[1].fallbackLanguage + '/']; // Ex /dk, dk.html, /dk/
280
280
  const matchedTypeOfFallback = typesOfFallback.filter(y => urlWithoutDomain.indexOf(y) !== -1);
281
281
  return matchedTypeOfFallback.length > 0;
@@ -286,7 +286,7 @@ class MarketWebContextService {
286
286
  }
287
287
  }
288
288
  if (!this.market) {
289
- console.info("Was unable to detect market, used fallback");
289
+ console.info('Was unable to detect market, used fallback');
290
290
  this.market = this.allowedMarkets[0];
291
291
  }
292
292
  }
@@ -296,12 +296,14 @@ class MarketWebContextService {
296
296
  return;
297
297
  }
298
298
  const potentialLanguages = [
299
- (_a = document.querySelector("html[lang]")) === null || _a === void 0 ? void 0 : _a.getAttribute("lang"),
300
- (_b = document.querySelector('[http-equiv="content-language"][content]')) === null || _b === void 0 ? void 0 : _b.getAttribute("content"),
301
- (_c = document.querySelector('[property="og:locale"][content]')) === null || _c === void 0 ? void 0 : _c.getAttribute("content"),
302
- (_d = document.querySelector("[lang]")) === null || _d === void 0 ? void 0 : _d.getAttribute("lang"),
299
+ (_a = document.querySelector('html[lang]')) === null || _a === void 0 ? void 0 : _a.getAttribute('lang'),
300
+ (_b = document.querySelector('[http-equiv="content-language"][content]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content'),
301
+ (_c = document.querySelector('[property="og:locale"][content]')) === null || _c === void 0 ? void 0 : _c.getAttribute('content'),
302
+ (_d = document.querySelector('[lang]')) === null || _d === void 0 ? void 0 : _d.getAttribute('lang'),
303
303
  ];
304
- potentialLanguages.filter(x => x).forEach((language) => {
304
+ potentialLanguages
305
+ .filter(x => x)
306
+ .forEach(language => {
305
307
  if (this.allowedLanguages.indexOf(language)) {
306
308
  this.language = language;
307
309
  return;
@@ -4,24 +4,33 @@ import { s as state$2 } from './pn-marketweb-siteheader-store-cd0a1dab.js';
4
4
  import { c as createStore } from './index-7b21ecff.js';
5
5
 
6
6
  const translations$1 = {
7
- 'sv': {
8
- "heading": "Språk",
7
+ sv: {
8
+ heading: 'Språk',
9
9
  },
10
- 'en': {
11
- "heading": "Language"
10
+ en: {
11
+ heading: 'Language',
12
12
  },
13
- 'da': {
14
- "heading": "Sprog"
13
+ da: {
14
+ heading: 'Sprog',
15
15
  },
16
- 'no': {
17
- "heading": "Språk"
16
+ no: {
17
+ heading: 'Språk',
18
18
  },
19
- 'fi': {
20
- "heading": "Kieli"
19
+ fi: {
20
+ heading: 'Kieli',
21
+ },
22
+ de: {
23
+ heading: 'Sprache',
24
+ },
25
+ zh: {
26
+ heading: '语言',
27
+ },
28
+ fr: {
29
+ heading: 'Langue',
30
+ },
31
+ es: {
32
+ heading: 'Idioma',
21
33
  },
22
- 'de': {
23
- "heading": "Sprache"
24
- }
25
34
  };
26
35
 
27
36
  const pnLanguageSelectorCss = "pn-language-selector{max-height:5.2rem}pn-language-selector pn-nav-dropdown:not([data-open]) .nav-dropdown-content-container,pn-language-selector pn-nav-dropdown[data-open=false] .nav-dropdown-content-container{display:none}pn-language-selector pn-nav-dropdown{display:block}.languageselector{position:relative}.languageselector-togglebtn{cursor:pointer;border:0;padding:0.64rem 0;background-color:#FFFFFF;color:#005D92;font-size:1.6rem}.languageselector-togglebtn:hover,.languageselector-togglebtn:focus,.languageselector-togglebtn:active{color:#0D234B;text-decoration:underline}.languageselector-togglebtn svg{width:1.9rem;height:1.9rem}.languageselector-title{padding:0.8rem 1.6rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.languageselector-list{margin:0;padding:0;list-style:none}";
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, a as Host, g as getElement } from './index-5397620b.js';
2
- import { F as FetchHelper, M as MarketWebContextService } from './MarketWebContextService-872043cc.js';
2
+ import { F as FetchHelper, M as MarketWebContextService } from './MarketWebContextService-3ed3fe80.js';
3
3
 
4
4
  const getSocialMediaIconsByType = (linkType = '', fill = '#005D92') => {
5
5
  switch (linkType) {
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, e as createEvent, h, a as Host, g as getElement } from './index-5397620b.js';
2
- import { F as FetchHelper, M as MarketWebContextService } from './MarketWebContextService-872043cc.js';
2
+ import { F as FetchHelper, M as MarketWebContextService } from './MarketWebContextService-3ed3fe80.js';
3
3
  import { s as state } from './pn-marketweb-siteheader-store-cd0a1dab.js';
4
4
  import './index-7b21ecff.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h } from './index-5397620b.js';
2
- import { F as FetchHelper, M as MarketWebContextService } from './MarketWebContextService-872043cc.js';
2
+ import { F as FetchHelper, M as MarketWebContextService } from './MarketWebContextService-3ed3fe80.js';
3
3
  import { c as createStore } from './index-7b21ecff.js';
4
4
 
5
5
  const translations = {
@@ -250,8 +250,9 @@ let PnProxioFindPrice = class {
250
250
  }
251
251
  init() {
252
252
  this.setState();
253
- this.getDataSource();
254
- this.fetchData();
253
+ this.fetchData().then(() => {
254
+ this.getDataSource();
255
+ });
255
256
  }
256
257
  async getDataSource() {
257
258
  try {
@@ -271,7 +272,7 @@ let PnProxioFindPrice = class {
271
272
  //const fetchUrl = `http://localhost:51444/api/proxio/price-list-groups?market=${this.market}&language=${this.language}&cached=${this.cache}`;
272
273
  const data = await this.fetchHelper.fetchJson(fetchUrl, {
273
274
  'mode': 'cors',
274
- }, this.cache, this.onFetchData.bind(this));
275
+ }, false, this.onFetchData.bind(this));
275
276
  if (data) {
276
277
  this.data.proxioProducts = data;
277
278
  }
@@ -291,9 +292,14 @@ let PnProxioFindPrice = class {
291
292
  }
292
293
  filterItems() {
293
294
  var _a;
294
- if (!this.data) {
295
- console.log('Data has not yet been loaded');
296
- return;
295
+ if (!this.data || !this.data.proxioProducts) {
296
+ console.log('Data has not yet been loaded, fetching again');
297
+ this.fetchData().then(() => {
298
+ if (!this.data) {
299
+ console.log('Data could not be loaded');
300
+ return;
301
+ }
302
+ });
297
303
  }
298
304
  const sizeItemData = this.data.proxioProducts.filter(item => {
299
305
  return item.proxioProduct.productWeightGroupList.some(weightGroup => {
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, a as Host } from './index-5397620b.js';
2
- import { F as FetchHelper, M as MarketWebContextService } from './MarketWebContextService-872043cc.js';
2
+ import { F as FetchHelper, M as MarketWebContextService } from './MarketWebContextService-3ed3fe80.js';
3
3
  import { t as translations } from './translations-0c395f8d.js';
4
4
 
5
5
  const pnProxioPricegroupCss = "pn-proxio-pricegroup div.proxio-pricegroup-container{max-width:99.4rem}pn-proxio-pricegroup div.weightcontainer{margin:2.8rem 0}pn-proxio-pricegroup div.weightvaluecontainer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-line-pack:center;align-content:center;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:start;align-items:flex-start}pn-proxio-pricegroup div.weightvaluecontainer pn-button{-webkit-transform:translateY(-0.4rem);transform:translateY(-0.4rem)}pn-proxio-pricegroup div.weightvaluecontainer pn-button button::before{display:none}pn-proxio-pricegroup div.weightradios{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;-ms-flex-wrap:wrap;flex-wrap:wrap;color:#005D92;width:80%;margin:0 3.6rem;position:relative;width:0%}pn-proxio-pricegroup div.weightradios[data-carousel-container-position=end50]{width:45%;margin-left:auto;margin-right:3.6rem}@media screen and (max-width: 48em){pn-proxio-pricegroup div.weightradios[data-carousel-container-position=end50]{width:40%}}pn-proxio-pricegroup div.weightradios[data-carousel-container-position=end75]{width:65%;margin-left:auto;margin-right:3.6rem}@media screen and (max-width: 48em){pn-proxio-pricegroup div.weightradios[data-carousel-container-position=end75]{margin-right:auto}}pn-proxio-pricegroup div.weightradios[data-carousel-container-position=start50]{width:45%;margin-right:auto;margin-left:3.6rem}@media screen and (max-width: 48em){pn-proxio-pricegroup div.weightradios[data-carousel-container-position=start50]{width:40%}}pn-proxio-pricegroup div.weightradios[data-carousel-container-position=start75]{width:65%;margin-right:auto;margin-left:3.6rem}@media screen and (max-width: 48em){pn-proxio-pricegroup div.weightradios[data-carousel-container-position=start75]{margin-left:auto}}pn-proxio-pricegroup div.weightradios[data-carousel-container-position=default]{-ms-flex:0 0 auto;flex:0 0 auto;width:80%}@media screen and (max-width: 48em){pn-proxio-pricegroup div.weightradios[data-carousel-container-position=default]{width:65%}}pn-proxio-pricegroup div.weightdata{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:center;align-content:center;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:justify;justify-content:space-between;gap:1.2rem;min-width:4rem;cursor:pointer}pn-proxio-pricegroup div.weightdata label{font-size:1.4rem;cursor:pointer}pn-proxio-pricegroup div.weightdata[data-carousel-position=\"0\"]{font-size:2rem;font-weight:700}@media screen and (max-width: 48em){pn-proxio-pricegroup div.weightdata[data-carousel-position=\"2\"],pn-proxio-pricegroup div.weightdata[data-carousel-position=\"-2\"]{display:none}}pn-proxio-pricegroup div.weightdata[data-carousel-position=outside]{display:none}pn-proxio-pricegroup div.weightdata input[type=radio]{-webkit-appearance:none;-moz-appearance:none;width:1.2rem;height:1.2rem;background-color:#005D92;border-radius:50%;margin:0;cursor:pointer}pn-proxio-pricegroup div.weightdata input[type=radio]:checked{z-index:1;-webkit-transform:translateY(-0.1rem);transform:translateY(-0.1rem);height:1.4rem;width:1.4rem;-webkit-box-shadow:0 0 0 0.3rem #FFFFFF, 0 0 0 0.4rem #005D92;box-shadow:0 0 0 0.3rem #FFFFFF, 0 0 0 0.4rem #005D92}pn-proxio-pricegroup div.weightline{width:100%;background-color:#F3F2F2;z-index:-1;height:0.8rem;-webkit-transform:translateX(2.1rem) translateY(1.32rem);transform:translateX(2.1rem) translateY(1rem);border-radius:2rem;margin-right:3.5rem}pn-proxio-pricegroup pn-button[disabled=disabled]{opacity:0.2}pn-proxio-pricegroup pn-button[disabled=disabled] button{cursor:default}pn-proxio-pricegroup pn-button[disabled=disabled] button.pn-button-light .pn-button-bg:after{background-color:#FFFFFF}pn-proxio-pricegroup pn-button[disabled=disabled] button[data-tooltip-open]:before{display:none}pn-proxio-pricegroup pn-button button div.button-tooltip{display:none}pn-proxio-pricegroup pn-button button:focus .pn-button-bg{-webkit-box-shadow:none;box-shadow:none}";
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(t,e,n,r){function o(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,i){function a(t){try{u(r.next(t))}catch(e){i(e)}}function s(t){try{u(r["throw"](t))}catch(e){i(e)}}function u(t){t.done?n(t.value):o(t.value).then(a,s)}u((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return u([t,e])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1];i=a;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(a);break}if(i[2])n.ops.pop();n.trys.pop();continue}a=e.call(t,n)}catch(s){a=[6,s];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var FetchHelper=function(){function t(t){var e=this;if(t===void 0){t=""}this.storagePrefix="";this.store={get:function(t,n){if(n===void 0){n=false}var r=n?window.localStorage:window.sessionStorage;var o=n?window.sessionStorage:window.localStorage;var i=r.getItem("".concat(e.storagePrefix,"-").concat(t));if(!i){i=o.getItem("".concat(e.storagePrefix,"-").concat(t))}if(!i){return i}if(i.indexOf("{")===0){try{return JSON.parse(i)}catch(a){}}if(i.indexOf(",")!==-1){return i.split(",")}return i},set:function(t,n,r){if(r===void 0){r=false}var o=r?window.localStorage:window.sessionStorage;if(typeof n==="object"&&typeof n.length==="undefined"){o.setItem("".concat(e.storagePrefix,"-").concat(t),JSON.stringify(n));return}o.setItem("".concat(e.storagePrefix,"-").concat(t),n)},remove:function(t){window.sessionStorage.removeItem("".concat(e.storagePrefix,"-").concat(t))}};this.storagePrefix=t}t.prototype.fetchJson=function(t,e,n,r){if(e===void 0){e={}}if(n===void 0){n=false}if(r===void 0){r=null}return __awaiter(this,void 0,void 0,(function(){var o;var i=this;return __generator(this,(function(a){o=new Promise((function(o){return __awaiter(i,void 0,void 0,(function(){var i,a,s,u,c,l;return __generator(this,(function(f){switch(f.label){case 0:i=true;a=typeof t==="string"?t:t.url;s=a;u=null;c=null;if(n){c=this.store.get(s);if(c&&!c.permanent){i=false}if(c&&c.data){u=c.data;o(u)}}if(!i)return[3,3];return[4,window.fetch(t,e)];case 1:l=f.sent();return[4,l.json()];case 2:u=f.sent();o(u);if(n){if(typeof r==="function"&&c!=null){r(u)}this.store.set(s,this.wrapJson(u,true),true);this.store.set(s,this.wrapJson(u,false),false)}f.label=3;case 3:return[2]}}))}))}));return[2,o]}))}))};t.prototype.wrapJson=function(t,e){if(e===void 0){e=false}var n=new Date;return{timestamp:n.getTime(),time:n.toISOString(),data:t,permanent:e}};return t}();var MarketWebContextService=function(){function t(t){if(t===void 0){t=window.location.href}this.href="";this.market="";this.language="";this.environment="";this.url=null;this.allowedLanguages=["sv","da","fi","no","en","de","zh","fr","es"];this.allowedMarkets=["se","dk","fi","no","com","de","tpl"];this.wwwMarkets=["se","dk","fi","no","de","com"];this.developmentDomains=["localhost",".local","local.",".dev","dev."];this.markets={se:{fallbackLanguage:"sv",integration:"se-integration.postnord.com",preproduction:"se-preproduction.postnord.com",production:"se-production.postnord.com",live:"www.postnord.se"},dk:{fallbackLanguage:"da",integration:"dk-integration.postnord.com",preproduction:"dk-preproduction.postnord.com",production:"dk-production.postnord.com",live:"www.postnord.dk"},fi:{fallbackLanguage:"fi",integration:"fi-integration.postnord.com",preproduction:"fi-preproduction.postnord.com",production:"fi-production.postnord.com",live:"www.postnord.fi"},no:{fallbackLanguage:"no",integration:"no-integration.postnord.com",preproduction:"no-preproduction.postnord.com",production:"no-production.postnord.com",live:"www.postnord.no"},com:{fallbackLanguage:"en",integration:"com-integration.postnord.com",preproduction:"com-preproduction.postnord.com",production:"com-production.postnord.com",live:"www.postnord.com"},de:{fallbackLanguage:"en",integration:"de-integration.postnord.com",preproduction:"de-preproduction.postnord.com",production:"de-production.postnord.com",live:"www.postnord.de"},tpl:{fallbackLanguage:"sv",integration:"tpl-integration.postnord.com",preproduction:"tpl-preproduction.postnord.com",production:"tpl-production.postnord.com",live:"tpl.postnord.com"}};this.environmentTypes=["integration","preproduction","production"];this.environments={production:{name:"production",url:"https://www.postnord.xx/"},preproduction:{name:"preproduction",url:"https://com-preproduction.postnord.com/"},integration:{name:"integration",url:"https://com-integration.postnord.com/"}};this.href=t;this.url=new URL(this.href)}t.prototype.getLanguage=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(this.language){return[2,this.language]}return[4,this.resolveLanguage()];case 1:t.sent();return[2,this.language]}}))}))};t.prototype.getMarket=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(this.market){return[2,this.market]}return[4,this.resolveMarket()];case 1:t.sent();return[2,this.market]}}))}))};t.prototype.getEndpoint=function(t,e){if(e===void 0){e=""}return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){n=this.environments.production.url;if(this.markets[e]&&this.markets[e][t]){if(t==="production"&&window.location.hostname.indexOf(this.markets[e]["live"])===0){return[2,"https://"+this.markets[e]["live"]]}if(window.location.hostname.indexOf(this.markets[e][t])===0){return[2,"https://"+this.markets[e][t]]}}if(this.environments[t]){n=this.environments[t].url;if(t===this.environments.production.name){if(this.wwwMarkets.indexOf(e)!==-1){n=n.replace(".xx","."+e)}else{n=n.replace(".xx",".com");n=n.replace("www.",e+".")}}}return[2,n]}))}))};t.prototype.getEnvironmentName=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(n){t=this.environmentTypes.filter((function(t){return e.url.hostname.indexOf("-"+t)!==-1}))[0];if(t){this.environment=t;return[2,this.environment]}if(this.url.hostname.indexOf("www.")!==-1){this.environment=this.environments.production.name;return[2,this.environment]}this.environment=this.environments.integration.name;return[2,this.environment]}))}))};t.prototype.isDevEnvironment=function(){var t=this;var e=this.developmentDomains.filter((function(e){return t.url.hostname.indexOf(e)!==-1}))[0];return e.length>0};t.prototype.resolveMarket=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,r,o,i,a,s,u,c;var l=this;return __generator(this,(function(f){if(this.href.indexOf("//www.")!==-1){t=this.url.hostname.substring(this.url.hostname.lastIndexOf(".")+1,this.url.hostname.length);if(t&&this.markets[t]){this.market=t}else{console.warn("Unable to define market from www. domain",this.href)}}e=this.environmentTypes.filter((function(t){return l.url.hostname.indexOf("-"+t)!==-1}));if(!this.market&&e&&e.length>0){n=e[0];r=this.url.hostname.substring(0,this.url.hostname.indexOf("-"+n));if(r&&this.markets[r]){this.market=r}else{console.warn("Unable to define market from preset environment names",this.href)}}if(!this.market){if(this.url.hostname.indexOf("www")===-1&&this.url.hostname.indexOf(".postnord.")>0){o=this.url.hostname.indexOf(".")!==this.url.hostname.indexOf(".postnord")?this.url.hostname.indexOf("."):0;i=this.url.hostname.substring(o,this.url.hostname.indexOf(".postnord."));if(this.allowedMarkets.indexOf(i)!==-1){this.market=i;return[2]}}}if(!this.market){a=this.developmentDomains.filter((function(t){return l.url.hostname.indexOf(t)!==-1}))[0];if(!a){this.market=this.allowedMarkets[0];return[2]}s=this.href.replace(a,"");u=this.allowedMarkets.filter((function(t){var e=["."+t,t+".","/"+t+"/"];var n=e.filter((function(t){return s.indexOf(t)!==-1}));return n.length>0}))[0];if(u){this.market=u}else{c=Object.entries(this.markets).filter((function(t){var e=["."+t[1].fallbackLanguage,t[1].fallbackLanguage+".","/"+t[1].fallbackLanguage+"/"];var n=e.filter((function(t){return s.indexOf(t)!==-1}));return n.length>0}))[0];if(c&&c[0]){this.market=c[0]}}}if(!this.market){console.info("Was unable to detect market, used fallback");this.market=this.allowedMarkets[0]}return[2]}))}))};t.prototype.resolveLanguage=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,r,o;var i=this;return __generator(this,(function(a){if(this.language){return[2]}o=[(t=document.querySelector("html[lang]"))===null||t===void 0?void 0:t.getAttribute("lang"),(e=document.querySelector('[http-equiv="content-language"][content]'))===null||e===void 0?void 0:e.getAttribute("content"),(n=document.querySelector('[property="og:locale"][content]'))===null||n===void 0?void 0:n.getAttribute("content"),(r=document.querySelector("[lang]"))===null||r===void 0?void 0:r.getAttribute("lang")];o.filter((function(t){return t})).forEach((function(t){if(i.allowedLanguages.indexOf(t)){i.language=t;return}}));if(!this.language&&this.market){this.language=this.markets[this.market].fallbackLanguage}return[2]}))}))};return t}();export{FetchHelper as F,MarketWebContextService as M};