@salesforcedevs/dx-components 1.2.2-avatar-button-5 → 1.2.2-avatar-button-7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.2.2-avatar-button-
|
|
3
|
+
"version": "1.2.2-avatar-button-7",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"classnames": "^2.2.6",
|
|
18
18
|
"coveo-search-ui": "^2.10082.5",
|
|
19
19
|
"debounce": "^1.2.0",
|
|
20
|
+
"js-cookie": "^3.0.1",
|
|
20
21
|
"lodash.get": "^4.4.2",
|
|
21
22
|
"lodash.kebabcase": "^4.1.1",
|
|
22
23
|
"microtip": "0.2.2",
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@types/classnames": "^2.2.10",
|
|
27
28
|
"@types/debounce": "^1.2.0",
|
|
29
|
+
"@types/js-cookie": "^3.0.2",
|
|
28
30
|
"@types/lodash.get": "^4.4.6",
|
|
29
31
|
"@types/lodash.kebabcase": "^4.1.7",
|
|
30
32
|
"@types/vimeo__player": "^2.16.2"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { api, LightningElement } from "lwc";
|
|
2
|
+
import Cookies from 'js-cookie';
|
|
2
3
|
import { track } from "dxUtils/analytics";
|
|
3
4
|
|
|
4
5
|
// TODO: move to environment variable
|
|
@@ -88,19 +89,11 @@ export default class AvatarButton extends LightningElement {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
connectedCallback() {
|
|
91
|
-
const
|
|
92
|
+
const isLoginSuccessRedirect = Cookies.get('tbidLoginSuccess') === 'true';
|
|
92
93
|
|
|
93
|
-
if (
|
|
94
|
+
if (isLoginSuccessRedirect) {
|
|
94
95
|
this.isLoading = true;
|
|
95
|
-
//
|
|
96
|
-
searchParams.delete("loginSuccess");
|
|
97
|
-
window.history.replaceState(
|
|
98
|
-
null,
|
|
99
|
-
"",
|
|
100
|
-
`${window.location.pathname}${
|
|
101
|
-
window.location.hash
|
|
102
|
-
}${searchParams.toString()}`
|
|
103
|
-
);
|
|
96
|
+
Cookies.remove('tbidLoginSuccess'); // cleanup
|
|
104
97
|
}
|
|
105
98
|
|
|
106
99
|
window.addEventListener("tbid-login", this.handleSsoLogin);
|
|
@@ -191,9 +184,7 @@ export default class AvatarButton extends LightningElement {
|
|
|
191
184
|
PlatformEventsType.UserMerge,
|
|
192
185
|
this.handleSsoLogout
|
|
193
186
|
);
|
|
194
|
-
|
|
195
|
-
this.eventSource.close();
|
|
196
|
-
}
|
|
187
|
+
this.eventSource.close();
|
|
197
188
|
this.eventSource = undefined;
|
|
198
189
|
};
|
|
199
190
|
|
|
@@ -316,20 +307,26 @@ export default class AvatarButton extends LightningElement {
|
|
|
316
307
|
return;
|
|
317
308
|
}
|
|
318
309
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
310
|
+
const nextUserInfo: Omit<UserInfo, 'fullName'> = {};
|
|
311
|
+
nextUserInfo.avatarImgSrc = userInfo.photos?.thumbnail;
|
|
312
|
+
nextUserInfo.firstName = userInfo.given_name;
|
|
313
|
+
nextUserInfo.lastName = userInfo.family_name;
|
|
314
|
+
nextUserInfo.username = userInfo.preferred_username;
|
|
315
|
+
nextUserInfo.id = userInfo.user_id;
|
|
316
|
+
nextUserInfo.orgId = userInfo.organization_id;
|
|
325
317
|
|
|
326
318
|
if (userInfo.custom_attributes) {
|
|
327
|
-
|
|
328
|
-
|
|
319
|
+
nextUserInfo.company = userInfo.custom_attributes.CompanyName;
|
|
320
|
+
nextUserInfo.relationship =
|
|
329
321
|
userInfo.custom_attributes.RelationshipToSalesforce;
|
|
330
|
-
|
|
322
|
+
nextUserInfo.role = userInfo.custom_attributes.Role;
|
|
331
323
|
}
|
|
332
324
|
// TODO: Consider displaying initials if no photo. Is there always a photo even if just a default one?
|
|
325
|
+
|
|
326
|
+
this.userInfo = {
|
|
327
|
+
...this.userInfo,
|
|
328
|
+
...nextUserInfo,
|
|
329
|
+
};
|
|
333
330
|
};
|
|
334
331
|
|
|
335
332
|
private requestUserInfo = async () => {
|