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