@salesforcedevs/dx-components 1.3.92-alpha-004-localstorage → 1.3.92-alpha-005-localstorage

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.3.92-alpha-004-localstorage",
3
+ "version": "1.3.92-alpha-005-localstorage",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -139,7 +139,6 @@ export default class SidebarSearch extends LightningElement {
139
139
  if (this.hasCorrectCoveoConfig && !this.engine) {
140
140
  this.initializeUserSession();
141
141
  this.initializeCoveo();
142
- this.syncAnalytics();
143
142
  } else if (!this.hasCorrectCoveoConfig) {
144
143
  console.error(
145
144
  "Incorrect coveo search configuration provided. All coveo configuration attributes must be defined.",
@@ -243,6 +242,8 @@ export default class SidebarSearch extends LightningElement {
243
242
  this.dispatchOnLoading(false);
244
243
  }
245
244
  }
245
+
246
+ this.syncAnalytics();
246
247
  };
247
248
 
248
249
  private syncAnalytics = () => {
@@ -355,9 +356,6 @@ export default class SidebarSearch extends LightningElement {
355
356
  isSelected = pathname === window.location.pathname;
356
357
  }
357
358
 
358
- console.log(result);
359
- const resultStringified = JSON.stringify(result);
360
- console.log(resultStringified);
361
359
  return {
362
360
  title,
363
361
  titleHighlights,
@@ -366,7 +364,12 @@ export default class SidebarSearch extends LightningElement {
366
364
  uniqueId,
367
365
  href,
368
366
  selected: isSelected,
369
- select: () => window.localStorage.setItem(RESULT_CLICK_LOCAL_STORAGE_KEY, resultStringified),
367
+ select: () => {
368
+ const resultStringified = JSON.stringify(result);
369
+ console.log(result);
370
+ console.log(resultStringified);
371
+ window.localStorage.setItem(RESULT_CLICK_LOCAL_STORAGE_KEY, resultStringified)
372
+ },
370
373
  };
371
374
  };
372
375
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <a class={className} href={href} onclick={select}>
2
+ <a class={className} onclick={onClick}>
3
3
  <span class="title search-text">
4
4
  <template for:each={titleChunks} for:item="chunk">
5
5
  <span class={chunk.class} key={chunk.id}>{chunk.value}</span>
@@ -68,4 +68,10 @@ export default class SidebarSearchResult extends LightningElement {
68
68
  private get className(): string {
69
69
  return cx("sidebar-item", this.selected && "sidebar-item-selected");
70
70
  }
71
+
72
+ private onClick(e: PointerEvent) {
73
+ e.preventDefault();
74
+ this.select();
75
+ window.location.href = this.href;
76
+ }
71
77
  }