@sledge-app/react-instant-search 2.0.10 → 2.0.12

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.
@@ -1106,7 +1106,7 @@ const Pagination = (props) => {
1106
1106
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__pagination", "data-pagination-type": type, children: renderPaginationLayout() });
1107
1107
  };
1108
1108
  const RadioGroup$1 = "";
1109
- const rowRenderer = ({ virtualized, item, id, labelStyle }) => {
1109
+ const rowRenderer$1 = ({ virtualized, item, id, labelStyle }) => {
1110
1110
  const { index, key = "" } = virtualized || {};
1111
1111
  const { label, value } = item;
1112
1112
  const content = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -1120,7 +1120,7 @@ const RadioGroup = ({ id, name, required, value, items, labelStyle = {}, onValue
1120
1120
  VirtualizedList,
1121
1121
  {
1122
1122
  rowCount: items == null ? void 0 : items.length,
1123
- rowRenderer: ({ index, key }) => rowRenderer({
1123
+ rowRenderer: ({ index, key }) => rowRenderer$1({
1124
1124
  virtualized: {
1125
1125
  index,
1126
1126
  key
@@ -1134,7 +1134,7 @@ const RadioGroup = ({ id, name, required, value, items, labelStyle = {}, onValue
1134
1134
  parentRef
1135
1135
  }
1136
1136
  ) : items.map(
1137
- (item, index) => rowRenderer({
1137
+ (item, index) => rowRenderer$1({
1138
1138
  virtualized: {
1139
1139
  index
1140
1140
  },
@@ -1177,8 +1177,25 @@ const ColorSwatch = ({ id, name, value, rgb, image, required, checked, onClick }
1177
1177
  );
1178
1178
  };
1179
1179
  const Select$1 = "";
1180
- const Select = ({ name, placeholder, required, defaultValue, items, labelStyle = {}, onValueChange }) => {
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 }) => {
1181
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
+ };
1182
1199
  React__default.useEffect(() => {
1183
1200
  setIsLoading(true);
1184
1201
  setTimeout(() => {
@@ -1195,19 +1212,25 @@ const Select = ({ name, placeholder, required, defaultValue, items, labelStyle =
1195
1212
  selectRootElement.classList.toggle("sledge__select-root");
1196
1213
  }
1197
1214
  };
1198
- 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(
1199
1216
  $cc7e05a45900e73f$export$be92b6f5f03c0fe9,
1200
1217
  {
1201
1218
  name,
1202
1219
  required,
1203
1220
  onValueChange,
1204
- onOpenChange: (open) => handleClassNameRoot(open),
1221
+ onOpenChange: (open) => {
1222
+ handleClassNameRoot(open);
1223
+ setItems(open && (itemsProp == null ? void 0 : itemsProp.length) ? [itemsProp == null ? void 0 : itemsProp[0]] : []);
1224
+ setTimeout(() => {
1225
+ setItems(open && (itemsProp == null ? void 0 : itemsProp.length) ? itemsProp : []);
1226
+ }, 0);
1227
+ },
1205
1228
  ...defaultValue ? {
1206
1229
  defaultValue
1207
1230
  } : {},
1208
1231
  children: [
1209
1232
  /* @__PURE__ */ jsxRuntimeExports.jsxs($cc7e05a45900e73f$export$41fb9f06171c75f4, { className: "sledge__select-trigger", style: labelStyle, children: [
1210
- /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$4c8d1a57a761ef94, { placeholder }),
1233
+ useVirtualized && defaultValue ? /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$4c8d1a57a761ef94, { children: defaultValue }) : /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$4c8d1a57a761ef94, { placeholder }),
1211
1234
  /* @__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(
1212
1235
  "path",
1213
1236
  {
@@ -1219,30 +1242,62 @@ const Select = ({ name, placeholder, required, defaultValue, items, labelStyle =
1219
1242
  ) }) })
1220
1243
  ] }),
1221
1244
  /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$602eac185826482c, { className: "sledge__select-portal", children: /* @__PURE__ */ jsxRuntimeExports.jsxs($cc7e05a45900e73f$export$7c6e2c02157bb7d2, { className: "sledge__select-content", children: [
1222
- /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$2f60d3ec9ad468f2, { className: "sledge__select-scroll-button", 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(
1223
- "path",
1245
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1246
+ $cc7e05a45900e73f$export$2f60d3ec9ad468f2,
1224
1247
  {
1225
- 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",
1226
- fill: "currentColor",
1227
- fillRule: "evenodd",
1228
- clipRule: "evenodd"
1248
+ className: "sledge__select-scroll-button",
1249
+ ...useVirtualized ? {
1250
+ onClick: () => scrollToPosition("up")
1251
+ } : {},
1252
+ 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(
1253
+ "path",
1254
+ {
1255
+ 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",
1256
+ fill: "currentColor",
1257
+ fillRule: "evenodd",
1258
+ clipRule: "evenodd"
1259
+ }
1260
+ ) })
1229
1261
  }
1230
- ) }) }),
1231
- /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$d5c6c08dc2d3ca7, { className: "sledge__select-viewport", children: items.map(
1262
+ ),
1263
+ /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$d5c6c08dc2d3ca7, { className: "sledge__select-viewport", ref: selectViewportRef, children: useVirtualized && (items == null ? void 0 : items.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1264
+ VirtualizedList,
1265
+ {
1266
+ rowCount: items == null ? void 0 : items.length,
1267
+ rowRenderer: ({ index, key }) => rowRenderer({
1268
+ virtualized: {
1269
+ index,
1270
+ key
1271
+ },
1272
+ item: items == null ? void 0 : items[index],
1273
+ labelStyle
1274
+ }),
1275
+ parentRef: selectViewportRef
1276
+ }
1277
+ ) : items.map(
1232
1278
  (item, index) => {
1233
1279
  const { label, value } = item;
1234
1280
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItemComponent, { value, children: label }, index);
1235
1281
  }
1236
1282
  ) }),
1237
- /* @__PURE__ */ jsxRuntimeExports.jsx($cc7e05a45900e73f$export$bf1aedc3039c8d63, { className: "sledge__select-scroll-button", 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(
1238
- "path",
1283
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1284
+ $cc7e05a45900e73f$export$bf1aedc3039c8d63,
1239
1285
  {
1240
- 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",
1241
- fill: "currentColor",
1242
- fillRule: "evenodd",
1243
- clipRule: "evenodd"
1286
+ className: "sledge__select-scroll-button",
1287
+ ...useVirtualized ? {
1288
+ onClick: () => scrollToPosition("down")
1289
+ } : {},
1290
+ 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(
1291
+ "path",
1292
+ {
1293
+ 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",
1294
+ fill: "currentColor",
1295
+ fillRule: "evenodd",
1296
+ clipRule: "evenodd"
1297
+ }
1298
+ ) })
1244
1299
  }
1245
- ) }) })
1300
+ )
1246
1301
  ] }) })
1247
1302
  ]
1248
1303
  }
@@ -7470,7 +7525,8 @@ const Facet = (props) => {
7470
7525
  if (!is_item_pagination || isDisplaySlider) {
7471
7526
  return {
7472
7527
  haveNextPage: false,
7473
- currentItems: arrFacetValues
7528
+ currentItems: arrFacetValues,
7529
+ allItems: arrFacetValues
7474
7530
  };
7475
7531
  }
7476
7532
  const lastItemLimit = separatedFilterItem[getValue] || Number(item_pagination_limit);
@@ -7482,6 +7538,7 @@ const Facet = (props) => {
7482
7538
  return {
7483
7539
  haveNextPage: haveNextPage2,
7484
7540
  currentItems: currentItems2,
7541
+ allItems: arrFacetValues,
7485
7542
  totalItems: Number(arrFacetValues == null ? void 0 : arrFacetValues.length)
7486
7543
  };
7487
7544
  };
@@ -7490,7 +7547,7 @@ const Facet = (props) => {
7490
7547
  setShowFacet(true);
7491
7548
  (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));
7492
7549
  };
7493
- const { haveNextPage, currentItems, totalItems } = handleFacetLoadMore({
7550
+ const { haveNextPage, currentItems, allItems, totalItems } = handleFacetLoadMore({
7494
7551
  facetItems: items
7495
7552
  });
7496
7553
  const filterSearchShowMoreId = stringToSlug(`filter-search-show-more-${getValue}`);
@@ -7531,7 +7588,7 @@ const Facet = (props) => {
7531
7588
  if (!(showFacet && isPreviousStateFromOutsideChanged))
7532
7589
  setShowFacet(false);
7533
7590
  }, [keywordFacet, clickedFacets]);
7534
- const loadMoreComponent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
7591
+ const loadMoreComponent = display.toLowerCase() === "select" ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(
7535
7592
  "div",
7536
7593
  {
7537
7594
  className: "sledge-instant-search__result-filter-item-show-more",
@@ -7764,7 +7821,7 @@ const Facet = (props) => {
7764
7821
  parentRef: ulListRef
7765
7822
  }
7766
7823
  ) });
7767
- } else if (display.toLowerCase() === "select" && (currentItems == null ? void 0 : currentItems.length)) {
7824
+ } else if (display.toLowerCase() === "select" && (allItems == null ? void 0 : allItems.length)) {
7768
7825
  blockComponent = /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
7769
7826
  Select,
7770
7827
  {
@@ -7775,7 +7832,7 @@ const Facet = (props) => {
7775
7832
  value: getValue2,
7776
7833
  force: true
7777
7834
  }),
7778
- items: currentItems == null ? void 0 : currentItems.map((item) => {
7835
+ items: allItems == null ? void 0 : allItems.map((item) => {
7779
7836
  const { labelName, value: value2, counter } = item;
7780
7837
  return {
7781
7838
  label: `${labelName} ${counter !== void 0 && isShowNumberMatchingProduct ? ` (${counter})` : ""}`,
@@ -7783,7 +7840,8 @@ const Facet = (props) => {
7783
7840
  };
7784
7841
  }),
7785
7842
  defaultValue: clickedFacets && ((_e = clickedFacets[value]) == null ? void 0 : _e.length) ? clickedFacets[value][0] : "",
7786
- labelStyle: filter_option_style
7843
+ labelStyle: filter_option_style,
7844
+ useVirtualized: true
7787
7845
  }
7788
7846
  ) });
7789
7847
  } else if (display.toLowerCase() === "swatch" && (currentItems == null ? void 0 : currentItems.length)) {
@@ -9581,7 +9639,7 @@ const SearchResultWidget = (props) => {
9581
9639
  ] });
9582
9640
  };
9583
9641
  const ResultProduct = React__default.memo((props) => {
9584
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
9642
+ 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;
9585
9643
  const {
9586
9644
  layoutType,
9587
9645
  keyword,
@@ -9666,22 +9724,25 @@ const ResultProduct = React__default.memo((props) => {
9666
9724
  } = props || {};
9667
9725
  const { collectionId, collectionName } = params || {};
9668
9726
  const isLoadMore = ["load_more", "infinite_scroll"].includes((_a = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _a.pagination_type);
9727
+ const valueClickedLimitId = Number((searchParams == null ? void 0 : searchParams.get(queryLimit)) || defaultLimit || DEFAULT_LIMIT_VALUE[0]);
9728
+ const valueDefaultLimit = ((_b = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _b.limit) || DEFAULT_LIMIT_VALUE[0];
9729
+ 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)));
9669
9730
  const [isLoadingProduct, setIsLoadingProduct] = React__default.useState(!propsData);
9670
9731
  const [isLoading, setIsLoading] = React__default.useState(!propsData);
9671
9732
  const [clickedSortId, setClickedSortId] = React__default.useState(defaultSort || "");
9672
- const [clickedLimitId, setClickedLimitId] = React__default.useState(Number((searchParams == null ? void 0 : searchParams.get(queryLimit)) || defaultLimit || DEFAULT_LIMIT_VALUE[0]));
9733
+ const [clickedLimitId, setClickedLimitId] = React__default.useState(Number(isLimitIdAvailable ? valueClickedLimitId : valueDefaultLimit));
9673
9734
  const [clickedOpenFilters, setClickedOpenFilters] = React__default.useState(
9674
9735
  keyOpenFilters({
9675
9736
  items: allowedFilter
9676
9737
  })
9677
9738
  );
9678
9739
  const [triggerClickedFacets, setTriggerClickedFacets] = React__default.useState(false);
9679
- const [searchResult, setSearchResult] = React__default.useState(((_d = (_c = (_b = propsData == null ? void 0 : propsData.result) == null ? void 0 : _b.results) == null ? void 0 : _c[0]) == null ? void 0 : _d.hits) || []);
9680
- const [hitsPerPageResult, setHitsPerPageResult] = React__default.useState(((_g = (_f = (_e = propsData == null ? void 0 : propsData.result) == null ? void 0 : _e.results) == null ? void 0 : _f[0]) == null ? void 0 : _g.hitsPerPage) || 0);
9740
+ 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) || []);
9741
+ 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);
9681
9742
  const [searchProcessingTimeMs, setSearchProcessingTimeMs] = React__default.useState(0);
9682
9743
  const [currentPage, setCurrentPage] = React__default.useState(Number(searchParams == null ? void 0 : searchParams.get(queryPage)) && !isLoadMore ? Number(searchParams == null ? void 0 : searchParams.get(queryPage)) : 1);
9683
9744
  const [totalPage, setTotalPage] = React__default.useState(0);
9684
- const [totalSearchResult, setTotalSearchResult] = 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.totalHits) || 0);
9745
+ 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);
9685
9746
  const [handleSearchResultFirstTime, setHandleSearchResultFirstTime] = React__default.useState(true);
