@salesforcedevs/dx-components 1.2.2-avatar-button-5 → 1.2.2-avatar-button-6

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.2-avatar-button-5",
3
+ "version": "1.2.2-avatar-button-6",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -17,6 +17,7 @@
17
17
  "classnames": "^2.2.6",
18
18
  "coveo-search-ui": "^2.10082.5",
19
19
  "debounce": "^1.2.0",
20
+ "js-cookie": "^3.0.1",
20
21
  "lodash.get": "^4.4.2",
21
22
  "lodash.kebabcase": "^4.1.1",
22
23
  "microtip": "0.2.2",
@@ -25,6 +26,7 @@
25
26
  "devDependencies": {
26
27
  "@types/classnames": "^2.2.10",
27
28
  "@types/debounce": "^1.2.0",
29
+ "@types/js-cookie": "^3.0.2",
28
30
  "@types/lodash.get": "^4.4.6",
29
31
  "@types/lodash.kebabcase": "^4.1.7",
30
32
  "@types/vimeo__player": "^2.16.2"
@@ -1,4 +1,5 @@
1
1
  import { api, LightningElement } from "lwc";
2
+ import Cookies from 'js-cookie';
2
3
  import { track } from "dxUtils/analytics";
3
4
 
4
5
  // TODO: move to environment variable
@@ -88,19 +89,11 @@ export default class AvatarButton extends LightningElement {
88
89
  }
89
90
 
90
91
  connectedCallback() {
91
- const searchParams = new URLSearchParams(window.location.search);
92
+ const isLoginSuccessRedirect = Cookies.get('tbidLoginSuccess') === 'true';
92
93
 
93
- if (searchParams.get("loginSuccess") === "true") {
94
+ if (isLoginSuccessRedirect) {
94
95
  this.isLoading = true;
95
- // clear the query param
96
- searchParams.delete("loginSuccess");
97
- window.history.replaceState(
98
- null,
99
- "",
100
- `${window.location.pathname}${
101
- window.location.hash
102
- }${searchParams.toString()}`
103
- );
96
+ Cookies.remove('tbidLoginSuccess'); // cleanup
104
97
  }
105
98
 
106
99
  window.addEventListener("tbid-login", this.handleSsoLogin);
@@ -191,9 +184,7 @@ export default class AvatarButton extends LightningElement {
191
184
  PlatformEventsType.UserMerge,
192
185
  this.handleSsoLogout
193
186
  );
194
- if (this.eventSource.readyState !== 2 /* CLOSED */) {
195
- this.eventSource.close();
196
- }
187
+ this.eventSource.close();
197
188
  this.eventSource = undefined;
198
189
  };
199
190