@salesforcedevs/dx-components 1.2.6-avatar-button-1 → 1.2.6-avatar-button-3
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
|
@@ -4,13 +4,17 @@ import { track } from "dxUtils/analytics";
|
|
|
4
4
|
import defaults from "lodash.defaults";
|
|
5
5
|
import escapeHtml from "escape-html";
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// TBID Page URLs:
|
|
8
|
+
// TODO: Switch this to env variable once we're out of dev
|
|
8
9
|
const TBID_BASE_URL = "https://dev1-trailblazer-identity.cs192.force.com";
|
|
9
10
|
const TBID_SETTINGS_URL = `${TBID_BASE_URL}/settings`;
|
|
10
11
|
const TBID_PROFILE_URL = `${TBID_BASE_URL}/id`;
|
|
11
12
|
const TBID_IFRAME_URL = `${TBID_BASE_URL}/secur/logout.jsp`;
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
// API URLs:
|
|
15
|
+
const TBID_API_BASE_URL = `${
|
|
16
|
+
process.env.BASE_URL || "https://developer.salesforce.com"
|
|
17
|
+
}/tbid`;
|
|
14
18
|
const TBID_API_LOGOUT_URL = `${TBID_API_BASE_URL}/logout`;
|
|
15
19
|
const TBID_API_USERINFO_URL = `${TBID_API_BASE_URL}/userinfo`;
|
|
16
20
|
const TBID_API_LOGIN_URL = `${TBID_API_BASE_URL}/dologin`;
|
|
@@ -196,11 +200,11 @@ export default class AvatarButton extends LightningElement {
|
|
|
196
200
|
window.SFIDWidget.logout();
|
|
197
201
|
} else {
|
|
198
202
|
// Always clear the session token; if not SSO logout, this will also revoke the token with
|
|
199
|
-
// TBID; if SSO logout, that step is already taken care of
|
|
203
|
+
// TBID; if SSO logout, that step is already taken care of. No need to await this.
|
|
200
204
|
fetch(`${TBID_API_LOGOUT_URL}?isSsoLogout=${isSsoLogout}`, {
|
|
201
|
-
method:
|
|
202
|
-
credentials:
|
|
203
|
-
});
|
|
205
|
+
method: "DELETE",
|
|
206
|
+
credentials: "same-origin"
|
|
207
|
+
});
|
|
204
208
|
|
|
205
209
|
if (!isSsoLogout) {
|
|
206
210
|
// Dropping an iframe is required to fully get TBID to destroy the session; this is
|
|
@@ -330,12 +334,12 @@ export default class AvatarButton extends LightningElement {
|
|
|
330
334
|
userInfo.custom_attributes.RelationshipToSalesforce;
|
|
331
335
|
nextUserInfo.role = userInfo.custom_attributes.Role;
|
|
332
336
|
}
|
|
333
|
-
// TODO: Consider displaying initials if no photo. Is there always a photo even if just a default one?
|
|
334
337
|
|
|
338
|
+
// A little extra safety here just to make sure we aren't receiving/displaying any unsafe values...
|
|
335
339
|
const htmlSafeNextUserInfo: UserInfo = Object.fromEntries(
|
|
336
340
|
Object.entries(nextUserInfo).map(([key, val]) => [
|
|
337
341
|
key,
|
|
338
|
-
escapeHtml(
|
|
342
|
+
escapeHtml(val)
|
|
339
343
|
])
|
|
340
344
|
);
|
|
341
345
|
|
|
@@ -357,7 +361,7 @@ export default class AvatarButton extends LightningElement {
|
|
|
357
361
|
this._didReceiveUserInfo = true;
|
|
358
362
|
}
|
|
359
363
|
} catch (ex) {
|
|
360
|
-
//
|
|
364
|
+
// Something not directly related to auth went wrong. Unsure what to do here.
|
|
361
365
|
console.error(`Could not request user info: ${ex}`);
|
|
362
366
|
}
|
|
363
367
|
|