@sledge-app/react-instant-search 2.0.57 → 2.0.59

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.
@@ -7044,7 +7044,7 @@ const PaginationOrLoadMore = (props) => {
7044
7044
  };
7045
7045
  const FacetBlockSelected = React__default.memo(
7046
7046
  (props) => {
7047
- var _a, _b, _c, _d, _e, _f, _g, _h;
7047
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7048
7048
  const {
7049
7049
  label,
7050
7050
  name,
@@ -7060,7 +7060,7 @@ const FacetBlockSelected = React__default.memo(
7060
7060
  handleFilterChange,
7061
7061
  allowedFilterSlider
7062
7062
  } = props;
7063
- const { money_format } = generalDataSettings || {};
7063
+ const { money_format: money_format_props } = generalDataSettings || {};
7064
7064
  const { separator: hierarchical_collections_separator } = hierarchicalCollectionsSettings || {};
7065
7065
  const {
7066
7066
  color: filter_option_color,
@@ -7100,11 +7100,17 @@ const FacetBlockSelected = React__default.memo(
7100
7100
  if (defaultFilterItems == null ? void 0 : defaultFilterItems.length) {
7101
7101
  let isSetValue = false;
7102
7102
  defaultFilterItems.map((defaultFilterItem) => {
7103
- const { label: defaultFilterItemLabel, items, settings: defaultFilterItemSettings } = defaultFilterItem;
7103
+ const { label: defaultFilterItemLabel, items, settings: defaultFilterItemSettings, value: defaultFilterItemValue } = defaultFilterItem;
7104
7104
  if ((items == null ? void 0 : items.includes(value)) && !isSetValue) {
7105
7105
  getLabel = defaultFilterItemLabel;
7106
7106
  getSettings = defaultFilterItemSettings;
7107
7107
  isSetValue = true;
7108
+ } else {
7109
+ if (defaultFilterItemValue === name && isRange && !isSetValue) {
7110
+ getLabel = defaultFilterItemLabel;
7111
+ getSettings = defaultFilterItemSettings;
7112
+ isSetValue = true;
7113
+ }
7108
7114
  }
7109
7115
  });
7110
7116
  }
@@ -7113,12 +7119,15 @@ const FacetBlockSelected = React__default.memo(
7113
7119
  valueText = String(valueText).replace(deletePrefix, "");
7114
7120
  });
7115
7121
  if (isRange) {
7122
+ let money_format = money_format_props;
7123
+ if (getSettings == null ? void 0 : getSettings.rounded)
7124
+ money_format = (_f = money_format == null ? void 0 : money_format.replace) == null ? void 0 : _f.call(money_format, /\{\{\s*amount[^}]*\}\}/g, "{{amount_no_decimals}}");
7116
7125
  const getValueRange = new Set(value).size === 1 ? [value[0]] : value;
7117
- valueText = (_f = getValueRange == null ? void 0 : getValueRange.map((valueItem) => isPriceValue ? shopifyFormatMoney(valueItem * 100, money_format) : isSalePercent ? `${valueItem}%` : valueItem)) == null ? void 0 : _f.join(" - ");
7126
+ valueText = (_g = getValueRange == null ? void 0 : getValueRange.map((valueItem) => isPriceValue ? shopifyFormatMoney(valueItem * 100, money_format) : isSalePercent ? `${valueItem}%` : valueItem)) == null ? void 0 : _g.join(" - ");
7118
7127
  } else {
7119
- valueText = (_g = String(valueText)) == null ? void 0 : _g.replaceAll(hierarchical_collections_separator, " > ");
7128
+ valueText = (_h = String(valueText)) == null ? void 0 : _h.replaceAll(hierarchical_collections_separator, " > ");
7120
7129
  }
7121
- valueText = (_h = String(valueText)) == null ? void 0 : _h.replaceAll("_", " ");
7130
+ valueText = (_i = String(valueText)) == null ? void 0 : _i.replaceAll("_", " ");
7122
7131
  let aliases = {};
7123
7132
  let aliasValue = "";
7124
7133
  let aliasSeparator = "";
@@ -7783,7 +7792,7 @@ const FilterActive = (props) => {
7783
7792
  ) }) : null });
