@postnord/pn-marketweb-components 2.2.0 → 2.2.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 (35) hide show
  1. package/cjs/loader.cjs.js +1 -1
  2. package/cjs/pn-market-web-components.cjs.js +1 -1
  3. package/cjs/pn-marketweb-siteheader.cjs.entry.js +1 -1
  4. package/cjs/pn-proxio-findprice.cjs.entry.js +107 -34
  5. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.css +1 -4
  6. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +1 -1
  7. package/collection/components/widgets/pn-proxio-findprice/data.js +47 -25
  8. package/collection/components/widgets/pn-proxio-findprice/pn-proxio-findprice-store.js +3 -1
  9. package/collection/components/widgets/pn-proxio-findprice/pn-proxio-findprice-translations.js +13 -3
  10. package/collection/components/widgets/pn-proxio-findprice/pn-proxio-findprice.css +10 -0
  11. package/collection/components/widgets/pn-proxio-findprice/pn-proxio-findprice.js +69 -9
  12. package/custom-elements/index.js +109 -36
  13. package/esm/loader.js +1 -1
  14. package/esm/pn-market-web-components.js +1 -1
  15. package/esm/pn-marketweb-siteheader.entry.js +1 -1
  16. package/esm/pn-proxio-findprice.entry.js +107 -34
  17. package/esm-es5/loader.js +1 -1
  18. package/esm-es5/pn-market-web-components.js +1 -1
  19. package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
  20. package/esm-es5/pn-proxio-findprice.entry.js +1 -1
  21. package/package.json +1 -1
  22. package/pn-market-web-components/p-67887512.system.js +1 -1
  23. package/pn-market-web-components/p-780b114e.system.entry.js +1 -0
  24. package/pn-market-web-components/p-9c18464d.system.entry.js +1 -0
  25. package/pn-market-web-components/p-a5764a6c.entry.js +1 -0
  26. package/pn-market-web-components/{p-b5fde443.entry.js → p-dc714241.entry.js} +1 -1
  27. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  28. package/types/components/widgets/pn-proxio-findprice/pn-proxio-findprice-store.d.ts +4 -0
  29. package/types/components/widgets/pn-proxio-findprice/pn-proxio-findprice-translations.d.ts +10 -0
  30. package/types/components/widgets/pn-proxio-findprice/pn-proxio-findprice-types.d.ts +2 -0
  31. package/types/components/widgets/pn-proxio-findprice/pn-proxio-findprice.d.ts +4 -0
  32. package/types/components.d.ts +2 -0
  33. package/pn-market-web-components/p-2423d620.system.entry.js +0 -1
  34. package/pn-market-web-components/p-25496649.system.entry.js +0 -1
  35. package/pn-market-web-components/p-2c7ba802.entry.js +0 -1
@@ -299,9 +299,6 @@ header[data-header-theme=dotcom] > pn-marketweb-siteheader > header nav.mainnav
299
299
  top: 6.4em;
300
300
  }
301
301
  }
302
- header[data-header-theme=dotcom] > pn-marketweb-siteheader > header nav.mainnav a {
303
- color: #FFFFFF;
304
- }
305
302
  header[data-header-theme=dotcom] > pn-marketweb-siteheader > header nav.mainnav pn-mainnav-level [slot=top].siteheader-menu-top pn-marketweb-siteheader-search {
306
303
  padding-bottom: 0.5rem;
307
304
  background-color: #0D234B;
@@ -360,7 +357,7 @@ header[data-header-theme=dotcom] > pn-marketweb-siteheader > header nav.mainnav
360
357
  background-color: #00A0D6;
361
358
  text-decoration: none;
362
359
  }
