@salesforcedevs/dx-components 0.10.1-alpha.125 → 0.10.1-alpha.129
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
|
@@ -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) {
|
|
@@ -95,6 +95,8 @@ export default class SidebarSearch extends LightningElement {
|
|
|
95
95
|
this.value = getSidebarSearchParams() || "";
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
queryConfigValue: string | null = null;
|
|
99
|
+
|
|
98
100
|
renderedCallback() {
|
|
99
101
|
// in prod some of the critical coveo configuration attributes seem to arrive later
|
|
100
102
|
// so I needed to put this coveo startup flow here where we can wait for them to arrive
|
|
@@ -114,6 +116,15 @@ export default class SidebarSearch extends LightningElement {
|
|
|
114
116
|
);
|
|
115
117
|
}
|
|
116
118
|
|
|
119
|
+
const queryConfigValue = JSON.stringify(this.coveoAdvancedQueryConfig);
|
|
120
|
+
if (this.queryConfigValue !== queryConfigValue) {
|
|
121
|
+
if (this.queryConfigValue && this.engine) {
|
|
122
|
+
console.log('setting query config again')
|
|
123
|
+
this.setAdvancedFilters(this.engine);
|
|
124
|
+
}
|
|
125
|
+
this.queryConfigValue = queryConfigValue;
|
|
126
|
+
}
|
|
127
|
+
|
|
117
128
|
// If this is the first render and there is a search value, trigger
|
|
118
129
|
// term highlighting
|
|
119
130
|
if (!this.didRender && this.value) {
|
|
@@ -125,31 +136,31 @@ export default class SidebarSearch extends LightningElement {
|
|
|
125
136
|
|
|
126
137
|
private initializeUserSession() {
|
|
127
138
|
const stringified = window.sessionStorage.getItem(SESSION_KEY);
|
|
128
|
-
console.log('initializing', stringified)
|
|
129
139
|
if (!stringified) {
|
|
130
140
|
return;
|
|
131
141
|
}
|
|
132
142
|
|
|
133
143
|
try {
|
|
134
|
-
console.log('USE SESSION STORAGE')
|
|
135
144
|
const json = JSON.parse(stringified);
|
|
136
|
-
const hasSameConfig =
|
|
137
|
-
|
|
138
|
-
.every(
|
|
139
|
-
([key, value]: [string,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
console.log(json.coveoAdvancedQueryConfig, this.coveoAdvancedQueryConfig, hasSameConfig)
|
|
145
|
+
const hasSameConfig = Object.entries(
|
|
146
|
+
json.coveoAdvancedQueryConfig
|
|
147
|
+
).every(
|
|
148
|
+
([key, value]: [string, any]) =>
|
|
149
|
+
this.coveoAdvancedQueryConfig[key] === value
|
|
150
|
+
);
|
|
151
|
+
const hasSameQuery = json?.state?.query?.q === this.value;
|
|
144
152
|
if (hasSameConfig && hasSameQuery) {
|
|
145
153
|
console.log(
|
|
146
154
|
"valid session storage found for value =",
|
|
147
155
|
this.value
|
|
148
156
|
);
|
|
149
157
|
this.preloadedState = json?.state;
|
|
158
|
+
} else {
|
|
159
|
+
window.sessionStorage.removeItem(SESSION_KEY);
|
|
150
160
|
}
|
|
151
161
|
} catch (e) {
|
|
152
|
-
console.error(e)
|
|
162
|
+
console.error(e);
|
|
163
|
+
window.sessionStorage.removeItem(SESSION_KEY);
|
|
153
164
|
}
|
|
154
165
|
}
|
|
155
166
|
|