@salesforcedevs/dx-components 0.10.1-alpha.124 → 0.10.1-alpha.128

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.124",
3
+ "version": "0.10.1-alpha.128",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -33,10 +33,11 @@ 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) {
40
+ console.log('QUERY CONFIG UPDATING', value)
40
41
  this._coveoAdvancedQueryConfig = toJson(value);
41
42
  }
42
43
 
@@ -125,31 +126,31 @@ export default class SidebarSearch extends LightningElement {
125
126
 
126
127
  private initializeUserSession() {
127
128
  const stringified = window.sessionStorage.getItem(SESSION_KEY);
128
- console.log('initializing', stringified)
129
129
  if (!stringified) {
130
130
  return;
131
131
  }
132
132
 
133
133
  try {
134
- console.log('USE SESSION STORAGE')
135
134
  const json = JSON.parse(stringified);
136
- const hasSameConfig = json.coveoAdvancedQueryConfig
137
- .entries()
138
- .every(
139
- ([key, value]: [string, string]) =>
140
- this.coveoAdvancedQueryConfig[key] === value
141
- );
142
- const hasSameQuery = json?.state?.query?.q === this.value;
143
- console.log(json.coveoAdvancedQueryConfig, this.coveoAdvancedQueryConfig, hasSameConfig)
135
+ const hasSameConfig = Object.entries(
136
+ json.coveoAdvancedQueryConfig
137
+ ).every(
138
+ ([key, value]: [string, any]) =>
139
+ this.coveoAdvancedQueryConfig[key] === value
140
+ );
141
+ const hasSameQuery = json?.state?.query?.q === this.value;
144
142
  if (hasSameConfig && hasSameQuery) {
145
143
  console.log(
146
144
  "valid session storage found for value =",
147
145
  this.value
148
146
  );
149
147
  this.preloadedState = json?.state;
148
+ } else {
149
+ window.sessionStorage.removeItem(SESSION_KEY);
150
150
  }
151
151
  } catch (e) {
152
- console.error(e)
152
+ console.error(e);
153
+ window.sessionStorage.removeItem(SESSION_KEY);
153
154
  }
154
155
  }
155
156