363
- header[data-header-theme=dotcom] > pn-marketweb-siteheader > header nav.mainnav pn-marketweb-siteheader-login-linklist ul li a {
360
+ header[data-header-theme=dotcom] > pn-marketweb-siteheader > header nav.mainnav pn-marketweb-siteheader-login-linklist ul li a:not(.pn-button) {
364
361
  color: #005D92;
365
362
  }
366
363
  header[data-header-theme=dotcom] > pn-marketweb-siteheader > header [data-level="1"] pn-mainnav-link pn-icon.first-level_arrow svg > path {
@@ -479,7 +479,7 @@ DotComSiteHeader.args = {
479
479
  language: 'sv',
480
480
  endpoint: 'https://com-integration.postnord.com',
481
481
  name: 'DotCom User',
482
- loggedin: false,
482
+ loggedin: true,
483
483
  loginInfo: encodeURIComponent('Hello i am a <a href="#">link!</a>'),
484
484
  unified: true,
485
485
  showProfileSelection: false,
@@ -6,34 +6,56 @@ const sizeCategories = [
6
6
  ];
7
7
 
8
8
  const weights = {
9
- "S": [
10
- { name: "50 g", abbreviation: 'g', value: 50 },
11
- { name: "100 g", abbreviation: 'g', value: 100 },
12
- { name: "250 g", abbreviation: 'g', value: 250 },
13
- { name: "500 g", abbreviation: 'g', value: 500 },
14
- { name: "1 kg", abbreviation: 'kg', value: 1000 },
15
- { name: "2 kg", abbreviation: 'kg', value: 2000 },
16
- ],
17
- "M": [
18
- { name: "1 kg", abbreviation: 'kg', value: 1000 },
19
- { name: "2 kg", abbreviation: 'kg', value: 2000},
20
- { name: "3 kg", abbreviation: 'kg', value: 3000 },
21
- { name: "5 kg", abbreviation: 'kg', value: 5000 },
22
- { name: "10 kg", abbreviation: 'kg', value: 10000 },
23
- { name: "15 kg", abbreviation: 'kg', value: 15000 },
24
- { name: "20 kg", abbreviation: 'kg', value: 20000 },
25
- ],
26
- "L": [
27
- { name: "3 kg", abbreviation: 'kg', value: 3000 },
28
- { name: "5 kg", abbreviation: 'kg', value: 5000 },
29
- { name: "10 kg", abbreviation: 'kg', value: 10000 },
30
- { name: "15 kg", abbreviation: 'kg', value: 15000 },
31
- { name: "20 kg", abbreviation: 'kg', value: 20000 },
32
- ]
9
+ "se": {
10
+ "S": [
11
+ { name: "50 g", abbreviation: 'g', value: 50 },
12
+ { name: "100 g", abbreviation: 'g', value: 100 },
13
+ { name: "250 g", abbreviation: 'g', value: 250 },
14
+ { name: "500 g", abbreviation: 'g', value: 500 },
15
+ { name: "1 kg", abbreviation: 'kg', value: 1000 },
16
+ { name: "2 kg", abbreviation: 'kg', value: 2000 },
17
+ ],
18
+ "M": [
19
+ { name: "1 kg", abbreviation: 'kg', value: 1000 },
20
+ { name: "2 kg", abbreviation: 'kg', value: 2000 },
21
+ { name: "3 kg", abbreviation: 'kg', value: 3000 },
22
+ { name: "5 kg", abbreviation: 'kg', value: 5000 },
23
+ { name: "10 kg", abbreviation: 'kg', value: 10000 },
24
+ { name: "15 kg", abbreviation: 'kg', value: 15000 },
25
+ { name: "20 kg", abbreviation: 'kg', value: 20000 },
26
+ ],
27
+ "L": [
28
+ { name: "3 kg", abbreviation: 'kg', value: 3000 },
29
+ { name: "5 kg", abbreviation: 'kg', value: 5000 },
30
+ { name: "10 kg", abbreviation: 'kg', value: 10000 },
31
+ { name: "15 kg", abbreviation: 'kg', value: 15000 },
32
+ { name: "20 kg", abbreviation: 'kg', value: 20000 },
33
+ ]
34
+ },
35
+ "dk": {
36
+ "S": [
37
+ { name: "50 g", abbreviation: 'g', value: 50 },
38
+ { name: "100 g", abbreviation: 'g', value: 100 },
39
+ { name: "250 g", abbreviation: 'g', value: 250 },
40
+ { name: "500 g", abbreviation: 'g', value: 500 },
41
+ { name: "1 kg", abbreviation: 'kg', value: 1000 },
42
+ { name: "2 kg", abbreviation: 'kg', value: 2000 },
43
+ ],
44
+ "M": [],
45
+ "L": [
46
+ { name: "2 kg", abbreviation: 'kg', value: 2000 },
47
+ { name: "5 kg", abbreviation: 'kg', value: 5000 },
48
+ { name: "10 kg", abbreviation: 'kg', value: 10000 },
49
+ { name: "15 kg", abbreviation: 'kg', value: 15000 },
50
+ { name: "20 kg", abbreviation: 'kg', value: 20000 },
51
+ { name: "25 kg", abbreviation: 'kg', value: 25000 },
52
+ { name: "30 kg", abbreviation: 'kg', value: 30000 },
53
+ { name: "35 kg", abbreviation: 'kg', value: 35000 },
54
+ ]
55
+ }
33
56
  };
34
57
 
35
58
 
36
-
37
59
  const RealValues =
38
60
  {
39
61
  WebUrl: "https://riktigavykort.postnord.se/sv",
@@ -17,7 +17,9 @@ const { state, onChange } = createStore({
17
17
  servicePointLink: '',
18
18
  realPostcard: '',
19
19
  realPostcardMobile: '',
20
- ombudHeader: ''
20
+ ombudHeader: '',
21
+ noResultMessage: '',
22
+ clearFilterButton: ''
21
23
  },
22
24
  market: {
23
25
  currency: "",
@@ -18,7 +18,9 @@ export const translations = {
18
18
  'ombudHeader': 'Köp via ombud',
19
19
  "from": "Från ",
20
20
  "labelMaxDimensionsRoll": "Rulle",
21
- "labelMaxDimensions": "Maxmått"
21
+ "labelMaxDimensions": "Maxmått",
22
+ 'noResultMessage': 'Inga produkter matchar dina kriterier',
23
+ 'clearFilterButton': 'Rensa alla filter'
22
24
  },
23
25
  'en': {
24
26
  'componentheading': 'Our prices and terms and conditions for domestic shipments for you as a direct paying customer',
@@ -39,7 +41,9 @@ export const translations = {
39
41
  'ombudHeader': 'Purchase by agent',
40
42
  "from": "From ",
41
43
  "labelMaxDimensionsRoll": "Roll",
42
- "labelMaxDimensions": "Maximum dimensions"
44
+ "labelMaxDimensions": "Maximum dimensions",
45
+ 'noResultMessage': 'No products match your criterias',
46
+ 'clearFilterButton': 'Clear all filters'
43
47
  },
44
48
  'da': {
45
49
  'componentheading': 'Vad vill du skicka?',
@@ -59,7 +63,9 @@ export const translations = {
59
63
  'ombudHeader': 'Køb af agent',
60
64
  "from": "Från ",
61
65
  "labelMaxDimensionsRoll": "Rulle",
62
- "labelMaxDimensions": "Maks måle"
66
+ "labelMaxDimensions": "Maks måle",
67
+ 'noResultMessage': 'Ingen produkter matcher dine kriterier',
68
+ 'clearFilterButton': 'Ryd alle filtre'
63
69
  },
64
70
  'no': {
65
71
  'componentheading': 'Vad vill du skicka?',
@@ -70,6 +76,8 @@ export const translations = {
70
76
  'maxmeasurementlabel': 'Maks volum',
71
77
  'senddirectcta': 'Buy shipping in Send Direct',
72
78
  'stampshopcta': 'Order home stamps from the webshop',
79
+ 'noResultMessage': 'No products match your criterias',
80
+ 'clearFilterButton': 'Clear all filters'
73
81
  },
74
82
  'fi': {
75
83
  'componentheading': 'Vad vill du skicka?',
@@ -80,6 +88,8 @@ export const translations = {
80
88
  'maxmeasurementlabel': 'Max äänenvoimakkuus',
81
89
  'senddirectcta': 'Buy shipping in Send Direct',
82
90
  'stampshopcta': 'Order home stamps from the webshop',
91
+ 'noResultMessage': 'No products match your criterias',
92
+ 'clearFilterButton': 'Clear all filters'
83
93
  }
84
94
  };
85
95
  export const markets = {
@@ -54,6 +54,16 @@ pn-proxio-findprice .resultHeading {
54
54
  font-weight: bold;
55
55
  margin-bottom: 2em;
56
56
  }
57
+ pn-proxio-findprice .findprice__clear-all-filters {
58
+ display: flex;
59
+ justify-content: center;
60
+ margin: 2.4rem;
61
+ color: #005D92;
62
+ }
63
+ pn-proxio-findprice .findprice__clear-all-filters .findprice__clear-all-filters__btn {
64
+ width: fit-content;
65
+ cursor: pointer;
66
+ }
57
67
  pn-proxio-findprice .sizecategory {
58
68
  margin-top: 1em;
59
69
  margin-bottom: 3rem;
@@ -14,6 +14,7 @@ export class PnProxioFindPrice {
14
14
  this.endpoint = null;
15
15
  this.language = "da";
16
16
  this.market = "dk";
17
+ this.showMedium = false;
17
18
  this.cache = false;
18
19
  this.filteredItems = [];
19
20
  this.weight = { value: 0, name: "" };
@@ -46,7 +47,6 @@ export class PnProxioFindPrice {
46
47
  }
47
48
  async getDataSource() {
48
49
  try {
49
- //for keeping small value preselected
50
50
  this.sizecategory = sizeCategories.filter(x => x.value === "S")[0];
51
51
  this.filterItems();
52
52
  }
@@ -82,6 +82,7 @@ export class PnProxioFindPrice {
82
82
  }
83
83
  }
84
84
  filterItems() {
85
+ var _a;
85
86
  if (!this.data) {
86
87
  console.log('Data has not yet been loaded');
87
88
  return;
@@ -107,8 +108,45 @@ export class PnProxioFindPrice {
107
108
  });
108
109
  });
109
110
  }
111
+ (_a = weightFilteredData === null || weightFilteredData === void 0 ? void 0 : weightFilteredData.sort((a, b) => {
112
+ var _a, _b, _c, _d, _e, _f, _g, _h;
113
+ let aIndex = a.proxioProduct.productWeightGroupList.findIndex(weightGroup => weightGroup.item1 === comparisonWeight);
114
+ if (aIndex < 0)
115
+ aIndex = 0;
116
+ let aValue = (_d = (_c = (_b = (_a = a === null || a === void 0 ? void 0 : a.proxioProduct) === null || _a === void 0 ? void 0 : _a.weightAndPriceList[aIndex]) === null || _b === void 0 ? void 0 : _b.item2) === null || _c === void 0 ? void 0 : _c.toLowerCase()) !== null && _d !== void 0 ? _d : "";
117
+ let aNumber = this.parseFloatFromString(aValue);
118
+ let bIndex = b.proxioProduct.productWeightGroupList.findIndex(weightGroup => weightGroup.item1 === comparisonWeight);
119
+ if (bIndex < 0)
120
+ bIndex = 0;
121
+ let bValue = (_h = (_g = (_f = (_e = b === null || b === void 0 ? void 0 : b.proxioProduct) === null || _e === void 0 ? void 0 : _e.weightAndPriceList[bIndex]) === null || _f === void 0 ? void 0 : _f.item2) === null || _g === void 0 ? void 0 : _g.toLowerCase()) !== null && _h !== void 0 ? _h : "";
122
+ let bNumber = this.parseFloatFromString(bValue);
123
+ if (aNumber && bNumber) {
124
+ return aNumber - bNumber;
125
+ }
126
+ if (aNumber < bNumber) {
127
+ return -1;
128
+ }
129
+ if (aNumber > bNumber) {
130
+ return 1;
131
+ }
132
+ return 0;
133
+ })) !== null && _a !== void 0 ? _a : [];
110
134
  this.filteredItems = weightFilteredData;
111
135
  }
136
+ parseFloatFromString(text) {
137
+ var _a;
138
+ return parseFloat((_a = text === null || text === void 0 ? void 0 : text.replace(/[^\d\.\,]*/g, '')) !== null && _a !== void 0 ? _a : 100000);
139
+ }
140
+ resetFilters() {
141
+ this.weight = { value: 0, name: "" };
142
+ this.sizecategory = sizeCategories.filter(x => x.value === "S")[0];
143
+ this.weightvalue = 0;
144
+ }
145
+ getWeights() {
146
+ var _a;
147
+ let marketWeightsArray = (_a = weights[this.market]) !== null && _a !== void 0 ? _a : { "S": [], "M": [], "L": [] };
148
+ return marketWeightsArray[this.sizecategory.unit];
149
+ }
112
150
  render() {
113
151
  return (h("div", { class: "findprice-form" },
114
152
  h("div", { class: "findprice-form-wrapper" },
@@ -121,27 +159,31 @@ export class PnProxioFindPrice {
121
159
  h("img", { class: "firstCell", src: person })),
122
160
  h("td", null,
123
161
  h("img", { src: S })),
124
- h("td", null,
125
- h("img", { src: M })),
162
+ this.showMedium ? h("td", null,
163
+ h("img", { src: M })) : null,
126
164
  h("td", null,
127
165
  h("img", { src: L }))),
128
166
  h("tr", null,
129
167
  h("td", null),
130
- sizeCategories.map((sizeCategory) => (h("td", null,
168
+ sizeCategories.map((sizeCategory) => (!this.showMedium && sizeCategory.value === "M" ? null : (h("td", null,
131
169
  h("pn-radio-button", { id: 'findpricecategory-' + sizeCategory.value, radioid: sizeCategory.value, value: sizeCategory.value, name: "sizecategory", checked: sizeCategory.value === this.sizecategory.value, onChange: () => {
132
170
  this.sizecategory = sizeCategories.filter(x => x.value === sizeCategory.value)[0];
133
171
  this.weight = { value: 0, name: "" };
134
172
  this.weightvalue = this.weight.value;
135
- } }))))))),
173
+ } })))))))),
136
174
  h("h4", { class: "findprice__heading findprice__subheading" }, state.i18n.weightheading),
137
- (this.sizecategory.value && weights[this.sizecategory.unit]) ? (h("div", { class: "weightoption" }, h("div", { class: "weightoption-content" }, weights[this.sizecategory.unit].map((wght) => (h("pn-choice-button", { id: 'findpriceweight-' + wght.value, choiceid: this.sizecategory.value + wght.value, name: "weight", type: "radio", value: (!this.weight.value) ? 0 : weights[this.sizecategory.unit].findIndex((x) => x.value === this.weightvalue), checked: wght.value === this.weight.value, onChange: () => {
138
- this.weight = weights[this.sizecategory.unit].filter(x => x.value === wght.value)[0];
175
+ (this.sizecategory.value && this.getWeights()) ? (h("div", { class: "weightoption" }, h("div", { class: "weightoption-content" }, this.getWeights().map((wght) => (h("pn-choice-button", { id: 'findpriceweight-' + wght.value, choiceid: this.sizecategory.value + wght.value, name: "weight", type: "radio", value: (!this.weight.value) ? 0 : this.getWeights().findIndex((x) => x.value === this.weightvalue), checked: wght.value === this.weight.value, onChange: () => {
176
+ this.weight = this.getWeights().filter(x => x.value === wght.value)[0];
139
177
  this.weightvalue = this.weight.value;
140
- } }, wght.name)))))) : null),
178
+ } }, wght.name)))))) : null,
179
+ h("div", { class: 'findprice__clear-all-filters', role: 'button' },
180
+ h("div", { class: 'findprice__clear-all-filters__btn', onClick: () => this.resetFilters() },
181
+ h("pn-icon", { symbol: "trash-can", color: "blue700" }),
182
+ h("span", { class: 'clear-all-filters__text' }, state.i18n.clearFilterButton)))),
141
183
  (this.filteredItems && this.filteredItems.length > 0) ? (h("div", { class: "resultlist" },
142
184
  (state.i18n.resultlistheading) ? (h("div", { class: "resultHeading" }, state.i18n.resultlistheading)) : null,
143
185
  this.filteredItems.map((item) => (h("div", null,
144
- h("pn-proxio-findprice-result", { activeweight: this.weight.value, item: item })))))) : null));
186
+ h("pn-proxio-findprice-result", { activeweight: this.weight.value, item: item })))))) : ((this.weightvalue !== 0) ? (h("h4", { class: "resultHeading" }, state.i18n.noResultMessage)) : null)));
145
187
  }
146
188
  static get is() { return "pn-proxio-findprice"; }
147
189
  static get originalStyleUrls() { return {
@@ -205,6 +247,24 @@ export class PnProxioFindPrice {
205
247
  "reflect": false,
206
248
  "defaultValue": "\"dk\""
207
249
  },
250
+ "showMedium": {
251
+ "type": "boolean",
252
+ "mutable": false,
253
+ "complexType": {
254
+ "original": "boolean",
255
+ "resolved": "boolean",
256
+ "references": {}
257
+ },
258
+ "required": false,
259
+ "optional": false,
260
+ "docs": {
261
+ "tags": [],
262
+ "text": ""
263
+ },
264
+ "attribute": "show-medium",
265
+ "reflect": false,
266
+ "defaultValue": "false"
267
+ },
208
268
  "cache": {
209
269
  "type": "boolean",
210
270
  "mutable": false,