@postnord/pn-marketweb-components 1.0.42-beta → 1.0.44-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 (124) hide show
  1. package/cjs/{MarketWebLoginManager-5431b20e.js → MarketWebLoginManager-1282a883.js} +1 -1
  2. package/cjs/{convert-57b3dd5e.js → convert-b8a6d658.js} +55 -0
  3. package/cjs/loader.cjs.js +1 -1
  4. package/cjs/pn-choice-button.cjs.entry.js +39 -0
  5. package/cjs/pn-find-price-result.cjs.entry.js +34 -0
  6. package/cjs/pn-find-price-store-d9aabecb.js +24 -0
  7. package/cjs/pn-find-price.cjs.entry.js +243 -0
  8. package/cjs/{pn-choice-button_2.cjs.entry.js → pn-find-service-and-price-result.cjs.entry.js} +0 -33
  9. package/cjs/pn-find-service-and-price.cjs.entry.js +1 -1
  10. package/cjs/pn-language-selector_9.cjs.entry.js +17 -2
  11. package/cjs/pn-market-web-components.cjs.js +1 -1
  12. package/cjs/pn-marketweb-sitefooter.cjs.entry.js +0 -1
  13. package/cjs/pn-marketweb-siteheader.cjs.entry.js +5 -6
  14. package/cjs/pn-product-card_3.cjs.entry.js +49 -0
  15. package/cjs/pn-product-pricelist.cjs.entry.js +1 -1
  16. package/cjs/pn-profile-selector.cjs.entry.js +1 -1
  17. package/collection/collection-manifest.json +5 -0
  18. package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js +0 -1
  19. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.js +1 -1
  20. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +28 -30
  21. package/collection/components/navigation/pn-language-selector/pn-language-selector.js +15 -0
  22. package/collection/components/widgets/pn-find-price/data.js +42 -0
  23. package/collection/components/widgets/pn-find-price/find-price.stories.js +27 -0
  24. package/collection/components/widgets/pn-find-price/pn-find-price-result.css +9 -0
  25. package/collection/components/widgets/pn-find-price/pn-find-price-result.js +94 -0
  26. package/collection/components/widgets/pn-find-price/pn-find-price-store.js +21 -0
  27. package/collection/components/widgets/pn-find-price/pn-find-price-translations.js +73 -0
  28. package/collection/components/widgets/pn-find-price/pn-find-price-types.js +1 -0
  29. package/collection/components/widgets/pn-find-price/pn-find-price.css +56 -0
  30. package/collection/components/widgets/pn-find-price/pn-find-price.js +217 -0
  31. package/collection/components/widgets/pn-product-card/pn-product-card-info.css +30 -0
  32. package/collection/components/widgets/pn-product-card/pn-product-card-info.js +92 -0
  33. package/collection/components/widgets/pn-product-card/pn-product-card-price.css +37 -0
  34. package/collection/components/widgets/pn-product-card/pn-product-card-price.js +112 -0
  35. package/collection/components/widgets/pn-product-card/pn-product-card.css +86 -0
  36. package/collection/components/widgets/pn-product-card/pn-product-card.js +26 -0
  37. package/collection/components/widgets/pn-product-card/product-card.stories.js +50 -0
  38. package/collection/globals/MarketWebLoginManager.js +1 -1
  39. package/collection/globals/shared/productprice/convert.js +55 -1
  40. package/custom-elements/index.d.ts +30 -0
  41. package/custom-elements/index.js +465 -66
  42. package/esm/{MarketWebLoginManager-12c15210.js → MarketWebLoginManager-310d2552.js} +1 -1
  43. package/esm/{convert-b49a0857.js → convert-8cce67c4.js} +55 -1
  44. package/esm/loader.js +1 -1
  45. package/esm/{pn-choice-button_2.entry.js → pn-choice-button.entry.js} +1 -39
  46. package/esm/pn-find-price-result.entry.js +30 -0
  47. package/esm/pn-find-price-store-8560f26c.js +22 -0
  48. package/esm/pn-find-price.entry.js +239 -0
  49. package/esm/pn-find-service-and-price-result.entry.js +41 -0
  50. package/esm/pn-find-service-and-price.entry.js +1 -1
  51. package/esm/pn-language-selector_9.entry.js +17 -2
  52. package/esm/pn-market-web-components.js +1 -1
  53. package/esm/pn-marketweb-sitefooter.entry.js +0 -1
  54. package/esm/pn-marketweb-siteheader.entry.js +5 -6
  55. package/esm/pn-product-card_3.entry.js +43 -0
  56. package/esm/pn-product-pricelist.entry.js +1 -1
  57. package/esm/pn-profile-selector.entry.js +1 -1
  58. package/esm-es5/{MarketWebLoginManager-12c15210.js → MarketWebLoginManager-310d2552.js} +1 -1
  59. package/esm-es5/{convert-b49a0857.js → convert-8cce67c4.js} +1 -1
  60. package/esm-es5/loader.js +1 -1
  61. package/esm-es5/pn-choice-button.entry.js +1 -0
  62. package/esm-es5/pn-find-price-result.entry.js +1 -0
  63. package/esm-es5/pn-find-price-store-8560f26c.js +1 -0
  64. package/esm-es5/pn-find-price.entry.js +1 -0
  65. package/esm-es5/pn-find-service-and-price-result.entry.js +1 -0
  66. package/esm-es5/pn-find-service-and-price.entry.js +1 -1
  67. package/esm-es5/pn-language-selector_9.entry.js +1 -1
  68. package/esm-es5/pn-market-web-components.js +1 -1
  69. package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
  70. package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
  71. package/esm-es5/pn-product-card_3.entry.js +1 -0
  72. package/esm-es5/pn-product-pricelist.entry.js +1 -1
  73. package/esm-es5/pn-profile-selector.entry.js +1 -1
  74. package/package.json +7 -6
  75. package/pn-market-web-components/{p-e6a209c6.system.entry.js → p-0d0ea574.system.entry.js} +1 -1
  76. package/pn-market-web-components/p-0fb48ff6.entry.js +1 -0
  77. package/pn-market-web-components/p-1051c2d9.system.entry.js +1 -0
  78. package/pn-market-web-components/p-1611123a.system.entry.js +1 -0
  79. package/pn-market-web-components/{p-b8af690a.entry.js → p-22738646.entry.js} +1 -1
  80. package/pn-market-web-components/{p-412ed7a0.js → p-2456901a.js} +1 -1
  81. package/pn-market-web-components/p-2e6644ea.system.entry.js +1 -0
  82. package/pn-market-web-components/p-325a7cae.entry.js +1 -0
  83. package/pn-market-web-components/p-38ff23f5.entry.js +1 -0
  84. package/pn-market-web-components/p-390d9a03.js +1 -0
  85. package/pn-market-web-components/p-492e6f0d.system.js +1 -0
  86. package/pn-market-web-components/p-50454694.system.entry.js +1 -0
  87. package/pn-market-web-components/{p-91624bd5.system.js → p-5ce5be4f.system.js} +2 -2
  88. package/pn-market-web-components/p-5f8ef634.entry.js +1 -0
  89. package/pn-market-web-components/p-6ee881ea.system.entry.js +1 -0
  90. package/pn-market-web-components/p-725e4377.entry.js +1 -0
  91. package/pn-market-web-components/{p-21e0e386.js → p-7dd91709.js} +1 -1
  92. package/pn-market-web-components/p-80ca78f4.entry.js +1 -0
  93. package/pn-market-web-components/p-93d8620b.entry.js +1 -0
  94. package/pn-market-web-components/p-a22df959.system.js +1 -1
  95. package/pn-market-web-components/p-a425e095.system.entry.js +1 -0
  96. package/pn-market-web-components/{p-592ef510.entry.js → p-a5284c78.entry.js} +1 -1
  97. package/pn-market-web-components/p-b42fd0cb.entry.js +1 -0
  98. package/pn-market-web-components/{p-030c3c8a.system.entry.js → p-d133f30d.system.entry.js} +1 -1
  99. package/pn-market-web-components/p-da370548.system.entry.js +1 -0
  100. package/pn-market-web-components/p-dd4de1a9.entry.js +1 -0
  101. package/pn-market-web-components/{p-e04f8d34.system.entry.js → p-eb75d0cf.system.entry.js} +1 -1
  102. package/pn-market-web-components/{p-f9437818.system.js → p-f1311662.system.js} +1 -1
  103. package/pn-market-web-components/p-f2898a60.system.entry.js +1 -0
  104. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  105. package/types/components/navigation/pn-language-selector/pn-language-selector.d.ts +1 -0
  106. package/types/components/widgets/pn-find-price/pn-find-price-result.d.ts +9 -0
  107. package/types/components/widgets/pn-find-price/pn-find-price-store.d.ts +35 -0
  108. package/types/components/widgets/pn-find-price/pn-find-price-translations.d.ts +73 -0
  109. package/types/components/widgets/pn-find-price/pn-find-price-types.d.ts +51 -0
  110. package/types/components/widgets/pn-find-price/pn-find-price.d.ts +16 -0
  111. package/types/components/widgets/pn-product-card/pn-product-card-info.d.ts +7 -0
  112. package/types/components/widgets/pn-product-card/pn-product-card-price.d.ts +8 -0
  113. package/types/components/widgets/pn-product-card/pn-product-card.d.ts +3 -0
  114. package/types/components.d.ts +94 -0
  115. package/esm-es5/pn-choice-button_2.entry.js +0 -1
  116. package/pn-market-web-components/p-37801e32.entry.js +0 -1
  117. package/pn-market-web-components/p-4aa3b95d.entry.js +0 -1
  118. package/pn-market-web-components/p-861210ae.entry.js +0 -1
  119. package/pn-market-web-components/p-b2383083.system.entry.js +0 -1
  120. package/pn-market-web-components/p-bbb59009.entry.js +0 -1
  121. package/pn-market-web-components/p-ca1c99dc.system.entry.js +0 -1
  122. package/pn-market-web-components/p-ec1127de.system.entry.js +0 -1
  123. package/pn-market-web-components/p-ef8a89bc.entry.js +0 -1
  124. package/pn-market-web-components/p-f6b6052b.system.entry.js +0 -1
