@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.2.7-avatar-button-3",
3
+ "version": "1.2.7-avatar-button-4",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -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
- this.isLoading = true;
233
+ if (!token) {
234
+ return;
235
+ }
235
236
 
236
- // If an SSO login occurred and we have an SSO access token, we want to start using
237
- // it rather than some other non-linked access token, for the "seamless SSO"
238
- // experience
239
- try {
240
- const tokenResponse = await fetch(TBID_API_TOKEN_URL, {
241
- method: "POST",
242
- headers: {
243
- "Content-Type": "application/json"
244
- },
245
- body: JSON.stringify({
246
- token
247
- })
248
- });
249
- if (tokenResponse.ok) {
250
- this.platformEventsSubscribe();
251
- this.trackLoginSuccess();
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) => {