@salesforcedevs/dx-components 0.10.1-alpha.132 → 0.10.1-alpha.136

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.132",
3
+ "version": "0.10.1-alpha.136",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -36,9 +36,21 @@ export default class SidebarSearch extends LightningElement {
36
36
  get coveoAdvancedQueryConfig(): { [key: string]: any } {
37
37
  return this._coveoAdvancedQueryConfig;
38
38
  }
39
- set coveoAdvancedQueryConfig(value) {
40
- console.log('set coveoAdvancedQueryConfig', value)
39
+ set coveoAdvancedQueryConfig(value: string) {
40
+ const hasChanged =
41
+ this._coveoAdvancedQueryConfigValue &&
42
+ value !== this._coveoAdvancedQueryConfigValue;
41
43
  this._coveoAdvancedQueryConfig = toJson(value);
44
+ this._coveoAdvancedQueryConfigValue = value;
45
+
46
+ console.log({ hasChanged }, this._coveoAdvancedQueryConfigValue, value);
47
+
48
+ if (hasChanged && this.engine) {
49
+ // set adnvanced filters needs access to the latest coveoAdvancedQueryConfig
50
+ this.dispatchOnLoading(true);
51
+ this.setAdvancedFilters(this.engine);
52
+ this.submitSearch();
53
+ }
42
54
  }
43
55
 
44
56
  @api
@@ -54,7 +66,8 @@ export default class SidebarSearch extends LightningElement {
54
66
  this.value = searchTerm || "";
55
67
  }
56
68
 
57
- private _coveoAdvancedQueryConfig!: object;
69
+ private _coveoAdvancedQueryConfigValue!: string;
70
+ private _coveoAdvancedQueryConfig!: { [key: string]: any };
58
71
  private dropdownRequestedOpen: boolean = false;
59
72
  private recentSearches: Option[] = [];
60
73
  private resultList: ResultList | null = null;
@@ -117,16 +130,6 @@ export default class SidebarSearch extends LightningElement {
117
130
  );
118
131
  }
119
132
 
120
- const queryConfigValue = JSON.stringify(this.coveoAdvancedQueryConfig);
121
- console.log('query config value', queryConfigValue);
122
- if (this.queryConfigValue !== queryConfigValue) {
123
- if (this.queryConfigValue && this.engine) {
124
- console.log('setting query config again')
125
- this.setAdvancedFilters(this.engine);
126
- }
127
- this.queryConfigValue = queryConfigValue;
128
- }
129
-
130
133
  // If this is the first render and there is a search value, trigger
131
134
  // term highlighting
132
135
  if (!this.didRender && this.value) {
@@ -252,6 +255,7 @@ export default class SidebarSearch extends LightningElement {
252
255
  };
253
256
 
254
257
  private setAdvancedFilters(engine: SearchEngine) {
258
+ console.log("setting advanced filters");
255
259
  const aq = Object.entries(this.coveoAdvancedQueryConfig).reduce(
256
260
  (result, [key, value]) =>
257
261
  `${result}(@${key}=="${normalizeCoveoAdvancedQueryValue(
@@ -362,6 +366,7 @@ export default class SidebarSearch extends LightningElement {
362
366
 
363
367
  private onClickRecentSearch(e: CustomEvent) {
364
368
  this.value = e.detail;
369
+ this.dispatchSidebarSearchChange(this.value);
365
370
  this.submitSearch();
366
371
  }
367
372