@postnord/pn-marketweb-components 2.0.23-beta4 → 2.0.24
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-customernumber-selector-option.cjs.entry.js +2 -2
- package/cjs/pn-customernumber-selector.cjs.entry.js +3 -3
- package/cjs/pn-find-price-result.cjs.entry.js +5 -5
- package/cjs/{pn-find-price-store-a2728ff4.js → pn-find-price-store-0b8c195c.js} +2 -0
- package/cjs/pn-find-price.cjs.entry.js +17 -9
- package/cjs/pn-language-selector_9.cjs.entry.js +51 -59
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-marketweb-siteheader-login-linklist.cjs.entry.js +72 -0
- package/cjs/pn-marketweb-siteheader-login-links_2.cjs.entry.js +186 -0
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +26 -7
- package/cjs/pn-product-pricelist.cjs.entry.js +1 -1
- package/cjs/pn-profile-selector-option.cjs.entry.js +2 -2
- package/collection/collection-manifest.json +3 -1
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-linklist.css +22 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-linklist.js +149 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/{pn-marketweb-siteheader-profileselection.css → pn-marketweb-siteheader-login-links.css} +0 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-links.js +199 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-profileselection.css +93 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-profileselection.js +269 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.css +0 -17
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.js +79 -72
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +24 -2
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +69 -2
- package/collection/components/layout-components/pn-marketweb-siteheader/translations.js +20 -5
- package/collection/components/profile/pn-customernumber-selector/pn-customernumber-selector-option.js +4 -4
- package/collection/components/profile/pn-customernumber-selector/pn-customernumber-selector.js +7 -7
- package/collection/components/profile/pn-customernumber-selector/pn-customernumber-selector.stories.js +3 -3
- package/collection/components/profile/pn-profile-selector/pn-profile-selector-option.js +4 -4
- package/collection/components/widgets/pn-find-price/pn-find-price-result.js +4 -4
- package/collection/components/widgets/pn-find-price/pn-find-price-store.js +2 -0
- package/collection/components/widgets/pn-find-price/pn-find-price-translations.js +6 -0
- package/collection/components/widgets/pn-find-price/pn-find-price.css +6 -3
- package/collection/components/widgets/pn-find-price/pn-find-price.js +9 -5
- package/custom-elements/index.d.ts +16 -4
- package/custom-elements/index.js +303 -186
- package/esm/loader.js +1 -1
- package/esm/pn-customernumber-selector-option.entry.js +2 -2
- package/esm/pn-customernumber-selector.entry.js +3 -3
- package/esm/pn-find-price-result.entry.js +5 -5
- package/esm/{pn-find-price-store-f531ab7e.js → pn-find-price-store-b4556c9b.js} +2 -0
- package/esm/pn-find-price.entry.js +17 -9
- package/esm/pn-language-selector_9.entry.js +51 -59
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-marketweb-siteheader-login-linklist.entry.js +68 -0
- package/esm/pn-marketweb-siteheader-login-links_2.entry.js +181 -0
- package/esm/pn-marketweb-siteheader.entry.js +26 -7
- package/esm/pn-product-pricelist.entry.js +1 -1
- package/esm/pn-profile-selector-option.entry.js +2 -2
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-customernumber-selector-option.entry.js +1 -1
- package/esm-es5/pn-customernumber-selector.entry.js +1 -1
- package/esm-es5/pn-find-price-result.entry.js +1 -1
- package/esm-es5/pn-find-price-store-b4556c9b.js +1 -0
- 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-login-linklist.entry.js +1 -0
- package/esm-es5/pn-marketweb-siteheader-login-links_2.entry.js +1 -0
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
- package/esm-es5/pn-product-pricelist.entry.js +1 -1
- package/esm-es5/pn-profile-selector-option.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/p-04240175.entry.js +1 -0
- package/pn-market-web-components/p-08411f5e.entry.js +1 -0
- package/pn-market-web-components/p-0d5d05cc.system.entry.js +1 -0
- package/pn-market-web-components/{p-77887623.system.entry.js → p-1924152a.system.entry.js} +1 -1
- package/pn-market-web-components/p-1f2d9304.entry.js +1 -0
- package/pn-market-web-components/p-37017f68.system.js +1 -0
- package/pn-market-web-components/p-4791c81b.entry.js +1 -0
- package/pn-market-web-components/p-67887512.system.js +1 -1
- package/pn-market-web-components/p-845d6b0a.entry.js +1 -0
- package/pn-market-web-components/{p-2a7e6d3a.system.entry.js → p-93cecc43.system.entry.js} +1 -1
- package/pn-market-web-components/p-a7bb94a0.entry.js +1 -0
- package/pn-market-web-components/{p-1f5b2d7a.entry.js → p-b32a8507.entry.js} +1 -1
- package/pn-market-web-components/p-ba41a7c0.system.entry.js +1 -0
- package/pn-market-web-components/p-c4254e9e.js +1 -0
- package/pn-market-web-components/p-c5a97974.entry.js +1 -0
- package/pn-market-web-components/{p-7f5bee11.entry.js → p-dc1827a6.entry.js} +1 -1
- package/pn-market-web-components/p-e32dc098.entry.js +1 -0
- package/pn-market-web-components/p-e66a8bb8.system.entry.js +1 -0
- package/pn-market-web-components/{p-ddbd131f.system.entry.js → p-e6fa11ad.system.entry.js} +1 -1
- package/pn-market-web-components/p-ec96434c.system.entry.js +1 -0
- package/pn-market-web-components/p-f4630c00.system.entry.js +1 -0
- package/pn-market-web-components/{p-e23a18f4.system.entry.js → p-f7d1c0a0.system.entry.js} +1 -1
- package/pn-market-web-components/{p-c1c79c65.system.entry.js → p-fecc53bb.system.entry.js} +1 -1
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-linklist.d.ts +13 -0
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-links.d.ts +14 -0
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-profileselection.d.ts +20 -0
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.d.ts +6 -4
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-types.d.ts +21 -0
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.d.ts +4 -2
- package/types/components/layout-components/pn-marketweb-siteheader/translations.d.ts +15 -0
- package/types/components/profile/pn-customernumber-selector/pn-customernumber-selector-option.d.ts +1 -1
- package/types/components/profile/pn-customernumber-selector/pn-customernumber-selector.d.ts +1 -1
- package/types/components/profile/pn-profile-selector/pn-profile-selector-option.d.ts +1 -1
- package/types/components/widgets/pn-find-price/pn-find-price-store.d.ts +4 -0
- package/types/components/widgets/pn-find-price/pn-find-price-translations.d.ts +6 -0
- package/types/components/widgets/pn-find-price/pn-find-price-types.d.ts +3 -1
- package/types/components.d.ts +89 -45
- package/umd/pn-marketweb-salesforce.js +1 -1
- package/cjs/pn-marketweb-siteheader-profileselection.cjs.entry.js +0 -161
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.js +0 -319
- package/esm/pn-marketweb-siteheader-profileselection.entry.js +0 -157
- package/esm-es5/pn-find-price-store-f531ab7e.js +0 -1
- package/esm-es5/pn-marketweb-siteheader-profileselection.entry.js +0 -1
- package/pn-market-web-components/p-39c42017.entry.js +0 -1
- package/pn-market-web-components/p-3a4b70d1.system.entry.js +0 -1
- package/pn-market-web-components/p-4cea6bf3.system.entry.js +0 -1
- package/pn-market-web-components/p-63a2ba1c.entry.js +0 -1
- package/pn-market-web-components/p-7e294268.entry.js +0 -1
- package/pn-market-web-components/p-893206f2.js +0 -1
- package/pn-market-web-components/p-a702dcfd.system.entry.js +0 -1
- package/pn-market-web-components/p-a94593a9.system.entry.js +0 -1
- package/pn-market-web-components/p-ac8285b4.entry.js +0 -1
- package/pn-market-web-components/p-b0053a2d.entry.js +0 -1
- package/pn-market-web-components/p-c2670af1.system.js +0 -1
- package/pn-market-web-components/p-ea39d576.entry.js +0 -1
- package/pn-market-web-components/p-fcea21cb.entry.js +0 -1
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.d.ts +0 -28
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { Component, Prop, h, Element, Watch, Host } from "@stencil/core";
|
|
2
|
+
export class PnMarketwebSiteheaderLoginLinks {
|
|
3
|
+
constructor() {
|
|
4
|
+
// Login dialog
|
|
5
|
+
this.loginDialog = null;
|
|
6
|
+
this.loginManager = null;
|
|
7
|
+
this.idNamespace = "";
|
|
8
|
+
this.loggedin = false;
|
|
9
|
+
this.username = "";
|
|
10
|
+
}
|
|
11
|
+
componentWillLoad() {
|
|
12
|
+
this.init();
|
|
13
|
+
console.log('from links', this.loggedin);
|
|
14
|
+
}
|
|
15
|
+
async init() {
|
|
16
|
+
this.adjustLoginLinks();
|
|
17
|
+
}
|
|
18
|
+
adjustLoginLinks() {
|
|
19
|
+
var _a, _b, _c, _d;
|
|
20
|
+
if (!this.loginDialog) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const adjustLink = (link, i) => {
|
|
24
|
+
link.isLogoutLink = (link.href.indexOf('logout') !== -1);
|
|
25
|
+
if (link.isLogoutLink) {
|
|
26
|
+
link.href = this.loginManager.getLogoutUrl(link.href.replace('logout', '').replace('http://window.location.href/?', '').replace('https://window.location.href/?', ''));
|
|
27
|
+
}
|
|
28
|
+
if (i === 0 && !link.href) {
|
|
29
|
+
link.href = this.loginManager.getLoginUrl();
|
|
30
|
+
link.linkType = 'primary';
|
|
31
|
+
}
|
|
32
|
+
if (link.primaryLinkApperance && !link.linkType) {
|
|
33
|
+
link.linkType = 'primary';
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
if ((_a = this.loginDialog) === null || _a === void 0 ? void 0 : _a.loginMenuLinks) {
|
|
37
|
+
(_b = this.loginDialog) === null || _b === void 0 ? void 0 : _b.loginMenuLinks.forEach(adjustLink);
|
|
38
|
+
}
|
|
39
|
+
if ((_c = this.loginDialog) === null || _c === void 0 ? void 0 : _c.loggedInLinks) {
|
|
40
|
+
(_d = this.loginDialog) === null || _d === void 0 ? void 0 : _d.loggedInLinks.forEach(adjustLink);
|
|
41
|
+
}
|
|
42
|
+
this.loginDialog.legacyLoginLinks = [
|
|
43
|
+
{
|
|
44
|
+
href: this.loginManager.getLoginUrl(this.loginDialog.loginUrl),
|
|
45
|
+
linkText: this.loginDialog.loginLinkText,
|
|
46
|
+
openInNewWindow: false,
|
|
47
|
+
isLogoutLink: false,
|
|
48
|
+
pageLink: null,
|
|
49
|
+
linkType: 'primary',
|
|
50
|
+
primaryLinkApperance: true
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
href: this.loginManager.getLoginUrl(this.loginDialog.registerUrl),
|
|
54
|
+
linkText: this.loginDialog.createLoginLinkText,
|
|
55
|
+
openInNewWindow: false,
|
|
56
|
+
isLogoutLink: false,
|
|
57
|
+
pageLink: null,
|
|
58
|
+
primaryLinkApperance: false
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
var _a;
|
|
64
|
+
if (!this.loginDialog) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
let hostElementAttribute = {
|
|
68
|
+
username: null,
|
|
69
|
+
loggedin: false,
|
|
70
|
+
};
|
|
71
|
+
if (this.username) {
|
|
72
|
+
hostElementAttribute.username = this.username;
|
|
73
|
+
hostElementAttribute.loggedin = this.loggedin;
|
|
74
|
+
}
|
|
75
|
+
return (h(Host, Object.assign({}, hostElementAttribute),
|
|
76
|
+
(!this.loginDialog.overrideLoginMenu) ?
|
|
77
|
+
h("div", { "data-loggedin": this.loggedin + '' }, (this.loggedin) ?
|
|
78
|
+
h("pn-marketweb-siteheader-login-linklist", { links: this.loginDialog.loggedInLinks, loginManager: this.loginManager, idNamespace: this.idNamespace })
|
|
79
|
+
:
|
|
80
|
+
h("div", null, ((_a = this.loginDialog.loginMenuLinks) === null || _a === void 0 ? void 0 : _a.length) > 0 ?
|
|
81
|
+
h("pn-marketweb-siteheader-login-linklist", { heading: this.loginDialog.loginTitle, links: this.loginDialog.loginMenuLinks, loginManager: this.loginManager, idNamespace: this.idNamespace })
|
|
82
|
+
:
|
|
83
|
+
h("pn-marketweb-siteheader-login-linklist", { links: this.loginDialog.legacyLoginLinks, loginManager: this.loginManager, idNamespace: this.idNamespace })))
|
|
84
|
+
: null,
|
|
85
|
+
(this.loginDialog.overrideLoginMenu) ?
|
|
86
|
+
h("pn-marketweb-siteheader-login-linklist", { links: this.loginDialog.loginMenuLinks, loginManager: this.loginManager, idNamespace: this.idNamespace })
|
|
87
|
+
: null));
|
|
88
|
+
}
|
|
89
|
+
static get is() { return "pn-marketweb-siteheader-login-links"; }
|
|
90
|
+
static get originalStyleUrls() { return {
|
|
91
|
+
"$": ["pn-marketweb-siteheader-login-links.scss"]
|
|
92
|
+
}; }
|
|
93
|
+
static get styleUrls() { return {
|
|
94
|
+
"$": ["pn-marketweb-siteheader-login-links.css"]
|
|
95
|
+
}; }
|
|
96
|
+
static get properties() { return {
|
|
97
|
+
"loginDialog": {
|
|
98
|
+
"type": "unknown",
|
|
99
|
+
"mutable": true,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "LoginDialog",
|
|
102
|
+
"resolved": "LoginDialog",
|
|
103
|
+
"references": {
|
|
104
|
+
"LoginDialog": {
|
|
105
|
+
"location": "import",
|
|
106
|
+
"path": "./pn-marketweb-siteheader-types"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"optional": false,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": ""
|
|
115
|
+
},
|
|
116
|
+
"defaultValue": "null"
|
|
117
|
+
},
|
|
118
|
+
"loginManager": {
|
|
119
|
+
"type": "unknown",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "MarketWebLoginManager",
|
|
123
|
+
"resolved": "MarketWebLoginManager",
|
|
124
|
+
"references": {
|
|
125
|
+
"MarketWebLoginManager": {
|
|
126
|
+
"location": "import",
|
|
127
|
+
"path": "../../../globals/MarketWebLoginManager"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": false,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": ""
|
|
136
|
+
},
|
|
137
|
+
"defaultValue": "null"
|
|
138
|
+
},
|
|
139
|
+
"idNamespace": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"mutable": false,
|
|
142
|
+
"complexType": {
|
|
143
|
+
"original": "string",
|
|
144
|
+
"resolved": "string",
|
|
145
|
+
"references": {}
|
|
146
|
+
},
|
|
147
|
+
"required": false,
|
|
148
|
+
"optional": false,
|
|
149
|
+
"docs": {
|
|
150
|
+
"tags": [],
|
|
151
|
+
"text": ""
|
|
152
|
+
},
|
|
153
|
+
"attribute": "id-namespace",
|
|
154
|
+
"reflect": false,
|
|
155
|
+
"defaultValue": "\"\""
|
|
156
|
+
},
|
|
157
|
+
"loggedin": {
|
|
158
|
+
"type": "boolean",
|
|
159
|
+
"mutable": false,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "boolean",
|
|
162
|
+
"resolved": "boolean",
|
|
163
|
+
"references": {}
|
|
164
|
+
},
|
|
165
|
+
"required": false,
|
|
166
|
+
"optional": false,
|
|
167
|
+
"docs": {
|
|
168
|
+
"tags": [],
|
|
169
|
+
"text": ""
|
|
170
|
+
},
|
|
171
|
+
"attribute": "loggedin",
|
|
172
|
+
"reflect": true,
|
|
173
|
+
"defaultValue": "false"
|
|
174
|
+
},
|
|
175
|
+
"username": {
|
|
176
|
+
"type": "string",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "string",
|
|
180
|
+
"resolved": "string",
|
|
181
|
+
"references": {}
|
|
182
|
+
},
|
|
183
|
+
"required": false,
|
|
184
|
+
"optional": false,
|
|
185
|
+
"docs": {
|
|
186
|
+
"tags": [],
|
|
187
|
+
"text": ""
|
|
188
|
+
},
|
|
189
|
+
"attribute": "username",
|
|
190
|
+
"reflect": false,
|
|
191
|
+
"defaultValue": "\"\""
|
|
192
|
+
}
|
|
193
|
+
}; }
|
|
194
|
+
static get elementRef() { return "hostElement"; }
|
|
195
|
+
static get watchers() { return [{
|
|
196
|
+
"propName": "loginDialog",
|
|
197
|
+
"methodName": "init"
|
|
198
|
+
}]; }
|
|
199
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
.pn-marketweb-siteheader-login-profileselection-heading {
|
|
2
|
+
display: block;
|
|
3
|
+
padding: 0.5rem 0 1rem;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pn-marketweb-siteheader-login-profileselection-user,
|
|
7
|
+
.pn-marketweb-siteheader-login-profileselection-currentprofile {
|
|
8
|
+
margin-top: 1rem;
|
|
9
|
+
margin-bottom: 1rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pn-marketweb-siteheader-login-profileselection-user-name,
|
|
13
|
+
.pn-marketweb-siteheader-login-profileselection-currentprofile-name {
|
|
14
|
+
line-height: 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pn-marketweb-siteheader-login-profileselection-user-description,
|
|
18
|
+
.pn-marketweb-siteheader-login-profileselection-currentprofile-description {
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
white-space: normal;
|
|
21
|
+
word-break: break-all;
|
|
22
|
+
color: #5E554A;
|
|
23
|
+
font-size: 0.75em;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.pn-marketweb-siteheader-login-profileselection-divider {
|
|
27
|
+
height: 1rem;
|
|
28
|
+
width: 100%;
|
|
29
|
+
background: #00A0D6;
|
|
30
|
+
position: relative;
|
|
31
|
+
margin-left: -1em;
|
|
32
|
+
margin-top: 1.6rem;
|
|
33
|
+
margin-bottom: 1.6rem;
|
|
34
|
+
border-radius: 0 0.6em 0.6em 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
.pn-marketweb-siteheader-login-profileselection-divider::after {
|
|
38
|
+
content: "";
|
|
39
|
+
width: 0.6em;
|
|
40
|
+
height: 0.6em;
|
|
41
|
+
border-radius: 50%;
|
|
42
|
+
position: absolute;
|
|
43
|
+
right: 0;
|
|
44
|
+
top: 0;
|
|
45
|
+
background: inherit;
|
|
46
|
+
transform: translateX(calc(100% + 0.2em));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pn-marketweb-siteheader-login-profileselection-profileoption-link {
|
|
50
|
+
display: flex;
|
|
51
|
+
background: #FFFFFF;
|
|
52
|
+
transition: background 0.15s ease-in-out;
|
|
53
|
+
margin: 0 -1em;
|
|
54
|
+
padding: 0.6rem 1.6rem;
|
|
55
|
+
text-decoration: none;
|
|
56
|
+
color: #005D92;
|
|
57
|
+
align-items: center;
|
|
58
|
+
}
|
|
59
|
+
.pn-marketweb-siteheader-login-profileselection-profileoption-link:hover, .pn-marketweb-siteheader-login-profileselection-profileoption-link:focus, .pn-marketweb-siteheader-login-profileselection-profileoption-link:active {
|
|
60
|
+
background: #F3F2F2;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.pn-marketweb-siteheader-login-profileselection-profileoption-content {
|
|
64
|
+
flex-grow: 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.pn-marketweb-siteheader-login-profileselection-profileoption-name {
|
|
68
|
+
font-weight: 700;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.pn-marketweb-siteheader-login-profileselection-profileoption-description {
|
|
72
|
+
font-weight: 400;
|
|
73
|
+
white-space: normal;
|
|
74
|
+
word-break: break-all;
|
|
75
|
+
color: #5E554A;
|
|
76
|
+
font-size: 0.75em;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.pn-marketweb-siteheader-login-profileselection-logout {
|
|
80
|
+
padding: 1.6rem;
|
|
81
|
+
text-align: center;
|
|
82
|
+
width: 100%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.pn-marketweb-siteheader-login-profileselection-logout-link {
|
|
86
|
+
display: inline-block;
|
|
87
|
+
font-weight: 500;
|
|
88
|
+
color: #005D92;
|
|
89
|
+
text-decoration: none;
|
|
90
|
+
}
|
|
91
|
+
.pn-marketweb-siteheader-login-profileselection-logout-link:hover, .pn-marketweb-siteheader-login-profileselection-logout-link:focus, .pn-marketweb-siteheader-login-profileselection-logout-link:active {
|
|
92
|
+
text-decoration: underline;
|
|
93
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { Component, Prop, h, State, Element, Host } from "@stencil/core";
|
|
2
|
+
export class PnMarketwebSiteheaderLoginProfileselection {
|
|
3
|
+
constructor() {
|
|
4
|
+
// Login dialog
|
|
5
|
+
this.loginDialog = null;
|
|
6
|
+
this.loginManager = null;
|
|
7
|
+
this.endpoint = "";
|
|
8
|
+
this.loggedin = false;
|
|
9
|
+
this.idNamespace = "";
|
|
10
|
+
this.heading = "";
|
|
11
|
+
this.i18n = { "searchlabel": "", "searchplaceholder": "", "searchbuttontext": "", "menuHomeButton": "", "menuGoBackButton": "", "mainMenuButton": "", "menuStartButton": "", "profileSelectionFlyoutHeading": "" };
|
|
12
|
+
this.user = null;
|
|
13
|
+
this.logoutLink = null;
|
|
14
|
+
this.profileSelectorDialog = {
|
|
15
|
+
currentProfile: {
|
|
16
|
+
name: 'Hedin',
|
|
17
|
+
customerid: '5560230053'
|
|
18
|
+
},
|
|
19
|
+
profiles: [
|
|
20
|
+
{
|
|
21
|
+
name: 'Bilmetro AB',
|
|
22
|
+
customerid: '5560612789'
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
componentWillLoad() {
|
|
28
|
+
var _a;
|
|
29
|
+
console.log('loginDialog', this.loginDialog);
|
|
30
|
+
console.log('this.loginManager', this.loginManager);
|
|
31
|
+
console.log('### this.loggedin', this.loggedin);
|
|
32
|
+
console.log('this.endpoint', this.endpoint);
|
|
33
|
+
if (!this.heading && ((_a = this.i18n) === null || _a === void 0 ? void 0 : _a.profileSelectionFlyoutHeading)) {
|
|
34
|
+
this.heading = this.i18n.profileSelectionFlyoutHeading;
|
|
35
|
+
}
|
|
36
|
+
this.init();
|
|
37
|
+
}
|
|
38
|
+
init() {
|
|
39
|
+
this.updateUserInfo();
|
|
40
|
+
this.adjustLoginLinks();
|
|
41
|
+
}
|
|
42
|
+
adjustLoginLinks() {
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
|
+
const adjustLink = (link, i) => {
|
|
45
|
+
link.isLogoutLink = (link.href.indexOf('logout') !== -1);
|
|
46
|
+
if (link.isLogoutLink) {
|
|
47
|
+
link.href = this.loginManager.getLogoutUrl(link.href.replace('logout', '').replace('http://window.location.href/?', '').replace('https://window.location.href/?', ''));
|
|
48
|
+
}
|
|
49
|
+
if (i === 0 && !link.href) {
|
|
50
|
+
link.href = this.loginManager.getLoginUrl();
|
|
51
|
+
link.linkType = 'primary';
|
|
52
|
+
}
|
|
53
|
+
if (link.primaryLinkApperance && !link.linkType) {
|
|
54
|
+
link.linkType = 'primary';
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
if ((_a = this.loginDialog) === null || _a === void 0 ? void 0 : _a.loggedInLinks) {
|
|
58
|
+
(_b = this.loginDialog) === null || _b === void 0 ? void 0 : _b.loggedInLinks.forEach(adjustLink);
|
|
59
|
+
}
|
|
60
|
+
this.logoutLink = (_d = (_c = this.loginDialog) === null || _c === void 0 ? void 0 : _c.loggedInLinks.filter(x => x.isLogoutLink)[0]) !== null && _d !== void 0 ? _d : null;
|
|
61
|
+
}
|
|
62
|
+
updateUserInfo() {
|
|
63
|
+
const userInfo = this.loginManager.getUserInfo();
|
|
64
|
+
this.user = userInfo;
|
|
65
|
+
console.log('this.user', this.user);
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
if (!this.loginDialog || !this.profileSelectorDialog) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let hostElementAttribute = {};
|
|
72
|
+
return (h(Host, Object.assign({}, hostElementAttribute),
|
|
73
|
+
this.heading ? h("strong", { class: "pn-marketweb-siteheader-login-profileselection-heading" }, this.heading) : null,
|
|
74
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-user" },
|
|
75
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-user-name" }, this.user.given_name),
|
|
76
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-user-description" }, this.user.username)),
|
|
77
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-currentprofile" },
|
|
78
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-currentprofile-name" }, this.profileSelectorDialog.currentProfile.name),
|
|
79
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-currentprofile-description" }, this.profileSelectorDialog.currentProfile.customerid)),
|
|
80
|
+
h("pn-marketweb-siteheader-login-linklist", { links: this.loginDialog.loggedInLinks.filter(x => x.isLogoutLink === false), loginManager: this.loginManager, idNamespace: this.idNamespace }),
|
|
81
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-divider" }),
|
|
82
|
+
this.profileSelectorDialog.profiles.map((profile) => {
|
|
83
|
+
return (h("div", { class: "pn-marketweb-siteheader-login-profileselection-profileoption" },
|
|
84
|
+
h("a", { href: `${this.endpoint}?selectprofile=${profile.customerid}}`, class: "pn-marketweb-siteheader-login-profileselection-profileoption-link" },
|
|
85
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-profileoption-content" },
|
|
86
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-profileoption-name" }, profile.name),
|
|
87
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-profileoption-description" }, profile.customerid)),
|
|
88
|
+
h("pn-icon", { symbol: "arrow-right", small: "false", color: "blue700" }))));
|
|
89
|
+
}),
|
|
90
|
+
this.logoutLink ?
|
|
91
|
+
h("div", { class: "pn-marketweb-siteheader-login-profileselection-logout" },
|
|
92
|
+
h("a", { href: this.logoutLink.href, rel: "nofollower noopener", class: "pn-marketweb-siteheader-login-profileselection-logout-link" }, this.logoutLink.linkText))
|
|
93
|
+
: null));
|
|
94
|
+
}
|
|
95
|
+
static get is() { return "pn-marketweb-siteheader-login-profileselection"; }
|
|
96
|
+
static get originalStyleUrls() { return {
|
|
97
|
+
"$": ["pn-marketweb-siteheader-login-profileselection.scss"]
|
|
98
|
+
}; }
|
|
99
|
+
static get styleUrls() { return {
|
|
100
|
+
"$": ["pn-marketweb-siteheader-login-profileselection.css"]
|
|
101
|
+
}; }
|
|
102
|
+
static get properties() { return {
|
|
103
|
+
"loginDialog": {
|
|
104
|
+
"type": "unknown",
|
|
105
|
+
"mutable": true,
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "LoginDialog",
|
|
108
|
+
"resolved": "LoginDialog",
|
|
109
|
+
"references": {
|
|
110
|
+
"LoginDialog": {
|
|
111
|
+
"location": "import",
|
|
112
|
+
"path": "./pn-marketweb-siteheader-types"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"required": false,
|
|
117
|
+
"optional": false,
|
|
118
|
+
"docs": {
|
|
119
|
+
"tags": [],
|
|
120
|
+
"text": ""
|
|
121
|
+
},
|
|
122
|
+
"defaultValue": "null"
|
|
123
|
+
},
|
|
124
|
+
"loginManager": {
|
|
125
|
+
"type": "unknown",
|
|
126
|
+
"mutable": false,
|
|
127
|
+
"complexType": {
|
|
128
|
+
"original": "MarketWebLoginManager",
|
|
129
|
+
"resolved": "MarketWebLoginManager",
|
|
130
|
+
"references": {
|
|
131
|
+
"MarketWebLoginManager": {
|
|
132
|
+
"location": "import",
|
|
133
|
+
"path": "../../../globals/MarketWebLoginManager"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": ""
|
|
142
|
+
},
|
|
143
|
+
"defaultValue": "null"
|
|
144
|
+
},
|
|
145
|
+
"endpoint": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "string",
|
|
150
|
+
"resolved": "string",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": false,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": ""
|
|
158
|
+
},
|
|
159
|
+
"attribute": "endpoint",
|
|
160
|
+
"reflect": false,
|
|
161
|
+
"defaultValue": "\"\""
|
|
162
|
+
},
|
|
163
|
+
"loggedin": {
|
|
164
|
+
"type": "boolean",
|
|
165
|
+
"mutable": false,
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "boolean",
|
|
168
|
+
"resolved": "boolean",
|
|
169
|
+
"references": {}
|
|
170
|
+
},
|
|
171
|
+
"required": false,
|
|
172
|
+
"optional": false,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [],
|
|
175
|
+
"text": ""
|
|
176
|
+
},
|
|
177
|
+
"attribute": "loggedin",
|
|
178
|
+
"reflect": false,
|
|
179
|
+
"defaultValue": "false"
|
|
180
|
+
},
|
|
181
|
+
"idNamespace": {
|
|
182
|
+
"type": "string",
|
|
183
|
+
"mutable": false,
|
|
184
|
+
"complexType": {
|
|
185
|
+
"original": "string",
|
|
186
|
+
"resolved": "string",
|
|
187
|
+
"references": {}
|
|
188
|
+
},
|
|
189
|
+
"required": false,
|
|
190
|
+
"optional": false,
|
|
191
|
+
"docs": {
|
|
192
|
+
"tags": [],
|
|
193
|
+
"text": ""
|
|
194
|
+
},
|
|
195
|
+
"attribute": "id-namespace",
|
|
196
|
+
"reflect": false,
|
|
197
|
+
"defaultValue": "\"\""
|
|
198
|
+
},
|
|
199
|
+
"heading": {
|
|
200
|
+
"type": "string",
|
|
201
|
+
"mutable": false,
|
|
202
|
+
"complexType": {
|
|
203
|
+
"original": "string",
|
|
204
|
+
"resolved": "string",
|
|
205
|
+
"references": {}
|
|
206
|
+
},
|
|
207
|
+
"required": false,
|
|
208
|
+
"optional": false,
|
|
209
|
+
"docs": {
|
|
210
|
+
"tags": [],
|
|
211
|
+
"text": ""
|
|
212
|
+
},
|
|
213
|
+
"attribute": "heading",
|
|
214
|
+
"reflect": false,
|
|
215
|
+
"defaultValue": "\"\""
|
|
216
|
+
},
|
|
217
|
+
"i18n": {
|
|
218
|
+
"type": "unknown",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "SiteHeaderI18N",
|
|
222
|
+
"resolved": "SiteHeaderI18N",
|
|
223
|
+
"references": {
|
|
224
|
+
"SiteHeaderI18N": {
|
|
225
|
+
"location": "import",
|
|
226
|
+
"path": "./pn-marketweb-siteheader-types"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"required": false,
|
|
231
|
+
"optional": false,
|
|
232
|
+
"docs": {
|
|
233
|
+
"tags": [],
|
|
234
|
+
"text": ""
|
|
235
|
+
},
|
|
236
|
+
"defaultValue": "{ \"searchlabel\":\"\", \"searchplaceholder\":\"\", \"searchbuttontext\":\"\", \"menuHomeButton\": \"\", \"menuGoBackButton\": \"\", \"mainMenuButton\": \"\", \"menuStartButton\": \"\", \"profileSelectionFlyoutHeading\": \"\" } as SiteHeaderI18N"
|
|
237
|
+
},
|
|
238
|
+
"profileSelectorDialog": {
|
|
239
|
+
"type": "unknown",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "ProfileSelectorDialog",
|
|
243
|
+
"resolved": "ProfileSelectorDialog",
|
|
244
|
+
"references": {
|
|
245
|
+
"ProfileSelectorDialog": {
|
|
246
|
+
"location": "import",
|
|
247
|
+
"path": "./pn-marketweb-siteheader-types"
|
|
248
|
+
},
|
|
249
|
+
"ProfileSelectorCustomer": {
|
|
250
|
+
"location": "import",
|
|
251
|
+
"path": "./pn-marketweb-siteheader-types"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"required": false,
|
|
256
|
+
"optional": false,
|
|
257
|
+
"docs": {
|
|
258
|
+
"tags": [],
|
|
259
|
+
"text": ""
|
|
260
|
+
},
|
|
261
|
+
"defaultValue": "{\n currentProfile: {\n name: 'Hedin',\n customerid: '5560230053'\n } as ProfileSelectorCustomer,\n profiles: [\n {\n name: 'Bilmetro AB',\n customerid: '5560612789'\n } as ProfileSelectorCustomer\n ]\n}"
|
|
262
|
+
}
|
|
263
|
+
}; }
|
|
264
|
+
static get states() { return {
|
|
265
|
+
"user": {},
|
|
266
|
+
"logoutLink": {}
|
|
267
|
+
}; }
|
|
268
|
+
static get elementRef() { return "hostElement"; }
|
|
269
|
+
}
|
|
@@ -3,23 +3,6 @@ pn-marketweb-siteheader-login {
|
|
|
3
3
|
max-height: 5.2rem;
|
|
4
4
|
position: relative;
|
|
5
5
|
}
|
|
6
|
-
pn-marketweb-siteheader-login strong {
|
|
7
|
-
padding: 0.8rem 1.6rem;
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
}
|
|
11
|
-
pn-marketweb-siteheader-login ul, pn-marketweb-siteheader-login li {
|
|
12
|
-
list-style: none;
|
|
13
|
-
margin: 0;
|
|
14
|
-
padding: 0;
|
|
15
|
-
}
|
|
16
|
-
pn-marketweb-siteheader-login li {
|
|
17
|
-
padding: 0.8rem 1.6rem;
|
|
18
|
-
}
|
|
19
|
-
pn-marketweb-siteheader-login li pn-button {
|
|
20
|
-
display: block;
|
|
21
|
-
width: 100%;
|
|
22
|
-
}
|
|
23
6
|
pn-marketweb-siteheader-login pn-nav-dropdown {
|
|
24
7
|
display: none;
|
|
25
8
|
}
|