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

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-8",
3
+ "version": "1.2.2-avatar-button-9",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -1,5 +1,5 @@
1
1
  import { api, LightningElement } from "lwc";
2
- import Cookies from 'js-cookie';
2
+ import Cookies from "js-cookie";
3
3
  import { track } from "dxUtils/analytics";
4
4
  import { defaults } from "lodash";
5
5
 
@@ -37,7 +37,7 @@ export interface UserInfo {
37
37
  relationship?: string;
38
38
  role?: string;
39
39
  username?: string;
40
- readonly fullName: string;
40
+ fullName?: string;
41
41
  }
42
42
 
43
43
  interface EventSourceEvent extends Event {
@@ -64,14 +64,7 @@ const trackableUserInfo = new Set([
64
64
  export default class AvatarButton extends LightningElement {
65
65
  @api size: "small" | "medium" | "large" = "medium";
66
66
 
67
- private userInfo: UserInfo = {
68
- get fullName() {
69
- if (this.firstName && this.lastName) {
70
- return `${this.firstName} ${this.lastName}`;
71
- }
72
- return this.firstName || this.lastName || "";
73
- }
74
- };
67
+ private userInfo: UserInfo = {};
75
68
  private isLoading = false;
76
69
  private settingsUrl = TBID_SETTINGS_URL;
77
70
  private profileUrl = TBID_PROFILE_URL;
@@ -90,11 +83,12 @@ export default class AvatarButton extends LightningElement {
90
83
  }
91
84
 
92
85
  connectedCallback() {
93
- const isLoginSuccessRedirect = Cookies.get('tbidLoginSuccess') === 'true';
86
+ const isLoginSuccessRedirect =
87
+ Cookies.get("tbidLoginSuccess") === "true";
94
88
 
95
89
  if (isLoginSuccessRedirect) {
96
90
  this.isLoading = true;
97
- Cookies.remove('tbidLoginSuccess'); // cleanup
91
+ Cookies.remove("tbidLoginSuccess"); // cleanup
98
92
  }
99
93
 
100
94
  window.addEventListener("tbid-login", this.handleSsoLogin);
@@ -308,13 +302,17 @@ export default class AvatarButton extends LightningElement {
308
302
  return;
309
303
  }
310
304
 
311
- const nextUserInfo: Omit<UserInfo, 'fullName'> = {};
305
+ const nextUserInfo: UserInfo = {};
312
306
  nextUserInfo.avatarImgSrc = userInfo.photos?.thumbnail;
313
307
  nextUserInfo.firstName = userInfo.given_name;
314
308
  nextUserInfo.lastName = userInfo.family_name;
315
309
  nextUserInfo.username = userInfo.preferred_username;
316
310
  nextUserInfo.id = userInfo.user_id;
317
311
  nextUserInfo.orgId = userInfo.organization_id;
312
+ nextUserInfo.fullName =
313
+ nextUserInfo.firstName && nextUserInfo.lastName
314
+ ? `${nextUserInfo.firstName} ${nextUserInfo.lastName}`
315
+ : nextUserInfo.firstName || nextUserInfo.lastName || "";
318
316
 
319
317
  if (userInfo.custom_attributes) {
320
318
  nextUserInfo.company = userInfo.custom_attributes.CompanyName;