@sledge-app/react-instant-search 2.0.22 → 2.0.23
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.
|
@@ -671,6 +671,17 @@ const setElementAttribute = ({ element, attributeName, value }) => {
|
|
|
671
671
|
element.setAttribute(attributeName, value);
|
|
672
672
|
}
|
|
673
673
|
};
|
|
674
|
+
const convertToQueryParams = (obj) => {
|
|
675
|
+
var _a;
|
|
676
|
+
if (typeof obj !== "object" || obj === null || obj && !((_a = Object.keys(obj)) == null ? void 0 : _a.length))
|
|
677
|
+
return {};
|
|
678
|
+
const queryParams = {};
|
|
679
|
+
Object.keys(obj).forEach((key) => {
|
|
680
|
+
var _a2, _b;
|
|
681
|
+
queryParams[key] = (_b = (_a2 = obj[key]) == null ? void 0 : _a2.map) == null ? void 0 : _b.call(_a2, (value) => encodeURIComponent(value));
|
|
682
|
+
});
|
|
683
|
+
return queryParams;
|
|
684
|
+
};
|
|
674
685
|
const root = "";
|
|
675
686
|
const Loading = "";
|
|
676
687
|
const ConfirmationPopup = "";
|
|
@@ -6152,12 +6163,13 @@ const parseFacetObject = ({ facet = "" }) => {
|
|
|
6152
6163
|
return null;
|
|
6153
6164
|
};
|
|
6154
6165
|
const detectQueryStringFilter = ({ facets, facetsQueryStringObject, callback }) => {
|
|
6166
|
+
var _a, _b;
|
|
6155
6167
|
const searchParams = new URLSearchParams(document.location.search);
|
|
6156
6168
|
const searchParamsObject = Object.fromEntries(searchParams);
|
|
6157
6169
|
for (const searchParamsKey in searchParamsObject) {
|
|
6158
6170
|
let ifFacetsQueryStringObject = (facets == null ? void 0 : facets.length) && facets.includes(searchParamsKey);
|
|
6159
6171
|
if (ifFacetsQueryStringObject)
|
|
6160
|
-
facetsQueryStringObject[searchParamsKey] = searchParamsObject[searchParamsKey].split(",");
|
|
6172
|
+
facetsQueryStringObject[searchParamsKey] = (_b = (_a = searchParamsObject[searchParamsKey].split(",")) == null ? void 0 : _a.map) == null ? void 0 : _b.call(_a, (item) => decodeURIComponent(item));
|
|
6161
6173
|
}
|
|
6162
6174
|
if (Object.keys(facetsQueryStringObject).length)
|
|
6163
6175
|
callback(facetsQueryStringObject);
|
|
@@ -9957,9 +9969,10 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
9957
9969
|
otherQueryStringObject[searchParamsKey] = searchParamsObject[searchParamsKey];
|
|
9958
9970
|
}
|
|
9959
9971
|
let facetQueryStringObject = {};
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9972
|
+
let convertValueClickedFacets = convertToQueryParams(valueClickedFacets);
|
|
9973
|
+
for (const valueClickedFacetsKey in convertValueClickedFacets) {
|
|
9974
|
+
if ((_a2 = convertValueClickedFacets[valueClickedFacetsKey]) == null ? void 0 : _a2.length)
|
|
9975
|
+
otherQueryStringObject[valueClickedFacetsKey] = convertValueClickedFacets[valueClickedFacetsKey];
|
|
9963
9976
|
}
|
|
9964
9977
|
const newQueryString = new URLSearchParams({
|
|
9965
9978
|
...otherQueryStringObject,
|