@postnord/pn-marketweb-components 2.0.21 → 2.0.23-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.
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-find-price-result.cjs.entry.js +9 -2
- package/cjs/{pn-find-price-store-b0ea47ed.js → pn-find-price-store-a2728ff4.js} +2 -1
- package/cjs/pn-find-price.cjs.entry.js +15 -10
- package/cjs/pn-language-selector_9.cjs.entry.js +1 -1
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-marketweb-siteheader-profileselection.cjs.entry.js +161 -0
- package/cjs/pn-product-card_4.cjs.entry.js +4 -4
- package/cjs/pn-product-pricelist.cjs.entry.js +1 -1
- package/collection/collection-manifest.json +1 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.css +0 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.js +319 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-search.js +1 -1
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +2 -2
- package/collection/components/widgets/pn-find-price/pn-find-price-result.js +12 -2
- package/collection/components/widgets/pn-find-price/pn-find-price-store.js +2 -1
- package/collection/components/widgets/pn-find-price/pn-find-price-translations.js +9 -6
- package/collection/components/widgets/pn-find-price/pn-find-price.css +1 -1
- package/collection/components/widgets/pn-find-price/pn-find-price.js +4 -2
- package/collection/components/widgets/pn-product-card/pn-product-card-info.js +6 -6
- package/custom-elements/index.d.ts +6 -0
- package/custom-elements/index.js +187 -18
- package/esm/{data-f0ac26a9.js → data-9c9c5f41.js} +1 -1
- package/esm/loader.js +1 -1
- package/esm/pn-find-price-result.entry.js +10 -3
- package/esm/{pn-find-price-store-625a6d87.js → pn-find-price-store-f531ab7e.js} +2 -1
- package/esm/pn-find-price.entry.js +16 -11
- package/esm/pn-language-selector_9.entry.js +1 -1
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-marketweb-siteheader-profileselection.entry.js +157 -0
- package/esm/pn-product-card_4.entry.js +4 -4
- package/esm/pn-product-pricelist.entry.js +1 -1
- package/esm-es5/{data-f0ac26a9.js → data-9c9c5f41.js} +1 -1
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-find-price-result.entry.js +1 -1
- package/esm-es5/{pn-find-price-store-625a6d87.js → pn-find-price-store-f531ab7e.js} +1 -1
- package/esm-es5/pn-find-price.entry.js +1 -1
- package/esm-es5/pn-language-selector_9.entry.js +1 -1
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-siteheader-profileselection.entry.js +1 -0
- package/esm-es5/pn-product-card_4.entry.js +1 -1
- package/esm-es5/pn-product-pricelist.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/{p-c1c3777d.entry.js → p-1f5b2d7a.entry.js} +1 -1
- package/pn-market-web-components/p-39c42017.entry.js +1 -0
- package/pn-market-web-components/{p-a0665bab.system.entry.js → p-47cf8713.system.entry.js} +1 -1
- package/pn-market-web-components/p-4cea6bf3.system.entry.js +1 -0
- package/pn-market-web-components/p-67887512.system.js +1 -1
- package/pn-market-web-components/{p-28d3a96e.entry.js → p-7f5bee11.entry.js} +1 -1
- package/pn-market-web-components/{p-f04541a1.js → p-86b52823.js} +1 -1
- package/pn-market-web-components/{p-e3ae421f.js → p-893206f2.js} +1 -1
- package/pn-market-web-components/p-a26e5490.system.entry.js +1 -0
- package/pn-market-web-components/p-a94593a9.system.entry.js +1 -0
- package/pn-market-web-components/{p-26191bda.entry.js → p-b1685197.entry.js} +1 -1
- package/pn-market-web-components/{p-9e0c9f32.system.js → p-bfa7c83f.system.js} +1 -1
- package/pn-market-web-components/{p-1c11b615.system.entry.js → p-c1c79c65.system.entry.js} +1 -1
- package/pn-market-web-components/{p-e9781689.system.js → p-c2670af1.system.js} +1 -1
- package/pn-market-web-components/p-e08a29ff.entry.js +1 -0
- package/pn-market-web-components/{p-d85f3f93.system.entry.js → p-e23a18f4.system.entry.js} +1 -1
- package/pn-market-web-components/p-fcea21cb.entry.js +1 -0
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.d.ts +28 -0
- package/types/components/widgets/pn-find-price/pn-find-price-result.d.ts +3 -0
- package/types/components/widgets/pn-find-price/pn-find-price-store.d.ts +2 -0
- package/types/components/widgets/pn-find-price/pn-find-price-translations.d.ts +3 -0
- package/types/components/widgets/pn-find-price/pn-find-price-types.d.ts +2 -0
- package/types/components.d.ts +46 -0
- package/umd/pn-marketweb-salesforce.js +1 -1
- package/pn-market-web-components/p-3fa09b4e.entry.js +0 -1
- package/pn-market-web-components/p-8339dcf6.system.entry.js +0 -1
- package/pn-market-web-components/p-885879fb.entry.js +0 -1
- package/pn-market-web-components/p-9d1a2d82.system.entry.js +0 -1
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { Component, Prop, h, State, Element, Watch, Event, Host } from "@stencil/core";
|
|
2
|
+
import { MarketWebLoginManager } from "../../../globals/MarketWebLoginManager";
|
|
3
|
+
export class PnMarketwebSiteheaderProfileSelection {
|
|
4
|
+
constructor() {
|
|
5
|
+
/** Specifies which endpoint domain we should load from */
|
|
6
|
+
this.endpoint = "";
|
|
7
|
+
/** Access token passed from backend */
|
|
8
|
+
this.token = "";
|
|
9
|
+
this.emitEvents = true;
|
|
10
|
+
// Login dialog
|
|
11
|
+
this.loginDialog = null;
|
|
12
|
+
/** User Fullname */
|
|
13
|
+
this.fullname = "";
|
|
14
|
+
this.loggedin = false;
|
|
15
|
+
this.loginManager = null;
|
|
16
|
+
this.toggleButtonText = "";
|
|
17
|
+
this.username = this.fullname;
|
|
18
|
+
}
|
|
19
|
+
componentWillLoad() {
|
|
20
|
+
const userInfo = this.loggedin && this.fullname ? { given_name: this.fullname } : null;
|
|
21
|
+
this.loginManager = new MarketWebLoginManager({ endpoint: this.endpoint, eventTarget: this.hostElement, userInfo });
|
|
22
|
+
this.hostElement["loginmanager"] = this.loginManager;
|
|
23
|
+
if (this.token) {
|
|
24
|
+
this.loginManager.registerToken(this.token, 'backend');
|
|
25
|
+
}
|
|
26
|
+
else if (this.emitEvents) { // The primary login instance
|
|
27
|
+
this.loginManager.invalidateTokenOfType('backend');
|
|
28
|
+
}
|
|
29
|
+
this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
|
|
30
|
+
this.init();
|
|
31
|
+
this.setUserName();
|
|
32
|
+
this.setToggleButtonText();
|
|
33
|
+
}
|
|
34
|
+
async init() {
|
|
35
|
+
this.toggleButtonText = this.loginDialog.loginMenuLinkText;
|
|
36
|
+
this.loginManager.init(this.emitEvents);
|
|
37
|
+
this.setToggleButtonText();
|
|
38
|
+
}
|
|
39
|
+
setUserName() {
|
|
40
|
+
const userInfo = this.loginManager.getUserInfo();
|
|
41
|
+
let name = "";
|
|
42
|
+
if (!this.loggedin || !userInfo) {
|
|
43
|
+
this.username = name;
|
|
44
|
+
}
|
|
45
|
+
if (userInfo && userInfo.given_name) {
|
|
46
|
+
name = userInfo.given_name + ((userInfo === null || userInfo === void 0 ? void 0 : userInfo.family_name) ? ` ${userInfo === null || userInfo === void 0 ? void 0 : userInfo.family_name}` : "");
|
|
47
|
+
}
|
|
48
|
+
if (!name && userInfo && userInfo.email) {
|
|
49
|
+
name = userInfo.email;
|
|
50
|
+
}
|
|
51
|
+
if (!name && this.fullname) {
|
|
52
|
+
name = this.fullname;
|
|
53
|
+
}
|
|
54
|
+
this.username = name;
|
|
55
|
+
}
|
|
56
|
+
setToggleButtonText() {
|
|
57
|
+
if (this.loggedin) {
|
|
58
|
+
this.toggleButtonText = this.username;
|
|
59
|
+
if (!this.toggleButtonText) {
|
|
60
|
+
this.toggleButtonText = this.loginDialog.loggedInButtonText;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.toggleButtonText = this.loginDialog.loginMenuLinkText;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
onLoginStateChange(e) {
|
|
68
|
+
if (this.loggedin !== e.detail && this.emitEvents) {
|
|
69
|
+
this.loggedin = e.detail;
|
|
70
|
+
this.loginStateChange.emit({ loggedIn: this.loggedin, token: this.loginManager.getToken() });
|
|
71
|
+
this.setUserName();
|
|
72
|
+
this.setToggleButtonText();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
uniqueId(text) {
|
|
76
|
+
return "loginlink-" + text.replace(/[^A-Za-z0-9.\\\/]/igm, "") + "-" + (this.emitEvents ? "1" : "2");
|
|
77
|
+
}
|
|
78
|
+
linkAppearanceAttributes(link) {
|
|
79
|
+
let attributes = {};
|
|
80
|
+
if (link.linkType) {
|
|
81
|
+
switch (link.linkType) {
|
|
82
|
+
case 'primary':
|
|
83
|
+
attributes = {
|
|
84
|
+
appearance: '',
|
|
85
|
+
variant: ''
|
|
86
|
+
};
|
|
87
|
+
break;
|
|
88
|
+
case 'secondary':
|
|
89
|
+
attributes = {
|
|
90
|
+
appearance: 'light',
|
|
91
|
+
variant: 'outlined'
|
|
92
|
+
};
|
|
93
|
+
break;
|
|
94
|
+
case 'regularlink':
|
|
95
|
+
default:
|
|
96
|
+
attributes = {
|
|
97
|
+
appearance: 'light',
|
|
98
|
+
variant: 'borderless',
|
|
99
|
+
icon: 'arrow-right'
|
|
100
|
+
};
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
return attributes;
|
|
104
|
+
}
|
|
105
|
+
if (!link.linkType) {
|
|
106
|
+
attributes = {
|
|
107
|
+
appearance: link.primaryLinkApperance ? "dark" : "light"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return attributes;
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
if (!this.loginDialog) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
let hostElementAttribute = {
|
|
118
|
+
username: null
|
|
119
|
+
};
|
|
120
|
+
if (this.username) {
|
|
121
|
+
hostElementAttribute.username = this.username;
|
|
122
|
+
}
|
|
123
|
+
return (h(Host, Object.assign({}, hostElementAttribute),
|
|
124
|
+
h("pn-nav-dropdown", { label: this.toggleButtonText, icon: "user", class: "siteheader-logindialog" }, (!this.loginDialog.overrideLoginMenu) ?
|
|
125
|
+
h("div", { "data-loggedin": this.loggedin + '' }, (!this.loggedin) ?
|
|
126
|
+
h("div", null, (_a = this.loginDialog.loginTitle) !== null && _a !== void 0 ? _a : h("strong", null, this.loginDialog.loginTitle),
|
|
127
|
+
((_b = this.loginDialog.loginMenuLinks) === null || _b === void 0 ? void 0 : _b.length) > 0 ?
|
|
128
|
+
h("ul", null, this.loginDialog.loginMenuLinks.map((link, i) => {
|
|
129
|
+
const href = (i === 0 && !link.href) ? this.loginManager.getLoginUrl() : link.href;
|
|
130
|
+
return (h("li", null,
|
|
131
|
+
h("pn-button", Object.assign({ href: href, id: this.uniqueId(link.linkText) }, this.linkAppearanceAttributes(link), (link.openInNewWindow && { target: '_blank' })), link.linkText)));
|
|
132
|
+
}))
|
|
133
|
+
: (h("ul", null,
|
|
134
|
+
h("li", null,
|
|
135
|
+
h("pn-button", { href: this.loginManager.getLoginUrl(this.loginDialog.loginUrl), target: "_top" }, this.loginDialog.loginLinkText)),
|
|
136
|
+
h("li", null,
|
|
137
|
+
h("pn-button", { href: this.loginDialog.registerUrl, target: "_top", appearance: "light", variant: "outlined" }, this.loginDialog.createLoginLinkText)))))
|
|
138
|
+
:
|
|
139
|
+
h("div", null,
|
|
140
|
+
h("ul", null, this.loginDialog.loggedInLinks.map((link) => {
|
|
141
|
+
const isLogoutLink = link.href.indexOf('logout') !== -1;
|
|
142
|
+
const href = (isLogoutLink) ? this.loginManager.getLogoutUrl(link.href.replace('logout', '').replace('http://window.location.href/?', '').replace('https://window.location.href/?', '')) : link.href;
|
|
143
|
+
return (h("li", null,
|
|
144
|
+
h("pn-button", Object.assign({ href: href, id: this.uniqueId(link.linkText) }, (link.openInNewWindow && { target: '_blank' }), this.linkAppearanceAttributes(link), { onClick: () => { if (isLogoutLink) {
|
|
145
|
+
this.loginManager.clearUserData();
|
|
146
|
+
} } }), link.linkText)));
|
|
147
|
+
}))))
|
|
148
|
+
:
|
|
149
|
+
h("div", null,
|
|
150
|
+
h("ul", null, (_c = this.loginDialog.loginMenuLinks) === null || _c === void 0 ? void 0 : _c.map(link => h("li", null,
|
|
151
|
+
h("a", { href: link.href, target: link.openInNewWindow ? "_blank" : "_self", class: "btn btn-link" }, link.linkText))))))));
|
|
152
|
+
}
|
|
153
|
+
static get is() { return "pn-marketweb-siteheader-profileselection"; }
|
|
154
|
+
static get originalStyleUrls() { return {
|
|
155
|
+
"$": ["pn-marketweb-siteheader-profileselection.scss"]
|
|
156
|
+
}; }
|
|
157
|
+
static get styleUrls() { return {
|
|
158
|
+
"$": ["pn-marketweb-siteheader-profileselection.css"]
|
|
159
|
+
}; }
|
|
160
|
+
static get properties() { return {
|
|
161
|
+
"endpoint": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"mutable": false,
|
|
164
|
+
"complexType": {
|
|
165
|
+
"original": "string",
|
|
166
|
+
"resolved": "string",
|
|
167
|
+
"references": {}
|
|
168
|
+
},
|
|
169
|
+
"required": false,
|
|
170
|
+
"optional": false,
|
|
171
|
+
"docs": {
|
|
172
|
+
"tags": [],
|
|
173
|
+
"text": "Specifies which endpoint domain we should load from"
|
|
174
|
+
},
|
|
175
|
+
"attribute": "endpoint",
|
|
176
|
+
"reflect": false,
|
|
177
|
+
"defaultValue": "\"\""
|
|
178
|
+
},
|
|
179
|
+
"token": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"mutable": false,
|
|
182
|
+
"complexType": {
|
|
183
|
+
"original": "string",
|
|
184
|
+
"resolved": "string",
|
|
185
|
+
"references": {}
|
|
186
|
+
},
|
|
187
|
+
"required": false,
|
|
188
|
+
"optional": false,
|
|
189
|
+
"docs": {
|
|
190
|
+
"tags": [],
|
|
191
|
+
"text": "Access token passed from backend"
|
|
192
|
+
},
|
|
193
|
+
"attribute": "token",
|
|
194
|
+
"reflect": false,
|
|
195
|
+
"defaultValue": "\"\""
|
|
196
|
+
},
|
|
197
|
+
"i18n": {
|
|
198
|
+
"type": "any",
|
|
199
|
+
"mutable": false,
|
|
200
|
+
"complexType": {
|
|
201
|
+
"original": "any",
|
|
202
|
+
"resolved": "any",
|
|
203
|
+
"references": {}
|
|
204
|
+
},
|
|
205
|
+
"required": false,
|
|
206
|
+
"optional": false,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": ""
|
|
210
|
+
},
|
|
211
|
+
"attribute": "i-1-8n",
|
|
212
|
+
"reflect": false
|
|
213
|
+
},
|
|
214
|
+
"emitEvents": {
|
|
215
|
+
"type": "boolean",
|
|
216
|
+
"mutable": false,
|
|
217
|
+
"complexType": {
|
|
218
|
+
"original": "boolean",
|
|
219
|
+
"resolved": "boolean",
|
|
220
|
+
"references": {}
|
|
221
|
+
},
|
|
222
|
+
"required": false,
|
|
223
|
+
"optional": false,
|
|
224
|
+
"docs": {
|
|
225
|
+
"tags": [],
|
|
226
|
+
"text": ""
|
|
227
|
+
},
|
|
228
|
+
"attribute": "emit-events",
|
|
229
|
+
"reflect": false,
|
|
230
|
+
"defaultValue": "true"
|
|
231
|
+
},
|
|
232
|
+
"loginDialog": {
|
|
233
|
+
"type": "unknown",
|
|
234
|
+
"mutable": true,
|
|
235
|
+
"complexType": {
|
|
236
|
+
"original": "LoginDialog",
|
|
237
|
+
"resolved": "LoginDialog",
|
|
238
|
+
"references": {
|
|
239
|
+
"LoginDialog": {
|
|
240
|
+
"location": "import",
|
|
241
|
+
"path": "./pn-marketweb-siteheader-types"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"required": false,
|
|
246
|
+
"optional": false,
|
|
247
|
+
"docs": {
|
|
248
|
+
"tags": [],
|
|
249
|
+
"text": ""
|
|
250
|
+
},
|
|
251
|
+
"defaultValue": "null"
|
|
252
|
+
},
|
|
253
|
+
"fullname": {
|
|
254
|
+
"type": "string",
|
|
255
|
+
"mutable": false,
|
|
256
|
+
"complexType": {
|
|
257
|
+
"original": "string",
|
|
258
|
+
"resolved": "string",
|
|
259
|
+
"references": {}
|
|
260
|
+
},
|
|
261
|
+
"required": false,
|
|
262
|
+
"optional": false,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": "User Fullname"
|
|
266
|
+
},
|
|
267
|
+
"attribute": "fullname",
|
|
268
|
+
"reflect": false,
|
|
269
|
+
"defaultValue": "\"\""
|
|
270
|
+
},
|
|
271
|
+
"loggedin": {
|
|
272
|
+
"type": "boolean",
|
|
273
|
+
"mutable": false,
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "boolean",
|
|
276
|
+
"resolved": "boolean",
|
|
277
|
+
"references": {}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": false,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [],
|
|
283
|
+
"text": ""
|
|
284
|
+
},
|
|
285
|
+
"attribute": "loggedin",
|
|
286
|
+
"reflect": false,
|
|
287
|
+
"defaultValue": "false"
|
|
288
|
+
}
|
|
289
|
+
}; }
|
|
290
|
+
static get states() { return {
|
|
291
|
+
"loginManager": {},
|
|
292
|
+
"toggleButtonText": {},
|
|
293
|
+
"username": {}
|
|
294
|
+
}; }
|
|
295
|
+
static get events() { return [{
|
|
296
|
+
"method": "loginStateChange",
|
|
297
|
+
"name": "loginStateChange",
|
|
298
|
+
"bubbles": true,
|
|
299
|
+
"cancelable": true,
|
|
300
|
+
"composed": true,
|
|
301
|
+
"docs": {
|
|
302
|
+
"tags": [],
|
|
303
|
+
"text": ""
|
|
304
|
+
},
|
|
305
|
+
"complexType": {
|
|
306
|
+
"original": "any",
|
|
307
|
+
"resolved": "any",
|
|
308
|
+
"references": {}
|
|
309
|
+
}
|
|
310
|
+
}]; }
|
|
311
|
+
static get elementRef() { return "hostElement"; }
|
|
312
|
+
static get watchers() { return [{
|
|
313
|
+
"propName": "i18n",
|
|
314
|
+
"methodName": "init"
|
|
315
|
+
}, {
|
|
316
|
+
"propName": "loginDialog",
|
|
317
|
+
"methodName": "init"
|
|
318
|
+
}]; }
|
|
319
|
+
}
|
|
@@ -41,7 +41,7 @@ export class PnMarketwebSiteheaderSearch {
|
|
|
41
41
|
if (!data || !data.hits || !data.hits.length) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
const suggestions = data.hits.map((item) => {
|
|
44
|
+
const suggestions = data.hits.filter(item => item.type === "editorial").map((item) => {
|
|
45
45
|
return item.query;
|
|
46
46
|
});
|
|
47
47
|
// Store query in store
|
|
@@ -51,7 +51,7 @@ const PrimaryTemplate = ({ ...args }) => {
|
|
|
51
51
|
hide-search="false"
|
|
52
52
|
hide-login="false"
|
|
53
53
|
cache="false"
|
|
54
|
-
|
|
54
|
+
autocomplete-endpoint="http://localhost:51444/find_v2/_autocomplete"
|
|
55
55
|
session-forward="true">
|
|
56
56
|
<a href="" class="header-cart" slot="toprightend" style="align-self:center;position:relative;text-decoration:none;">
|
|
57
57
|
<span>Varukorg</span>
|
|
@@ -69,7 +69,7 @@ Content that is higher than 100% viewport height
|
|
|
69
69
|
-->
|
|
70
70
|
`;
|
|
71
71
|
};
|
|
72
|
-
//
|
|
72
|
+
//
|
|
73
73
|
export const Primary = PrimaryTemplate.bind({});
|
|
74
74
|
Primary.args = {
|
|
75
75
|
market : "se",
|
|
@@ -9,6 +9,9 @@ export class PnfindPriceResult {
|
|
|
9
9
|
this.showMeasurement = false;
|
|
10
10
|
this.weightText = "";
|
|
11
11
|
this.linkId = '';
|
|
12
|
+
this.shopLabel = '';
|
|
13
|
+
this.shopUrl = '';
|
|
14
|
+
this.shopId = '';
|
|
12
15
|
}
|
|
13
16
|
componentWillLoad() {
|
|
14
17
|
this.composeItems();
|
|
@@ -25,6 +28,10 @@ export class PnfindPriceResult {
|
|
|
25
28
|
}
|
|
26
29
|
this.showMeasurement = (this.item.maxmått !== null) || (this.item.rulle !== null);
|
|
27
30
|
this.linkId = `${this.item.id}-${this.item.name.toLocaleLowerCase().replace(/[^a-zA-Z0-9]/g, '')}`;
|
|
31
|
+
var availableOnline = (this.item.availableonline !== "No");
|
|
32
|
+
this.shopLabel = availableOnline ? state.i18n.stampshopcta : state.i18n.ombudHeader;
|
|
33
|
+
this.shopUrl = availableOnline ? stampShopUrl : state.market.servicePoint;
|
|
34
|
+
this.shopId = availableOnline ? '-stampshop' : '-servicepoint';
|
|
28
35
|
}
|
|
29
36
|
render() {
|
|
30
37
|
return (h(Host, null, h("pn-product-card", { "data-productid": this.item.id },
|
|
@@ -54,7 +61,7 @@ export class PnfindPriceResult {
|
|
|
54
61
|
h("div", { slot: "cardprice" },
|
|
55
62
|
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,
|
|
56
63
|
this.item.pricestamps ? ((this.item.name.toLocaleLowerCase() !== "riktiga vykort") ?
|
|
57
|
-
(h("pn-product-card-price", { slot: "stampPrice", label:
|
|
64
|
+
(h("pn-product-card-price", { slot: "stampPrice", label: this.shopLabel, amount: this.item.pricestamps + '', currency: state.market.currency, url: this.shopUrl, linkid: this.linkId + this.shopId })) :
|
|
58
65
|
(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),
|
|
59
66
|
h("div", { slot: "servicepoint" }, (this.item.showservicepointlink) ? (h("a", { href: state.market.servicePoint, target: "_blank" },
|
|
60
67
|
h("pn-icon", { symbol: "map-marker", color: "blue700" }),
|
|
@@ -206,7 +213,10 @@ export class PnfindPriceResult {
|
|
|
206
213
|
}; }
|
|
207
214
|
static get states() { return {
|
|
208
215
|
"weightText": {},
|
|
209
|
-
"linkId": {}
|
|
216
|
+
"linkId": {},
|
|
217
|
+
"shopLabel": {},
|
|
218
|
+
"shopUrl": {},
|
|
219
|
+
"shopId": {}
|
|
210
220
|
}; }
|
|
211
221
|
static get watchers() { return [{
|
|
212
222
|
"propName": "item",
|
|
@@ -7,12 +7,13 @@ export const translations = {
|
|
|
7
7
|
'maxweightlabel': 'Maxvikt',
|
|
8
8
|
'maxmeasurementlabel': 'Maxvolym',
|
|
9
9
|
'senddirectcta': 'Köp online',
|
|
10
|
-
'stampshopcta': '
|
|
10
|
+
'stampshopcta': 'Till butiken',
|
|
11
11
|
'message': '*Vid köp hos valfritt ombud',
|
|
12
12
|
'servicePointHeader': 'Eller hitta närmaste serviceställe',
|
|
13
13
|
'servicePointLink': 'Hitta Serviceställe',
|
|
14
|
-
'riktigaVykort': '
|
|
15
|
-
'riktigaVykortMobile': '
|
|
14
|
+
'riktigaVykort': 'Köp Riktiga Vykort',
|
|
15
|
+
'riktigaVykortMobile': 'Ladda ner appen',
|
|
16
|
+
'ombudHeader': 'Köp via ombud'
|
|
16
17
|
},
|
|
17
18
|
'en': {
|
|
18
19
|
'componentheading': 'Our prices and terms and conditions for domestic shipments for you as a direct paying customer',
|
|
@@ -22,12 +23,13 @@ export const translations = {
|
|
|
22
23
|
'maxweightlabel': 'Max weight',
|
|
23
24
|
'maxmeasurementlabel': 'Maximum measurement',
|
|
24
25
|
'senddirectcta': 'Buy Online',
|
|
25
|
-
'stampshopcta': '
|
|
26
|
+
'stampshopcta': 'To the Store',
|
|
26
27
|
'message': 'When buying from any agent',
|
|
27
28
|
'servicePointHeader': 'Find service point',
|
|
28
29
|
'servicePointLink': 'Find service point',
|
|
29
30
|
'riktigaVykort': 'Buy Postcards',
|
|
30
|
-
'riktigaVykortMobile': '
|
|
31
|
+
'riktigaVykortMobile': 'Download the app',
|
|
32
|
+
'ombudHeader': 'Purchase by agent'
|
|
31
33
|
},
|
|
32
34
|
'da': {
|
|
33
35
|
'componentheading': 'Vad vill du skicka?',
|
|
@@ -37,11 +39,12 @@ export const translations = {
|
|
|
37
39
|
'maxweightlabel': 'Max vægt',
|
|
38
40
|
'maxmeasurementlabel': 'Maks. Volumen',
|
|
39
41
|
'senddirectcta': 'Køb Online',
|
|
40
|
-
'stampshopcta': '
|
|
42
|
+
'stampshopcta': 'Til butikken',
|
|
41
43
|
'message': 'When buying from any agent',
|
|
42
44
|
'servicePointHeader': 'Find nærmeste servicested',
|
|
43
45
|
'servicePointLink': 'Find nærmeste servicested',
|
|
44
46
|
'riktigaVykort': 'Køb Riktiga Vykort',
|
|
47
|
+
'ombudHeader': 'Køb af agent'
|
|
45
48
|
},
|
|
46
49
|
'no': {
|
|
47
50
|
'componentheading': 'Vad vill du skicka?',
|
|
@@ -58,11 +58,13 @@ export class PnfindPrice {
|
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
const sizeItemData = deliveryScopeData.filter((x) => x.sizecategory.toLocaleLowerCase() === this.sizecategory.value.toLocaleLowerCase());
|
|
61
|
-
if (
|
|
61
|
+
if (this.weight.value === 0) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
const comparisonWeight = this.weight.value <= 20 ? this.weight.value * 1000 : this.weight.value;
|
|
65
|
-
let
|
|
65
|
+
let clubbedProducts = sizeItemData.filter(x => x.maxweight.toString().includes("upto")).
|
|
66
|
+
filter(x => (Number(x.maxweight.toString().toLocaleLowerCase().replace("upto", '')) - comparisonWeight) >= 0);
|
|
67
|
+
let weightFilteredData = sizeItemData.filter(x => (x.maxweight <= 20 ? x.maxweight * 1000 : x.maxweight) === comparisonWeight).concat(clubbedProducts);
|
|
66
68
|
// if no value found select the next available value
|
|
67
69
|
if (weightFilteredData.length === 0 && this.weightvalue !== 0) {
|
|
68
70
|
weightFilteredData = sizeItemData.filter(x => (x.maxweight <= 20 ? x.maxweight * 1000 : x.maxweight) >= comparisonWeight);
|
|
@@ -5,16 +5,16 @@ export class PnProductCardInfo {
|
|
|
5
5
|
h("div", { class: "cardinfocontent" }, (this.text) ? (h("pre", { slot: "formatPre" }, this.text)) : null))) : (h(Host, null,
|
|
6
6
|
h("div", { class: "cardinfocontent" },
|
|
7
7
|
(this.paket) ? (h("div", { class: "cardinfocontent-item" },
|
|
8
|
-
h("strong", null, "Maxm\u00E5tt
|
|
9
|
-
this.paket.split("/").map((item) => ((item.split(":").length >
|
|
10
|
-
h("p", null,
|
|
8
|
+
h("strong", null, "Maxm\u00E5tt"),
|
|
9
|
+
this.paket.split("/").map((item) => ((item.split(":").length > 1) ?
|
|
10
|
+
(h("p", null,
|
|
11
11
|
h("strong", null, item.split(":")[0] + ": "),
|
|
12
12
|
" ",
|
|
13
|
-
item.split(":")[1]) :
|
|
14
|
-
h("p", null, item))))) : null,
|
|
13
|
+
item.split(":")[1])) :
|
|
14
|
+
(h("p", null, item)))))) : null,
|
|
15
15
|
(this.rulle) ?
|
|
16
16
|
(h("div", { class: "cardinfocontent-item" },
|
|
17
|
-
h("strong", null, "Rulle
|
|
17
|
+
h("strong", null, "Rulle"),
|
|
18
18
|
this.rulle.split("/").map((item) => ((item.split(":").length > 0) ?
|
|
19
19
|
h("p", null,
|
|
20
20
|
h("strong", null, item.split(":")[0] + ": "),
|
|
@@ -128,6 +128,12 @@ export const PnMarketwebSiteheaderLogin: {
|
|
|
128
128
|
new (): PnMarketwebSiteheaderLogin;
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
interface PnMarketwebSiteheaderProfileselection extends Components.PnMarketwebSiteheaderProfileselection, HTMLElement {}
|
|
132
|
+
export const PnMarketwebSiteheaderProfileselection: {
|
|
133
|
+
prototype: PnMarketwebSiteheaderProfileselection;
|
|
134
|
+
new (): PnMarketwebSiteheaderProfileselection;
|
|
135
|
+
};
|
|
136
|
+
|
|
131
137
|
interface PnMarketwebSiteheaderSearch extends Components.PnMarketwebSiteheaderSearch, HTMLElement {}
|
|
132
138
|
export const PnMarketwebSiteheaderSearch: {
|
|
133
139
|
prototype: PnMarketwebSiteheaderSearch;
|