@salesforcedevs/dw-components 1.2.5-canary.0 → 1.2.5-canary.2
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,5 +1,6 @@
|
|
|
1
1
|
import { LightningElement } from "lwc";
|
|
2
2
|
import { track } from "dxUtils/analytics";
|
|
3
|
+
import type TbidAvatarButton from "dx/tbidAvatarButton";
|
|
3
4
|
|
|
4
5
|
const DSC_BASE_URL = process.env.BASE_URL || "https://developer.salesforce.com";
|
|
5
6
|
|
|
@@ -45,14 +46,14 @@ export default class AvatarButton extends LightningElement {
|
|
|
45
46
|
private isLoggedIn = false;
|
|
46
47
|
private userInfo: UserInfo = {};
|
|
47
48
|
|
|
48
|
-
private handleComponentLogoutClick = () => {
|
|
49
|
+
private handleComponentLogoutClick = (event: Event) => {
|
|
49
50
|
this.trackLogoutClick();
|
|
50
|
-
this.
|
|
51
|
+
(this.template.querySelector('dx-tbid-avatar-button') as unknown as TbidAvatarButton).logout(event);
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
private handleComponentLoginClick = () => {
|
|
54
|
+
private handleComponentLoginClick = (event: Event) => {
|
|
54
55
|
this.trackLoginClick();
|
|
55
|
-
this.
|
|
56
|
+
(this.template.querySelector('dx-tbid-avatar-button') as unknown as TbidAvatarButton).login(event);
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
private handleTbidLoginSuccess = (event: CustomEvent) => {
|
|
@@ -87,19 +88,14 @@ export default class AvatarButton extends LightningElement {
|
|
|
87
88
|
const { detail } = event;
|
|
88
89
|
if (detail && detail.userInfo) {
|
|
89
90
|
this.userInfo = detail.userInfo;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
private dispatchComponentLogin = () => {
|
|
94
|
-
this.dispatchEvent(new CustomEvent('avatarbuttonloginclick', {
|
|
95
|
-
bubbles: true,
|
|
96
|
-
}));
|
|
97
|
-
};
|
|
98
91
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
if (!this.isLoggedIn) {
|
|
93
|
+
// If we are not "logged in" but we receive userInfo, it means the user has a valid
|
|
94
|
+
// session cookie that was re-used without login, and we should update the UI to a
|
|
95
|
+
// logged in state.
|
|
96
|
+
this.isLoggedIn = true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
103
99
|
};
|
|
104
100
|
|
|
105
101
|
private trackLoginClick = () => {
|