@sledge-app/react-instant-search 1.0.95 → 1.0.97
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/components/SearchResultWidget/Atoms.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/SearchResultWidget.d.ts.map +1 -1
- package/dist/sledge-react-instant-search.cjs +1 -1
- package/dist/sledge-react-instant-search.cjs.map +1 -1
- package/dist/sledge-react-instant-search.js +24 -13
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/package.json +1 -1
|
@@ -4894,6 +4894,13 @@ const FacetComponent = (props) => {
|
|
|
4894
4894
|
}
|
|
4895
4895
|
) : null
|
|
4896
4896
|
] }),
|
|
4897
|
+
onClick: (e) => {
|
|
4898
|
+
e.stopPropagation();
|
|
4899
|
+
handleFilterChange({
|
|
4900
|
+
parentId: value,
|
|
4901
|
+
value: e.currentTarget.value
|
|
4902
|
+
});
|
|
4903
|
+
},
|
|
4897
4904
|
checked: isChecked,
|
|
4898
4905
|
labelStyle: filter_option_style
|
|
4899
4906
|
}
|
|
@@ -5347,19 +5354,23 @@ const SearchResultWidget = (props) => {
|
|
|
5347
5354
|
queries: getTabs.map((tab) => {
|
|
5348
5355
|
const { index } = tab;
|
|
5349
5356
|
let isSetFilter = false;
|
|
5350
|
-
let getFacets =
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
if (collections == null ? void 0 : collections.includes(
|
|
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)))) {
|
|
5358
5365
|
isSetFilter = true;
|
|
5359
|
-
|
|
5366
|
+
getFacets = newItems;
|
|
5367
|
+
} else {
|
|
5368
|
+
if (collections == null ? void 0 : collections.includes("all")) {
|
|
5369
|
+
isSetFilter = true;
|
|
5370
|
+
getFacets = newItems;
|
|
5371
|
+
}
|
|
5360
5372
|
}
|
|
5361
|
-
}
|
|
5362
|
-
}) : [];
|
|
5373
|
+
});
|
|
5363
5374
|
let isProductIndex = index.includes(index_product);
|
|
5364
5375
|
let isHasProductFacets = isProductIndex && getFacets.length;
|
|
5365
5376
|
let additionalFilter = [];
|
|
@@ -5370,12 +5381,12 @@ const SearchResultWidget = (props) => {
|
|
|
5370
5381
|
if (collectionId)
|
|
5371
5382
|
additionalFilter.push(`'collections.id' = '${collectionId}'`);
|
|
5372
5383
|
if (isHasProductFacets)
|
|
5373
|
-
setFacets(getFacets
|
|
5384
|
+
setFacets(getFacets);
|
|
5374
5385
|
return {
|
|
5375
5386
|
indexUid: index,
|
|
5376
5387
|
q: keyword || "",
|
|
5377
5388
|
hitsPerPage: 1,
|
|
5378
|
-
facets: isHasProductFacets ? getFacets
|
|
5389
|
+
facets: isHasProductFacets ? getFacets : [],
|
|
5379
5390
|
filter: isProductIndex ? [...new Set(additionalFilter.concat(DEFAULT_QUERY_PRODUCT_MEILISEARCH))].join(" AND ") : "",
|
|
5380
5391
|
attributesToRetrieve: [],
|
|
5381
5392
|
limit: 0,
|