@@ -0,0 +1,217 @@
1
+ import { Component, h, Prop, State, Watch } from "@stencil/core";
2
+ import { translations, markets } from "./pn-find-price-translations";
3
+ import { weights, sizeCategories } from "./data.js";
4
+ import { convertFileForSizeCategogy } from "../../../globals/shared/productprice/convert.js";
5
+ import { state } from "./pn-find-price-store";
6
+ export class PnfindPrice {
7
+ constructor() {
8
+ this.source = "https://com-integration.postnord.com/globalassets/global/prices/sv-findprice.xlsx";
9
+ this.language = "sv";
10
+ this.market = "se";
11
+ this.filteredItems = [];
12
+ this.weight = { value: 0, name: "" };
13
+ this.weightvalue = 0;
14
+ this.sourceData = { types: [], data: [] };
15
+ this.sizecategory = { value: "", name: "", icon: "", unit: "" };
16
+ }
17
+ componentWillLoad() {
18
+ this.setState();
19
+ this.getDataSource();
20
+ }
21
+ async getDataSource() {
22
+ const cacheBusting = `?cache=${Math.floor(Math.random() * (10000 - 1) + 1)}`;
23
+ const req = await fetch(this.source + cacheBusting);
24
+ const reqbody = await req.blob();
25
+ try {
26
+ const convertedData = await convertFileForSizeCategogy(reqbody);
27
+ this.sourceData = convertedData;
28
+ this.filterItems();
29
+ }
30
+ catch (e) {
31
+ console.log('Unable to parse data');
32
+ }
33
+ }
34
+ setState() {
35
+ if (this.market) {
36
+ state.market = markets[this.market];
37
+ }
38
+ if (this.language && translations[this.language]) {
39
+ state.i18n = translations[this.language];
40
+ }
41
+ }
42
+ filterItems() {
43
+ var _a;
44
+ if (!((_a = this.sourceData) === null || _a === void 0 ? void 0 : _a.data)) {
45
+ console.log('Data has not yet been loaded');
46
+ return;
47
+ }
48
+ const deliveryScopeData = this.sourceData.data.filter((x) => x.deliveryscope === "Sweden");
49
+ if (!this.sizecategory) {
50
+ return;
51
+ }
52
+ const sizeItemData = deliveryScopeData.filter((x) => x.sizecategory === this.sizecategory.value);
53
+ if (!this.weight || !this.weight.value) {
54
+ return;
55
+ }
56
+ const comparisonWeight = this.weight.value <= 20 ? this.weight.value * 1000 : this.weight.value;
57
+ let weightFilteredData = sizeItemData.filter(x => (x.maxweight <= 20 ? x.maxweight * 1000 : x.maxweight) === comparisonWeight);
58
+ // if no value found select the next available value
59
+ if (weightFilteredData.length === 0) {
60
+ weightFilteredData = sizeItemData.filter(x => (x.maxweight <= 20 ? x.maxweight * 1000 : x.maxweight) >= comparisonWeight);
61
+ if (weightFilteredData.length > 0) {
62
+ //sort based on the maxvalue
63
+ weightFilteredData.sort((a, b) => { return (a.maxweight - b.maxweight); });
64
+ // map to get the next unique item
65
+ const uniqueWeightOptions = [...new Map(weightFilteredData.reverse().map(item => [item["id"], item])).values()];
66
+ if (uniqueWeightOptions.length > 0) {
67
+ weightFilteredData = uniqueWeightOptions;
68
+ }
69
+ }
70
+ }
71
+ weightFilteredData.sort((a, b) => {
72
+ var rankA = a.highestrankusp ? a.highestrankusp.toLowerCase() : "z";
73
+ var rankB = b.highestrankusp ? b.highestrankusp.toLowerCase() : "z";
74
+ return (rankA.localeCompare(rankB));
75
+ });
76
+ this.filteredItems = weightFilteredData;
77
+ }
78
+ render() {
79
+ return (h("div", null,
80
+ h("div", { class: "findprice-form" },
81
+ h("div", null, (h("div", { class: "heading" }, state.i18n.deliveryscopeheading))),
82
+ h("div", null,
83
+ (h("div", { class: "heading" }, state.i18n.componentheading)),
84
+ h("div", { class: "sizecategory" }, sizeCategories.map((sizeCategory) => (h("pn-choice-button", { choiceid: sizeCategory.value, value: sizeCategory.value, name: "sizecategory", type: "radio", checked: sizeCategory.value === this.sizecategory.value, onChange: () => {
85
+ this.sizecategory = sizeCategories.filter(x => x.value === sizeCategory.value)[0];
86
+ if (this.weight.value === 0) {
87
+ this.weight = weights[this.sizecategory.unit][0];
88
+ this.weightvalue = this.weight.value;
89
+ }
90
+ } },
91
+ h("pn-illustration", { illustration: sizeCategory.illustration }),
92
+ " ",
93
+ sizeCategory.name))))),
94
+ (this.sizecategory.value && weights[this.sizecategory.unit]) ? (h("div", null,
95
+ (state.i18n.sizeheading) ? (h("div", { class: "heading" }, state.i18n.sizeheading)) : null,
96
+ h("div", { class: "weightoption" },
97
+ h("div", { class: "weightoption-input" },
98
+ h("pn-input", { inputid: "weightvalue", name: "weightvalue", type: "number", label: state.i18n.weightlabel, value: this.weightvalue, onChange: (e) => {
99
+ if (e && e.target && e.target.value) {
100
+ const weightNum = parseInt(e.target.value, 10);
101
+ if (!isNaN(weightNum)) {
102
+ let matchingWeights = weights[this.sizecategory.unit].filter((x) => {
103
+ let weightInGrams = (x.abbreviation === "kg") ? x.value * 1000 : x.value;
104
+ return weightInGrams >= weightNum;
105
+ });
106
+ if (matchingWeights && matchingWeights.length > 0) {
107
+ this.weight = matchingWeights[0];
108
+ this.weightvalue = this.weight.value;
109
+ }
110
+ }
111
+ }
112
+ } }),
113
+ h("span", { class: "weightoption-input-abbreviation" }, this.weight.abbreviation)),
114
+ h("div", { class: "weightoption-range" },
115
+ h("input", { type: "range", id: "weightrange", name: "weightrange", list: "weightlist", value: (!this.weight.value) ? 0 : weights[this.sizecategory.unit].findIndex((x) => x.value === this.weightvalue), onChange: (e) => {
116
+ const value = e.target.value;
117
+ this.weight = weights[this.sizecategory.unit][value];
118
+ this.weightvalue = this.weight.value;
119
+ }, min: "0",
120
+ // max={ weights[this.postagetype.value][weights[this.postagetype.value].length - 1].value }
121
+ max: weights[this.sizecategory.unit].length - 1 }),
122
+ h("datalist", { id: "weightlist" }, weights[this.sizecategory.unit].map((weight, weightindex) => {
123
+ let labelText = weight.name;
124
+ if (weights[this.sizecategory.unit].length > 6) {
125
+ labelText = (weightindex % 5 === 0 || weightindex === 0 || weightindex === weights[this.sizecategory.unit].length - 1) ? weight.name : '';
126
+ }
127
+ return (h("option", Object.assign({ value: weightindex }, (labelText ? { label: labelText } : {}))));
128
+ })))))) : null),
129
+ (this.filteredItems && this.filteredItems.length > 0) ? (h("div", { class: "resultlist" },
130
+ (state.i18n.resultlistheading) ? (h("div", { class: "heading" }, state.i18n.resultlistheading)) : null,
131
+ this.filteredItems.map((item) => (h("div", null,
132
+ h("pn-find-price-result", { item: item })))))) : null));
133
+ }
134
+ static get is() { return "pn-find-price"; }
135
+ static get originalStyleUrls() { return {
136
+ "$": ["pn-find-price.scss"]
137
+ }; }
138
+ static get styleUrls() { return {
139
+ "$": ["pn-find-price.css"]
140
+ }; }
141
+ static get properties() { return {
142
+ "source": {
143
+ "type": "string",
144
+ "mutable": false,
145
+ "complexType": {
146
+ "original": "string",
147
+ "resolved": "string",
148
+ "references": {}
149
+ },
150
+ "required": false,
151
+ "optional": false,
152
+ "docs": {
153
+ "tags": [],
154
+ "text": ""
155
+ },
156
+ "attribute": "source",
157
+ "reflect": false,
158
+ "defaultValue": "\"https://com-integration.postnord.com/globalassets/global/prices/sv-findprice.xlsx\""
159
+ },
160
+ "language": {
161
+ "type": "string",
162
+ "mutable": true,
163
+ "complexType": {
164
+ "original": "string",
165
+ "resolved": "string",
166
+ "references": {}
167
+ },
168
+ "required": false,
169
+ "optional": false,
170
+ "docs": {
171
+ "tags": [],
172
+ "text": ""
173
+ },
174
+ "attribute": "language",
175
+ "reflect": false,
176
+ "defaultValue": "\"sv\""
177
+ },
178
+ "market": {
179
+ "type": "string",
180
+ "mutable": true,
181
+ "complexType": {
182
+ "original": "string",
183
+ "resolved": "string",
184
+ "references": {}
185
+ },
186
+ "required": false,
187
+ "optional": false,
188
+ "docs": {
189
+ "tags": [],
190
+ "text": ""
191
+ },
192
+ "attribute": "market",
193
+ "reflect": false,
194
+ "defaultValue": "\"se\""
195
+ }
196
+ }; }
197
+ static get states() { return {
198
+ "filteredItems": {},
199
+ "weight": {},
200
+ "weightvalue": {},
201
+ "sourceData": {},
202
+ "sizecategory": {}
203
+ }; }
204
+ static get watchers() { return [{
205
+ "propName": "market",
206
+ "methodName": "setState"
207
+ }, {
208
+ "propName": "language",
209
+ "methodName": "setState"
210
+ }, {
211
+ "propName": "weightvalue",
212
+ "methodName": "filterItems"
213
+ }, {
214
+ "propName": "sizecategory",
215
+ "methodName": "filterItems"
216
+ }]; }
217
+ }
@@ -0,0 +1,30 @@
1
+ pn-product-card-info {
2
+ align-self: center;
3
+ }
4
+
5
+ .cardinfocontent {
6
+ display: flex;
7
+ flex-direction: row;
8
+ justify-content: space-between;
9
+ flex-grow: 1;
10
+ font-size: 0.875em;
11
+ }
12
+ .cardinfocontent > div {
13
+ margin: 10px;
14
+ }
15
+
16
+ [slot=formatPre] {
17
+ font-size: 1em;
18
+ font-family: "PostNordSans", "Verdana";
19
+ }
20
+ [slot=formatPre] > strong {
21
+ font-weight: bold;
22
+ }
23
+
24
+ .cardinfoprice {
25
+ display: flex;
26
+ font-size: 1em;
27
+ flex-direction: row;
28
+ justify-content: center;
29
+ flex-grow: 1;
30
+ }
@@ -0,0 +1,92 @@
1
+ import { Component, h, Prop, Host } from "@stencil/core";
2
+ export class PnProductCardInfo {
3
+ render() {
4
+ return (this.label) ? (h(Host, null,
5
+ h("div", { class: "cardinfocontent" }, (this.text) ? (h("pre", { slot: "formatPre" }, this.text)) : null))) : (h(Host, null,
6
+ h("div", { class: "cardinfocontent" },
7
+ h("div", null,
8
+ h("h4", null, "Paket:"),
9
+ h("pre", { slot: "formatPre" }, this.paket)),
10
+ h("div", null,
11
+ h("h4", null, "Rulle:"),
12
+ h("pre", { slot: "formatPre" }, this.rulle)))));
13
+ }
14
+ static get is() { return "pn-product-card-info"; }
15
+ static get originalStyleUrls() { return {
16
+ "$": ["pn-product-card-info.scss"]
17
+ }; }
18
+ static get styleUrls() { return {
19
+ "$": ["pn-product-card-info.css"]
20
+ }; }
21
+ static get properties() { return {
22
+ "rulle": {
23
+ "type": "string",
24
+ "mutable": false,
25
+ "complexType": {
26
+ "original": "string",
27
+ "resolved": "string",
28
+ "references": {}
29
+ },
30
+ "required": false,
31
+ "optional": false,
32
+ "docs": {
33
+ "tags": [],
34
+ "text": ""
35
+ },
36
+ "attribute": "rulle",
37
+ "reflect": false
38
+ },
39
+ "paket": {
40
+ "type": "string",
41
+ "mutable": false,
42
+ "complexType": {
43
+ "original": "string",
44
+ "resolved": "string",
45
+ "references": {}
46
+ },
47
+ "required": false,
48
+ "optional": false,
49
+ "docs": {
50
+ "tags": [],
51
+ "text": ""
52
+ },
53
+ "attribute": "paket",
54
+ "reflect": false
55
+ },
56
+ "label": {
57
+ "type": "string",
58
+ "mutable": false,
59
+ "complexType": {
60
+ "original": "string",
61
+ "resolved": "string",
62
+ "references": {}
63
+ },
64
+ "required": false,
65
+ "optional": false,
66
+ "docs": {
67
+ "tags": [],
68
+ "text": ""
69
+ },
70
+ "attribute": "label",
71
+ "reflect": false
72
+ },
73
+ "text": {
74
+ "type": "string",
75
+ "mutable": false,
76
+ "complexType": {
77
+ "original": "string",
78
+ "resolved": "string",
79
+ "references": {}
80
+ },
81
+ "required": false,
82
+ "optional": false,
83
+ "docs": {
84
+ "tags": [],
85
+ "text": ""
86
+ },
87
+ "attribute": "text",
88
+ "reflect": false
89
+ }
90
+ }; }
91
+ }
92
+ h("pn-icon", { symbol: "align-center", small: "false", color: "black" });
@@ -0,0 +1,37 @@
1
+ pn-product-card-price {
2
+ margin-top: 1em;
3
+ white-space: nowrap;
4
+ text-align: center;
5
+ }
6
+ pn-product-card-price span {
7
+ font-size: 1.25em;
8
+ }
9
+ pn-product-card-price span:last-child {
10
+ display: inline-block;
11
+ margin-left: 0.2em;
12
+ }
13
+ pn-product-card-price + pn-product-card-price {
14
+ margin-left: 1.5em;
15
+ }
16
+ pn-product-card-price pn-icon {
17
+ display: inline-block;
18
+ align-self: center;
19
+ }
20
+ pn-product-card-price pn-button {
21
+ width: 12.8em;
22
+ margin-bottom: 1em;
23
+ margin-top: 0.5em;
24
+ }
25
+ pn-product-card-price p {
26
+ font-weight: lighter;
27
+ font-size: 0.6em;
28
+ align-self: center;
29
+ margin-top: 0.5em;
30
+ }
31
+ pn-product-card-price a {
32
+ text-decoration: none;
33
+ color: #005D92;
34
+ }
35
+ pn-product-card-price a h3 {
36
+ text-decoration: underline;
37
+ }
@@ -0,0 +1,112 @@
1
+ import { Component, h, Prop, Host } from "@stencil/core";
2
+ export class PnProductCardPrice {
3
+ render() {
4
+ if (!this.amount) {
5
+ return;
6
+ }
7
+ return (this.url) ? (h(Host, null,
8
+ h("h3", null,
9
+ (this.amount) ? (h("span", null, this.amount)) : null,
10
+ (this.currency) ? (h("span", null, this.currency)) : null,
11
+ (this.note) ? (h("p", null, this.note)) : null),
12
+ (this.label) ? (h("a", { href: this.url },
13
+ h("pn-button", { small: "true", icon: "arrow-right", appearance: "secondary" }, this.label))) : null)) : (h(Host, null,
14
+ h("h3", null,
15
+ (this.amount) ? (h("span", null, this.amount)) : null,
16
+ (this.currency) ? (h("span", null, this.currency)) : null)));
17
+ }
18
+ static get is() { return "pn-product-card-price"; }
19
+ static get originalStyleUrls() { return {
20
+ "$": ["pn-product-card-price.scss"]
21
+ }; }
22
+ static get styleUrls() { return {
23
+ "$": ["pn-product-card-price.css"]
24
+ }; }
25
+ static get properties() { return {
26
+ "label": {
27
+ "type": "string",
28
+ "mutable": false,
29
+ "complexType": {
30
+ "original": "string",
31
+ "resolved": "string",
32
+ "references": {}
33
+ },
34
+ "required": false,
35
+ "optional": false,
36
+ "docs": {
37
+ "tags": [],
38
+ "text": ""
39
+ },
40
+ "attribute": "label",
41
+ "reflect": false
42
+ },
43
+ "amount": {
44
+ "type": "string",
45
+ "mutable": false,
46
+ "complexType": {
47
+ "original": "string",
48
+ "resolved": "string",
49
+ "references": {}
50
+ },
51
+ "required": false,
52
+ "optional": false,
53
+ "docs": {
54
+ "tags": [],
55
+ "text": ""
56
+ },
57
+ "attribute": "amount",
58
+ "reflect": false
59
+ },
60
+ "currency": {
61
+ "type": "string",
62
+ "mutable": false,
63
+ "complexType": {
64
+ "original": "string",
65
+ "resolved": "string",
66
+ "references": {}
67
+ },
68
+ "required": false,
69
+ "optional": false,
70
+ "docs": {
71
+ "tags": [],
72
+ "text": ""
73
+ },
74
+ "attribute": "currency",
75
+ "reflect": false
76
+ },
77
+ "note": {
78
+ "type": "string",
79
+ "mutable": false,
80
+ "complexType": {
81
+ "original": "string",
82
+ "resolved": "string",
83
+ "references": {}
84
+ },
85
+ "required": false,
86
+ "optional": false,
87
+ "docs": {
88
+ "tags": [],
89
+ "text": ""
90
+ },
91
+ "attribute": "note",
92
+ "reflect": false
93
+ },
94
+ "url": {
95
+ "type": "string",
96
+ "mutable": false,
97
+ "complexType": {
98
+ "original": "string",
99
+ "resolved": "string",
100
+ "references": {}
101
+ },
102
+ "required": false,
103
+ "optional": false,
104
+ "docs": {
105
+ "tags": [],
106
+ "text": ""
107
+ },
108
+ "attribute": "url",
109
+ "reflect": false
110
+ }
111
+ }; }
112
+ }
@@ -0,0 +1,86 @@
1
+ pn-product-card {
2
+ margin-bottom: 1em;
3
+ border: 0.1rem solid #D3CECB;
4
+ outline: none;
5
+ background: white;
6
+ box-shadow: 0px 0.6px 1.8px rgba(0, 0, 0, 0.1), 0px 3.2px 7.2px rgba(0, 0, 0, 0.13);
7
+ display: flex;
8
+ padding: 1.5em;
9
+ word-break: break-word;
10
+ text-decoration: none;
11
+ border-radius: 0.8rem;
12
+ }
13
+ pn-product-card [slot=content] h3 {
14
+ display: flex;
15
+ width: 100%;
16
+ margin-bottom: 0.5em;
17
+ }
18
+ pn-product-card [slot=content] h3 > [slot=Biligast] {
19
+ font-size: 0.6em;
20
+ background: #005E41;
21
+ color: white;
22
+ border-radius: 0.37em;
23
+ width: 4em;
24
+ line-height: 2em;
25
+ text-align: center;
26
+ margin-left: 0.6em;
27
+ font-weight: normal;
28
+ }
29
+ pn-product-card [slot=content] h3 > [slot=Snabbast] {
30
+ font-size: 0.6em;
31
+ background: #005D92;
32
+ color: white;
33
+ border-radius: 0.37em;
34
+ width: 5em;
35
+ line-height: 2em;
36
+ text-align: center;
37
+ vertical-align: bottom;
38
+ margin-left: 0.6em;
39
+ font-weight: normal;
40
+ }
41
+ pn-product-card [slot=additionalUSP] {
42
+ font-size: 0.6em;
43
+ background: #D3CECB;
44
+ color: #2D2013;
45
+ border-radius: 0.25em;
46
+ width: fit-content;
47
+ padding: 0.3em;
48
+ margin-top: 0.5em;
49
+ }
50
+ pn-product-card > pn-illustration {
51
+ min-width: 8rem;
52
+ width: 8rem;
53
+ height: 8rem;
54
+ margin-right: 3rem;
55
+ align-self: center;
56
+ }
57
+ pn-product-card .cardcontent {
58
+ display: flex;
59
+ flex-direction: row;
60
+ justify-content: center;
61
+ flex-grow: 1;
62
+ }
63
+ pn-product-card .cardprice {
64
+ display: flex;
65
+ font-size: 1em;
66
+ flex-direction: row;
67
+ justify-content: center;
68
+ flex-grow: 1;
69
+ }
70
+ pn-product-card .details {
71
+ display: flex;
72
+ flex-direction: column;
73
+ justify-content: space-between;
74
+ width: 100%;
75
+ }
76
+ pn-product-card .info {
77
+ display: flex;
78
+ justify-content: space-between;
79
+ flex-grow: 1;
80
+ max-width: 66.6666666667%;
81
+ flex-flow: wrap;
82
+ }
83
+ pn-product-card .info > * {
84
+ min-width: 6em;
85
+ margin: 0.2em 1em 0.2em 0;
86
+ }
@@ -0,0 +1,26 @@
1
+ import { Component, h, Host } from "@stencil/core";
2
+ export class PnProductCard {
3
+ render() {
4
+ return (h(Host, null,
5
+ h("slot", { name: "illustration" }),
6
+ h("div", { class: "cardcontent" },
7
+ h("div", { class: "details" },
8
+ h("slot", { name: "content" }),
9
+ h("div", { class: "info" },
10
+ h("slot", null)),
11
+ h("slot", { name: "note" }),
12
+ h("slot", { name: "additionalUSP" })),
13
+ h("div", { class: "cardprice" },
14
+ h("div", null,
15
+ h("slot", { name: "price" }),
16
+ h("slot", { name: "sendDirectPrice" }),
17
+ h("slot", { name: "stampPrice" }))))));
18
+ }
19
+ static get is() { return "pn-product-card"; }
20
+ static get originalStyleUrls() { return {
21
+ "$": ["pn-product-card.scss"]
22
+ }; }
23
+ static get styleUrls() { return {
24
+ "$": ["pn-product-card.css"]
25
+ }; }
26
+ }
@@ -0,0 +1,50 @@
1
+ import readme from "./readme.md";
2
+
3
+ export default {
4
+ title: "Widgets/Product Card",
5
+ parameters: {
6
+ notes: readme
7
+ }
8
+ };
9
+
10
+ const Template = ({ ...args }) => {
11
+ return `
12
+ <div style="max-width: 30em; margin:1em auto 0;">
13
+ <pn-product-card>
14
+ <div slot="content">
15
+ <h3>${args.heading}</h3>
16
+ <p>${args.description}</p>
17
+ </div>
18
+ <pn-product-card-info label="${args.info1label}" text="${args.info1value}"></pn-product-card-info>
19
+ <pn-product-card-info label="${args.info2label}" text="${args.info2value}"></pn-product-card-info>
20
+ <pn-product-card-price slot="price" label="${args.pricelabel}" amount="${args.priceamount}" currency="${args.pricecurrency}"></pn-product-card-price>
21
+ </pn-product-card>
22
+ </div>
23
+ `;
24
+ };
25
+
26
+ export const Primary = Template.bind({});
27
+ Primary.args = {
28
+ heading: "Skicka hem",
29
+ description: "Lorem ipsum dolor sit amet",
30
+ info1label: "Maxvikt",
31
+ info1value: "250g",
32
+ info2label: "Max längd + bredd + höjd",
33
+ info2value: "90cm",
34
+ pricelabel: "Skicka direkt",
35
+ priceamount: "52",
36
+ pricecurrency: "kr"
37
+ };
38
+
39
+ export const Secondary = Template.bind({});
40
+ Secondary.args = {
41
+ heading: "",
42
+ description: "",
43
+ info1label: "Maxvikt",
44
+ info1value: "250g",
45
+ info2label: "Max längd + bredd + höjd",
46
+ info2value: "90cm",
47
+ pricelabel: "Skicka direkt",
48
+ priceamount: "52",
49
+ pricecurrency: "kr"
50
+ };
@@ -87,7 +87,7 @@ class MarketWebLoginManager {
87
87
  return `${this.getBaseUrl()}${this.endpoints.authorizationEndpoint}?redirectionUrl=${redirectPage}`;
88
88
  }
89
89
  getLogoutUrl(redirectPage = "") {
90
- redirectPage = window.location.href = '../logout';
90
+ redirectPage = window.location.origin + '/logout';
91
91
  return `${this.getBaseUrl()}${this.endpoints.logoutEndpoint}?redirectionUrl=${redirectPage}&authorization=${this.store.get(this.keys.token)}`;
92
92
  }
93
93
  getUserInfo() {