@sledge-app/react-instant-search 2.0.34 → 2.0.36
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/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 +23 -2
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/package.json +1 -1
|
@@ -6681,11 +6681,12 @@ const keyOpenFilters = ({ items = [] }) => {
|
|
|
6681
6681
|
}).filter((item) => item) : [];
|
|
6682
6682
|
};
|
|
6683
6683
|
const handleSearchResponse = async (props) => {
|
|
6684
|
+
var _a, _b, _c;
|
|
6684
6685
|
const {
|
|
6685
6686
|
layoutType = "default",
|
|
6686
6687
|
clickedTabIndexId,
|
|
6687
6688
|
clickedTabIndexType = "product",
|
|
6688
|
-
keyword,
|
|
6689
|
+
keyword: keywordProp,
|
|
6689
6690
|
sort = [],
|
|
6690
6691
|
page = 1,
|
|
6691
6692
|
limit = 1,
|
|
@@ -6709,6 +6710,7 @@ const handleSearchResponse = async (props) => {
|
|
|
6709
6710
|
tabs = [],
|
|
6710
6711
|
instantSearchSettings
|
|
6711
6712
|
} = props;
|
|
6713
|
+
let keyword = keywordProp;
|
|
6712
6714
|
const isResultForProduct = clickedTabIndexType === "product";
|
|
6713
6715
|
const isTypeCategoryHasPublished = ({ usePublishedFilter: usePublishedFilter2, type }) => Boolean(usePublishedFilter2 && type && ["collection", "page", "article"].includes(type));
|
|
6714
6716
|
const { separator: hierarchical_separator, hiddens: hierarchical_hiddens } = hierarchicalProductTypeSettings || {};
|
|
@@ -6718,6 +6720,17 @@ const handleSearchResponse = async (props) => {
|
|
|
6718
6720
|
hidden_ids: hierarchical_collections_hidden_ids,
|
|
6719
6721
|
structure: hierarchical_collections_structure
|
|
6720
6722
|
} = hierarchicalCollectionsSettings || {};
|
|
6723
|
+
const searchableAttributes = ((_a = instantSearchSettings == null ? void 0 : instantSearchSettings.search_field_priority) == null ? void 0 : _a.length) ? (_c = (_b = instantSearchSettings.search_field_priority.map((item) => {
|
|
6724
|
+
if (!(item == null ? void 0 : item.active))
|
|
6725
|
+
return;
|
|
6726
|
+
return item == null ? void 0 : item.value;
|
|
6727
|
+
})) == null ? void 0 : _b.filter) == null ? void 0 : _c.call(_b, (item) => item) : [];
|
|
6728
|
+
const isContainsFilter = (instantSearchSettings == null ? void 0 : instantSearchSettings.contains_filter) && (searchableAttributes == null ? void 0 : searchableAttributes.length) && (keywordProp == null ? void 0 : keywordProp.length);
|
|
6729
|
+
let containsFilter = null;
|
|
6730
|
+
if (isContainsFilter) {
|
|
6731
|
+
containsFilter = searchableAttributes.map((item) => `'${item}' CONTAINS ${JSON.stringify(keywordProp)}`).join(" OR ");
|
|
6732
|
+
keyword = "";
|
|
6733
|
+
}
|
|
6721
6734
|
let response;
|
|
6722
6735
|
let filterProduct = createQueryFilter({
|
|
6723
6736
|
facets,
|
|
@@ -6740,7 +6753,8 @@ const handleSearchResponse = async (props) => {
|
|
|
6740
6753
|
additional: [
|
|
6741
6754
|
(hiddenTags == null ? void 0 : hiddenTags.length) ? `'tags' NOT IN ${JSON.stringify(hiddenTags)}` : null,
|
|
6742
6755
|
collectionId ? `'collections.id' = '${collectionId}'` : null,
|
|
6743
|
-
!showOutOfStock ? `'availability' IN ${JSON.stringify(["in stock"])}` : null
|
|
6756
|
+
!showOutOfStock ? `'availability' IN ${JSON.stringify(["in stock"])}` : null,
|
|
6757
|
+
containsFilter
|
|
6744
6758
|
],
|
|
6745
6759
|
allowedFilterSlider,
|
|
6746
6760
|
hierarchicalFacetAliases,
|
|
@@ -10542,6 +10556,13 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
10542
10556
|
useEffectOnChange(() => {
|
|
10543
10557
|
setSummaryText(summaryTextGenerator(totalSearchResult));
|
|
10544
10558
|
}, [previewSettings]);
|
|
10559
|
+
useEffectOnChange(() => {
|
|
10560
|
+
setClickedOpenFilters(
|
|
10561
|
+
keyOpenFilters({
|
|
10562
|
+
items: allowedFilter
|
|
10563
|
+
})
|
|
10564
|
+
);
|
|
10565
|
+
}, [allowedFilter]);
|
|
10545
10566
|
let dataClickedFacets = handleDataClickedFacets();
|
|
10546
10567
|
let keepCounterFacets = [];
|
|
10547
10568
|
allowedFilter == null ? void 0 : allowedFilter.map((filter) => {
|