@sledge-app/react-instant-search 2.0.74 → 2.0.75

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.
@@ -6220,7 +6220,7 @@ const SearchIconWidgetPopup = () => {
6220
6220
  let response;
6221
6221
  let body = {
6222
6222
  queries: tabs.map((tab) => {
6223
- var _a3, _b3, _c3;
6223
+ var _a3, _b3, _c3, _d3;
6224
6224
  const { index } = tab;
6225
6225
  let isProductIndex = index.includes(index_product);
6226
6226
  let additionalFilter = DEFAULT_QUERY_PRODUCT_MEILISEARCH;
@@ -6255,12 +6255,13 @@ const SearchIconWidgetPopup = () => {
6255
6255
  let filterProduct = additionalFilter;
6256
6256
  if (containsFilter)
6257
6257
  filterProduct = filterProduct.concat(containsFilter);
6258
+ let hiddenCollectionsFilter = index === (instantSearchSettings == null ? void 0 : instantSearchSettings.index_collection) && ((_d3 = instantSearchSettings == null ? void 0 : instantSearchSettings.hidden_collections) == null ? void 0 : _d3.length) ? `'id' NOT IN ${JSON.stringify(instantSearchSettings.hidden_collections)}` : null;
6258
6259
  return {
6259
6260
  indexUid: index,
6260
6261
  q: valueKeyword,
6261
6262
  sort,
6262
6263
  hitsPerPage: isProductIndex ? instantSearchLimit : 4,
6263
- filter: isProductIndex ? [...new Set(filterProduct)].join(" AND ") : "",
6264
+ filter: isProductIndex ? [...new Set(filterProduct)].join(" AND ") : [hiddenCollectionsFilter].filter(Boolean).join(" AND "),
6264
6265
  attributesToRetrieve: attributes_to_retrieve
6265
6266
  };
6266
6267
  })
@@ -7023,7 +7024,7 @@ const keyOpenFilters = ({ items = [] }) => {
7023
7024
  }).filter((item) => item) : [];
7024
7025
  };
7025
7026
  const handleSearchResponse = async (props) => {
7026
- var _a, _b, _c, _d;
7027
+ var _a, _b, _c, _d, _e;
7027
7028
  let {
7028
7029
  layoutType = "default",
7029
7030
  clickedTabIndexId,
@@ -7113,6 +7114,10 @@ const handleSearchResponse = async (props) => {
7113
7114
  if (isTypeCategoryHasPublished({ usePublishedFilter, type: clickedTabIndexType })) {
7114
7115
  filterCategory = DEFAULT_QUERY_PUBLISHED_FILTER;
7115
7116
  }
7117
+ let hiddenCollectionsCategoryFilter = String(clickedTabIndexId) === (instantSearchSettings == null ? void 0 : instantSearchSettings.index_collection) && ((_e = instantSearchSettings == null ? void 0 : instantSearchSettings.hidden_collections) == null ? void 0 : _e.length) ? `'id' NOT IN ${JSON.stringify(instantSearchSettings.hidden_collections)}` : null;
7118
+ if (hiddenCollectionsCategoryFilter) {
7119
+ filterCategory = [filterCategory, hiddenCollectionsCategoryFilter].filter(Boolean).join(" AND ");
7120
+ }
7116
7121
  let bodyProductOrCategory = isResultForProduct ? {
7117
7122
  q: keyword,
7118
7123
  sort,
@@ -7137,15 +7142,20 @@ const handleSearchResponse = async (props) => {
7137
7142
  let getTabs = isUseMultiSearch ? tabs : tabs.filter(({ index }) => index == null ? void 0 : index.includes(clickedTabIndexId));
7138
7143
  let body = {
7139
7144
  queries: getTabs.map((tab) => {
7145
+ var _a2;
7140
7146
  const { index, type } = tab;
7141
7147
  let isCurrentIndex = index.includes(clickedTabIndexId);
7142
7148
  let isProductIndex = type === "product";
7149
+ let hiddenCollectionsFilter = index === (instantSearchSettings == null ? void 0 : instantSearchSettings.index_collection) && ((_a2 = instantSearchSettings == null ? void 0 : instantSearchSettings.hidden_collections) == null ? void 0 : _a2.length) ? `'id' NOT IN ${JSON.stringify(instantSearchSettings.hidden_collections)}` : null;
7143
7150
  return {
7144
7151
  indexUid: index,
7145
7152
  ...isCurrentIndex ? bodyProductOrCategory : {
7146
7153
  q: keyword || "",
7147
7154
  hitsPerPage: 1,
7148
- filter: isTypeCategoryHasPublished({ usePublishedFilter, type }) ? DEFAULT_QUERY_PUBLISHED_FILTER : isProductIndex ? filterProduct : "",
7155
+ filter: [
7156
+ isTypeCategoryHasPublished({ usePublishedFilter, type }) ? DEFAULT_QUERY_PUBLISHED_FILTER : isProductIndex ? filterProduct : "",
7157
+ hiddenCollectionsFilter
7158
+ ].filter(Boolean).join(" AND "),
7149
7159
  attributesToRetrieve: [],
7150
7160
  limit: 0,
7151
7161
  page: 0,
@@ -11703,7 +11713,7 @@ const SearchWidget = (props) => {
11703
11713
  let response;
11704
11714
  let body = {
11705
11715
  queries: tabs.map((tab) => {
11706
- var _a3, _b3, _c3;
11716
+ var _a3, _b3, _c3, _d3;
11707
11717
  const { index } = tab;
11708
11718
  let isProductIndex = index.includes(index_product);
11709
11719
  let additionalFilter = DEFAULT_QUERY_PRODUCT_MEILISEARCH;
@@ -11738,12 +11748,13 @@ const SearchWidget = (props) => {
11738
11748
  let filterProduct = additionalFilter;
11739
11749
  if (containsFilter)
11740
11750
  filterProduct = filterProduct.concat(containsFilter);
11751
+ let hiddenCollectionsFilter = index === (instantSearchSettings == null ? void 0 : instantSearchSettings.index_collection) && ((_d3 = instantSearchSettings == null ? void 0 : instantSearchSettings.hidden_collections) == null ? void 0 : _d3.length) ? `'id' NOT IN ${JSON.stringify(instantSearchSettings.hidden_collections)}` : null;
11741
11752
  return {
11742
11753
  indexUid: index,
11743
11754
  q: valueKeyword,
11744
11755
  sort,
11745
11756
  hitsPerPage: isProductIndex ? instantSearchLimit : 4,
11746
- filter: isProductIndex ? [...new Set(filterProduct)].join(" AND ") : "",
11757
+ filter: isProductIndex ? [...new Set(filterProduct)].join(" AND ") : [hiddenCollectionsFilter].filter(Boolean).join(" AND "),
11747
11758
  attributesToRetrieve: attributes_to_retrieve
11748
11759
  };
11749
11760
  })