@sledge-app/react-instant-search 1.0.136 → 1.0.138

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.
@@ -67,7 +67,8 @@ const DATASET_ATTRIBUTE_KEY = {
67
67
  RENDER_COLLECTION_CARD: "data-render-collection-card",
68
68
  RENDER_PAGE_CARD: "data-render-page-card",
69
69
  RENDER_BLOG_CARD: "data-render-blog-card",
70
- RENDER_ARTICLE_CARD: "data-render-article-card"
70
+ RENDER_ARTICLE_CARD: "data-render-article-card",
71
+ CURRENT_TAGS: "data-current-tags"
71
72
  },
72
73
  PRODUCT_RECOMMENDATION: {
73
74
  DISPLAY_LIMIT: "data-display-limit",
@@ -5901,7 +5902,7 @@ const handleFacetValues = ({
5901
5902
  keepCounterFacets,
5902
5903
  allowedFilterSlider
5903
5904
  }) => {
5904
- var _a, _b, _c, _d;
5905
+ var _a, _b, _c, _d, _e;
5905
5906
  const { value, settings: filterSettings } = filter;
5906
5907
  let aliases = {};
5907
5908
  if (filter.value === HIERARCHICAL_FACET_OBJECT_ALIASES.product_type)
@@ -5910,7 +5911,7 @@ const handleFacetValues = ({
5910
5911
  aliases = settings.collectionAliases || {};
5911
5912
  const isCollection = (_a = String(filter == null ? void 0 : filter.value)) == null ? void 0 : _a.includes(HIERARCHICAL_FACET_OBJECT_ALIASES.collections);
5912
5913
  const isHideFacetWhenZeroValue = (_b = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _b.hide_when_zero_value;
5913
- const { prefix, filter_list, delete_prefix, selected_filter, structure } = filterSettings || {};
5914
+ const { prefix, filter_list, delete_prefix, selected_filter, structure, hiddens } = filterSettings || {};
5914
5915
  let facetValues = [];
5915
5916
  if (!(items == null ? void 0 : items.length))
5916
5917
  return facetValues;
@@ -5920,12 +5921,13 @@ const handleFacetValues = ({
5920
5921
  var _a2;
5921
5922
  return (_a2 = item == null ? void 0 : item.value) == null ? void 0 : _a2.startsWith(prefixItem);
5922
5923
  }));
5923
- if (!item || isManualFilter || isPrefixFilter)
5924
+ const isHidden = (_c = hiddens == null ? void 0 : hiddens.includes) == null ? void 0 : _c.call(hiddens, item == null ? void 0 : item.value);
5925
+ if (!item || isManualFilter || isPrefixFilter || isHidden)
5924
5926
  continue;
5925
5927
  const isFacetHierarchical = Object.hasOwn(item, "children");
5926
5928
  let labelName = item.name;
5927
5929
  if (isFacetHierarchical && isCollection)
5928
- labelName = ((_c = parseFacetObject({ facet: labelName })) == null ? void 0 : _c.collection_title) || labelName;
5930
+ labelName = ((_d = parseFacetObject({ facet: labelName })) == null ? void 0 : _d.collection_title) || labelName;
5929
5931
  let getValue = isFacetHierarchical ? `${value}.lvl${item.level}` : value;
5930
5932
  if (languageSettings && (languageSettings[item.value] || languageSettings[item.name]))
5931
5933
  labelName = languageSettings[item.value] || languageSettings[item.name];
@@ -5935,7 +5937,7 @@ const handleFacetValues = ({
5935
5937
  keepCounterFacets,
5936
5938
  allowedFilterSlider,
5937
5939
  filterSettings
5938
- }) ? (item == null ? void 0 : item.total) || 0 : (searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) && ((_d = searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) == null ? void 0 : _d[item.value]) ? searchFacetDistribution[getValue][item.value] : 0;
5940
+ }) ? (item == null ? void 0 : item.total) || 0 : (searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) && ((_e = searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) == null ? void 0 : _e[item.value]) ? searchFacetDistribution[getValue][item.value] : 0;
5939
5941
  let getLabelName = aliases[labelName] || labelName;
5940
5942
  delete_prefix == null ? void 0 : delete_prefix.map((deletePrefix) => {
5941
5943
  if (String(getLabelName).startsWith(deletePrefix))
@@ -6794,7 +6796,14 @@ const FacetBlockSelected = React__default.memo(
6794
6796
  aliasValue = newSplitedValues.join(" > ");
6795
6797
  }
6796
6798
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-item-refine-selected", style: filter_option_style, children: [
6797
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-filter-item-title-refine-list", dangerouslySetInnerHTML: { __html: `${getLabel}: ${aliasValue || valueText}` } }),
6799
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
6800
+ "span",
6801
+ {
6802
+ className: "sledge-instant-search__result-filter-item-title-refine-list",
6803
+ "data-value": `${getLabel}: ${aliasValue || valueText}`,
6804
+ dangerouslySetInnerHTML: { __html: `${getLabel}: ${aliasValue || valueText}` }
6805
+ }
6806
+ ),
6798
6807
  /* @__PURE__ */ jsxRuntimeExports.jsx(
6799
6808
  "span",
6800
6809
  {
@@ -6871,7 +6880,8 @@ const SearchResultWidget = (props) => {
6871
6880
  onAfterRenderBlog,
6872
6881
  onAfterRenderArticle,
6873
6882
  data: propsData,
6874
- sledgeSettings
6883
+ sledgeSettings,
6884
+ currentTags = []
6875
6885
  } = props;
6876
6886
  useIsFirstRender();
6877
6887
  const queryKeyword = (query == null ? void 0 : query.keyword) ? query.keyword : DEFAULT_QUERY_PARAM.KEYWORD;
@@ -6910,7 +6920,11 @@ const SearchResultWidget = (props) => {
6910
6920
  const [searchResultFacets, setSearchResultFacets] = React__default.useState({});
6911
6921
  const [generalDataSettings, setGeneralDataSettings] = React__default.useState((sledgeSettings == null ? void 0 : sledgeSettings.general) || {});
6912
6922
  const [instantSearchSettings, setInstantSearchSettings] = React__default.useState((sledgeSettings == null ? void 0 : sledgeSettings.instantsearch) || {});
6913
- const [clickedFacets, setClickedFacets] = React__default.useState({});
6923
+ const [clickedFacets, setClickedFacets] = React__default.useState(
6924
+ (currentTags == null ? void 0 : currentTags.length) ? {
6925
+ tags: currentTags
6926
+ } : {}
6927
+ );
6914
6928
  const [clickedOpenFilterHorizontalId, setClickedOpenFilterHorizontalId] = React__default.useState(null);
6915
6929
  const [clickedOpenFilterHorizontalMobileId, setClickedOpenFilterHorizontalMobileId] = React__default.useState(null);
6916
6930
  const [separatedFilterItem, setSeparatedFilterItem] = React__default.useState({});