@salesforcedevs/dx-components 0.59.0-avatar-button-9 → 0.59.0-avatar-button-10
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 +2 -1
- package/src/modules/dx/avatarButton/avatarButton.ts +10 -4
- package/yarn-error.log +19802 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "0.59.0-avatar-button-
|
|
3
|
+
"version": "0.59.0-avatar-button-10",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"@sfdocs-internal/wires": "^0.6.3",
|
|
16
16
|
"@vimeo/player": "^2.16.4",
|
|
17
17
|
"classnames": "^2.2.6",
|
|
18
|
+
"cometd": "^7.0.7",
|
|
18
19
|
"debounce": "^1.2.0",
|
|
19
20
|
"lodash.get": "^4.4.2",
|
|
20
21
|
"microtip": "0.2.2",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { api, LightningElement } from "lwc";
|
|
2
|
+
import { CometD } from "cometd";
|
|
2
3
|
|
|
3
4
|
const TBID_BASE_URL = "https://dev1-trailblazer-identity.cs192.force.com";
|
|
4
5
|
const TBID_SETTINGS_URL = `${TBID_BASE_URL}/settings`;
|
|
@@ -26,6 +27,9 @@ export interface UserInfo {
|
|
|
26
27
|
readonly fullName: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
window.COMETD = CometD;
|
|
32
|
+
|
|
29
33
|
export default class AvatarButton extends LightningElement {
|
|
30
34
|
@api size: "small" | "medium" | "large" = "medium";
|
|
31
35
|
|
|
@@ -56,10 +60,12 @@ export default class AvatarButton extends LightningElement {
|
|
|
56
60
|
window.addEventListener("tbid-login", this.handleSsoLogin);
|
|
57
61
|
window.addEventListener("tbid-logout", this.handleSsoLogout);
|
|
58
62
|
|
|
59
|
-
// Whenever this component is added to the DOM
|
|
60
|
-
// and we receive the info, this component will display the avatar UI;
|
|
61
|
-
// button.
|
|
62
|
-
|
|
63
|
+
// Whenever this component is added to the DOM and there is not an SFIDWidget present, immediately request
|
|
64
|
+
// user info; if the user is logged in and we receive the info, this component will display the avatar UI;
|
|
65
|
+
// otherwise, it will display the login button.
|
|
66
|
+
if (!window.SFIDWidget) {
|
|
67
|
+
this.requestUserInfo();
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
disconnectedCallback() {
|