@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.
- package/cjs/{MarketWebContextService-392b4585.js → MarketWebContextService-f77b4a5f.js} +61 -59
- package/cjs/pn-language-selector_9.cjs.entry.js +22 -13
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +1 -1
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +1 -1
- package/cjs/pn-proxio-findprice.cjs.entry.js +13 -7
- package/cjs/pn-proxio-pricegroup.cjs.entry.js +1 -1
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +3 -2
- package/collection/components/navigation/pn-language-selector/translations.js +22 -13
- package/collection/components/widgets/pn-proxio-findprice/pn-proxio-findprice.js +12 -6
- package/collection/globals/MarketWebContextService.js +61 -59
- package/custom-elements/index.js +95 -78
- package/esm/{MarketWebContextService-872043cc.js → MarketWebContextService-3ed3fe80.js} +61 -59
- package/esm/pn-language-selector_9.entry.js +22 -13
- package/esm/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm/pn-marketweb-siteheader.entry.js +1 -1
- package/esm/pn-proxio-findprice.entry.js +13 -7
- package/esm/pn-proxio-pricegroup.entry.js +1 -1
- package/esm-es5/MarketWebContextService-3ed3fe80.js +1 -0
- package/esm-es5/pn-language-selector_9.entry.js +1 -1
- package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
- package/esm-es5/pn-proxio-findprice.entry.js +1 -1
- package/esm-es5/pn-proxio-pricegroup.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/p-2e2dfb79.entry.js +1 -0
- package/pn-market-web-components/p-67887512.system.js +1 -1
- package/pn-market-web-components/{p-befd7c8d.entry.js → p-77c907d9.entry.js} +1 -1
- package/pn-market-web-components/p-783b4892.js +1 -0
- package/pn-market-web-components/{p-dc714241.entry.js → p-803088a3.entry.js} +1 -1
- package/pn-market-web-components/p-861def61.entry.js +1 -0
- package/pn-market-web-components/p-8f1b7c70.system.entry.js +1 -0
- package/pn-market-web-components/{p-fe417bbb.system.entry.js → p-906719be.system.entry.js} +1 -1
- package/pn-market-web-components/{p-dd0b02de.entry.js → p-9c2c1aa2.entry.js} +1 -1
- package/pn-market-web-components/{p-5b802a17.system.entry.js → p-bb4f0673.system.entry.js} +1 -1
- package/pn-market-web-components/p-cb53b67f.system.js +1 -0
- package/pn-market-web-components/{p-9c18464d.system.entry.js → p-efe598a8.system.entry.js} +1 -1
- package/pn-market-web-components/{p-ed990629.system.entry.js → p-f008015e.system.entry.js} +1 -1
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/navigation/pn-language-selector/translations.d.ts +9 -0
- package/esm-es5/MarketWebContextService-872043cc.js +0 -1
- package/pn-market-web-components/p-31fd7a95.system.js +0 -1
- package/pn-market-web-components/p-5176eaf3.entry.js +0 -1
- package/pn-market-web-components/p-74120b9b.js +0 -1
- package/pn-market-web-components/p-84193b02.system.entry.js +0 -1
- package/pn-market-web-components/p-b3bf353f.entry.js +0 -1
|
@@ -86,80 +86,80 @@ class FetchHelper {
|
|
|
86
86
|
|
|
87
87
|
class MarketWebContextService {
|
|
88
88
|
constructor(href = window.location.href) {
|
|
89
|
-
this.href =
|
|
90
|
-
this.market =
|
|
91
|
-
this.language =
|
|
92
|
-
this.environment =
|
|
89
|
+
this.href = '';
|
|
90
|
+
this.market = '';
|
|
91
|
+
this.language = '';
|
|
92
|
+
this.environment = '';
|
|
93
93
|
this.url = null;
|
|
94
|
-
this.allowedLanguages = [
|
|
95
|
-
this.allowedMarkets = [
|
|
96
|
-
this.wwwMarkets = [
|
|
97
|
-
this.developmentDomains = [
|
|
94
|
+
this.allowedLanguages = ['sv', 'da', 'fi', 'no', 'en', 'de', 'zh', 'fr', 'es'];
|
|
95
|
+
this.allowedMarkets = ['se', 'dk', 'fi', 'no', 'com', 'de', 'tpl'];
|
|
96
|
+
this.wwwMarkets = ['se', 'dk', 'fi', 'no', 'de', 'com'];
|
|
97
|
+
this.developmentDomains = ['localhost', '.local', 'local.', '.dev', 'dev.'];
|
|
98
98
|
this.markets = {
|
|
99
|
-
|
|
100
|
-
fallbackLanguage:
|
|
99
|
+
se: {
|
|
100
|
+
fallbackLanguage: 'sv',
|
|
101
101
|
integration: 'se-integration.postnord.com',
|
|
102
102
|
preproduction: 'se-preproduction.postnord.com',
|
|
103
103
|
production: 'se-production.postnord.com',
|
|
104
|
-
live: 'www.postnord.se'
|
|
104
|
+
live: 'www.postnord.se',
|
|
105
105
|
},
|
|
106
|
-
|
|
107
|
-
fallbackLanguage:
|
|
106
|
+
dk: {
|
|
107
|
+
fallbackLanguage: 'da',
|
|
108
108
|
integration: 'dk-integration.postnord.com',
|
|
109
109
|
preproduction: 'dk-preproduction.postnord.com',
|
|
110
110
|
production: 'dk-production.postnord.com',
|
|
111
|
-
live: 'www.postnord.dk'
|
|
111
|
+
live: 'www.postnord.dk',
|
|
112
112
|
},
|
|
113
|
-
|
|
114
|
-
fallbackLanguage:
|
|
113
|
+
fi: {
|
|
114
|
+
fallbackLanguage: 'fi',
|
|
115
115
|
integration: 'fi-integration.postnord.com',
|
|
116
116
|
preproduction: 'fi-preproduction.postnord.com',
|
|
117
117
|
production: 'fi-production.postnord.com',
|
|
118
|
-
live: 'www.postnord.fi'
|
|
118
|
+
live: 'www.postnord.fi',
|
|
119
119
|
},
|
|
120
|
-
|
|
121
|
-
fallbackLanguage:
|
|
120
|
+
no: {
|
|
121
|
+
fallbackLanguage: 'no',
|
|
122
122
|
integration: 'no-integration.postnord.com',
|
|
123
123
|
preproduction: 'no-preproduction.postnord.com',
|
|
124
124
|
production: 'no-production.postnord.com',
|
|
125
|
-
live: 'www.postnord.no'
|
|
125
|
+
live: 'www.postnord.no',
|
|
126
126
|
},
|
|
127
|
-
|
|
128
|
-
fallbackLanguage:
|
|
127
|
+
com: {
|
|
128
|
+
fallbackLanguage: 'en',
|
|
129
129
|
integration: 'com-integration.postnord.com',
|
|
130
130
|
preproduction: 'com-preproduction.postnord.com',
|
|
131
131
|
production: 'com-production.postnord.com',
|
|
132
|
-
live: 'www.postnord.com'
|
|
132
|
+
live: 'www.postnord.com',
|
|
133
133
|
},
|
|
134
|
-
|
|
135
|
-
fallbackLanguage:
|
|
134
|
+
de: {
|
|
135
|
+
fallbackLanguage: 'en',
|
|
136
136
|
integration: 'de-integration.postnord.com',
|
|
137
137
|
preproduction: 'de-preproduction.postnord.com',
|
|
138
138
|
production: 'de-production.postnord.com',
|
|
139
|
-
live: 'www.postnord.de'
|
|
139
|
+
live: 'www.postnord.de',
|
|
140
140
|
},
|
|
141
|
-
|
|
142
|
-
fallbackLanguage:
|
|
141
|
+
tpl: {
|
|
142
|
+
fallbackLanguage: 'sv',
|
|
143
143
|
integration: 'tpl-integration.postnord.com',
|
|
144
144
|
preproduction: 'tpl-preproduction.postnord.com',
|
|
145
145
|
production: 'tpl-production.postnord.com',
|
|
146
|
-
live: 'tpl.postnord.com'
|
|
146
|
+
live: 'tpl.postnord.com',
|
|
147
147
|
},
|
|
148
148
|
};
|
|
149
|
-
this.environmentTypes = [
|
|
149
|
+
this.environmentTypes = ['integration', 'preproduction', 'production'];
|
|
150
150
|
this.environments = {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
production: {
|
|
152
|
+
name: 'production',
|
|
153
|
+
url: 'https://www.postnord.xx/',
|
|
154
154
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
preproduction: {
|
|
156
|
+
name: 'preproduction',
|
|
157
|
+
url: 'https://com-preproduction.postnord.com/',
|
|
158
|
+
},
|
|
159
|
+
integration: {
|
|
160
|
+
name: 'integration',
|
|
161
|
+
url: 'https://com-integration.postnord.com/',
|
|
158
162
|
},
|
|
159
|
-
"integration": {
|
|
160
|
-
"name": "integration",
|
|
161
|
-
"url": "https://com-integration.postnord.com/"
|
|
162
|
-
}
|
|
163
163
|
};
|
|
164
164
|
this.href = href;
|
|
165
165
|
this.url = new URL(this.href);
|
|
@@ -178,7 +178,7 @@ class MarketWebContextService {
|
|
|
178
178
|
await this.resolveMarket();
|
|
179
179
|
return this.market;
|
|
180
180
|
}
|
|
181
|
-
async getEndpoint(environmentName, marketName =
|
|
181
|
+
async getEndpoint(environmentName, marketName = '') {
|
|
182
182
|
let url = this.environments.production.url;
|
|
183
183
|
if (this.markets[marketName] && this.markets[marketName][environmentName]) {
|
|
184
184
|
if (environmentName === 'production' && window.location.hostname.indexOf(this.markets[marketName]['live']) === 0) {
|
|
@@ -195,18 +195,18 @@ class MarketWebContextService {
|
|
|
195
195
|
if (environmentName === this.environments.production.name) {
|
|
196
196
|
if (this.wwwMarkets.indexOf(marketName) !== -1) {
|
|
197
197
|
// Handles www.postnord.xx domains
|
|
198
|
-
url = url.replace(
|
|
198
|
+
url = url.replace('.xx', '.' + marketName);
|
|
199
199
|
}
|
|
200
200
|
else {
|
|
201
|
-
url = url.replace(
|
|
202
|
-
url = url.replace(
|
|
201
|
+
url = url.replace('.xx', '.com'); // Expect URL to end in postnord.com
|
|
202
|
+
url = url.replace('www.', marketName + '.');
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
return url;
|
|
207
207
|
}
|
|
208
208
|
async getEnvironmentName() {
|
|
209
|
-
const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(
|
|
209
|
+
const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf('-' + x) !== -1)[0];
|
|
210
210
|
if (likelyEnvironment) {
|
|
211
211
|
this.environment = likelyEnvironment;
|
|
212
212
|
return this.environment;
|
|
@@ -224,17 +224,17 @@ class MarketWebContextService {
|
|
|
224
224
|
}
|
|
225
225
|
async resolveMarket() {
|
|
226
226
|
// Resolve market from www domains
|
|
227
|
-
if (this.href.indexOf(
|
|
227
|
+
if (this.href.indexOf('//www.') !== -1) {
|
|
228
228
|
const domainRoot = this.url.hostname.substring(this.url.hostname.lastIndexOf('.') + 1, this.url.hostname.length);
|
|
229
229
|
if (domainRoot && this.markets[domainRoot]) {
|
|
230
230
|
this.market = domainRoot;
|
|
231
231
|
}
|
|
232
232
|
else {
|
|
233
|
-
console.warn(
|
|
233
|
+
console.warn('Unable to define market from www. domain', this.href);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
// Check if domains are on one of the integration/preproduction/production environments urls
|
|
237
|
-
const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf(
|
|
237
|
+
const likelyEnvironment = this.environmentTypes.filter(x => this.url.hostname.indexOf('-' + x) !== -1);
|
|
238
238
|
if (!this.market && likelyEnvironment && likelyEnvironment.length > 0) {
|
|
239
239
|
const matchedEnvironment = likelyEnvironment[0];
|
|
240
240
|
const marketPrefix = this.url.hostname.substring(0, this.url.hostname.indexOf('-' + matchedEnvironment));
|
|
@@ -242,14 +242,14 @@ class MarketWebContextService {
|
|
|
242
242
|
this.market = marketPrefix;
|
|
243
243
|
}
|
|
244
244
|
else {
|
|
245
|
-
console.warn(
|
|
245
|
+
console.warn('Unable to define market from preset environment names', this.href);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
if (!this.market) {
|
|
249
249
|
if (this.url.hostname.indexOf('www') === -1 && this.url.hostname.indexOf('.postnord.') > 0) {
|
|
250
250
|
const start = this.url.hostname.indexOf('.') !== this.url.hostname.indexOf('.postnord') ? this.url.hostname.indexOf('.') : 0;
|
|
251
251
|
const potentialMarket = this.url.hostname.substring(start, this.url.hostname.indexOf('.postnord.'));
|
|
252
|
-
// Break down the subdomain to the word closest to .postnord. and take that word.
|
|
252
|
+
// Break down the subdomain to the word closest to .postnord. and take that word.
|
|
253
253
|
// Supports sub-sub domain down to 1 level.
|
|
254
254
|
if (this.allowedMarkets.indexOf(potentialMarket) !== -1) {
|
|
255
255
|
this.market = potentialMarket;
|
|
@@ -257,7 +257,7 @@ class MarketWebContextService {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
// Check if we're on a development environment
|
|
260
|
+
// Check if we're on a development environment
|
|
261
261
|
if (!this.market) {
|
|
262
262
|
const matchedDevEnvironment = this.developmentDomains.filter(x => this.url.hostname.indexOf(x) !== -1)[0];
|
|
263
263
|
if (!matchedDevEnvironment) {
|
|
@@ -265,7 +265,7 @@ class MarketWebContextService {
|
|
|
265
265
|
this.market = this.allowedMarkets[0];
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
const urlWithoutDomain = this.href.replace(matchedDevEnvironment,
|
|
268
|
+
const urlWithoutDomain = this.href.replace(matchedDevEnvironment, '');
|
|
269
269
|
// We see if the dev environment contains something like /dk
|
|
270
270
|
let matchedMarket = this.allowedMarkets.filter(x => {
|
|
271
271
|
const typesOfFallback = ['.' + x, x + '.', '/' + x + '/']; // Ex /dk, dk.html, /dk/
|
|
@@ -277,7 +277,7 @@ class MarketWebContextService {
|
|
|
277
277
|
}
|
|
278
278
|
else {
|
|
279
279
|
// We do a similar filter for subpaths but for language this time
|
|
280
|
-
let filteredMarket = Object.entries(this.markets).filter(
|
|
280
|
+
let filteredMarket = Object.entries(this.markets).filter(item => {
|
|
281
281
|
const typesOfFallback = ['.' + item[1].fallbackLanguage, item[1].fallbackLanguage + '.', '/' + item[1].fallbackLanguage + '/']; // Ex /dk, dk.html, /dk/
|
|
282
282
|
const matchedTypeOfFallback = typesOfFallback.filter(y => urlWithoutDomain.indexOf(y) !== -1);
|
|
283
283
|
return matchedTypeOfFallback.length > 0;
|
|
@@ -288,7 +288,7 @@ class MarketWebContextService {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
if (!this.market) {
|
|
291
|
-
console.info(
|
|
291
|
+
console.info('Was unable to detect market, used fallback');
|
|
292
292
|
this.market = this.allowedMarkets[0];
|
|
293
293
|
}
|
|
294
294
|
}
|
|
@@ -298,12 +298,14 @@ class MarketWebContextService {
|
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
const potentialLanguages = [
|
|
301
|
-
(_a = document.querySelector(
|
|
302
|
-
(_b = document.querySelector('[http-equiv="content-language"][content]')) === null || _b === void 0 ? void 0 : _b.getAttribute(
|
|
303
|
-
(_c = document.querySelector('[property="og:locale"][content]')) === null || _c === void 0 ? void 0 : _c.getAttribute(
|
|
304
|
-
(_d = document.querySelector(
|
|
301
|
+
(_a = document.querySelector('html[lang]')) === null || _a === void 0 ? void 0 : _a.getAttribute('lang'),
|
|
302
|
+
(_b = document.querySelector('[http-equiv="content-language"][content]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content'),
|
|
303
|
+
(_c = document.querySelector('[property="og:locale"][content]')) === null || _c === void 0 ? void 0 : _c.getAttribute('content'),
|
|
304
|
+
(_d = document.querySelector('[lang]')) === null || _d === void 0 ? void 0 : _d.getAttribute('lang'),
|
|
305
305
|
];
|
|
306
|
-
potentialLanguages
|
|
306
|
+
potentialLanguages
|
|
307
|
+
.filter(x => x)
|
|
308
|
+
.forEach(language => {
|
|
307
309
|
if (this.allowedLanguages.indexOf(language)) {
|
|
308
310
|
this.language = language;
|
|
309
311
|
return;
|
|
@@ -8,24 +8,33 @@ const pnMarketwebSiteheaderStore = require('./pn-marketweb-siteheader-store-e29a
|
|
|
8
8
|
const index$1 = require('./index-28bbc937.js');
|
|
9
9
|
|
|
10
10
|
const translations$1 = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
sv: {
|
|
12
|
+
heading: 'Språk',
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
en: {
|
|
15
|
+
heading: 'Language',
|
|
16
16
|
},
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
da: {
|
|
18
|
+
heading: 'Sprog',
|
|
19
19
|
},
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
no: {
|
|
21
|
+
heading: 'Språk',
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
fi: {
|
|
24
|
+
heading: 'Kieli',
|
|
25
|
+
},
|
|
26
|
+
de: {
|
|
27
|
+
heading: 'Sprache',
|
|
28
|
+
},
|
|
29
|
+
zh: {
|
|
30
|
+
heading: '语言',
|
|
31
|
+
},
|
|
32
|
+
fr: {
|
|
33
|
+
heading: 'Langue',
|
|
34
|
+
},
|
|
35
|
+
es: {
|
|
36
|
+
heading: 'Idioma',
|
|
25
37
|
},
|
|
26
|
-
'de': {
|
|
27
|
-
"heading": "Sprache"
|
|
28
|
-
}
|
|
29
38
|
};
|
|
30
39
|
|
|
31
40
|
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}";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e3e27c79.js');
|
|
6
|
-
const MarketWebContextService = require('./MarketWebContextService-
|
|
6
|
+
const MarketWebContextService = require('./MarketWebContextService-f77b4a5f.js');
|
|
7
7
|
|
|
8
8
|
const getSocialMediaIconsByType = (linkType = '', fill = '#005D92') => {
|
|
9
9
|
switch (linkType) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e3e27c79.js');
|
|
6
|
-
const MarketWebContextService = require('./MarketWebContextService-
|
|
6
|
+
const MarketWebContextService = require('./MarketWebContextService-f77b4a5f.js');
|
|
7
7
|
const pnMarketwebSiteheaderStore = require('./pn-marketweb-siteheader-store-e29ad918.js');
|
|
8
8
|
require('./index-28bbc937.js');
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index$1 = require('./index-e3e27c79.js');
|
|
6
|
-
const MarketWebContextService = require('./MarketWebContextService-
|
|
6
|
+
const MarketWebContextService = require('./MarketWebContextService-f77b4a5f.js');
|
|
7
7
|
const index = require('./index-28bbc937.js');
|
|
8
8
|
|
|
9
9
|
const translations = {
|
|
@@ -254,8 +254,9 @@ let PnProxioFindPrice = class {
|
|
|
254
254
|
}
|
|
255
255
|
init() {
|
|
256
256
|
this.setState();
|
|
257
|
-
this.
|
|
258
|
-
|
|
257
|
+
this.fetchData().then(() => {
|
|
258
|
+
this.getDataSource();
|
|
259
|
+
});
|
|
259
260
|
}
|
|
260
261
|
async getDataSource() {
|
|
261
262
|
try {
|
|
@@ -275,7 +276,7 @@ let PnProxioFindPrice = class {
|
|
|
275
276
|
//const fetchUrl = `http://localhost:51444/api/proxio/price-list-groups?market=${this.market}&language=${this.language}&cached=${this.cache}`;
|
|
276
277
|
const data = await this.fetchHelper.fetchJson(fetchUrl, {
|
|
277
278
|
'mode': 'cors',
|
|
278
|
-
},
|
|
279
|
+
}, false, this.onFetchData.bind(this));
|
|
279
280
|
if (data) {
|
|
280
281
|
this.data.proxioProducts = data;
|
|
281
282
|
}
|
|
@@ -295,9 +296,14 @@ let PnProxioFindPrice = class {
|
|
|
295
296
|
}
|
|
296
297
|
filterItems() {
|
|
297
298
|
var _a;
|
|
298
|
-
if (!this.data) {
|
|
299
|
-
console.log('Data has not yet been loaded');
|
|
300
|
-
|
|
299
|
+
if (!this.data || !this.data.proxioProducts) {
|
|
300
|
+
console.log('Data has not yet been loaded, fetching again');
|
|
301
|
+
this.fetchData().then(() => {
|
|
302
|
+
if (!this.data) {
|
|
303
|
+
console.log('Data could not be loaded');
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
301
307
|
}
|
|
302
308
|
const sizeItemData = this.data.proxioProducts.filter(item => {
|
|
303
309
|
return item.proxioProduct.productWeightGroupList.some(weightGroup => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e3e27c79.js');
|
|
6
|
-
const MarketWebContextService = require('./MarketWebContextService-
|
|
6
|
+
const MarketWebContextService = require('./MarketWebContextService-f77b4a5f.js');
|
|
7
7
|
const translations = require('./translations-aef1609e.js');
|
|
8
8
|
|
|
9
9
|
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}";
|
|
@@ -26,6 +26,7 @@ export default {
|
|
|
26
26
|
{ name: 'Danish', value: 'da' },
|
|
27
27
|
{ name: 'Finnish', value: 'fi' },
|
|
28
28
|
{ name: 'Norwegian', value: 'no' },
|
|
29
|
+
{ name: 'Chinese', value: 'zh' },
|
|
29
30
|
],
|
|
30
31
|
},
|
|
31
32
|
endpoint: {
|
|
@@ -475,8 +476,8 @@ const DotComSiteHeaderTemplate = ({ ...args }) => {
|
|
|
475
476
|
|
|
476
477
|
export const DotComSiteHeader = DotComSiteHeaderTemplate.bind({});
|
|
477
478
|
DotComSiteHeader.args = {
|
|
478
|
-
market: '
|
|
479
|
-
language: '
|
|
479
|
+
market: 'com',
|
|
480
|
+
language: 'zh',
|
|
480
481
|
endpoint: 'https://com-integration.postnord.com',
|
|
481
482
|
name: 'DotCom User',
|
|
482
483
|
loggedin: true,
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
export const translations = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
sv: {
|
|
3
|
+
heading: 'Språk',
|
|
4
4
|
},
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
en: {
|
|
6
|
+
heading: 'Language',
|
|
7
7
|
},
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
da: {
|
|
9
|
+
heading: 'Sprog',
|
|
10
10
|
},
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
no: {
|
|
12
|
+
heading: 'Språk',
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
fi: {
|
|
15
|
+
heading: 'Kieli',
|
|
16
|
+
},
|
|
17
|
+
de: {
|
|
18
|
+
heading: 'Sprache',
|
|
19
|
+
},
|
|
20
|
+
zh: {
|
|
21
|
+
heading: '语言',
|
|
22
|
+
},
|
|
23
|
+
fr: {
|
|
24
|
+
heading: 'Langue',
|
|
25
|
+
},
|
|
26
|
+
es: {
|
|
27
|
+
heading: 'Idioma',
|
|
16
28
|
},
|
|
17
|
-
'de': {
|
|
18
|
-
"heading": "Sprache"
|
|
19
|
-
}
|
|
20
29
|
};
|
|
@@ -42,8 +42,9 @@ export class PnProxioFindPrice {
|
|
|
42
42
|
}
|
|
43
43
|
init() {
|
|
44
44
|
this.setState();
|
|
45
|
-
this.
|
|
46
|
-
|
|
45
|
+
this.fetchData().then(() => {
|
|
46
|
+
this.getDataSource();
|
|
47
|
+
});
|
|
47
48
|
}
|
|
48
49
|
async getDataSource() {
|
|
49
50
|
try {
|
|
@@ -63,7 +64,7 @@ export class PnProxioFindPrice {
|
|
|
63
64
|
//const fetchUrl = `http://localhost:51444/api/proxio/price-list-groups?market=${this.market}&language=${this.language}&cached=${this.cache}`;
|
|
64
65
|
const data = await this.fetchHelper.fetchJson(fetchUrl, {
|
|
65
66
|
'mode': 'cors',
|
|
66
|
-
},
|
|
67
|
+
}, false, this.onFetchData.bind(this));
|
|
67
68
|
if (data) {
|
|
68
69
|
this.data.proxioProducts = data;
|
|
69
70
|
}
|
|
@@ -83,9 +84,14 @@ export class PnProxioFindPrice {
|
|
|
83
84
|
}
|
|
84
85
|
filterItems() {
|
|
85
86
|
var _a;
|
|
86
|
-
if (!this.data) {
|
|
87
|
-
console.log('Data has not yet been loaded');
|
|
88
|
-
|
|
87
|
+
if (!this.data || !this.data.proxioProducts) {
|
|
88
|
+
console.log('Data has not yet been loaded, fetching again');
|
|
89
|
+
this.fetchData().then(() => {
|
|
90
|
+
if (!this.data) {
|
|
91
|
+
console.log('Data could not be loaded');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
89
95
|
}
|
|
90
96
|
const sizeItemData = this.data.proxioProducts.filter(item => {
|
|
91
97
|
return item.proxioProduct.productWeightGroupList.some(weightGroup => {
|