@sledge-app/react-instant-search 2.0.46 → 2.0.48

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.
@@ -6000,7 +6000,7 @@ const SearchIconWidgetPopup = () => {
6000
6000
  let getValueSearchResultProduct = (valueSearchResultProduct == null ? void 0 : valueSearchResultProduct.length) ? (_g2 = valueSearchResultProduct[0]) == null ? void 0 : _g2.hits : [];
6001
6001
  let valueSuggestionIndex = !keyword.length ? "zero_character" : !(getValueSearchResultProduct == null ? void 0 : getValueSearchResultProduct.length) ? "no_result" : "";
6002
6002
  let isPriorityZeroCharacter = Boolean(
6003
- !keyword.length && Object.keys(suggestion).length && ((_i2 = (_h2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _h2.products) == null ? void 0 : _i2.active) && ((_l2 = (_k2 = (_j2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _j2.products) == null ? void 0 : _k2.list) == null ? void 0 : _l2.length)
6003
+ !keyword.length && suggestion && Object.keys(suggestion).length && ((_i2 = (_h2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _h2.products) == null ? void 0 : _i2.active) && ((_l2 = (_k2 = (_j2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _j2.products) == null ? void 0 : _k2.list) == null ? void 0 : _l2.length)
6004
6004
  );
6005
6005
  let dataSearchResultProduct = isPriorityZeroCharacter ? (_n2 = (_m2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _m2.products) == null ? void 0 : _n2.list : getValueSearchResultProduct;
6006
6006
  if (withFetchReviewInfo) {
@@ -6183,7 +6183,7 @@ const SearchIconWidgetPopup = () => {
6183
6183
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-flex-item-product", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.ProductGrid, { count: 6, type: "medium" }) })
6184
6184
  ] }) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__icon-widget-search-form-result-flex", children: [
6185
6185
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__icon-widget-search-form-result-flex-item-other", children: [
6186
- Object.keys(suggestionSettings).length && ((_d = (_c = suggestionSettings[suggestionIndex]) == null ? void 0 : _c.keywords) == null ? void 0 : _d.active) && ((_g = (_f = (_e = suggestionSettings[suggestionIndex]) == null ? void 0 : _e.keywords) == null ? void 0 : _f.list) == null ? void 0 : _g.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
6186
+ suggestionSettings && Object.keys(suggestionSettings).length && ((_d = (_c = suggestionSettings[suggestionIndex]) == null ? void 0 : _c.keywords) == null ? void 0 : _d.active) && ((_g = (_f = (_e = suggestionSettings[suggestionIndex]) == null ? void 0 : _e.keywords) == null ? void 0 : _f.list) == null ? void 0 : _g.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
6187
6187
  Global.SuggestionKeywordLists,
6188
6188
  {
6189
6189
  listsComponent: handleFunctions.suggestionKeywordListsComponent,
@@ -6244,7 +6244,7 @@ const SearchIconWidgetPopup = () => {
6244
6244
  dataReviews,
6245
6245
  previewSettings: handleFunctions == null ? void 0 : handleFunctions.previewSettings
6246
6246
  }
6247
- ) }) : Object.keys(suggestionSettings).length && ((_l = (_k = suggestionSettings[suggestionIndex]) == null ? void 0 : _k.products) == null ? void 0 : _l.active) && ((_o = (_n = (_m = suggestionSettings[suggestionIndex]) == null ? void 0 : _m.products) == null ? void 0 : _n.list) == null ? void 0 : _o.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6247
+ ) }) : suggestionSettings && Object.keys(suggestionSettings).length && ((_l = (_k = suggestionSettings[suggestionIndex]) == null ? void 0 : _k.products) == null ? void 0 : _l.active) && ((_o = (_n = (_m = suggestionSettings[suggestionIndex]) == null ? void 0 : _m.products) == null ? void 0 : _n.list) == null ? void 0 : _o.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6248
6248
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__icon-widget-search-form-result-product-suggestion-no-result-text", children: [
6249
6249
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Sorry" }),
6250
6250
  ", nothing found for ",
@@ -6286,7 +6286,7 @@ const SearchIconWidgetPopup = () => {
6286
6286
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-title", children: (languageSettings == null ? void 0 : languageSettings.product) || "Products" }),
6287
6287
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-item-disabled", children: (languageSettings == null ? void 0 : languageSettings.text_no_result) || "No product were found" })
6288
6288
  ] }),
6289
- (searchResultProduct == null ? void 0 : searchResultProduct.length) || Object.keys(suggestionSettings).length && ((_t = (_s = suggestionSettings[suggestionIndex]) == null ? void 0 : _s.products) == null ? void 0 : _t.active) && ((_w = (_v = (_u = suggestionSettings[suggestionIndex]) == null ? void 0 : _u.products) == null ? void 0 : _v.list) == null ? void 0 : _w.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6289
+ (searchResultProduct == null ? void 0 : searchResultProduct.length) || suggestionSettings && Object.keys(suggestionSettings).length && ((_t = (_s = suggestionSettings[suggestionIndex]) == null ? void 0 : _s.products) == null ? void 0 : _t.active) && ((_w = (_v = (_u = suggestionSettings[suggestionIndex]) == null ? void 0 : _u.products) == null ? void 0 : _v.list) == null ? void 0 : _w.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6290
6290
  Global.SearchViewMoreResult,
6291
6291
  {
6292
6292
  component: handleFunctions.searchViewMoreResultComponent,
@@ -6568,13 +6568,15 @@ const createHierarchicalFacet = ({
6568
6568
  let isHideFacetWhenZeroValue = (_b = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _b.hide_when_zero_value;
6569
6569
  if (isHideFacetWhenZeroValue) {
6570
6570
  let filteredFacets = (searchFacetDistribution == null ? void 0 : searchFacetDistribution[`${indexValue}.lvl${level}`]) || {};
6571
- facets = Object.keys(filteredFacets).map((item) => {
6572
- return {
6573
- name: item,
6574
- value: item,
6575
- total: filteredFacets[item] || 0
6576
- };
6577
- });
6571
+ if (filteredFacets && Object.keys(filteredFacets).length) {
6572
+ facets = Object.keys(filteredFacets).map((item) => {
6573
+ return {
6574
+ name: item,
6575
+ value: item,
6576
+ total: filteredFacets[item] || 0
6577
+ };
6578
+ });
6579
+ }
6578
6580
  }
6579
6581
  if (!facets || facets && !Object.keys(facets).length)
6580
6582
  continue;
@@ -6775,7 +6777,7 @@ const handleSearchResponse = async (props) => {
6775
6777
  const isContainsFilter = (instantSearchSettings == null ? void 0 : instantSearchSettings.contains_filter) && (searchableAttributes == null ? void 0 : searchableAttributes.length) && (keywordProp == null ? void 0 : keywordProp.length);
6776
6778
  let containsFilter = null;
6777
6779
  if (isContainsFilter) {
6778
- containsFilter = searchableAttributes.map((item) => `'${item}' CONTAINS ${JSON.stringify(keywordProp)}`).join(" OR ");
6780
+ containsFilter = `(${searchableAttributes.map((item) => `'${item}' CONTAINS ${JSON.stringify(keywordProp)}`).join(" OR ")})`;
6779
6781
  keyword = "";
6780
6782
  }
6781
6783
  let response;
@@ -9407,13 +9409,15 @@ const SearchResultWidget = (props) => {
9407
9409
  }
9408
9410
  ];
9409
9411
  } else {
9410
- items = Object.keys(facetDistribution[value]).map((item) => {
9411
- return {
9412
- name: item,
9413
- value: item,
9414
- total: facetDistribution[value][item] || 0
9415
- };
9416
- });
9412
+ if ((facetDistribution == null ? void 0 : facetDistribution[value]) && Object.keys(facetDistribution[value]).length) {
9413
+ items = Object.keys(facetDistribution[value]).map((item) => {
9414
+ return {
9415
+ name: item,
9416
+ value: item,
9417
+ total: facetDistribution[value][item] || 0
9418
+ };
9419
+ });
9420
+ }
9417
9421
  }
9418
9422
  return [value, items];
9419
9423
  })
@@ -9582,7 +9586,7 @@ const SearchResultWidget = (props) => {
9582
9586
  setTabs(tabs2);
9583
9587
  if (!clickedTabIndexId) {
9584
9588
  getFirstIndex = (_f2 = tabs2 == null ? void 0 : tabs2.find) == null ? void 0 : _f2.call(tabs2, ({ index }) => index.includes(index_product));
9585
- if (Object.keys(getFirstIndex).length) {
9589
+ if (getFirstIndex && Object.keys(getFirstIndex).length) {
9586
9590
  setClickedTabIndexId(getFirstIndex.index);
9587
9591
  setClickedTabIndexName(getFirstIndex.name);
9588
9592
  setClickedTabIndexType(getFirstIndex.type);
@@ -11398,7 +11402,7 @@ const SearchWidget = (props) => {
11398
11402
  let getValueSearchResultProduct = (valueSearchResultProduct == null ? void 0 : valueSearchResultProduct.length) ? (_f2 = valueSearchResultProduct[0]) == null ? void 0 : _f2.hits : [];
11399
11403
  let valueSuggestionIndex = !keyword.length ? "zero_character" : !(getValueSearchResultProduct == null ? void 0 : getValueSearchResultProduct.length) ? "no_result" : "";
11400
11404
  let isPriorityZeroCharacter = Boolean(
11401
- !keyword.length && Object.keys(suggestion).length && ((_h2 = (_g2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _g2.products) == null ? void 0 : _h2.active) && ((_k2 = (_j2 = (_i2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _i2.products) == null ? void 0 : _j2.list) == null ? void 0 : _k2.length)
11405
+ !keyword.length && suggestion && Object.keys(suggestion).length && ((_h2 = (_g2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _g2.products) == null ? void 0 : _h2.active) && ((_k2 = (_j2 = (_i2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _i2.products) == null ? void 0 : _j2.list) == null ? void 0 : _k2.length)
11402
11406
  );
11403
11407
  setSearchResultProduct(isPriorityZeroCharacter ? (_m2 = (_l2 = suggestion[valueSuggestionIndex]) == null ? void 0 : _l2.products) == null ? void 0 : _m2.list : getValueSearchResultProduct);
11404
11408
  setSearchResultOther(valueSearchResultOther);
@@ -11520,7 +11524,7 @@ const SearchWidget = (props) => {
11520
11524
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { isLoading, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
11521
11525
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__widget-search-form-result-flex", children: [
11522
11526
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__widget-search-form-result-flex-item-other", children: [
11523
- Object.keys(suggestionSettings).length && ((_d = (_c = suggestionSettings[suggestionIndex]) == null ? void 0 : _c.keywords) == null ? void 0 : _d.active) && ((_g = (_f = (_e = suggestionSettings[suggestionIndex]) == null ? void 0 : _e.keywords) == null ? void 0 : _f.list) == null ? void 0 : _g.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
11527
+ suggestionSettings && Object.keys(suggestionSettings).length && ((_d = (_c = suggestionSettings[suggestionIndex]) == null ? void 0 : _c.keywords) == null ? void 0 : _d.active) && ((_g = (_f = (_e = suggestionSettings[suggestionIndex]) == null ? void 0 : _e.keywords) == null ? void 0 : _f.list) == null ? void 0 : _g.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
11524
11528
  Global.SuggestionKeywordLists,
11525
11529
  {
11526
11530
  listsComponent: suggestionKeywordListsComponent,
@@ -11574,7 +11578,7 @@ const SearchWidget = (props) => {
11574
11578
  onAfterRemoveWishlist,
11575
11579
  onAfterRenderProduct
11576
11580
  }
11577
- ) }) : Object.keys(suggestionSettings).length && ((_l = (_k = suggestionSettings[suggestionIndex]) == null ? void 0 : _k.products) == null ? void 0 : _l.active) && ((_o = (_n = (_m = suggestionSettings[suggestionIndex]) == null ? void 0 : _m.products) == null ? void 0 : _n.list) == null ? void 0 : _o.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
11581
+ ) }) : suggestionSettings && Object.keys(suggestionSettings).length && ((_l = (_k = suggestionSettings[suggestionIndex]) == null ? void 0 : _k.products) == null ? void 0 : _l.active) && ((_o = (_n = (_m = suggestionSettings[suggestionIndex]) == null ? void 0 : _m.products) == null ? void 0 : _n.list) == null ? void 0 : _o.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
11578
11582
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__widget-search-form-result-product-suggestion-no-result-text", children: [
11579
11583
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Sorry, nothing found for" }),
11580
11584
  " ",
@@ -11613,7 +11617,7 @@ const SearchWidget = (props) => {
11613
11617
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-search-form-result-product-disabled", children: (languageSettings == null ? void 0 : languageSettings.text_no_result) || "No product were found" })
11614
11618
  ] })
11615
11619
  ] }),
11616
- (searchResultProduct == null ? void 0 : searchResultProduct.length) || Object.keys(suggestionSettings).length && ((_t = (_s = suggestionSettings[suggestionIndex]) == null ? void 0 : _s.products) == null ? void 0 : _t.active) && ((_w = (_v = (_u = suggestionSettings[suggestionIndex]) == null ? void 0 : _u.products) == null ? void 0 : _v.list) == null ? void 0 : _w.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11620
+ (searchResultProduct == null ? void 0 : searchResultProduct.length) || suggestionSettings && Object.keys(suggestionSettings).length && ((_t = (_s = suggestionSettings[suggestionIndex]) == null ? void 0 : _s.products) == null ? void 0 : _t.active) && ((_w = (_v = (_u = suggestionSettings[suggestionIndex]) == null ? void 0 : _u.products) == null ? void 0 : _v.list) == null ? void 0 : _w.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11617
11621
  Global.SearchViewMoreResult,
11618
11622
  {
11619
11623
  component: searchViewMoreResultComponent,