@postnord/pn-marketweb-components 2.0.6-beta9 → 2.0.8-beta2

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 (88) hide show
  1. package/cjs/{MarketWebLoginManager-3c2f4423.js → MarketWebLoginManager-865226ea.js} +13 -1
  2. package/cjs/{data-b9e6d752.js → data-b5ef4f7c.js} +14 -1
  3. package/cjs/loader.cjs.js +1 -1
  4. package/cjs/pn-find-price-result.cjs.entry.js +13 -6
  5. package/cjs/{pn-find-price-store-63671327.js → pn-find-price-store-b0ea47ed.js} +3 -1
  6. package/cjs/pn-find-price.cjs.entry.js +17 -11
  7. package/cjs/pn-language-selector_9.cjs.entry.js +19 -12
  8. package/cjs/pn-market-web-components.cjs.js +1 -1
  9. package/cjs/pn-marketweb-siteheader.cjs.entry.js +8 -4
  10. package/cjs/pn-product-card_3.cjs.entry.js +3 -3
  11. package/cjs/pn-product-pricelist.cjs.entry.js +1 -1
  12. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.js +54 -12
  13. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +45 -5
  14. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +26 -2
  15. package/collection/components/widgets/pn-find-price/data.js +17 -2
  16. package/collection/components/widgets/pn-find-price/find-price.stories.js +2 -2
  17. package/collection/components/widgets/pn-find-price/pn-find-price-result.js +46 -14
  18. package/collection/components/widgets/pn-find-price/pn-find-price-store.js +3 -1
  19. package/collection/components/widgets/pn-find-price/pn-find-price-translations.js +10 -5
  20. package/collection/components/widgets/pn-find-price/pn-find-price.js +5 -10
  21. package/collection/components/widgets/pn-product-card/pn-product-card-price.css +1 -9
  22. package/collection/components/widgets/pn-product-card/pn-product-card.css +57 -1
  23. package/collection/components/widgets/pn-product-card/pn-product-card.js +3 -1
  24. package/collection/globals/MarketWebLoginManager.js +13 -1
  25. package/custom-elements/index.js +86 -36
  26. package/esm/{MarketWebLoginManager-3bb0a307.js → MarketWebLoginManager-8fef95d2.js} +13 -1
  27. package/esm/{data-8e7bd46e.js → data-f0ac26a9.js} +14 -2
  28. package/esm/loader.js +1 -1
  29. package/esm/pn-find-price-result.entry.js +13 -6
  30. package/esm/{pn-find-price-store-55b65ec0.js → pn-find-price-store-625a6d87.js} +3 -1
  31. package/esm/pn-find-price.entry.js +17 -11
  32. package/esm/pn-language-selector_9.entry.js +19 -12
  33. package/esm/pn-market-web-components.js +1 -1
  34. package/esm/pn-marketweb-siteheader.entry.js +8 -4
  35. package/esm/pn-product-card_3.entry.js +3 -3
  36. package/esm/pn-product-pricelist.entry.js +1 -1
  37. package/esm-es5/MarketWebLoginManager-8fef95d2.js +1 -0
  38. package/esm-es5/{data-8e7bd46e.js → data-f0ac26a9.js} +1 -1
  39. package/esm-es5/loader.js +1 -1
  40. package/esm-es5/pn-find-price-result.entry.js +1 -1
  41. package/esm-es5/{pn-find-price-store-55b65ec0.js → pn-find-price-store-625a6d87.js} +1 -1
  42. package/esm-es5/pn-find-price.entry.js +1 -1
  43. package/esm-es5/pn-language-selector_9.entry.js +1 -1
  44. package/esm-es5/pn-market-web-components.js +1 -1
  45. package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
  46. package/esm-es5/pn-product-card_3.entry.js +1 -1
  47. package/esm-es5/pn-product-pricelist.entry.js +1 -1
  48. package/package.json +1 -1
  49. package/pn-market-web-components/p-0351965d.system.entry.js +1 -0
  50. package/pn-market-web-components/{p-4d584dca.system.entry.js → p-1c11b615.system.entry.js} +1 -1
  51. package/pn-market-web-components/p-285c6c82.system.entry.js +1 -0
  52. package/pn-market-web-components/p-2a624d21.entry.js +1 -0
  53. package/pn-market-web-components/p-424fac62.js +1 -0
  54. package/pn-market-web-components/{p-e89a9e79.system.entry.js → p-4a71cd20.system.entry.js} +1 -1
  55. package/pn-market-web-components/p-67887512.system.js +1 -1
  56. package/pn-market-web-components/{p-51fc5bc4.entry.js → p-6c75474c.entry.js} +1 -1
  57. package/pn-market-web-components/p-82daf429.entry.js +1 -0
  58. package/pn-market-web-components/p-8a269121.system.js +1 -0
  59. package/pn-market-web-components/{p-a7421a8e.system.js → p-9e0c9f32.system.js} +1 -1
  60. package/pn-market-web-components/p-ae775ba5.system.entry.js +1 -0
  61. package/pn-market-web-components/p-b2840380.entry.js +1 -0
  62. package/pn-market-web-components/{p-28db6d9f.entry.js → p-c1c3777d.entry.js} +1 -1
  63. package/pn-market-web-components/p-c2fada23.entry.js +1 -0
  64. package/pn-market-web-components/{p-f9586bef.js → p-e3ae421f.js} +1 -1
  65. package/pn-market-web-components/p-e7f8da0b.system.entry.js +1 -0
  66. package/pn-market-web-components/{p-f6fa6caa.system.js → p-e9781689.system.js} +1 -1
  67. package/pn-market-web-components/{p-d94d8879.js → p-f04541a1.js} +1 -1
  68. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  69. package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.d.ts +3 -1
  70. package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.d.ts +5 -1
  71. package/types/components/widgets/pn-find-price/pn-find-price-result.d.ts +4 -0
  72. package/types/components/widgets/pn-find-price/pn-find-price-store.d.ts +4 -0
  73. package/types/components/widgets/pn-find-price/pn-find-price-translations.d.ts +5 -0
  74. package/types/components/widgets/pn-find-price/pn-find-price-types.d.ts +5 -0
  75. package/types/components.d.ts +30 -2
  76. package/types/globals/MarketWebLoginManager.d.ts +29 -27
  77. package/umd/pn-marketweb-salesforce.js +1 -1
  78. package/esm-es5/MarketWebLoginManager-3bb0a307.js +0 -1
  79. package/pn-market-web-components/p-01a615ef.system.entry.js +0 -1
  80. package/pn-market-web-components/p-23902611.system.entry.js +0 -1
  81. package/pn-market-web-components/p-29b8041d.entry.js +0 -1
  82. package/pn-market-web-components/p-36380a2b.system.entry.js +0 -1
  83. package/pn-market-web-components/p-55513980.system.js +0 -1
  84. package/pn-market-web-components/p-606ab75d.system.entry.js +0 -1
  85. package/pn-market-web-components/p-6423bacf.js +0 -1
  86. package/pn-market-web-components/p-9a8dba33.entry.js +0 -1
  87. package/pn-market-web-components/p-c9edf78b.entry.js +0 -1
  88. package/pn-market-web-components/p-dc869f2f.entry.js +0 -1
