@sledge-app/react-instant-search 1.0.96 → 1.0.98

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.
@@ -5354,19 +5354,23 @@ const SearchResultWidget = (props) => {
5354
5354
  queries: getTabs.map((tab) => {
5355
5355
  const { index } = tab;
5356
5356
  let isSetFilter = false;
5357
- let getFacets = !isSetFilter ? filters == null ? void 0 : filters.map((filter) => {
5358
- const { collections, items } = filter;
5359
- const newItems = items == null ? void 0 : items.map(({ value, ...otherItem }) => (otherItem == null ? void 0 : otherItem.display) === "tree" ? HIERARCHICAL_FACET_OBJECT_ALIASES[value] : value);
5360
- if (collectionId && (collections == null ? void 0 : collections.includes(Number(collectionId)))) {
5361
- isSetFilter = true;
5362
- return newItems;
5363
- } else {
5364
- if (collections == null ? void 0 : collections.includes("all")) {
5357
+ let getFacets = [];
5358
+ if (!isSetFilter)
5359
+ filters == null ? void 0 : filters.map((filter) => {
5360
+ const { active, collections, items } = filter;
5361
+ if (!active)
5362
+ return;
5363
+ const newItems = items == null ? void 0 : items.map(({ value, ...otherItem }) => (otherItem == null ? void 0 : otherItem.display) === "tree" ? HIERARCHICAL_FACET_OBJECT_ALIASES[value] : value);
5364
+ if (collectionId && (collections == null ? void 0 : collections.includes(String(collectionId)))) {
5365
5365
  isSetFilter = true;
5366
- return newItems;
5366
+ getFacets = newItems;
5367
+ } else {
5368
+ if (collections == null ? void 0 : collections.includes("all")) {
5369
+ isSetFilter = true;
5370
+ getFacets = newItems;
5371
+ }
5367
5372
  }
5368
- }
5369
- }) : [];
5373
+ });
5370
5374
  let isProductIndex = index.includes(index_product);
5371
5375
  let isHasProductFacets = isProductIndex && getFacets.length;
5372
5376
  let additionalFilter = [];
@@ -5377,12 +5381,12 @@ const SearchResultWidget = (props) => {
5377
5381
  if (collectionId)
5378
5382
  additionalFilter.push(`'collections.id' = '${collectionId}'`);
5379
5383
  if (isHasProductFacets)
5380
- setFacets(getFacets[0]);
5384
+ setFacets(getFacets);
5381
5385
  return {
5382
5386
  indexUid: index,
5383
5387
  q: keyword || "",
5384
5388
  hitsPerPage: 1,
5385
- facets: isHasProductFacets ? getFacets[0] : [],
5389
+ facets: isHasProductFacets ? getFacets : [],
5386
5390
  filter: isProductIndex ? [...new Set(additionalFilter.concat(DEFAULT_QUERY_PRODUCT_MEILISEARCH))].join(" AND ") : "",
5387
5391
  attributesToRetrieve: [],
5388
5392
  limit: 0,
@@ -6213,7 +6217,7 @@ const ResultProduct = (props) => {
6213
6217
  setValueFilterOnSaleChange([]);
6214
6218
  }
6215
6219
  } else {
6216
- facets2 = value;
6220
+ facets2 = (value == null ? void 0 : value.length) === 1 ? [...value, ...value] : value;
6217
6221
  }
6218
6222
  } else {
6219
6223
  facets2 = clickedFacets[parentId] ? [...clickedFacets[parentId], value] : [value];
@@ -6384,7 +6388,7 @@ const ResultProduct = (props) => {
6384
6388
  }
6385
6389
  });
6386
6390
  const facetBlockSelected = ({ label, name, value, index }) => {
6387
- var _a2, _b2, _c2;
6391
+ var _a2, _b2, _c2, _d2;
6388
6392
  let valueText = (languageSettings == null ? void 0 : languageSettings[value]) || value;
6389
6393
  let isRange = ["variants.price", "variants.sale_percent"].includes(name);
6390
6394
  let getLabel = label;
@@ -6409,11 +6413,13 @@ const ResultProduct = (props) => {
6409
6413
  if (String(valueText).startsWith(deletePrefix))
6410
6414
  valueText = String(valueText).replace(deletePrefix, "");
6411
6415
  });
6412
- if (isRange)
6413
- valueText = value == null ? void 0 : value.map((valueItem) => isPriceValue ? shopifyFormatMoney(valueItem * 100, money_format) : isSalePercent ? `${valueItem}%` : valueItem).join(" - ");
6414
- else
6415
- valueText = (_b2 = String(valueText)) == null ? void 0 : _b2.replaceAll(hierarchical_collections_separator, " > ");
6416
- valueText = (_c2 = String(valueText)) == null ? void 0 : _c2.replaceAll("_", " ");
6416
+ if (isRange) {
6417
+ const getValueRange = new Set(value).size === 1 ? [value[0]] : value;
6418
+ valueText = (_b2 = getValueRange == null ? void 0 : getValueRange.map((valueItem) => isPriceValue ? shopifyFormatMoney(valueItem * 100, money_format) : isSalePercent ? `${valueItem}%` : valueItem)) == null ? void 0 : _b2.join(" - ");
6419
+ } else {
6420
+ valueText = (_c2 = String(valueText)) == null ? void 0 : _c2.replaceAll(hierarchical_collections_separator, " > ");
6421
+ }
6422
+ valueText = (_d2 = String(valueText)) == null ? void 0 : _d2.replaceAll("_", " ");
6417
6423
  let aliases = {};
6418
6424
  let aliasValue = "";
6419
6425
  let aliasSeparator = "";