@salesforcedevs/dx-components 1.2.2-avatar-button-1 → 1.2.2-avatar-button-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
|
@@ -114,14 +114,16 @@ export default class AvatarButton extends LightningElement {
|
|
|
114
114
|
) {
|
|
115
115
|
setTimeout(() => {
|
|
116
116
|
if (!window.SFIDWidget?.openid_response) {
|
|
117
|
-
this.trackLogin();
|
|
117
|
+
// this.trackLogin(); TODO: track only clicks
|
|
118
|
+
this.platformEventsSubscribe();
|
|
118
119
|
this.requestUserInfo();
|
|
119
120
|
}
|
|
120
121
|
}, 1000);
|
|
121
122
|
} else {
|
|
122
123
|
if (this.isLoading) {
|
|
123
124
|
// This was a login.
|
|
124
|
-
this.
|
|
125
|
+
this.platformEventsSubscribe();
|
|
126
|
+
// this.trackLogin(); TODO: track only clicks
|
|
125
127
|
}
|
|
126
128
|
this.requestUserInfo();
|
|
127
129
|
}
|
|
@@ -189,11 +191,17 @@ export default class AvatarButton extends LightningElement {
|
|
|
189
191
|
this.eventSource = undefined;
|
|
190
192
|
};
|
|
191
193
|
|
|
194
|
+
private platformEventsSubscribe = () => {
|
|
195
|
+
this.teardownEventSource();
|
|
196
|
+
this.setupEventSource();
|
|
197
|
+
};
|
|
198
|
+
|
|
192
199
|
// This handles logout from within this component, rather than from SSO via the SFIDWidget.
|
|
193
200
|
private handleLogout = (isSsoLogout: boolean) => {
|
|
194
201
|
this._didReceiveUserInfo = false;
|
|
195
202
|
this.isLoading = false;
|
|
196
203
|
this.updateAvatarWithUserInfo({}); // clear old info
|
|
204
|
+
this.teardownEventSource();
|
|
197
205
|
|
|
198
206
|
if (!isSsoLogout) {
|
|
199
207
|
this.trackLogout();
|
|
@@ -245,6 +253,7 @@ export default class AvatarButton extends LightningElement {
|
|
|
245
253
|
token
|
|
246
254
|
})
|
|
247
255
|
});
|
|
256
|
+
this.platformEventsSubscribe();
|
|
248
257
|
} catch (ex) {
|
|
249
258
|
console.error(`Attempt to update token failed: ${ex}`);
|
|
250
259
|
}
|
|
@@ -255,7 +264,7 @@ export default class AvatarButton extends LightningElement {
|
|
|
255
264
|
this._didReceiveUserInfo = true;
|
|
256
265
|
}
|
|
257
266
|
|
|
258
|
-
this.trackLogin();
|
|
267
|
+
// this.trackLogin(); TODO: only track clicks
|
|
259
268
|
};
|
|
260
269
|
|
|
261
270
|
private handleComponentLogin = () => {
|