@@ -9,13 +9,16 @@ export class PnMarketwebSiteheaderLogin {
9
9
  this.emitEvents = true;
10
10
  // Login dialog
11
11
  this.loginDialog = null;
12
+ /** User Fullname */
13
+ this.fullname = "";
14
+ this.loggedin = false;
12
15
  this.loginManager = null;
13
- this.loggedIn = false;
14
16
  this.toggleButtonText = "";
15
- this.username = "";
17
+ this.username = this.fullname;
16
18
  }
17
19
  componentWillLoad() {
18
- this.loginManager = new MarketWebLoginManager({ endpoint: this.endpoint, eventTarget: this.hostElement });
20
+ const userInfo = this.loggedin && this.fullname ? { given_name: this.fullname } : null;
21
+ this.loginManager = new MarketWebLoginManager({ endpoint: this.endpoint, eventTarget: this.hostElement, userInfo });
19
22
  this.hostElement["loginmanager"] = this.loginManager;
20
23
  if (this.token) {
21
24
  this.loginManager.registerToken(this.token, 'backend');
@@ -25,6 +28,7 @@ export class PnMarketwebSiteheaderLogin {
25
28
  }
26
29
  this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
27
30
  this.init();
31
+ this.setUserName();
28
32
  }
29
33
  async init() {
30
34
  this.toggleButtonText = this.loginDialog.loginMenuLinkText;
@@ -34,19 +38,22 @@ export class PnMarketwebSiteheaderLogin {
34
38
  setUserName() {
35
39
  const userInfo = this.loginManager.getUserInfo();
36
40
  let name = "";
37
- if (!this.loggedIn || !userInfo) {
41
+ if (!this.loggedin || !userInfo) {
38
42
  this.username = name;
39
43
  }
40
- if (userInfo.given_name) {
44
+ if (userInfo && userInfo.given_name) {
41
45
  name = userInfo.given_name + ((userInfo === null || userInfo === void 0 ? void 0 : userInfo.family_name) ? ` ${userInfo === null || userInfo === void 0 ? void 0 : userInfo.family_name}` : "");
42
46
  }
43
- if (!name && userInfo.email) {
47
+ if (!name && userInfo && userInfo.email) {
44
48
  name = userInfo.email;
45
49
  }
50
+ if (!name && this.fullname) {
51
+ name = this.fullname;
52
+ }
46
53
  this.username = name;
47
54
  }
48
55
  setToggleButtonText() {
49
- if (this.loggedIn) {
56
+ if (this.loggedin) {
50
57
  this.toggleButtonText = this.username;
51
58
  if (!this.toggleButtonText) {
52
59
  this.toggleButtonText = this.loginDialog.loggedInButtonText;
@@ -57,9 +64,9 @@ export class PnMarketwebSiteheaderLogin {
57
64
  }
58
65
  }
59
66
  onLoginStateChange(e) {
60
- if (this.loggedIn !== e.detail && this.emitEvents) {
61
- this.loggedIn = e.detail;
62
- this.loginStateChange.emit({ loggedIn: this.loggedIn, token: this.loginManager.getToken() });
67
+ if (this.loggedin !== e.detail && this.emitEvents) {
68
+ this.loggedin = e.detail;
69
+ this.loginStateChange.emit({ loggedIn: this.loggedin, token: this.loginManager.getToken() });
63
70
  this.setUserName();
64
71
  this.setToggleButtonText();
65
72
  }
@@ -114,7 +121,7 @@ export class PnMarketwebSiteheaderLogin {
114
121
  }
115
122
  return (h(Host, Object.assign({}, hostElementAttribute),
116
123
  h("pn-nav-dropdown", { label: this.toggleButtonText, icon: "user", class: "siteheader-logindialog" }, (!this.loginDialog.overrideLoginMenu) ?
117
- h("div", { "data-loggedin": this.loggedIn + '' }, (!this.loggedIn) ?
124
+ h("div", { "data-loggedin": this.loggedin + '' }, (!this.loggedin) ?
118
125
  h("div", null, (_a = this.loginDialog.loginTitle) !== null && _a !== void 0 ? _a : h("strong", null, this.loginDialog.loginTitle),
119
126
  ((_b = this.loginDialog.loginMenuLinks) === null || _b === void 0 ? void 0 : _b.length) > 0 ?
120
127
  h("ul", null, this.loginDialog.loginMenuLinks.map((link, i) => {
@@ -241,11 +248,46 @@ export class PnMarketwebSiteheaderLogin {
241
248
  "text": ""
242
249
  },
243
250
  "defaultValue": "null"
251
+ },
252
+ "fullname": {
253
+ "type": "string",
254
+ "mutable": false,
255
+ "complexType": {
256
+ "original": "string",
257
+ "resolved": "string",
258
+ "references": {}
259
+ },
260
+ "required": false,
261
+ "optional": false,
262
+ "docs": {
263
+ "tags": [],
264
+ "text": "User Fullname"
265
+ },
266
+ "attribute": "fullname",
267
+ "reflect": false,
268
+ "defaultValue": "\"\""
269
+ },
270
+ "loggedin": {
271
+ "type": "boolean",
272
+ "mutable": false,
273
+ "complexType": {
274
+ "original": "boolean",
275
+ "resolved": "boolean",
276
+ "references": {}
277
+ },
278
+ "required": false,
279
+ "optional": false,
280
+ "docs": {
281
+ "tags": [],
282
+ "text": ""
283
+ },
284
+ "attribute": "loggedin",
285
+ "reflect": false,
286
+ "defaultValue": "false"
244
287
  }
245
288
  }; }
246
289
  static get states() { return {
247
290
  "loginManager": {},
248
- "loggedIn": {},
249
291
  "toggleButtonText": {},
250
292
  "username": {}
251
293
  }; }
@@ -15,7 +15,11 @@ export class PnMarketwebSiteheader {
15
15
  /** Specifies which environment we're fetching data from. (production, preproduction, integration, localhost) */
16
16
  this.environment = null; //sv
17
17
  /** Access token passed from backend */
18
- this.token = "";
18
+ this.userToken = "";
19
+ /** User Fullname */
20
+ this.userFullname = "";
21
+ /** User Logged in state from the backend */
22
+ this.userLoggedin = false;
19
23
  /** Specifies which endpoint domain we should load from */
20
24
  this.endpoint = null;
21
25
  /** Hides the site selector if set to true*/
@@ -263,7 +267,7 @@ export class PnMarketwebSiteheader {
263
267
  h("path", { d: "M108.84,13.35c0,6.34-5.17,9-10,9S89,19.76,89,13.63c0-6.28,5.08-9,10-9S108.84,7.25,108.84,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.29,3.29,0,0,0,3.42,3.41A3.24,3.24,0,0,0,102.28,13.54Zm-83,0c0,4.83-3.32,8.82-8.49,8.82a6.54,6.54,0,0,1-4.65-1.57v5.86H0V5.16H6.17V6.8a6.43,6.43,0,0,1,5.11-2.18C16.41,4.62,19.31,8.58,19.31,13.54Zm-6.53,0A3.27,3.27,0,0,0,9.4,10,3.28,3.28,0,0,0,6,13.54,3.29,3.29,0,0,0,9.4,16.95,3.24,3.24,0,0,0,12.78,13.54Zm103.69,0.27c0-2.54,1.54-3.32,3.6-3.32a6.56,6.56,0,0,1,2.08.3L122.3,5.1a3.92,3.92,0,0,0-1.45-.18c-3.45,0-4.38,2.18-4.38,2.18V5.16H110.3V21.84h6.17v-8ZM141.73,0V21.84h-6.16V20.21a6.43,6.43,0,0,1-5.11,2.18c-5.14,0-8-4-8-8.91s3.32-8.82,8.49-8.82a6.54,6.54,0,0,1,4.65,1.57v-5Zm-6,13.48a3.28,3.28,0,0,0-3.41-3.41A3.24,3.24,0,0,0,129,13.47,3.4,3.4,0,1,0,135.75,13.47ZM81.35,4.62c-3.6,0-4.9,2.18-4.9,2.18V5.16H70.29V21.84h6.16V13.29c0-2.11.79-3.08,2.69-3.08s2.18,1.57,2.18,3.57v8.07h6.22V11.6C87.55,7,85.34,4.62,81.35,4.62ZM64.07,1.42H57.9V21.84h6.16V10.36H67l2.81-5.2H64.07V1.42ZM50.26,11.21c-2-.3-2.87-0.3-2.87-1.09s0.81-.94,2.42-0.94a16.15,16.15,0,0,1,5.11.91L56,5.41a24.56,24.56,0,0,0-6.13-.75c-5.89,0-9,2.27-9,5.89,0,2.81,1.66,4.47,6.53,5.11,2.06,0.27,2.81.39,2.81,1.15s-0.82,1-2.24,1a16.67,16.67,0,0,1-6-1.3L40.77,21.3a22.14,22.14,0,0,0,6.68,1c6.35,0,9.28-2.24,9.28-5.89C56.72,13.54,55.15,12,50.26,11.21ZM40.19,13.35c0,6.34-5.17,9-10,9s-9.82-2.6-9.82-8.73c0-6.28,5.08-9,10-9S40.19,7.25,40.19,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.28,3.28,0,0,0,3.41,3.41A3.24,3.24,0,0,0,33.63,13.54Z", fill: "#00A0D6", transform: "translate(0 0)" })))),
264
268
  h("div", { class: "siteheader-topright" },
265
269
  h("slot", { name: "toprightstart" }),
266
- (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { token: this.token, loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })),
270
+ (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { token: this.userToken, fullname: this.userFullname, loggedin: this.userLoggedin, loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })),
267
271
  (this.gotData && this.languageOptions && this.languageOptions.length) && !this.hideLanguageSelector &&
268
272
  h("pn-language-selector", { value: this.language }, this.languageOptions.map(language => h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))),
269
273
  h("slot", { name: "toprightend" }))),
@@ -285,7 +289,7 @@ export class PnMarketwebSiteheader {
285
289
  h("pn-mainnav-list", { heading: item.promotedMenuItemsHeader }, item.promotedMenuItems.map((childitem) => (h("pn-mainnav-link", { href: childitem.href, name: childitem.linkText, target: childitem.openInNewWindow ? "_blank" : "_self", linkid: this.promotedItemId(childitem) + item.id })))))));
286
290
  })),
287
291
  h("div", { slot: "footer", class: "siteheader-menu-footer" },
288
- (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { emitEvents: false, loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n })),
292
+ (this.gotData && this.loginDialog && !this.hideLogin) && (h("pn-marketweb-siteheader-login", { emitEvents: false, loginDialog: this.loginDialog, endpoint: this.endpoint, fullname: this.userFullname, loggedin: this.userLoggedin, i18n: this.i18n })),
289
293
  (this.gotData && this.languageOptions && this.languageOptions.length) && !this.hideLanguageSelector &&
290
294
  h("pn-language-selector", { value: this.language }, this.languageOptions.map(language => h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))),
291
295
  !this.hideSiteSelector &&
@@ -359,7 +363,7 @@ export class PnMarketwebSiteheader {
359
363
  "reflect": true,
360
364
  "defaultValue": "null"
361
365
  },
362
- "token": {
366
+ "userToken": {
363
367
  "type": "string",
364
368
  "mutable": false,
365
369
  "complexType": {
@@ -373,10 +377,46 @@ export class PnMarketwebSiteheader {
373
377
  "tags": [],
374
378
  "text": "Access token passed from backend"
375
379
  },
376
- "attribute": "token",
380
+ "attribute": "user-token",
377
381
  "reflect": false,
378
382
  "defaultValue": "\"\""
379
383
  },
384
+ "userFullname": {
385
+ "type": "string",
386
+ "mutable": false,
387
+ "complexType": {
388
+ "original": "string",
389
+ "resolved": "string",
390
+ "references": {}
391
+ },
392
+ "required": false,
393
+ "optional": false,
394
+ "docs": {
395
+ "tags": [],
396
+ "text": "User Fullname"
397
+ },
398
+ "attribute": "user-fullname",
399
+ "reflect": false,
400
+ "defaultValue": "\"\""
401
+ },
402
+ "userLoggedin": {
403
+ "type": "boolean",
404
+ "mutable": false,
405
+ "complexType": {
406
+ "original": "boolean",
407
+ "resolved": "boolean",
408
+ "references": {}
409
+ },
410
+ "required": false,
411
+ "optional": false,
412
+ "docs": {
413
+ "tags": [],
414
+ "text": "User Logged in state from the backend"
415
+ },
416
+ "attribute": "user-loggedin",
417
+ "reflect": false,
418
+ "defaultValue": "false"
419
+ },
380
420
  "endpoint": {
381
421
  "type": "string",
382
422
  "mutable": false,
@@ -152,7 +152,7 @@ const LoggedInTemplate = ({ ...args }) => {
152
152
  market="${ args.market }"
153
153
  language="${ args.language }"
154
154
  endpoint="${ args.endpoint }"
155
- token="${ args.token }"
155
+ user-token="${ args.token }"
156
156
  >
157
157
  </pn-marketweb-siteheader>
158
158
  </div>
@@ -165,4 +165,28 @@ LoggedIn.args = {
165
165
  language: 'sv',
166
166
  endpoint: 'https://com-integration.postnord.com',
167
167
  token: '441c4a692237f6baa82459431400cb39ac4c07b70116ebd8f5c9df3',
168
- };
168
+ };
169
+
170
+ const BusinessUserLoggedInTemplate = ({ ...args }) => {
171
+ return `
172
+ <div style="background:#ddd;min-height:100vh;">
173
+ <pn-marketweb-siteheader
174
+ market="${ args.market }"
175
+ language="${ args.language }"
176
+ endpoint="${ args.endpoint }"
177
+ user-fullname="${ args.name }"
178
+ user-loggedin="${ args.loggedin }"
179
+ >
180
+ </pn-marketweb-siteheader>
181
+ </div>
182
+ `;
183
+ };
184
+
185
+ export const BusinessUserLoggedIn = BusinessUserLoggedInTemplate.bind({});
186
+ BusinessUserLoggedIn.args = {
187
+ market : "se",
188
+ language: 'sv',
189
+ endpoint: 'https://com-integration.postnord.com',
190
+ name: 'custom user name',
191
+ loggedin: true
192
+ };
@@ -33,10 +33,25 @@ const weights = {
33
33
  };
34
34
 
35
35
 
36
- const fileLocation = "https://com-integration.postnord.com/globalassets/global/prices/dk-findprice.xlsx";
36
+
37
+ const RiktigaValues =
38
+ {
39
+ WebUrl: "https://riktigavykort.postnord.se/sv",
40
+ AndroidAppUrl: "https://play.google.com/store/apps/details?id=se.posten.riktigavykort&hl=sv",
41
+ AndroidImg: "https://com-integration.postnord.com/globalassets/icons/logos-and-badges/google-play-badge_se.svg",
42
+ IosAppUrl: "https://apps.apple.com/se/app/riktiga-vykort/id444458799?l=sv",
43
+ IosImg: "https://com-integration.postnord.com/globalassets/icons/logos-and-badges/app_store_badge_se_rgb_blk.svg"
44
+ };
45
+
46
+
47
+
48
+ const fileLocation = "https://com-integration.postnord.com/globalassets/global/prices/sv-findprice-1-PN.xlsx";
37
49
 
38
50
  const sendDirectUrl = "https://portal.postnord.com/skickadirekt/";
39
51
 
40
52
  const stampShopUrl = "https://shop.postnord.se/ebutik/default.aspx";
41
53
 
42
- export { weights, sizeCategories, fileLocation, sendDirectUrl, stampShopUrl };
54
+ const productDescriptionUrl = "https://se-integration.postnord.com/skicka-forsandelser/brev-och-vykort/"
55
+
56
+
57
+ export { weights, sizeCategories, fileLocation, sendDirectUrl, stampShopUrl, RiktigaValues };
@@ -23,6 +23,6 @@ const Template = ({ ...args }) => {
23
23
  export const Primary = Template.bind({});
24
24
  Primary.args = {
25
25
  source: fileLocation,
26
- language: 'da',
27
- market: 'dk',
26
+ language: 'sv',
27
+ market: 'se',
28
28
  };
@@ -1,6 +1,6 @@
1
1
  import { Component, h, Prop, Host, Watch, State } from "@stencil/core";
2
2
  import { state } from "./pn-find-price-store";
3
- import { sendDirectUrl, stampShopUrl } from "./data.js";
3
+ import { sendDirectUrl, stampShopUrl, RiktigaValues } from "./data.js";
4
4
  export class PnfindPriceResult {
5
5
  constructor() {
6
6
  this.item = null;
@@ -9,6 +9,14 @@ export class PnfindPriceResult {
9
9
  this.showMeasurement = false;
10
10
  this.weightText = "";
11
11
  this.linkId = '';
12
+ this.usp = {
13
+ Billigast: h("span", { slot: "Billigast" },
14
+ this.item.highestrankusp,
15
+ h("pn-icon", { symbol: "box-label", small: "false", color: "green700" })),
16
+ Snabbast: h("span", { slot: "Snabbast" },
17
+ this.item.highestrankusp,
18
+ h("pn-icon", { symbol: "bolt", small: "false", color: "blue700" }))
19
+ };
12
20
  }
13
21
  componentWillLoad() {
14
22
  this.composeItems();
@@ -30,17 +38,11 @@ export class PnfindPriceResult {
30
38
  return (h(Host, null, h("pn-product-card", { "data-productid": this.item.id },
31
39
  h("pn-illustration", { slot: "illustration", illustration: this.item.illustration }),
32
40
  h("div", { slot: "title" },
33
- h("h2", null,
34
- this.item.name,
35
- " "),
36
- (this.item.highestrankusp) ?
37
- (this.item.highestrankusp === "Billigast") ?
38
- (h("span", { slot: "Billigast" },
39
- this.item.highestrankusp,
40
- h("pn-icon", { symbol: "box-label", small: "false", color: "green700" })))
41
- : (h("span", { slot: "Snabbast" },
42
- this.item.highestrankusp,
43
- h("pn-icon", { symbol: "bolt", small: "false", color: "blue700" }))) : null),
41
+ this.item.infopagelink ?
42
+ (h("h2", null,
43
+ h("a", { href: this.item.infopagelink, target: "_blank" }, this.item.name))) :
44
+ (h("h2", null, this.item.name)),
45
+ this.usp[this.item.highestrankusp]),
44
46
  h("div", { slot: "content" },
45
47
  h("div", { class: "content" },
46
48
  (this.item.description) ? (h("div", { class: "description" }, this.description.map((desc) => (h("li", null, desc))))) : null,
@@ -51,10 +53,24 @@ export class PnfindPriceResult {
51
53
  this.Usp1 ? (h("span", null, this.Usp1)) : null,
52
54
  this.Usp2 ? (h("span", null, this.Usp2)) : null,
53
55
  this.Usp3 ? (h("span", null, this.Usp3)) : null)) : null,
54
- this.showMeasurement ? (h("pn-product-card-info", { paket: this.item.maxmått, rulle: this.item.rulle })) : null,
56
+ this.showMeasurement ?
57
+ (h("pn-product-card-info", { paket: this.item.maxmått, rulle: this.item.rulle })) : null,
55
58
  h("div", { slot: "cardprice" },
56
59
  this.item.pricesenddirect ? (h("pn-product-card-price", { slot: "sendDirectPrice", label: state.i18n.senddirectcta, amount: this.item.pricesenddirect + '', currency: state.market.currency, url: sendDirectUrl, linkid: this.linkId + '-portal' })) : null,
57
- this.item.pricestamps ? (h("pn-product-card-price", { slot: "stampPrice", label: state.i18n.stampshopcta, amount: this.item.pricestamps + '', currency: state.market.currency, url: stampShopUrl, linkid: this.linkId + '-stampshop' })) : null))));
60
+ this.item.pricestamps ? ((this.item.name.toLocaleLowerCase() !== "riktiga vykort") ?
61
+ (h("pn-product-card-price", { slot: "stampPrice", label: state.i18n.stampshopcta, amount: this.item.pricestamps + '', currency: state.market.currency, url: stampShopUrl, linkid: this.linkId + '-stampshop' })) :
62
+ (h("pn-product-card-price", { slot: "riktiga", label: state.i18n.riktigaVykort, amount: this.item.pricestamps + '', currency: state.market.currency, url: RiktigaValues["WebUrl"], linkid: this.linkId + '-riktiga' }))) : null),
63
+ h("div", { slot: "servicepoint" }, (this.item.showservicepointlink) ? (h("a", { href: state.market.servicePoint, target: "_blank" },
64
+ h("pn-icon", { symbol: "map-marker", color: "blue700" }),
65
+ state.i18n.servicePointLink)) : null),
66
+ h("div", { slot: "mobiledownload" }, (this.item.name.toLocaleLowerCase() === "riktiga vykort") ?
67
+ (h("div", { id: "riktiga" },
68
+ h("h4", null, state.i18n.riktigaVykortMobile),
69
+ h("div", null,
70
+ h("a", { href: RiktigaValues["AndroidAppUrl"], target: "_blank" },
71
+ h("img", { class: "riktigaAndroidImg", src: RiktigaValues["AndroidImg"] })),
72
+ h("a", { href: RiktigaValues["IosAppUrl"], target: "_blank" },
73
+ h("img", { class: "riktigaAppleImg", src: RiktigaValues["IosImg"] }))))) : null))));
58
74
  }
59
75
  static get is() { return "pn-find-price-result"; }
60
76
  static get originalStyleUrls() { return {
@@ -190,6 +206,22 @@ export class PnfindPriceResult {
190
206
  "attribute": "show-measurement",
191
207
  "reflect": false,
192
208
  "defaultValue": "false"
209
+ },
210
+ "usp": {
211
+ "type": "unknown",
212
+ "mutable": false,
213
+ "complexType": {
214
+ "original": "{ Billigast: any; Snabbast: any; }",
215
+ "resolved": "{ Billigast: any; Snabbast: any; }",
216
+ "references": {}
217
+ },
218
+ "required": false,
219
+ "optional": false,
220
+ "docs": {
221
+ "tags": [],
222
+ "text": ""
223
+ },
224
+ "defaultValue": "{\n Billigast : <span slot=\"Billigast\">{this.item.highestrankusp}<pn-icon symbol=\"box-label\" small=\"false\" color=\"green700\" /></span>,\n Snabbast : <span slot=\"Snabbast\">{this.item.highestrankusp}<pn-icon symbol=\"bolt\" small=\"false\" color=\"blue700\" /></span>\n }"
193
225
  }
194
226
  }; }
195
227
  static get states() { return {
@@ -12,7 +12,9 @@ const { state, onChange } = createStore({
12
12
  stampshopcta: '',
13
13
  message: '',
14
14
  servicePointHeader: '',
15
- servicePointLink: ''
15
+ servicePointLink: '',
16
+ riktigaVykort: '',
17
+ riktigaVykortMobile: ''
16
18
  },
17
19
  market: {
18
20
  currency: "",
@@ -10,7 +10,9 @@ export const translations = {
10
10
  'stampshopcta': 'Köp frimärken',
11
11
  'message': '*Vid köp hos valfritt ombud',
12
12
  'servicePointHeader': 'Eller hitta närmaste serviceställe',
13
- 'servicePointLink': 'Sök serviceställe eller brevlåda'
13
+ 'servicePointLink': 'Hitta Serviceställe',
14
+ 'riktigaVykort': 'köp Riktiga Vykort',
15
+ 'riktigaVykortMobile': 'Testa Riktiga Vykorts mobilapp'
14
16
  },
15
17
  'en': {
16
18
  'componentheading': 'Our prices and terms and conditions for domestic shipments for you as a direct paying customer',
@@ -22,8 +24,10 @@ export const translations = {
22
24
  'senddirectcta': 'Buy Online',
23
25
  'stampshopcta': 'Buy Stamps',
24
26
  'message': 'When buying from any agent',
25
- 'servicePointHeader': 'Or find nearest service point',
26
- 'servicePointLink': 'Search letter-box or service point'
27
+ 'servicePointHeader': 'Find service point',
28
+ 'servicePointLink': 'Find service point',
29
+ 'riktigaVykort': 'Buy Postcards',
30
+ 'riktigaVykortMobile': 'Try the Real Postcards mobile app'
27
31
  },
28
32
  'da': {
29
33
  'componentheading': 'Vad vill du skicka?',
@@ -35,8 +39,9 @@ export const translations = {
35
39
  'senddirectcta': 'Køb Online',
36
40
  'stampshopcta': 'Køb Frimærker',
37
41
  'message': 'When buying from any agent',
38
- 'servicePointHeader': 'Eller find nærmeste servicested',
39
- 'servicePointLink': 'Søg i brevkasse eller servicepunkt'
42
+ 'servicePointHeader': 'Find nærmeste servicested',
43
+ 'servicePointLink': 'Find nærmeste servicested',
44
+ 'riktigaVykort': 'Køb Riktiga Vykort',
40
45
  },
41
46
  'no': {
42
47
  'componentheading': 'Vad vill du skicka?',
@@ -76,10 +76,11 @@ export class PnfindPrice {
76
76
  }
77
77
  }
78
78
  }
79
+ //10000 to handle the null values in the rank column, to keep such products at the end of the list
79
80
  weightFilteredData.sort((a, b) => {
80
- var rankA = a.highestrankusp ? a.highestrankusp.toLowerCase() : "z";
81
- var rankB = b.highestrankusp ? b.highestrankusp.toLowerCase() : "z";
82
- return (rankA.localeCompare(rankB));
81
+ var ra = a.rank ? a.rank : 10000;
82
+ var rb = b.rank ? b.rank : 10000;
83
+ return (ra - rb);
83
84
  });
84
85
  this.filteredItems = weightFilteredData;
85
86
  }
@@ -113,13 +114,7 @@ export class PnfindPrice {
113
114
  (this.filteredItems && this.filteredItems.length > 0) ? (h("div", { class: "resultlist" },
114
115
  (state.i18n.resultlistheading) ? (h("div", { class: "resultHeading" }, state.i18n.resultlistheading)) : null,
115
116
  this.filteredItems.map((item) => (h("div", null,
116
- h("pn-find-price-result", { item: item })))),
117
- h("div", { class: "servicePoint" },
118
- h("pn-illustration", { illustration: "character-box-letters-house" }),
119
- h("h3", null, state.i18n.servicePointHeader),
120
- h("a", { href: state.market.servicePoint, target: "_blank" },
121
- h("pn-icon", { symbol: "map-marker", color: "blue700" }),
122
- state.i18n.servicePointLink)))) : null));
117
+ h("pn-find-price-result", { item: item })))))) : null));
123
118
  }
124
119
  static get is() { return "pn-find-price"; }
125
120
  static get originalStyleUrls() { return {
@@ -1,5 +1,5 @@
1
1
  pn-product-card-price {
2
- margin-top: 1.6rem;
2
+ margin-top: 1rem;
3
3
  white-space: nowrap;
4
4
  text-align: center;
5
5
  display: flex;
@@ -23,7 +23,6 @@ pn-product-card-price .price {
23
23
  }
24
24
  pn-product-card-price pn-button {
25
25
  min-width: 12.8em;
26
- margin-top: 0.8rem;
27
26
  font-size: 1.25;
28
27
  order: 2;
29
28
  }
@@ -44,11 +43,4 @@ pn-product-card-price p {
44
43
  pn-product-card-price p {
45
44
  order: 2;
46
45
  }
47
- }
48
- pn-product-card-price a {
49
- text-decoration: none;
50
- color: #005D92;
51
- }
52
- pn-product-card-price a h3 {
53
- text-decoration: underline;
54
46
  }
@@ -38,6 +38,12 @@ pn-product-card [slot=title] h2 {
38
38
  width: auto;
39
39
  }
40
40
  }
41
+ pn-product-card [slot=title] h2 > a {
42
+ color: #000000;
43
+ }
44
+ pn-product-card [slot=title] h2 > a::after {
45
+ content: "" !important;
46
+ }
41
47
  pn-product-card [slot=title] > [slot] {
42
48
  border-radius: 0.4rem;
43
49
  height: 2.5em;
@@ -124,6 +130,7 @@ pn-product-card [slot=cardprice] {
124
130
  display: flex;
125
131
  flex-direction: column;
126
132
  justify-content: center;
133
+ padding: 0.6em;
127
134
  flex-grow: 1;
128
135
  }
129
136
  @media screen and (min-width: 36em) {
@@ -139,6 +146,55 @@ pn-product-card [slot=cardprice] {
139
146
  align-items: flex-end;
140
147
  }
141
148
  }
149
+ pn-product-card [slot=mobiledownload] {
150
+ margin-top: 1rem;
151
+ white-space: nowrap;
152
+ text-align: center;
153
+ display: flex;
154
+ flex-direction: column;
155
+ }
156
+ pn-product-card [slot=mobiledownload] #riktiga {
157
+ order: 4;
158
+ margin-top: 1em;
159
+ }
160
+ pn-product-card [slot=mobiledownload] #riktiga > div > a::after {
161
+ content: "" !important;
162
+ }
163
+ pn-product-card [slot=mobiledownload] .riktigaAndroidImg {
164
+ width: 6em;
165
+ margin: 0.5em;
166
+ }
167
+ pn-product-card [slot=mobiledownload] .riktigaAppleImg {
168
+ width: 5.6em;
169
+ margin: 0.5em;
170
+ }
171
+ pn-product-card [slot=mobiledownload] a {
172
+ text-decoration: none;
173
+ color: #005D92;
174
+ }
175
+ pn-product-card [slot=mobiledownload] a h3 {
176
+ text-decoration: underline;
177
+ }
178
+ pn-product-card [slot=servicepoint] {
179
+ flex-direction: column;
180
+ justify-content: center;
181
+ flex-grow: 2;
182
+ align-items: flex-end;
183
+ text-align: center;
184
+ }
185
+ @media screen and (min-width: 36em) {
186
+ pn-product-card [slot=servicepoint] {
187
+ flex-direction: row;
188
+ justify-content: space-between;
189
+ }
190
+ }
191
+ @media screen and (min-width: 48em) {
192
+ pn-product-card [slot=servicepoint] {
193
+ flex-direction: column;
194
+ justify-content: center;
195
+ align-items: flex-end;
196
+ }
197
+ }
142
198
  pn-product-card .details {
143
199
  display: flex;
144
200
  flex-direction: column;
@@ -154,5 +210,5 @@ pn-product-card .info {
154
210
  }
155
211
  pn-product-card .info > * {
156
212
  min-width: 6em;
157
- margin: 0.5em 2em 0.5em 0;
213
+ margin: 0.5em 1em 0.5em 0;
158
214
  }
@@ -12,7 +12,9 @@ export class PnProductCard {
12
12
  h("slot", { name: "note" }),
13
13
  h("slot", { name: "additionalUSP" })),
14
14
  h("div", { class: "cardprice" },
15
- h("slot", { name: "cardprice" })))));
15
+ h("slot", { name: "cardprice" }),
16
+ h("slot", { name: "mobiledownload" }),
17
+ h("slot", { name: "servicepoint" })))));
16
18
  }
