@searchcraft/vue-sdk 0.10.3 → 0.10.4

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/dist/index.d.ts CHANGED
@@ -642,7 +642,7 @@ export interface SearchcraftStateValues {
642
642
  searchMode: "fuzzy" | "exact";
643
643
  searchClientResponseItems: SearchClientResponseItem[];
644
644
  searchResponseTimeTaken: number | undefined;
645
- searchResponseFacetPrime: FacetPrime | undefined;
645
+ searchResponseFacetPrime: FacetPrime | undefined | null;
646
646
  searchResultsCount: number;
647
647
  searchResultsPage: number;
648
648
  searchResultsPerPage: number;
package/dist/index.es.js CHANGED
@@ -1477,34 +1477,35 @@ class ko {
1477
1477
  */
1478
1478
  formatParamsForRequest(t) {
1479
1479
  const r = [];
1480
- t.facetPathsForIndexFields && Object.keys(t.facetPathsForIndexFields).forEach((o) => {
1481
- var n;
1482
- const c = (n = t.facetPathsForIndexFields) == null ? void 0 : n[o];
1483
- c && r.push({
1480
+ let s = "should";
1481
+ t.facetPathsForIndexFields && Object.keys(t.facetPathsForIndexFields).forEach((n) => {
1482
+ var c;
1483
+ const u = (c = t.facetPathsForIndexFields) == null ? void 0 : c[n];
1484
+ u && (s = "must", r.push({
1484
1485
  occur: "must",
1485
1486
  exact: {
1486
- ctx: qt(c.value)
1487
+ ctx: qt(u.value)
1487
1488
  }
1488
- });
1489
- }), t.rangeValueForIndexFields && Object.keys(t.rangeValueForIndexFields).forEach((o) => {
1490
- var n;
1491
- const c = (n = t.rangeValueForIndexFields) == null ? void 0 : n[o];
1492
- c && r.push({
1489
+ }));
1490
+ }), t.rangeValueForIndexFields && Object.keys(t.rangeValueForIndexFields).forEach((n) => {
1491
+ var c;
1492
+ const u = (c = t.rangeValueForIndexFields) == null ? void 0 : c[n];
1493
+ u && (s = "must", r.push({
1493
1494
  occur: "must",
1494
1495
  exact: {
1495
- ctx: qt(c.value)
1496
+ ctx: qt(u.value)
1496
1497
  }
1497
- });
1498
+ }));
1498
1499
  });
1499
- const s = qt(t.searchTerm), a = t.mode === "fuzzy" ? { fuzzy: { ctx: s } } : {
1500
+ const a = qt(t.searchTerm), o = t.mode === "fuzzy" ? { fuzzy: { ctx: a } } : {
1500
1501
  exact: {
1501
- ctx: `${s.startsWith('"') ? s : `"${s}"`}`
1502
+ ctx: `${a.startsWith('"') ? a : `"${a}"`}`
1502
1503
  }
1503
1504
  };
1504
1505
  return r.push({
1505
- occur: t.mode === "exact" ? "must" : "should",
1506
+ occur: t.mode === "exact" ? "must" : s,
1506
1507
  // Valid, as 'occur' is a required property in SearchClientQuery
1507
- ...a
1508
+ ...o
1508
1509
  }), r;
1509
1510
  }
1510
1511
  }
@@ -2204,7 +2205,7 @@ const bs = {
2204
2205
  c === g.searchResultsCount ? g.searchResultsPage : 1
2205
2206
  ),
2206
2207
  searchResultsCount: c,
2207
- ...n && { searchResponseFacetPrime: n }
2208
+ searchResponseFacetPrime: n
2208
2209
  }));
2209
2210
  (i = h.logger) == null || i.log(pe.DEBUG, `Search results: ${JSON.stringify(o)}`), (p = h.logger) == null || p.log(pe.DEBUG, `Facets from response: ${JSON.stringify(n)}`);
2210
2211
  },
@@ -3128,11 +3129,11 @@ const rc = /* @__PURE__ */ H(class extends D {
3128
3129
  handleStateUpdate(r) {
3129
3130
  const s = r.searchResponseFacetPrime, a = r.searchResponseTimeTaken;
3130
3131
  if (this.fieldName) {
3131
- if ((r.searchTerm !== this.lastSearchTerm || r.searchMode !== this.lastSearchMode) && (this.selectedPaths = {}, this.hasNewSearchTerm = !0), a !== this.lastTimeTaken && s) {
3132
+ if (r.searchTerm || (this.facetRoot = void 0), (r.searchTerm !== this.lastSearchTerm || r.searchMode !== this.lastSearchMode) && (this.selectedPaths = {}, this.hasNewSearchTerm = !0), a !== this.lastTimeTaken && s) {
3132
3133
  this.facetRoot = void 0;
3133
3134
  const o = s.find((n) => this.fieldName === Object.keys(n)[0]);
3134
3135
  this.hasNewSearchTerm ? (this.baseFacetRoot = o, this.facetRoot = o, this.hasNewSearchTerm = !1) : this.baseFacetRoot && o && (this.facetRoot = tc(this.fieldName, this.baseFacetRoot, o));
3135
- }
3136
+ } else !s && Object.keys(this.selectedPaths).length === 0 && (this.facetRoot = void 0);
3136
3137
  this.lastSearchTerm = r.searchTerm, this.lastSearchMode = r.searchMode, this.lastSortType = r.sortType, this.lastTimeTaken = a;
3137
3138
  }
3138
3139
  }
@@ -4658,7 +4659,7 @@ const Wc = Bc, Gc = aa, ha = () => {
4658
4659
  qo(), Zo(), Ko(), sc(), lc(), dc(), fc(), gc(), yc(), Sc(), Rc(), Ec(), Pc(), _c(), Ac(), Nc(), Oc(), Uc(), zc(), Wc(), Gc();
4659
4660
  };
4660
4661
  globalThis.__scDefineCustomElements__ = ha;
4661
- const qc = "@searchcraft/vue-sdk", Yc = "0.10.3", Cs = {
4662
+ const qc = "@searchcraft/vue-sdk", Yc = "0.10.4", Cs = {
4662
4663
  name: qc,
4663
4664
  version: Yc
4664
4665
  }, Zt = "routerLink", Ss = "navManager", Zc = "router", Qc = "aria", Ke = Symbol(), ks = { default: Ke }, ws = (e) => (e == null ? void 0 : e.split(" ")) || [], Kc = (e, t, r = []) => {