@sledge-app/react-instant-search 2.0.9 → 2.0.11
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/components/Facet.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 +123 -52
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -692,14 +692,18 @@ const Popover = ({
|
|
|
692
692
|
alignOffset = 0
|
|
693
693
|
}) => {
|
|
694
694
|
const [open, setOpen] = React__default.useState(withOpenState ? isOpen : false);
|
|
695
|
-
React__default.
|
|
696
|
-
|
|
697
|
-
|
|
695
|
+
const popoverContentRef = React__default.useRef(null);
|
|
696
|
+
const handleCustomArrow = () => {
|
|
697
|
+
var _a, _b;
|
|
698
|
+
const popoverContentRefCurrent = popoverContentRef == null ? void 0 : popoverContentRef.current;
|
|
699
|
+
if (!popoverContentRefCurrent)
|
|
700
|
+
return;
|
|
701
|
+
let arrowElement = (_b = (_a = popoverContentRefCurrent == null ? void 0 : popoverContentRefCurrent.querySelector) == null ? void 0 : _a.call(popoverContentRefCurrent, ".PopoverArrow")) == null ? void 0 : _b.parentElement;
|
|
698
702
|
if (arrowElement && (customArrow == null ? void 0 : customArrow.length)) {
|
|
699
703
|
arrowElement.style.display = "inline-flex";
|
|
700
704
|
arrowElement.innerHTML = customArrow;
|
|
701
705
|
}
|
|
702
|
-
}
|
|
706
|
+
};
|
|
703
707
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
704
708
|
$cb5cc270b50c6fcd$export$be92b6f5f03c0fe9,
|
|
705
709
|
{
|
|
@@ -721,8 +725,12 @@ const Popover = ({
|
|
|
721
725
|
sideOffset,
|
|
722
726
|
alignOffset,
|
|
723
727
|
align,
|
|
728
|
+
ref: popoverContentRef,
|
|
724
729
|
...setIsOpen && {
|
|
725
|
-
onOpenAutoFocus: () =>
|
|
730
|
+
onOpenAutoFocus: () => {
|
|
731
|
+
setIsOpen(true);
|
|
732
|
+
handleCustomArrow();
|
|
733
|
+
},
|
|
726
734
|
onCloseAutoFocus: () => setIsOpen(false)
|
|
727
735
|
},
|
|
728
736
|
children: [
|
|
@@ -1098,7 +1106,7 @@ const Pagination = (props) => {
|
|
|
1098
1106
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__pagination", "data-pagination-type": type, children: renderPaginationLayout() });
|
|
1099
1107
|
};
|
|
1100
1108
|
const RadioGroup$1 = "";
|
|
1101
|
-
const rowRenderer = ({ virtualized, item, id, labelStyle }) => {
|
|
1109
|
+
const rowRenderer$1 = ({ virtualized, item, id, labelStyle }) => {
|
|
1102
1110
|
const { index, key = "" } = virtualized || {};
|
|
1103
1111
|
const { label, value } = item;
|
|
1104
1112
|
const content = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
@@ -1112,7 +1120,7 @@ const RadioGroup = ({ id, name, required, value, items, labelStyle = {}, onValue
|
|
|
1112
1120
|
VirtualizedList,
|
|
1113
1121
|
{
|
|
1114
1122
|
rowCount: items == null ? void 0 : items.length,
|
|
1115
|
-
rowRenderer: ({ index, key }) => rowRenderer({
|
|
1123
|
+
rowRenderer: ({ index, key }) => rowRenderer$1({
|
|
1116
1124
|
virtualized: {
|
|
1117
1125
|
index,
|
|
1118
1126
|
key
|
|
@@ -1126,7 +1134,7 @@ const RadioGroup = ({ id, name, required, value, items, labelStyle = {}, onValue
|
|
|
1126
1134
|
parentRef
|
|
1127
1135
|
}
|
|
1128
1136
|
) : items.map(
|
|
1129
|
-
(item, index) => rowRenderer({
|
|
1137
|
+
(item, index) => rowRenderer$1({
|
|
1130
1138
|
virtualized: {
|
|
1131
1139
|
index
|
|
1132
1140
|
},
|
|
@@ -1169,8 +1177,25 @@ const ColorSwatch = ({ id, name, value, rgb, image, required, checked, onClick }
|
|
|
1169
1177
|
);
|
|
1170
1178
|
};
|
|
1171
1179
|
const Select$1 = "";
|
|
1172
|
-
const
|
|
1180
|
+
const rowRenderer = ({ virtualized, item, labelStyle }) => {
|
|
1181
|
+
const { index, key = "" } = virtualized || {};
|
|
1182
|
+
const { label, value } = item;
|
|
1183
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItemComponent, { value, children: label }, index);
|
|
1184
|
+
};
|
|
1185
|
+
const Select = ({ name, placeholder, required, defaultValue, items: itemsProp, labelStyle = {}, onValueChange, useVirtualized = false }) => {
|
|
1173
1186
|
const [isLoading, setIsLoading] = React__default.useState(true);
|
|
1187
|
+
const [items, setItems] = React__default.useState([]);
|
|
1188
|
+
const selectViewportRef = React__default.useRef(null);
|
|
1189
|
+
const scrollToPosition = (direction) => {
|
|
1190
|
+
const directionMultiplier = direction === "up" ? -1 : 1;
|
|
1191
|
+
if (selectViewportRef.current) {
|
|
1192
|
+
const currentPosition = selectViewportRef.current.scrollTop;
|
|
1193
|
+
const scrollAmount = 500 * directionMultiplier;
|
|
1194
|
+
selectViewportRef.current.scrollTo({
|
|
1195
|
+
top: currentPosition + scrollAmount
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1174
1199
|
React__default.useEffect(() => {
|
|
1175
1200
|
setIsLoading(true);
|
|
1176
1201
|
setTimeout(() => {
|
|
@@ -1187,19 +1212,22 @@ const Select = ({ name, placeholder, required, defaultValue, items, labelStyle =
|
|
|
1187
1212
|
selectRootElement.classList.toggle("sledge__select-root");
|
|
1188
1213
|
}
|
|
1189
1214
|
};
|
|
1190
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isLoading ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__select-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1215
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isLoading ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__select-wrapper", "data-use-virtualized": useVirtualized, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1191
1216
|
$cc7e05a45900e73f$export$be92b6f5f03c0fe9,
|
|
1192
1217
|
{
|
|
1193
1218
|
name,
|
|
1194
1219
|
required,
|
|
1195
1220
|
onValueChange,
|
|
1196
|
-
onOpenChange: (open) =>
|
|
1221
|
+
onOpenChange: (open) => {
|
|
1222
|
+
handleClassNameRoot(open);
|
|
1223
|
+
setItems(open ? itemsProp : []);
|
|
1224
|
+
},
|
|
1197
1225
|
...defaultValue ? {
|
|
1198
1226
|
defaultValue
|
|
1199
1227
|
} : {},
|
|
1200
1228
|
children: [
|
|
1201
1229
|
/* @__PURE__ */ jsxRuntimeExports.jsxs($cc7e05a45900e73f$export$41fb9f06171c75f4, { className: "sledge__select-trigger", style: labelStyle, children: [
|
|
1202
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$4c8d1a57a761ef94, { placeholder }),
|
|
1230
|
+
useVirtualized && defaultValue ? /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$4c8d1a57a761ef94, { children: defaultValue }) : /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$4c8d1a57a761ef94, { placeholder }),
|
|
1203
1231
|
/* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$f04a61298a47a40f, { className: "sledge__select-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: 15, height: 15, viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1204
1232
|
"path",
|
|
1205
1233
|
{
|
|
@@ -1211,30 +1239,62 @@ const Select = ({ name, placeholder, required, defaultValue, items, labelStyle =
|
|
|
1211
1239
|
) }) })
|
|
1212
1240
|
] }),
|
|
1213
1241
|
/* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$602eac185826482c, { className: "sledge__select-portal", children: /* @__PURE__ */ jsxRuntimeExports.jsxs($cc7e05a45900e73f$export$7c6e2c02157bb7d2, { className: "sledge__select-content", children: [
|
|
1214
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1215
|
-
|
|
1242
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1243
|
+
$cc7e05a45900e73f$export$2f60d3ec9ad468f2,
|
|
1216
1244
|
{
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1245
|
+
className: "sledge__select-scroll-button",
|
|
1246
|
+
...useVirtualized ? {
|
|
1247
|
+
onClick: () => scrollToPosition("up")
|
|
1248
|
+
} : {},
|
|
1249
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: 15, height: 15, viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1250
|
+
"path",
|
|
1251
|
+
{
|
|
1252
|
+
d: "M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",
|
|
1253
|
+
fill: "currentColor",
|
|
1254
|
+
fillRule: "evenodd",
|
|
1255
|
+
clipRule: "evenodd"
|
|
1256
|
+
}
|
|
1257
|
+
) })
|
|
1221
1258
|
}
|
|
1222
|
-
)
|
|
1223
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$d5c6c08dc2d3ca7, { className: "sledge__select-viewport", children:
|
|
1259
|
+
),
|
|
1260
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$d5c6c08dc2d3ca7, { className: "sledge__select-viewport", ref: selectViewportRef, children: useVirtualized ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1261
|
+
VirtualizedList,
|
|
1262
|
+
{
|
|
1263
|
+
rowCount: items == null ? void 0 : items.length,
|
|
1264
|
+
rowRenderer: ({ index, key }) => rowRenderer({
|
|
1265
|
+
virtualized: {
|
|
1266
|
+
index,
|
|
1267
|
+
key
|
|
1268
|
+
},
|
|
1269
|
+
item: items == null ? void 0 : items[index],
|
|
1270
|
+
labelStyle
|
|
1271
|
+
}),
|
|
1272
|
+
parentRef: selectViewportRef
|
|
1273
|
+
}
|
|
1274
|
+
) : items.map(
|
|
1224
1275
|
(item, index) => {
|
|
1225
1276
|
const { label, value } = item;
|
|
1226
1277
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItemComponent, { value, children: label }, index);
|
|
1227
1278
|
}
|
|
1228
1279
|
) }),
|
|
1229
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1230
|
-
|
|
1280
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1281
|
+
$cc7e05a45900e73f$export$bf1aedc3039c8d63,
|
|
1231
1282
|
{
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1283
|
+
className: "sledge__select-scroll-button",
|
|
1284
|
+
...useVirtualized ? {
|
|
1285
|
+
onClick: () => scrollToPosition("down")
|
|
1286
|
+
} : {},
|
|
1287
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: 15, height: 15, viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1288
|
+
"path",
|
|
1289
|
+
{
|
|
1290
|
+
d: "M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",
|
|
1291
|
+
fill: "currentColor",
|
|
1292
|
+
fillRule: "evenodd",
|
|
1293
|
+
clipRule: "evenodd"
|
|
1294
|
+
}
|
|
1295
|
+
) })
|
|
1236
1296
|
}
|
|
1237
|
-
)
|
|
1297
|
+
)
|
|
1238
1298
|
] }) })
|
|
1239
1299
|
]
|
|
1240
1300
|
}
|
|
@@ -7462,7 +7522,8 @@ const Facet = (props) => {
|
|
|
7462
7522
|
if (!is_item_pagination || isDisplaySlider) {
|
|
7463
7523
|
return {
|
|
7464
7524
|
haveNextPage: false,
|
|
7465
|
-
currentItems: arrFacetValues
|
|
7525
|
+
currentItems: arrFacetValues,
|
|
7526
|
+
allItems: arrFacetValues
|
|
7466
7527
|
};
|
|
7467
7528
|
}
|
|
7468
7529
|
const lastItemLimit = separatedFilterItem[getValue] || Number(item_pagination_limit);
|
|
@@ -7474,6 +7535,7 @@ const Facet = (props) => {
|
|
|
7474
7535
|
return {
|
|
7475
7536
|
haveNextPage: haveNextPage2,
|
|
7476
7537
|
currentItems: currentItems2,
|
|
7538
|
+
allItems: arrFacetValues,
|
|
7477
7539
|
totalItems: Number(arrFacetValues == null ? void 0 : arrFacetValues.length)
|
|
7478
7540
|
};
|
|
7479
7541
|
};
|
|
@@ -7482,7 +7544,7 @@ const Facet = (props) => {
|
|
|
7482
7544
|
setShowFacet(true);
|
|
7483
7545
|
(searchFacetRef == null ? void 0 : searchFacetRef.current) && ((_b2 = (_a2 = searchFacetRef == null ? void 0 : searchFacetRef.current) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2));
|
|
7484
7546
|
};
|
|
7485
|
-
const { haveNextPage, currentItems, totalItems } = handleFacetLoadMore({
|
|
7547
|
+
const { haveNextPage, currentItems, allItems, totalItems } = handleFacetLoadMore({
|
|
7486
7548
|
facetItems: items
|
|
7487
7549
|
});
|
|
7488
7550
|
const filterSearchShowMoreId = stringToSlug(`filter-search-show-more-${getValue}`);
|
|
@@ -7523,7 +7585,7 @@ const Facet = (props) => {
|
|
|
7523
7585
|
if (!(showFacet && isPreviousStateFromOutsideChanged))
|
|
7524
7586
|
setShowFacet(false);
|
|
7525
7587
|
}, [keywordFacet, clickedFacets]);
|
|
7526
|
-
const loadMoreComponent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7588
|
+
const loadMoreComponent = display.toLowerCase() === "select" ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7527
7589
|
"div",
|
|
7528
7590
|
{
|
|
7529
7591
|
className: "sledge-instant-search__result-filter-item-show-more",
|
|
@@ -7756,7 +7818,7 @@ const Facet = (props) => {
|
|
|
7756
7818
|
parentRef: ulListRef
|
|
7757
7819
|
}
|
|
7758
7820
|
) });
|
|
7759
|
-
} else if (display.toLowerCase() === "select" && (
|
|
7821
|
+
} else if (display.toLowerCase() === "select" && (allItems == null ? void 0 : allItems.length)) {
|
|
7760
7822
|
blockComponent = /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7761
7823
|
Select,
|
|
7762
7824
|
{
|
|
@@ -7767,7 +7829,7 @@ const Facet = (props) => {
|
|
|
7767
7829
|
value: getValue2,
|
|
7768
7830
|
force: true
|
|
7769
7831
|
}),
|
|
7770
|
-
items:
|
|
7832
|
+
items: allItems == null ? void 0 : allItems.map((item) => {
|
|
7771
7833
|
const { labelName, value: value2, counter } = item;
|
|
7772
7834
|
return {
|
|
7773
7835
|
label: `${labelName} ${counter !== void 0 && isShowNumberMatchingProduct ? ` (${counter})` : ""}`,
|
|
@@ -7775,7 +7837,8 @@ const Facet = (props) => {
|
|
|
7775
7837
|
};
|
|
7776
7838
|
}),
|
|
7777
7839
|
defaultValue: clickedFacets && ((_e = clickedFacets[value]) == null ? void 0 : _e.length) ? clickedFacets[value][0] : "",
|
|
7778
|
-
labelStyle: filter_option_style
|
|
7840
|
+
labelStyle: filter_option_style,
|
|
7841
|
+
useVirtualized: true
|
|
7779
7842
|
}
|
|
7780
7843
|
) });
|
|
7781
7844
|
} else if (display.toLowerCase() === "swatch" && (currentItems == null ? void 0 : currentItems.length)) {
|
|
@@ -9573,7 +9636,7 @@ const SearchResultWidget = (props) => {
|
|
|
9573
9636
|
] });
|
|
9574
9637
|
};
|
|
9575
9638
|
const ResultProduct = React__default.memo((props) => {
|
|
9576
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
9639
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
9577
9640
|
const {
|
|
9578
9641
|
layoutType,
|
|
9579
9642
|
keyword,
|
|
@@ -9658,22 +9721,25 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
9658
9721
|
} = props || {};
|
|
9659
9722
|
const { collectionId, collectionName } = params || {};
|
|
9660
9723
|
const isLoadMore = ["load_more", "infinite_scroll"].includes((_a = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _a.pagination_type);
|
|
9724
|
+
const valueClickedLimitId = Number((searchParams == null ? void 0 : searchParams.get(queryLimit)) || defaultLimit || DEFAULT_LIMIT_VALUE[0]);
|
|
9725
|
+
const valueDefaultLimit = ((_b = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _b.limit) || DEFAULT_LIMIT_VALUE[0];
|
|
9726
|
+
const isLimitIdAvailable = Boolean((_g = (_f = (_e = (_d = (_c = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _c.allowed_limit) == null ? void 0 : _d.map) == null ? void 0 : _e.call(_d, (limit) => String(limit))) == null ? void 0 : _f.includes) == null ? void 0 : _g.call(_f, String(valueClickedLimitId)));
|
|
9661
9727
|
const [isLoadingProduct, setIsLoadingProduct] = React__default.useState(!propsData);
|
|
9662
9728
|
const [isLoading, setIsLoading] = React__default.useState(!propsData);
|
|
9663
9729
|
const [clickedSortId, setClickedSortId] = React__default.useState(defaultSort || "");
|
|
9664
|
-
const [clickedLimitId, setClickedLimitId] = React__default.useState(Number(
|
|
9730
|
+
const [clickedLimitId, setClickedLimitId] = React__default.useState(Number(isLimitIdAvailable ? valueClickedLimitId : valueDefaultLimit));
|
|
9665
9731
|
const [clickedOpenFilters, setClickedOpenFilters] = React__default.useState(
|
|
9666
9732
|
keyOpenFilters({
|
|
9667
9733
|
items: allowedFilter
|
|
9668
9734
|
})
|
|
9669
9735
|
);
|
|
9670
9736
|
const [triggerClickedFacets, setTriggerClickedFacets] = React__default.useState(false);
|
|
9671
|
-
const [searchResult, setSearchResult] = React__default.useState(((
|
|
9672
|
-
const [hitsPerPageResult, setHitsPerPageResult] = React__default.useState(((
|
|
9737
|
+
const [searchResult, setSearchResult] = React__default.useState(((_j = (_i = (_h = propsData == null ? void 0 : propsData.result) == null ? void 0 : _h.results) == null ? void 0 : _i[0]) == null ? void 0 : _j.hits) || []);
|
|
9738
|
+
const [hitsPerPageResult, setHitsPerPageResult] = React__default.useState(((_m = (_l = (_k = propsData == null ? void 0 : propsData.result) == null ? void 0 : _k.results) == null ? void 0 : _l[0]) == null ? void 0 : _m.hitsPerPage) || 0);
|
|
9673
9739
|
const [searchProcessingTimeMs, setSearchProcessingTimeMs] = React__default.useState(0);
|
|
9674
9740
|
const [currentPage, setCurrentPage] = React__default.useState(Number(searchParams == null ? void 0 : searchParams.get(queryPage)) && !isLoadMore ? Number(searchParams == null ? void 0 : searchParams.get(queryPage)) : 1);
|
|
9675
9741
|
const [totalPage, setTotalPage] = React__default.useState(0);
|
|
9676
|
-
const [totalSearchResult, setTotalSearchResult] = React__default.useState(((
|
|
9742
|
+
const [totalSearchResult, setTotalSearchResult] = React__default.useState(((_p = (_o = (_n = propsData == null ? void 0 : propsData.result) == null ? void 0 : _n.results) == null ? void 0 : _o[0]) == null ? void 0 : _p.totalHits) || 0);
|
|
9677
9743
|
const [handleSearchResultFirstTime, setHandleSearchResultFirstTime] = React__default.useState(true);
|
|
9678
9744
|
const [searchFacetDistribution, setSearchFacetDistribution] = React__default.useState({});
|
|
9679
9745
|
const [isLoadingButtonLoadMore, setIsLoadingButtonLoadMore] = React__default.useState(false);
|
|
@@ -9725,13 +9791,13 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
9725
9791
|
};
|
|
9726
9792
|
const [summaryText, setSummaryText] = React__default.useState(propsData ? summaryTextGenerator(totalSearchResult) : null);
|
|
9727
9793
|
const previousState = usePrevious({ clickedLimitId, clickedSortId, clickedFacets, clickedTabIndexId });
|
|
9728
|
-
const { color: filter_title_color, font_size: filter_title_font_size, font_weight: filter_title_font_weight, text_transform: filter_title_text_transform } = ((
|
|
9794
|
+
const { color: filter_title_color, font_size: filter_title_font_size, font_weight: filter_title_font_weight, text_transform: filter_title_text_transform } = ((_q = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _q.title) || {};
|
|
9729
9795
|
const {
|
|
9730
9796
|
color: filter_option_color,
|
|
9731
9797
|
font_size: filter_option_font_size,
|
|
9732
9798
|
font_weight: filter_option_font_weight,
|
|
9733
9799
|
text_transform: filter_option_text_transform
|
|
9734
|
-
} = ((
|
|
9800
|
+
} = ((_r = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _r.option) || {};
|
|
9735
9801
|
const {
|
|
9736
9802
|
text_color: filter_button_text_color,
|
|
9737
9803
|
border_color: filter_button_border_color,
|
|
@@ -9744,7 +9810,7 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
9744
9810
|
font_size: filter_button_font_size,
|
|
9745
9811
|
font_weight: filter_button_font_weight,
|
|
9746
9812
|
text_transform: filter_button_text_transform
|
|
9747
|
-
} = ((
|
|
9813
|
+
} = ((_s = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _s.button) || {};
|
|
9748
9814
|
const filter_title_style = {
|
|
9749
9815
|
...filter_title_color && { color: filter_title_color },
|
|
9750
9816
|
...filter_title_font_size && { fontSize: filter_title_font_size },
|
|
@@ -10003,11 +10069,16 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
10003
10069
|
if (isReplaceData) {
|
|
10004
10070
|
setCurrentPage(1);
|
|
10005
10071
|
setSearchResult([]);
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
searchParams2.set(queryLimit, String(clickedLimitId));
|
|
10072
|
+
searchParams.set(queryPage, String(1));
|
|
10073
|
+
searchParams.set(queryLimit, String(clickedLimitId));
|
|
10009
10074
|
if (!objectPresent(previewSettings))
|
|
10010
|
-
window.history.pushState(null, "", `${document.location.pathname}?${
|
|
10075
|
+
window.history.pushState(null, "", `${document.location.pathname}?${searchParams.toString()}`);
|
|
10076
|
+
} else {
|
|
10077
|
+
if (!isLimitIdAvailable) {
|
|
10078
|
+
searchParams.set(queryLimit, String(valueDefaultLimit));
|
|
10079
|
+
if (!objectPresent(previewSettings))
|
|
10080
|
+
window.history.pushState(null, "", `${document.location.pathname}?${searchParams.toString()}`);
|
|
10081
|
+
}
|
|
10011
10082
|
}
|
|
10012
10083
|
setIsLoading(isReplaceData ? true : !isLoadMore2);
|
|
10013
10084
|
let response;
|
|
@@ -10299,7 +10370,7 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
10299
10370
|
const paginationComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10300
10371
|
PaginationOrLoadMore,
|
|
10301
10372
|
{
|
|
10302
|
-
type: (
|
|
10373
|
+
type: (_t = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _t.pagination_type,
|
|
10303
10374
|
isLoadMore,
|
|
10304
10375
|
isLoadingButtonLoadMore,
|
|
10305
10376
|
handleLoadMore: () => {
|
|
@@ -10308,7 +10379,7 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
10308
10379
|
setIsReplaceWidgetList == null ? void 0 : setIsReplaceWidgetList(true);
|
|
10309
10380
|
},
|
|
10310
10381
|
buttonLoadMoreText: isLoadingButtonLoadMore ? button_loading || "Loading..." : button_load_more || "Load More",
|
|
10311
|
-
isInfiniteScroll: ((
|
|
10382
|
+
isInfiniteScroll: ((_u = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _u.pagination_type) === "infinite_scroll",
|
|
10312
10383
|
currentPage,
|
|
10313
10384
|
totalPage,
|
|
10314
10385
|
totalResult: totalSearchResult,
|
|
@@ -10317,7 +10388,7 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
10317
10388
|
handlePageChange
|
|
10318
10389
|
}
|
|
10319
10390
|
);
|
|
10320
|
-
const summaryTextComponent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: ((
|
|
10391
|
+
const summaryTextComponent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: ((_v = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _v.show_total_products) ? summaryText : null });
|
|
10321
10392
|
const searchFieldComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Search, { placeholder: language_search_form_placeholder == null ? void 0 : language_search_form_placeholder.product, value: keyword, handleChangeSearch: handleChangeKeyword });
|
|
10322
10393
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Search, { placeholder: language_search_form_placeholder == null ? void 0 : language_search_form_placeholder.product, value: keyword, handleChangeSearch: handleChangeKeyword });
|
|
10323
10394
|
const sortComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -10330,7 +10401,7 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
10330
10401
|
overridePlaceholderOnMobile: !mobileShowSelectedSort ? mobile_sort_placeholder || "Sort" : null
|
|
10331
10402
|
}
|
|
10332
10403
|
);
|
|
10333
|
-
const limitComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Limit, { label: language_limit, options: (
|
|
10404
|
+
const limitComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Limit, { label: language_limit, options: (_w = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _w.allowed_limit, clickedOption: clickedLimitId, handleChangeOption: handleChangeLimit });
|
|
10334
10405
|
const productGridComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10335
10406
|
ProductGrid,
|
|
10336
10407
|
{
|
|
@@ -10344,9 +10415,9 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
10344
10415
|
};
|
|
10345
10416
|
}),
|
|
10346
10417
|
setting: {
|
|
10347
|
-
show_vendor: (
|
|
10348
|
-
show_sku: (
|
|
10349
|
-
show_price: (
|
|
10418
|
+
show_vendor: (_x = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _x.show_vendor,
|
|
10419
|
+
show_sku: (_y = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _y.show_sku,
|
|
10420
|
+
show_price: (_z = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _z.show_price,
|
|
10350
10421
|
language_button_add_to_cart: language_add_to_cart,
|
|
10351
10422
|
language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
|
|
10352
10423
|
},
|