@sledge-app/react-instant-search 1.0.125 → 1.0.126
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/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 -0
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/package.json +1 -1
|
@@ -6874,11 +6874,25 @@ const SearchResultWidget = (props) => {
|
|
|
6874
6874
|
window.history.pushState(null, "", `${document.location.pathname}?${searchParams2.toString()}`);
|
|
6875
6875
|
};
|
|
6876
6876
|
useEffectCallback(() => {
|
|
6877
|
+
var _a2, _b2, _c2, _d2;
|
|
6877
6878
|
if (!isRenderAppInstantSearch)
|
|
6878
6879
|
return;
|
|
6879
6880
|
const searchParams2 = new URLSearchParams(document.location.search);
|
|
6880
6881
|
setKeyword((searchParams2 == null ? void 0 : searchParams2.get(queryKeyword)) || "");
|
|
6881
6882
|
handleSettings(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || null);
|
|
6883
|
+
if (typeof window !== "undefined") {
|
|
6884
|
+
if (layoutType === "default") {
|
|
6885
|
+
if ((_b2 = (_a2 = window == null ? void 0 : window.sledge) == null ? void 0 : _a2.instantSearch) == null ? void 0 : _b2.searchResult)
|
|
6886
|
+
window.sledge.instantSearch.searchResult.search = (keyword2 = "") => {
|
|
6887
|
+
handleChangeKeyword == null ? void 0 : handleChangeKeyword(keyword2);
|
|
6888
|
+
};
|
|
6889
|
+
} else {
|
|
6890
|
+
if ((_d2 = (_c2 = window == null ? void 0 : window.sledge) == null ? void 0 : _c2.instantSearch) == null ? void 0 : _d2.productFilter)
|
|
6891
|
+
window.sledge.instantSearch.productFilter.search = (keyword2 = "") => {
|
|
6892
|
+
handleChangeKeyword == null ? void 0 : handleChangeKeyword(keyword2);
|
|
6893
|
+
};
|
|
6894
|
+
}
|
|
6895
|
+
}
|
|
6882
6896
|
}, [isRenderAppInstantSearch]);
|
|
6883
6897
|
useEffectCallback(() => {
|
|
6884
6898
|
if (!valueRenderInstantSearchResult)
|
|
@@ -7660,6 +7674,20 @@ const ResultProduct = (props) => {
|
|
|
7660
7674
|
setIsReplaceWidgetList == null ? void 0 : setIsReplaceWidgetList(true);
|
|
7661
7675
|
};
|
|
7662
7676
|
React__default.useEffect(() => {
|
|
7677
|
+
var _a2, _b2, _c2, _d2;
|
|
7678
|
+
if (typeof window !== "undefined") {
|
|
7679
|
+
if (layoutType === "default") {
|
|
7680
|
+
if ((_b2 = (_a2 = window == null ? void 0 : window.sledge) == null ? void 0 : _a2.instantSearch) == null ? void 0 : _b2.searchResult)
|
|
7681
|
+
window.sledge.instantSearch.searchResult.filter = () => {
|
|
7682
|
+
setTriggerClickedFacets(!triggerClickedFacets);
|
|
7683
|
+
};
|
|
7684
|
+
} else {
|
|
7685
|
+
if ((_d2 = (_c2 = window == null ? void 0 : window.sledge) == null ? void 0 : _c2.instantSearch) == null ? void 0 : _d2.productFilter)
|
|
7686
|
+
window.sledge.instantSearch.productFilter.filter = () => {
|
|
7687
|
+
setTriggerClickedFacets(!triggerClickedFacets);
|
|
7688
|
+
};
|
|
7689
|
+
}
|
|
7690
|
+
}
|
|
7663
7691
|
let isKeywordChanged = Boolean(parentPreviousState && parentPreviousState.keyword !== keyword);
|
|
7664
7692
|
let isReplaceData = Boolean(
|
|
7665
7693
|
previousState && ((previousState == null ? void 0 : previousState.clickedLimitId) !== clickedLimitId || (previousState == null ? void 0 : previousState.clickedSortId) !== clickedSortId || (previousState == null ? void 0 : previousState.clickedFacets) !== clickedFacets) || isKeywordChanged
|