9686
9747
  const [searchFacetDistribution, setSearchFacetDistribution] = React__default.useState({});
9687
9748
  const [isLoadingButtonLoadMore, setIsLoadingButtonLoadMore] = React__default.useState(false);
@@ -9733,13 +9794,13 @@ const ResultProduct = React__default.memo((props) => {
9733
9794
  };
9734
9795
  const [summaryText, setSummaryText] = React__default.useState(propsData ? summaryTextGenerator(totalSearchResult) : null);
9735
9796
  const previousState = usePrevious({ clickedLimitId, clickedSortId, clickedFacets, clickedTabIndexId });
9736
- const { color: filter_title_color, font_size: filter_title_font_size, font_weight: filter_title_font_weight, text_transform: filter_title_text_transform } = ((_k = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _k.title) || {};
9797
+ 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) || {};
9737
9798
  const {
9738
9799
  color: filter_option_color,
9739
9800
  font_size: filter_option_font_size,
9740
9801
  font_weight: filter_option_font_weight,
9741
9802
  text_transform: filter_option_text_transform
9742
- } = ((_l = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _l.option) || {};
9803
+ } = ((_r = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _r.option) || {};
9743
9804
  const {
9744
9805
  text_color: filter_button_text_color,
9745
9806
  border_color: filter_button_border_color,
@@ -9752,7 +9813,7 @@ const ResultProduct = React__default.memo((props) => {
9752
9813
  font_size: filter_button_font_size,
9753
9814
  font_weight: filter_button_font_weight,
9754
9815
  text_transform: filter_button_text_transform
9755
- } = ((_m = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _m.button) || {};
9816
+ } = ((_s = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _s.button) || {};
9756
9817
  const filter_title_style = {
9757
9818
  ...filter_title_color && { color: filter_title_color },
9758
9819
  ...filter_title_font_size && { fontSize: filter_title_font_size },
@@ -10011,11 +10072,16 @@ const ResultProduct = React__default.memo((props) => {
10011
10072
  if (isReplaceData) {
10012
10073
  setCurrentPage(1);
10013
10074
  setSearchResult([]);
10014
- const searchParams2 = new URLSearchParams(document.location.search);
10015
- searchParams2.set(queryPage, String(1));
10016
- searchParams2.set(queryLimit, String(clickedLimitId));
10075
+ searchParams.set(queryPage, String(1));
10076
+ searchParams.set(queryLimit, String(clickedLimitId));
10017
10077
  if (!objectPresent(previewSettings))
10018
- window.history.pushState(null, "", `${document.location.pathname}?${searchParams2.toString()}`);
10078
+ window.history.pushState(null, "", `${document.location.pathname}?${searchParams.toString()}`);
10079
+ } else {
10080
+ if (!isLimitIdAvailable) {
10081
+ searchParams.set(queryLimit, String(valueDefaultLimit));
10082
+ if (!objectPresent(previewSettings))
10083
+ window.history.pushState(null, "", `${document.location.pathname}?${searchParams.toString()}`);
10084
+ }
10019
10085
  }
10020
10086
  setIsLoading(isReplaceData ? true : !isLoadMore2);
10021
10087
  let response;
@@ -10307,7 +10373,7 @@ const ResultProduct = React__default.memo((props) => {
10307
10373
  const paginationComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(
10308
10374
  PaginationOrLoadMore,
10309
10375
  {
10310
- type: (_n = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _n.pagination_type,
10376
+ type: (_t = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _t.pagination_type,
10311
10377
  isLoadMore,
10312
10378
  isLoadingButtonLoadMore,
10313
10379
  handleLoadMore: () => {
@@ -10316,7 +10382,7 @@ const ResultProduct = React__default.memo((props) => {
10316
10382
  setIsReplaceWidgetList == null ? void 0 : setIsReplaceWidgetList(true);
10317
10383
  },
10318
10384
  buttonLoadMoreText: isLoadingButtonLoadMore ? button_loading || "Loading..." : button_load_more || "Load More",
10319
- isInfiniteScroll: ((_o = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _o.pagination_type) === "infinite_scroll",
10385
+ isInfiniteScroll: ((_u = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _u.pagination_type) === "infinite_scroll",
10320
10386
  currentPage,
10321
10387
  totalPage,
10322
10388
  totalResult: totalSearchResult,
@@ -10325,7 +10391,7 @@ const ResultProduct = React__default.memo((props) => {
10325
10391
  handlePageChange
10326
10392
  }
10327
10393
  );
10328
- const summaryTextComponent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: ((_p = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _p.show_total_products) ? summaryText : null });
10394
+ 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 });
10329
10395
  const searchFieldComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Search, { placeholder: language_search_form_placeholder == null ? void 0 : language_search_form_placeholder.product, value: keyword, handleChangeSearch: handleChangeKeyword });
10330
10396
  /* @__PURE__ */ jsxRuntimeExports.jsx(Search, { placeholder: language_search_form_placeholder == null ? void 0 : language_search_form_placeholder.product, value: keyword, handleChangeSearch: handleChangeKeyword });
10331
10397
  const sortComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -10338,7 +10404,7 @@ const ResultProduct = React__default.memo((props) => {
10338
10404
  overridePlaceholderOnMobile: !mobileShowSelectedSort ? mobile_sort_placeholder || "Sort" : null
10339
10405
  }
10340
10406
  );
10341
- const limitComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Limit, { label: language_limit, options: (_q = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _q.allowed_limit, clickedOption: clickedLimitId, handleChangeOption: handleChangeLimit });
10407
+ 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 });
10342
10408
  const productGridComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(
10343
10409
  ProductGrid,
10344
10410
  {
@@ -10352,9 +10418,9 @@ const ResultProduct = React__default.memo((props) => {
10352
10418
  };
10353
10419
  }),
10354
10420
  setting: {
10355
- show_vendor: (_r = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _r.show_vendor,
10356
- show_sku: (_s = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _s.show_sku,
10357
- show_price: (_t = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _t.show_price,
10421
+ show_vendor: (_x = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _x.show_vendor,
10422
+ show_sku: (_y = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _y.show_sku,
10423
+ show_price: (_z = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _z.show_price,
10358
10424
  language_button_add_to_cart: language_add_to_cart,
10359
10425
  language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
10360
10426
  },