@salesforcedevs/dx-components 1.2.7-avatar-button-3 → 1.2.7-avatar-button-4
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
|
@@ -230,38 +230,37 @@ export default class AvatarButton extends LightningElement {
|
|
|
230
230
|
const isAlreadyLoading = this.isLoading;
|
|
231
231
|
|
|
232
232
|
// `token` should always be defined if an SSO login occurs, but we check for extra safety
|
|
233
|
-
if (token) {
|
|
234
|
-
|
|
233
|
+
if (!token) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
235
236
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
237
|
+
// If an SSO login occurred and we have an SSO access token, we want to start using
|
|
238
|
+
// it rather than some other non-linked access token, for the "seamless SSO"
|
|
239
|
+
// experience
|
|
240
|
+
try {
|
|
241
|
+
const tokenResponse = await fetch(TBID_API_TOKEN_URL, {
|
|
242
|
+
method: "POST",
|
|
243
|
+
headers: {
|
|
244
|
+
"Content-Type": "application/json"
|
|
245
|
+
},
|
|
246
|
+
body: JSON.stringify({
|
|
247
|
+
token
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
if (tokenResponse.ok) {
|
|
252
|
+
this.platformEventsSubscribe();
|
|
253
|
+
this.trackLoginSuccess();
|
|
254
|
+
|
|
255
|
+
if (!isAlreadyLoading) {
|
|
256
|
+
// TODO: This sucks and we will have to raise an issue with the TBID team, but for some reason the
|
|
257
|
+
// SSO login userInfo payload is missing photos for the user, so we have to re-request it on login.
|
|
258
|
+
this.requestUserInfo();
|
|
252
259
|
}
|
|
253
|
-
} catch (ex) {
|
|
254
|
-
console.error(`Attempt to update token failed: ${ex}`);
|
|
255
260
|
}
|
|
261
|
+
} catch (ex) {
|
|
262
|
+
console.error(`Attempt to update token failed: ${ex}`);
|
|
256
263
|
}
|
|
257
|
-
|
|
258
|
-
if (userInfo && !isAlreadyLoading) {
|
|
259
|
-
// TODO: This sucks and we will have to raise an issue with the TBID team, but for some reason the
|
|
260
|
-
// SSO login userInfo payload is missing photos for the user, so we have to re-request it on login.
|
|
261
|
-
this.requestUserInfo();
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
this.isLoading = false;
|
|
265
264
|
};
|
|
266
265
|
|
|
267
266
|
private handleComponentLogin = (event: MouseEvent) => {
|