@salesforcedevs/dx-components 1.2.2-avatar-button-6 → 1.2.2-avatar-button-8

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-6",
3
+ "version": "1.2.2-avatar-button-8",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -18,6 +18,7 @@
18
18
  "coveo-search-ui": "^2.10082.5",
19
19
  "debounce": "^1.2.0",
20
20
  "js-cookie": "^3.0.1",
21
+ "lodash.defaults": "^4.2.0",
21
22
  "lodash.get": "^4.4.2",
22
23
  "lodash.kebabcase": "^4.1.1",
23
24
  "microtip": "0.2.2",
@@ -27,6 +28,7 @@
27
28
  "@types/classnames": "^2.2.10",
28
29
  "@types/debounce": "^1.2.0",
29
30
  "@types/js-cookie": "^3.0.2",
31
+ "@types/lodash.defaults": "^4.2.7",
30
32
  "@types/lodash.get": "^4.4.6",
31
33
  "@types/lodash.kebabcase": "^4.1.7",
32
34
  "@types/vimeo__player": "^2.16.2"
@@ -1,6 +1,7 @@
1
1
  import { api, LightningElement } from "lwc";
2
2
  import Cookies from 'js-cookie';
3
3
  import { track } from "dxUtils/analytics";
4
+ import { defaults } from "lodash";
4
5
 
5
6
  // TODO: move to environment variable
6
7
  const TBID_BASE_URL = "https://dev1-trailblazer-identity.cs192.force.com";
@@ -307,20 +308,23 @@ export default class AvatarButton extends LightningElement {
307
308
  return;
308
309
  }
309
310
 
310
- this.userInfo.avatarImgSrc = userInfo.photos?.thumbnail;
311
- this.userInfo.firstName = userInfo.given_name;
312
- this.userInfo.lastName = userInfo.family_name;
313
- this.userInfo.username = userInfo.preferred_username;
314
- this.userInfo.id = userInfo.user_id;
315
- this.userInfo.orgId = userInfo.organization_id;
311
+ const nextUserInfo: Omit<UserInfo, 'fullName'> = {};
312
+ nextUserInfo.avatarImgSrc = userInfo.photos?.thumbnail;
313
+ nextUserInfo.firstName = userInfo.given_name;
314
+ nextUserInfo.lastName = userInfo.family_name;
315
+ nextUserInfo.username = userInfo.preferred_username;
316
+ nextUserInfo.id = userInfo.user_id;
317
+ nextUserInfo.orgId = userInfo.organization_id;
316
318
 
317
319
  if (userInfo.custom_attributes) {
318
- this.userInfo.company = userInfo.custom_attributes.CompanyName;
319
- this.userInfo.relationship =
320
+ nextUserInfo.company = userInfo.custom_attributes.CompanyName;
321
+ nextUserInfo.relationship =
320
322
  userInfo.custom_attributes.RelationshipToSalesforce;
321
- this.userInfo.role = userInfo.custom_attributes.Role;
323
+ nextUserInfo.role = userInfo.custom_attributes.Role;
322
324
  }
323
325
  // TODO: Consider displaying initials if no photo. Is there always a photo even if just a default one?
326
+
327
+ this.userInfo = defaults(nextUserInfo, this.userInfo);
324
328
  };
325
329
 
326
330
  private requestUserInfo = async () => {