7784
7793
  };
7785
7794
  const Facet = (props) => {
7786
- var _a, _b, _c, _d, _e;
7795
+ var _a, _b, _c, _d, _e, _f;
7787
7796
  const {
7788
7797
  filter,
7789
7798
  isFirstLoading,
@@ -7821,7 +7830,7 @@ const Facet = (props) => {
7821
7830
  const searchFacetRef = React__default.useRef(null);
7822
7831
  const ulListRef = React__default.useRef(null);
7823
7832
  const previousState = usePrevious({ keywordFacet });
7824
- const { money_format, default_currency_symbol } = generalDataSettings || {};
7833
+ const { money_format: money_format_props, default_currency_symbol } = generalDataSettings || {};
7825
7834
  const { button_load_more } = (generalDataSettings == null ? void 0 : generalDataSettings.languages) || {};
7826
7835
  const { search_filter_placeholder, search_filter_show_more_result, search_filter_no_result, filter_select_placeholder, highest_price_info } = languageSettings || {};
7827
7836
  const {
@@ -7838,12 +7847,15 @@ const Facet = (props) => {
7838
7847
  ...filter_option_text_transform && { textTransform: filter_option_text_transform }
7839
7848
  };
7840
7849
  let { value, label, display, indexFilter, items, settings: filterSettings } = filter;
7841
- const { show_search, auto_select_search, hide_filter_list, show_all_children_items } = filterSettings || {};
7850
+ const { show_search, auto_select_search, hide_filter_list, show_all_children_items, rounded } = filterSettings || {};
7851
+ let money_format = money_format_props;
7852
+ if (rounded)
7853
+ money_format = (_b = money_format == null ? void 0 : money_format.replace) == null ? void 0 : _b.call(money_format, /\{\{\s*amount[^}]*\}\}/g, "{{amount_no_decimals}}");
7842
7854
  const show_filter_list_when_search = !hide_filter_list;
7843
7855
  if (isFirstLoading)
7844
7856
  return null;
7845
7857
  let blockComponent = null;
7846
- const isShowNumberMatchingProduct = (_b = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _b.show_number_matching_product;
7858
+ const isShowNumberMatchingProduct = (_c = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _c.show_number_matching_product;
7847
7859
  const isDisplaySlider = ["slider", "input_range", "slider_with_input_range"].includes(display.toLowerCase());
7848
7860
  const isDisplayColorSwatch = ["swatch", "swatch_with_label"].includes(display.toLowerCase());
7849
7861
  const isDisplayInputRange = display.toLowerCase() === "input_range";
@@ -8086,11 +8098,17 @@ const Facet = (props) => {
8086
8098
  }
8087
8099
  if (isDisplaySlider) {
8088
8100
  items = (defaultFacetStats == null ? void 0 : defaultFacetStats[value]) && Object.keys(defaultFacetStats[value]).length ? defaultFacetStats[value] : {};
8089
- if (items && ((_c = Object.keys(items)) == null ? void 0 : _c.length)) {
8101
+ if (items && ((_d = Object.keys(items)) == null ? void 0 : _d.length)) {
8090
8102
  items = {
8091
8103
  min: (items == null ? void 0 : items.min) < 0 ? 0 : items == null ? void 0 : items.min,
8092
8104
  max: items == null ? void 0 : items.max
8093
8105
  };
8106
+ if (rounded) {
8107
+ items = {
8108
+ min: Math.floor(items == null ? void 0 : items.min),
8109
+ max: Math.floor(items == null ? void 0 : items.max)
8110
+ };
8111
+ }
8094
8112
  }
8095
8113
  let valueFilterSliderChange = [];
8096
8114
  let isPriceValue = false;
@@ -8186,7 +8204,7 @@ const Facet = (props) => {
8186
8204
  value: value2
8187
8205
  };
8188
8206
  }),
8189
- value: clickedFacets && ((_d = clickedFacets[value]) == null ? void 0 : _d.length) ? clickedFacets[value][0] : "",
8207
+ value: clickedFacets && ((_e = clickedFacets[value]) == null ? void 0 : _e.length) ? clickedFacets[value][0] : "",
8190
8208
  labelStyle: filter_option_style,
8191
8209
  useVirtualized: true,
8192
8210
  selector: scrollElementSelector,
@@ -8214,7 +8232,7 @@ const Facet = (props) => {
8214
8232
  value: value2
8215
8233
  };
8216
8234
  }),
8217
- defaultValue: clickedFacets && ((_e = clickedFacets[value]) == null ? void 0 : _e.length) ? clickedFacets[value][0] : "",
8235
+ defaultValue: clickedFacets && ((_f = clickedFacets[value]) == null ? void 0 : _f.length) ? clickedFacets[value][0] : "",
8218
8236
  labelStyle: filter_option_style,
8219
8237
  loadMoreText: button_load_more || "Load More",
8220
8238
  useLoadMore: true
@@ -8645,7 +8663,8 @@ const EnterpriseLayout = (props) => {
8645
8663
  languageSettings,
8646
8664
  openFilterToggle = false,
8647
8665
  setOpenFilterToggle = () => {
8648
- }
8666
+ },
8667
+ handleSearchResultFirstTime
8649
8668
  } = props;
8650
8669
  const { filter: language_filter } = languageSettings || {};
8651
8670
  const {
@@ -8683,7 +8702,7 @@ const EnterpriseLayout = (props) => {
8683
8702
  /* @__PURE__ */ jsxRuntimeExports.jsxs(ResultData, { className: openFilterToggle ? "" : "sledge__has-closed-filter-toggle", children: [
8684
8703
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge-instant-search__result-filter-toggle-panel ${"animated"}`, "data-filter-toggle": openFilterToggle ? "open" : "closed", children: filterVertical == null ? void 0 : filterVertical({
8685
8704
  filterLayoutType: "standard",
8686
- isSkeleton: Boolean(!isAllowedFilterTree && isFirstLoading || isAllowedFilterTree && isLoadingProduct || isLoadingSetting)
8705
+ isSkeleton: Boolean(!isAllowedFilterTree && isFirstLoading || isAllowedFilterTree && isLoadingProduct || isLoadingSetting || handleSearchResultFirstTime)
8687
8706
  }) }),
8688
8707
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-flex", children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: productGridSkeleton }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProductGridPaginationWrapper, { children: (searchResult == null ? void 0 : searchResult.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
8689
8708
  productGrid,
@@ -8750,7 +8769,7 @@ const YuvaLayout = (props) => {
8750
8769
  /* @__PURE__ */ jsxRuntimeExports.jsxs(ResultData, { className: openFilterToggle ? "" : "sledge__has-closed-filter-toggle", children: [
8751
8770
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge-instant-search__result-filter-toggle-panel ${""}`, "data-filter-toggle": openFilterToggle ? "open" : "closed", children: filterVertical == null ? void 0 : filterVertical({
8752
8771
  filterLayoutType: "standard",
8753
- isSkeleton: Boolean(!isAllowedFilterTree && isFirstLoading || isAllowedFilterTree && isLoadingProduct || isLoadingSetting)
8772
+ isSkeleton: Boolean(!isAllowedFilterTree && isFirstLoading || isAllowedFilterTree && isLoadingProduct || isLoadingSetting || handleSearchResultFirstTime)
8754
8773
  }) }),
8755
8774
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-flex", children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: productGridSkeleton }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProductGridPaginationWrapper, { children: (searchResult == null ? void 0 : searchResult.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
8756
8775
  productGrid,
@@ -9332,8 +9351,14 @@ const SearchResultWidget = (props) => {
9332
9351
  const { value, label, display, settings: settings2 } = filter;
9333
9352
  const { prefix, filter_list, selected_filter } = settings2 || {};
9334
9353
  const isDisplaySlider = ["slider", "input_range", "slider_with_input_range"].includes(display.toLowerCase());
9335
- if (isDisplaySlider)
9336
- return;
9354
+ if (isDisplaySlider) {
9355
+ return {
9356
+ value,
9357
+ label,
9358
+ settings: settings2,
9359
+ index
9360
+ };
9361
+ }
9337
9362
  let items = [];
9338
9363
  if (display.toLowerCase() === "tree") {
9339
9364
  for (let level = 0; level < MAX_LIMIT_HIERARCHICAL; level++) {