@salesforcedevs/dx-components 0.10.1-alpha.123 → 0.10.1-alpha.127

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": "0.10.1-alpha.123",
3
+ "version": "0.10.1-alpha.127",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -33,7 +33,7 @@ export default class SidebarSearch extends LightningElement {
33
33
  @api coveoPublicAccessToken!: string;
34
34
  @api coveoSearchHub!: string;
35
35
  @api
36
- get coveoAdvancedQueryConfig() {
36
+ get coveoAdvancedQueryConfig(): { [key: string]: any } {
37
37
  return this._coveoAdvancedQueryConfig;
38
38
  }
39
39
  set coveoAdvancedQueryConfig(value) {
@@ -125,21 +125,18 @@ export default class SidebarSearch extends LightningElement {
125
125
 
126
126
  private initializeUserSession() {
127
127
  const stringified = window.sessionStorage.getItem(SESSION_KEY);
128
- console.log('initializing', stringified)
129
128
  if (!stringified) {
130
129
  return;
131
130
  }
132
131
 
133
132
  try {
134
- console.log('USE SESSION STORAGE')
135
133
  const json = JSON.parse(stringified);
136
- console.log(json.coveoAdvancedQueryConfig, this.coveoAdvancedQueryConfig, hasSameConfig)
137
- const hasSameConfig = json.coveoAdvancedQueryConfig
138
- .entries()
139
- .every(
140
- ([key, value]: [string, string]) =>
141
- this.coveoAdvancedQueryConfig[key] === value
142
- );
134
+ const hasSameConfig = Object.entries(
135
+ json.coveoAdvancedQueryConfig
136
+ ).every(
137
+ ([key, value]: [string, any]) =>
138
+ this.coveoAdvancedQueryConfig[key] === value
139
+ );
143
140
  const hasSameQuery = json?.state?.query?.q === this.value;
144
141
  if (hasSameConfig && hasSameQuery) {
145
142
  console.log(
@@ -147,9 +144,12 @@ export default class SidebarSearch extends LightningElement {
147
144
  this.value
148
145
  );
149
146
  this.preloadedState = json?.state;
147
+ } else {
148
+ window.sessionStorage.removeItem(SESSION_KEY);
150
149
  }
151
150
  } catch (e) {
152
- console.error(e)
151
+ console.error(e);
152
+ window.sessionStorage.removeItem(SESSION_KEY);
153
153
  }
154
154
  }
155
155