17
19
  static get is() { return "pn-product-card"; }
18
20
  static get originalStyleUrls() { return {
@@ -24,6 +24,7 @@ class MarketWebLoginManager {
24
24
  expire: 'expire',
25
25
  expireDate: 'expiredate'
26
26
  };
27
+ this.overridetokenValue = 'overridetokenValue';
27
28
  this.store = {
28
29
  get: (key) => {
29
30
  const value = window.sessionStorage.getItem(`${this.storagePrefix}-${key}`);
@@ -59,6 +60,10 @@ class MarketWebLoginManager {
59
60
  this.eventTarget = (options.eventTarget) ? options.eventTarget : this.eventTarget;
60
61
  this.endpoint = options.endpoint ? options.endpoint : `${window.location.protocol}//${window.location.host}`;
61
62
  (_a = this.storagePrefix) !== null && _a !== void 0 ? _a : (this.storagePrefix = options.storagePrefix);
63
+ if (options.userInfo) {
64
+ this.store.set(this.keys.user, options.userInfo);
65
+ this.registerToken(this.overridetokenValue, 'override');
66
+ }
62
67
  }
63
68
  init(checkParameters = true) {
64
69
  if (checkParameters) {
@@ -70,7 +75,10 @@ class MarketWebLoginManager {
70
75
  this.loginStateChange();
71
76
  }
72
77
  }
73
- isLoggedIn() {
78
+ isLoggedIn(override = false) {
79
+ if (override) {
80
+ return override;
81
+ }
74
82
  const isLoggedIn = (this.store.get(this.keys.token) && this.store.get(this.keys.user)) ? true : false;
75
83
  return isLoggedIn;
76
84
  }
@@ -141,6 +149,10 @@ class MarketWebLoginManager {
141
149
  }
142
150
  async fetchUserInfo() {
143
151
  const token = this.store.get(this.keys.token);
152
+ if (this.store.get(this.keys.token) === this.overridetokenValue) {
153
+ console.info('Did not fetch user data since it was set by an override');
154
+ return;
155
+ }
144
156
  const reqConfig = {
145
157
  method: 'GET',
146
158
  headers: {