@sledge-app/react-instant-search 1.0.119 → 1.0.120
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/SearchResultWidget.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/utils.d.ts +4 -2
- package/dist/components/SearchResultWidget/utils.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 +28 -10
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/package.json +1 -1
|
@@ -4889,9 +4889,10 @@ const createQueryFilter = ({
|
|
|
4889
4889
|
separator,
|
|
4890
4890
|
separatorCollection,
|
|
4891
4891
|
allowedFilterSlider,
|
|
4892
|
-
hierarchicalFacetAliases
|
|
4892
|
+
hierarchicalFacetAliases,
|
|
4893
|
+
defaultFilterItems
|
|
4893
4894
|
}) => {
|
|
4894
|
-
var _a, _b;
|
|
4895
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4895
4896
|
let filters = additional == null ? void 0 : additional.filter((item) => item);
|
|
4896
4897
|
let detectClickedFacets = detectQueryStringFilter({
|
|
4897
4898
|
facets,
|
|
@@ -4912,6 +4913,8 @@ const createQueryFilter = ({
|
|
|
4912
4913
|
let isCustom = ["variants.inventory_quantity"].includes(detectClickedFacet[0]);
|
|
4913
4914
|
let isRange = allowedFilterSlider == null ? void 0 : allowedFilterSlider.includes(detectClickedFacet[0]);
|
|
4914
4915
|
let isHierarchical = hierarchicalFacetAliases == null ? void 0 : hierarchicalFacetAliases.includes(detectClickedFacet[0]);
|
|
4916
|
+
let filterSettings = defaultFilterItems == null ? void 0 : defaultFilterItems.find(({ value }) => value === detectClickedFacet[0]);
|
|
4917
|
+
const { query_filter } = filterSettings || {};
|
|
4915
4918
|
if (isHierarchical) {
|
|
4916
4919
|
let arrItemHierarchicals = [];
|
|
4917
4920
|
Object.entries(facetHierarchical[detectClickedFacet[0]]).map((itemHierarchical) => {
|
|
@@ -4920,16 +4923,26 @@ const createQueryFilter = ({
|
|
|
4920
4923
|
arrItemHierarchicals.push([`${detectClickedFacet[0]}.${itemHierarchical[0]}`, itemHierarchical[1]]);
|
|
4921
4924
|
});
|
|
4922
4925
|
let filterItemHierarchicals = arrItemHierarchicals == null ? void 0 : arrItemHierarchicals.map((filterHierarchical) => {
|
|
4923
|
-
|
|
4926
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
4927
|
+
if (query_filter === "AND") {
|
|
4928
|
+
return ((_a2 = filterHierarchical == null ? void 0 : filterHierarchical[1]) == null ? void 0 : _a2.length) ? (_e2 = (_d2 = (_c2 = (_b2 = filterHierarchical == null ? void 0 : filterHierarchical[1]) == null ? void 0 : _b2.map) == null ? void 0 : _c2.call(_b2, (item) => `'${filterHierarchical[0]}' = ${JSON.stringify(item)}`)) == null ? void 0 : _d2.join) == null ? void 0 : _e2.call(_d2, " AND ") : "";
|
|
4929
|
+
} else {
|
|
4930
|
+
return `'${filterHierarchical[0]}' IN ${JSON.stringify(filterHierarchical[1])}`;
|
|
4931
|
+
}
|
|
4924
4932
|
}).join(" AND ");
|
|
4925
4933
|
filters.push(filterItemHierarchicals);
|
|
4926
4934
|
} else {
|
|
4927
|
-
let filterItem =
|
|
4935
|
+
let filterItem = "";
|
|
4936
|
+
if (query_filter === "AND") {
|
|
4937
|
+
filterItem = ((_a = detectClickedFacet == null ? void 0 : detectClickedFacet[1]) == null ? void 0 : _a.length) ? (_e = (_d = (_c = (_b = detectClickedFacet == null ? void 0 : detectClickedFacet[1]) == null ? void 0 : _b.map) == null ? void 0 : _c.call(_b, (item) => `'${detectClickedFacet[0]}' = ${JSON.stringify(item)}`)) == null ? void 0 : _d.join) == null ? void 0 : _e.call(_d, " AND ") : "";
|
|
4938
|
+
} else {
|
|
4939
|
+
filterItem = `'${detectClickedFacet[0]}' IN ${JSON.stringify(detectClickedFacet[1])}`;
|
|
4940
|
+
}
|
|
4928
4941
|
if (isRange)
|
|
4929
4942
|
filterItem = `'${detectClickedFacet[0]}' >= ${detectClickedFacet[1][0]} AND '${detectClickedFacet[0]}' <= ${detectClickedFacet[1][1]}`;
|
|
4930
4943
|
if (isCustom) {
|
|
4931
|
-
if (Array.isArray(detectClickedFacet[1]) && ((
|
|
4932
|
-
filterItem = `(${(
|
|
4944
|
+
if (Array.isArray(detectClickedFacet[1]) && ((_f = detectClickedFacet[1]) == null ? void 0 : _f.length) > 1) {
|
|
4945
|
+
filterItem = `(${(_g = detectClickedFacet[1]) == null ? void 0 : _g.map((item) => {
|
|
4933
4946
|
return `'${detectClickedFacet[0]}' ${item}`;
|
|
4934
4947
|
}).join(" OR ")})`;
|
|
4935
4948
|
} else {
|
|
@@ -5037,8 +5050,10 @@ const handleConditionNotUpdateFacetDistribution = ({
|
|
|
5037
5050
|
value,
|
|
5038
5051
|
clickedFacets,
|
|
5039
5052
|
keepCounterFacets,
|
|
5040
|
-
allowedFilterSlider
|
|
5053
|
+
allowedFilterSlider,
|
|
5054
|
+
filterSettings
|
|
5041
5055
|
}) => {
|
|
5056
|
+
const { query_filter } = filterSettings || {};
|
|
5042
5057
|
let arrFacetSelected = [];
|
|
5043
5058
|
Object.entries(clickedFacets).map((facet) => {
|
|
5044
5059
|
if ((facet == null ? void 0 : facet.length) && facet[1].length) {
|
|
@@ -5055,7 +5070,7 @@ const handleConditionNotUpdateFacetDistribution = ({
|
|
|
5055
5070
|
isSelectedFacetWithPrice = arrFacetSelected.includes(filterSlider);
|
|
5056
5071
|
});
|
|
5057
5072
|
let isPriorityFacet = isHasFacetSelected && !isOnFacetSelectedOne && (keepCounterFacets == null ? void 0 : keepCounterFacets.includes(value)) && !isSelectedFacetWithPrice;
|
|
5058
|
-
return isNoneFacetSelected || isOnFacetSelectedOne || isPriorityFacet;
|
|
5073
|
+
return query_filter === "AND" ? false : isNoneFacetSelected || isOnFacetSelectedOne || isPriorityFacet;
|
|
5059
5074
|
};
|
|
5060
5075
|
const handleFacetValues = ({
|
|
5061
5076
|
filter,
|
|
@@ -5100,7 +5115,8 @@ const handleFacetValues = ({
|
|
|
5100
5115
|
value: getValue,
|
|
5101
5116
|
clickedFacets,
|
|
5102
5117
|
keepCounterFacets,
|
|
5103
|
-
allowedFilterSlider
|
|
5118
|
+
allowedFilterSlider,
|
|
5119
|
+
filterSettings
|
|
5104
5120
|
}) ? (item == null ? void 0 : item.total) || 0 : (searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) && ((_d = searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) == null ? void 0 : _d[item.value]) ? searchFacetDistribution[getValue][item.value] : 0;
|
|
5105
5121
|
let getLabelName = aliases[labelName] || labelName;
|
|
5106
5122
|
delete_prefix == null ? void 0 : delete_prefix.map((deletePrefix) => {
|
|
@@ -5926,6 +5942,7 @@ const SearchResultWidget = (props) => {
|
|
|
5926
5942
|
items = valueSearchResultFacets[value];
|
|
5927
5943
|
}
|
|
5928
5944
|
return {
|
|
5945
|
+
value,
|
|
5929
5946
|
label,
|
|
5930
5947
|
settings: settings2,
|
|
5931
5948
|
items: (_a3 = items == null ? void 0 : items.map((item) => {
|
|
@@ -6783,7 +6800,8 @@ const ResultProduct = (props) => {
|
|
|
6783
6800
|
separatorCollection: hierarchical_collections_separator,
|
|
6784
6801
|
additional: [(hiddenTags == null ? void 0 : hiddenTags.length) ? `'tags' NOT IN ${JSON.stringify(hiddenTags)}` : null, collectionId ? `'collections.id' = '${collectionId}'` : null],
|
|
6785
6802
|
allowedFilterSlider,
|
|
6786
|
-
hierarchicalFacetAliases
|
|
6803
|
+
hierarchicalFacetAliases,
|
|
6804
|
+
defaultFilterItems
|
|
6787
6805
|
});
|
|
6788
6806
|
let sort = soldProductAtEnd ? ["availability:asc"] : [];
|
|
6789
6807
|
if (clickedSortId)
|