@sledge-app/react-instant-search 1.0.31 → 1.0.33

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.
@@ -30,6 +30,7 @@ const DATASET_ATTRIBUTE_KEY = {
30
30
  USER_EMAIL: "data-user-email",
31
31
  USER_FULLNAME: "data-user-fullname",
32
32
  COLLECTION_ID: "data-collection-id",
33
+ COLLECTION_NAME: "data-collection-name",
33
34
  WIDTH_ELEMENT: "data-width-element",
34
35
  ICON_SIZE: "data-icon-size",
35
36
  API_KEY: "data-api-key",
@@ -1279,7 +1280,7 @@ const Trigger = (props) => {
1279
1280
  if (typeof window !== "undefined" && window.sledgeToastNotification && show_notification)
1280
1281
  window.sledgeToastNotification({
1281
1282
  title: title_fail_add_to_wishlist || "Failed",
1282
- message: text_fail_add_to_wishlist || "failed add to wishlist",
1283
+ message: text_fail_add_to_wishlist || "Failed add to wishlist, please try again",
1283
1284
  location: location_notification,
1284
1285
  type: "failed",
1285
1286
  icon: /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 40, height: 40, color: "black", type: "outline" })
@@ -1394,7 +1395,7 @@ const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLo
1394
1395
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isRequiredLogin && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !shareId && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "132px", height: "46px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", colorType: "danger", onClick: handleClick, style: display_button_clear_all_style, children: buttonText ? buttonText : button_clear_all || "Clear Wishlist" }) }) }) }) });
1395
1396
  };
1396
1397
  const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger, shareLink, shareId, dataSettings, isFirstLoading }) => {
1397
- var _a, _b, _c, _d, _e, _f, _g;
1398
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1398
1399
  const { triggerRenderMultipleComponent, sledgeAnonymId } = React__default.useContext(SledgeContext);
1399
1400
  const { trigger: triggerRenderWishlistBadge } = ((_a = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _a.badge) || {};
1400
1401
  const { is_required_login } = ((_b = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _b.global) || {};
@@ -1413,7 +1414,8 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
1413
1414
  } = ((_d = (_c = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _c.widget) == null ? void 0 : _d.button_share) || {};
1414
1415
  const { title_share_wishlist } = ((_e = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _e.popup) || {};
1415
1416
  const { button_share } = ((_f = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _f.widget) || {};
1416
- const { title_added_all_to_wishlist, text_added_all_to_wishlist } = ((_g = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _g.notification) || {};
1417
+ const { show: show_notification, location: location_notification } = ((_g = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _g.notification) || {};
1418
+ const { title_added_all_to_wishlist, text_added_all_to_wishlist, title_fail_add_to_wishlist, text_fail_add_to_wishlist } = ((_h = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _h.notification) || {};
1417
1419
  const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
1418
1420
  const display_button_share_style = {
1419
1421
  ...display_button_share_text_color && { color: display_button_share_text_color },
@@ -1464,17 +1466,18 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
1464
1466
  if (window.sledgeInfoPopup)
1465
1467
  window.sledgeInfoPopup({
1466
1468
  title: title_added_all_to_wishlist,
1467
- message: text_added_all_to_wishlist,
1468
- textCancel: "Cancel"
1469
+ message: text_added_all_to_wishlist
1469
1470
  });
1470
1471
  }
1471
1472
  setIsLoadingBulkAdd(false);
1472
1473
  } else {
1473
- if (typeof window !== "undefined" && window.sledgeInfoPopup)
1474
- window.sledgeInfoPopup({
1475
- title: "Failed",
1476
- message: "Failed add to wishlist, please try again",
1477
- textCancel: "Cancel"
1474
+ if (typeof window !== "undefined" && window.sledgeToastNotification && show_notification)
1475
+ window.sledgeToastNotification({
1476
+ title: title_fail_add_to_wishlist || "Failed",
1477
+ message: text_fail_add_to_wishlist || "Failed add to wishlist, please try again",
1478
+ location: location_notification,
1479
+ type: "failed",
1480
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 40, height: 40, color: "black", type: "outline" })
1478
1481
  });
1479
1482
  }
1480
1483
  };
@@ -1522,8 +1525,7 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
1522
1525
  ${clipboardIcon}
1523
1526
  </div>
1524
1527
  <div class="sledge-wishlist__widget-box-copy-content">${shareLink}</div>
1525
- </div>` : "",
1526
- textCancel: "Cancel"
1528
+ </div>` : ""
1527
1529
  });
1528
1530
  }
1529
1531
  }
@@ -2379,6 +2381,7 @@ const ProductCard = (props) => {
2379
2381
  show_price = true,
2380
2382
  show_add_to_cart = true,
2381
2383
  language_button_add_to_cart,
2384
+ language_button_out_of_stock,
2382
2385
  display_product_name_style = {},
2383
2386
  display_price_style = {},
2384
2387
  display_button_add_to_cart_style = {}
@@ -2542,7 +2545,7 @@ const ProductCard = (props) => {
2542
2545
  ]
2543
2546
  }
2544
2547
  ),
2545
- isOutOfStock ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-out-of-stock", children: "Sold out" }) : null
2548
+ isOutOfStock ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-out-of-stock", children: language_button_out_of_stock || "Sold out" }) : null
2546
2549
  ] }),
2547
2550
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-desc", children: [
2548
2551
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-title", children: [
@@ -2650,7 +2653,7 @@ ${selectedOption === item2 ? "sledge__product-variant-size-swatch-active" : ""}
2650
2653
  },
2651
2654
  children: isOutOfStock ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2652
2655
  /* @__PURE__ */ jsxRuntimeExports.jsx(BagIcon, { width: 15, height: 15, color: "currentColor" }),
2653
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Sold out" })
2656
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: language_button_out_of_stock || "Sold out" })
2654
2657
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2655
2658
  isLoadingAddToCart ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingDots, {}) : null,
2656
2659
  /* @__PURE__ */ jsxRuntimeExports.jsx(BagIcon, { width: 15, height: 15, color: "currentColor" }),
@@ -3237,13 +3240,15 @@ const SearchIconWidget = (props) => {
3237
3240
  const OtherIndexLists = ({
3238
3241
  listsComponent: ListsComponent,
3239
3242
  name,
3243
+ type,
3240
3244
  items,
3241
3245
  isComponentJsVersion,
3242
3246
  showPopupComponent,
3243
- setShowPopupComponent
3247
+ setShowPopupComponent,
3248
+ languageSettings
3244
3249
  }) => {
3245
3250
  if (ListsComponent) {
3246
- const ListsProps = { name, items, showPopupComponent, setShowPopupComponent };
3251
+ const ListsProps = { name, type, items, showPopupComponent, setShowPopupComponent };
3247
3252
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: ListsComponent({ ...ListsProps }) } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ListsComponent, { ...ListsProps }) });
3248
3253
  } else {
3249
3254
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -3251,11 +3256,7 @@ const OtherIndexLists = ({
3251
3256
  (items == null ? void 0 : items.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__icon-widget-search-form-result-list", children: items.map((hit, index) => {
3252
3257
  const { title, url } = hit;
3253
3258
  return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, className: "sledge-instant-search__icon-widget-search-form-result-list-link", children: title }) }, index);
3254
- }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__icon-widget-search-form-result-list", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "sledge-instant-search__icon-widget-search-form-result-item-disabled", children: [
3255
- "No ",
3256
- name == null ? void 0 : name.toLowerCase(),
3257
- " were found"
3258
- ] }) })
3259
+ }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__icon-widget-search-form-result-list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: "sledge-instant-search__icon-widget-search-form-result-item-disabled", children: (languageSettings == null ? void 0 : languageSettings.title_no_result) || `No ${name == null ? void 0 : name.toLowerCase()} were found` }) })
3259
3260
  ] });
3260
3261
  }
3261
3262
  };
@@ -3306,7 +3307,8 @@ const SearchViewMoreResult = ({
3306
3307
  showPopupComponent,
3307
3308
  setShowPopupComponent,
3308
3309
  urlSearchResult = "",
3309
- query
3310
+ query,
3311
+ languageSettings
3310
3312
  }) => {
3311
3313
  var _a;
3312
3314
  if (Component) {
@@ -3320,7 +3322,7 @@ const SearchViewMoreResult = ({
3320
3322
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: Component({ ...ComponentProps }) } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ...ComponentProps }) });
3321
3323
  } else {
3322
3324
  const queryKeyword = (query == null ? void 0 : query.keyword) ? query.keyword : DEFAULT_QUERY_PARAM.KEYWORD;
3323
- return /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: `${urlSearchResult || DEFAULT_SEARCH_RESULT_URL}?${queryKeyword}=${keyword}`, className: "sledge-instant-search__icon-widget-button-more", children: "View More Result" });
3325
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: `${urlSearchResult || DEFAULT_SEARCH_RESULT_URL}?${queryKeyword}=${keyword}`, className: "sledge-instant-search__icon-widget-button-more", children: (languageSettings == null ? void 0 : languageSettings.view_more_result) || "View More Result" });
3324
3326
  }
3325
3327
  };
3326
3328
  const Global = {
@@ -3398,11 +3400,12 @@ const SearchIconWidgetPopup = () => {
3398
3400
  }
3399
3401
  let valueSearchResultOther = ((_c2 = results == null ? void 0 : results.filter(({ indexUid }) => !(indexUid == null ? void 0 : indexUid.includes(index_product)))) == null ? void 0 : _c2.map((result) => {
3400
3402
  const { indexUid } = result;
3401
- const { name } = tabs == null ? void 0 : tabs.find(({ index }) => index.includes(indexUid));
3403
+ const { name, type } = tabs == null ? void 0 : tabs.find(({ index }) => index.includes(indexUid));
3402
3404
  return {
3403
3405
  ...result,
3404
3406
  ...{
3405
- name: name || ""
3407
+ name: name || "",
3408
+ type: type || ""
3406
3409
  }
3407
3410
  };
3408
3411
  })) || [];
@@ -3580,16 +3583,18 @@ const SearchIconWidgetPopup = () => {
3580
3583
  }
3581
3584
  ) : null,
3582
3585
  searchResultOther && searchResultOther.map((item, index) => {
3583
- const { hits, name } = item;
3586
+ const { hits, name, type } = item;
3584
3587
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3585
3588
  Global.OtherIndexLists,
3586
3589
  {
3587
3590
  listsComponent: handleFunctions.otherIndexListsComponent,
3588
3591
  name,
3592
+ type,
3589
3593
  items: hits,
3590
3594
  isComponentJsVersion: handleFunctions.isJsVersion,
3591
3595
  showPopupComponent: showInfo,
3592
- setShowPopupComponent: setShowInfo
3596
+ setShowPopupComponent: setShowInfo,
3597
+ languageSettings
3593
3598
  }
3594
3599
  ) }, index);
3595
3600
  })
@@ -3610,7 +3615,9 @@ const SearchIconWidgetPopup = () => {
3610
3615
  setting: {
3611
3616
  show_vendor: (_h = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _h.show_vendor,
3612
3617
  show_sku: (_i = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _i.show_sku,
3613
- show_price: (_j = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _j.show_price
3618
+ show_price: (_j = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _j.show_price,
3619
+ language_button_add_to_cart: languageSettings == null ? void 0 : languageSettings.add_to_cart,
3620
+ language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
3614
3621
  },
3615
3622
  showOptionOutOfStock: true,
3616
3623
  isComponentJsVersion: handleFunctions.isJsVersion,
@@ -3645,7 +3652,9 @@ const SearchIconWidgetPopup = () => {
3645
3652
  setting: {
3646
3653
  show_vendor: (_p = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _p.show_vendor,
3647
3654
  show_sku: (_q = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _q.show_sku,
3648
- show_price: (_r = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _r.show_price
3655
+ show_price: (_r = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _r.show_price,
3656
+ language_button_add_to_cart: languageSettings == null ? void 0 : languageSettings.add_to_cart,
3657
+ language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
3649
3658
  },
3650
3659
  showOptionOutOfStock: true,
3651
3660
  isComponentJsVersion: handleFunctions.isJsVersion,
@@ -3659,8 +3668,8 @@ const SearchIconWidgetPopup = () => {
3659
3668
  }
3660
3669
  )
3661
3670
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
3662
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-title", children: "Products" }),
3663
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-item-disabled", children: "No product were found" })
3671
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-title", children: (languageSettings == null ? void 0 : languageSettings.product) || "Products" }),
3672
+ /* @__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" })
3664
3673
  ] }),
3665
3674
  (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(
3666
3675
  Global.SearchViewMoreResult,
@@ -3671,7 +3680,8 @@ const SearchIconWidgetPopup = () => {
3671
3680
  showPopupComponent: showInfo,
3672
3681
  setShowPopupComponent: setShowInfo,
3673
3682
  urlSearchResult,
3674
- query: handleFunctions.query
3683
+ query: handleFunctions.query,
3684
+ languageSettings
3675
3685
  }
3676
3686
  ) }) : null
3677
3687
  ] })
@@ -4262,7 +4272,7 @@ const ResultProduct = (props) => {
4262
4272
  setIsReplaceWidgetList
4263
4273
  } = props || {};
4264
4274
  const queryKeyword = (query == null ? void 0 : query.keyword) ? query.keyword : DEFAULT_QUERY_PARAM.KEYWORD;
4265
- const { collectionId } = params || {};
4275
+ const { collectionId, collectionName } = params || {};
4266
4276
  const [isFirstLoading, setIsFirstLoading] = React__default.useState(!propsData);
4267
4277
  const [isLoading, setIsLoading] = React__default.useState(!propsData);
4268
4278
  const [isOpenSort, setIsOpenSort] = React__default.useState(false);
@@ -4288,11 +4298,23 @@ const ResultProduct = (props) => {
4288
4298
  const [isFilterChanged, setIsFilterChanged] = React__default.useState(false);
4289
4299
  const [handleSearchResultFirstTime, setHandleSearchResultFirstTime] = React__default.useState(true);
4290
4300
  const [searchResultFacets, setSearchResultFacets] = React__default.useState({});
4291
- const summaryTextGenerator = () => {
4301
+ const {
4302
+ sort_by: language_sort_by,
4303
+ result: language_result,
4304
+ search_form_placeholder: language_search_form_placeholder,
4305
+ limit: language_limit,
4306
+ add_to_cart: language_add_to_cart,
4307
+ filter: language_filter,
4308
+ clear_filter: language_clear_filter,
4309
+ pagination_info: language_pagination_info,
4310
+ total_result_text: language_total_result_text
4311
+ } = languageSettings || {};
4312
+ const summaryTextGenerator = (totalResult) => {
4292
4313
  var _a2;
4293
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: ((_a2 = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a2.show_total_products) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-instant-search__result-data-summary-text", children: [
4294
- totalSearchResult,
4295
- " result",
4314
+ const defaultSummaryText = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4315
+ totalResult,
4316
+ " ",
4317
+ language_result || "result",
4296
4318
  " ",
4297
4319
  (keyword == null ? void 0 : keyword.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4298
4320
  "for ",
@@ -4302,9 +4324,17 @@ const ResultProduct = (props) => {
4302
4324
  '"'
4303
4325
  ] })
4304
4326
  ] }) : null
4305
- ] }) : null });
4327
+ ] });
4328
+ let getSummaryText = language_total_result_text[layoutType === "product-filter" ? "product_filter" : "product"];
4329
+ let isSummaryTextFromLanguage = language_total_result_text && getSummaryText && collectionName;
4330
+ if (isSummaryTextFromLanguage) {
4331
+ getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.TOTAL_RESULT, totalResult);
4332
+ if (layoutType === "product-filter")
4333
+ getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.COLLECTION_NAME, collectionName);
4334
+ }
4335
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: ((_a2 = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a2.show_total_products) ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-data-summary-text", children: isSummaryTextFromLanguage ? getSummaryText : defaultSummaryText }) : null });
4306
4336
  };
4307
- const [summaryText, setSummaryText] = React__default.useState(propsData ? summaryTextGenerator() : null);
4337
+ const [summaryText, setSummaryText] = React__default.useState(propsData ? summaryTextGenerator(totalSearchResult) : null);
4308
4338
  const previousState = usePrevious({ keyword, clickedLimitId, clickedFacets, clickedTabIndexId });
4309
4339
  const { color: filter_title_color, font_size: filter_title_font_size, font_weight: filter_title_font_weight, text_transform: filter_title_text_transform } = ((_i = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _i.title) || {};
4310
4340
  const {
@@ -4326,17 +4356,6 @@ const ResultProduct = (props) => {
4326
4356
  font_weight: filter_button_font_weight,
4327
4357
  text_transform: filter_button_text_transform
4328
4358
  } = ((_k = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _k.button) || {};
4329
- const {
4330
- sort_by: language_sort_by,
4331
- result: language_result,
4332
- search_form_placeholder: language_search_form_placeholder,
4333
- limit: language_limit,
4334
- add_to_cart: language_add_to_cart,
4335
- filter: language_filter,
4336
- clear_filter: language_clear_filter,
4337
- pagination_info: language_pagination_info,
4338
- total_result_text: language_total_result_text
4339
- } = languageSettings || {};
4340
4359
  const filter_title_style = {
4341
4360
  ...filter_title_color && { color: filter_title_color },
4342
4361
  ...filter_title_font_size && { fontSize: filter_title_font_size },
@@ -4468,7 +4487,6 @@ const ResultProduct = (props) => {
4468
4487
  }, 10);
4469
4488
  };
4470
4489
  const handleSearchResultData = (result, onSearch) => {
4471
- var _a2;
4472
4490
  if (!result)
4473
4491
  return;
4474
4492
  const { hits, processingTimeMs, totalHits, totalPages, facetDistribution } = result;
@@ -4485,22 +4503,7 @@ const ResultProduct = (props) => {
4485
4503
  setSearchProcessingTimeMs(processingTimeMs || 0);
4486
4504
  setTotalPage(totalPages);
4487
4505
  setTotalSearchResult(totalHits || 0);
4488
- setSummaryText(
4489
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: ((_a2 = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a2.show_total_products) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-instant-search__result-data-summary-text", children: [
4490
- totalHits,
4491
- " ",
4492
- language_result || "result",
4493
- " ",
4494
- (keyword == null ? void 0 : keyword.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4495
- "for ",
4496
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-instant-search__result-data-summary-text-keyword", children: [
4497
- '"',
4498
- keyword,
4499
- '"'
4500
- ] })
4501
- ] }) : null
4502
- ] }) : null })
4503
- );
4506
+ setSummaryText(summaryTextGenerator(totalHits));
4504
4507
  setSearchResultFacets(
4505
4508
  defaultFacetDistribution ? Object.fromEntries(
4506
4509
  Object.entries(defaultFacetDistribution).map((facet) => {
@@ -4998,7 +5001,8 @@ const ResultProduct = (props) => {
4998
5001
  show_vendor: (_z = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _z.show_vendor,
4999
5002
  show_sku: (_A = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _A.show_sku,
5000
5003
  show_price: (_B = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _B.show_price,
5001
- language_button_add_to_cart: language_add_to_cart
5004
+ language_button_add_to_cart: language_add_to_cart,
5005
+ language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
5002
5006
  },
5003
5007
  isComponentJsVersion: isJsVersion,
5004
5008
  cards: productCardsComponent,
@@ -5024,6 +5028,7 @@ const ResultCategory = (props) => {
5024
5028
  clickedTabIndexId,
5025
5029
  clickedTabIndexName,
5026
5030
  clickedTabIndexType,
5031
+ displaySettings,
5027
5032
  isJsVersion,
5028
5033
  collectionCardsComponent,
5029
5034
  pageCardsComponent,
@@ -5049,7 +5054,34 @@ const ResultCategory = (props) => {
5049
5054
  const [totalSearchResult, setTotalSearchResult] = React__default.useState(0);
5050
5055
  const [summaryText, setSummaryText] = React__default.useState(null);
5051
5056
  const previousState = usePrevious({ keyword, clickedTabIndexId });
5052
- const { pagination_info: language_pagination_info, search_form_placeholder: language_search_form_placeholder } = languageSettings || {};
5057
+ const {
5058
+ pagination_info: language_pagination_info,
5059
+ search_form_placeholder: language_search_form_placeholder,
5060
+ result: language_result,
5061
+ total_result_text: language_total_result_text
5062
+ } = languageSettings || {};
5063
+ const summaryTextGenerator = (totalResult) => {
5064
+ var _a;
5065
+ const defaultSummaryText = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
5066
+ totalResult,
5067
+ " ",
5068
+ language_result || "result",
5069
+ " ",
5070
+ (keyword == null ? void 0 : keyword.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
5071
+ "for ",
5072
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-instant-search__result-data-summary-text-keyword", children: [
5073
+ '"',
5074
+ keyword,
5075
+ '"'
5076
+ ] })
5077
+ ] }) : null
5078
+ ] });
5079
+ let getSummaryText = clickedTabIndexType ? language_total_result_text[clickedTabIndexType] : null;
5080
+ let isSummaryTextFromLanguage = language_total_result_text && getSummaryText;
5081
+ if (isSummaryTextFromLanguage)
5082
+ getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.TOTAL_RESULT, totalResult);
5083
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: ((_a = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a.show_total_products) ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-data-summary-text", children: isSummaryTextFromLanguage ? getSummaryText : defaultSummaryText }) : null });
5084
+ };
5053
5085
  const handleSearchResultData = (result) => {
5054
5086
  if (!result)
5055
5087
  return;
@@ -5061,21 +5093,7 @@ const ResultCategory = (props) => {
5061
5093
  setSearchProcessingTimeMs(processingTimeMs || 0);
5062
5094
  setTotalPage(totalPages);
5063
5095
  setTotalSearchResult(totalHits || 0);
5064
- setSummaryText(
5065
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-instant-search__result-data-summary-text", children: [
5066
- totalHits,
5067
- " result",
5068
- " ",
5069
- (keyword == null ? void 0 : keyword.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
5070
- "for ",
5071
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-instant-search__result-data-summary-text-keyword", children: [
5072
- '"',
5073
- keyword,
5074
- '"'
5075
- ] })
5076
- ] }) : null
5077
- ] }) })
5078
- );
5096
+ setSummaryText(summaryTextGenerator(totalHits));
5079
5097
  };
5080
5098
  const handleSearchResult = async (isRefreshPage = false) => {
5081
5099
  if (!clickedTabIndexId)
@@ -5248,11 +5266,12 @@ const SearchWidget = (props) => {
5248
5266
  }
5249
5267
  let valueSearchResultOther = ((_c2 = results == null ? void 0 : results.filter(({ indexUid }) => !(indexUid == null ? void 0 : indexUid.includes(index_product)))) == null ? void 0 : _c2.map((result) => {
5250
5268
  const { indexUid } = result;
5251
- const { name } = tabs == null ? void 0 : tabs.find(({ index }) => index.includes(indexUid));
5269
+ const { name, type } = tabs == null ? void 0 : tabs.find(({ index }) => index.includes(indexUid));
5252
5270
  return {
5253
5271
  ...result,
5254
5272
  ...{
5255
- name: name || ""
5273
+ name: name || "",
5274
+ type: type || ""
5256
5275
  }
5257
5276
  };
5258
5277
  })) || [];
@@ -5385,12 +5404,22 @@ const SearchWidget = (props) => {
5385
5404
  }
5386
5405
  ) : null,
5387
5406
  searchResultOther.map((item, index) => {
5388
- const { hits, name } = item;
5389
- return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Global.OtherIndexLists, { listsComponent: otherIndexListsComponent, name, items: hits, isComponentJsVersion: isJsVersion }) }, index);
5407
+ const { hits, name, type } = item;
5408
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5409
+ Global.OtherIndexLists,
5410
+ {
5411
+ listsComponent: otherIndexListsComponent,
5412
+ name,
5413
+ type,
5414
+ items: hits,
5415
+ isComponentJsVersion: isJsVersion,
5416
+ languageSettings
5417
+ }
5418
+ ) }, index);
5390
5419
  })
5391
5420
  ] }),
5392
5421
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__widget-search-form-result-flex-item-product", children: [
5393
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-search-form-result-title-product", children: "Products" }),
5422
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-search-form-result-title-product", children: (languageSettings == null ? void 0 : languageSettings.product) || "Products" }),
5394
5423
  (searchResultProduct == null ? void 0 : searchResultProduct.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-search-form-result-product", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5395
5424
  ProductGrid,
5396
5425
  {
@@ -5406,7 +5435,9 @@ const SearchWidget = (props) => {
5406
5435
  setting: {
5407
5436
  show_vendor: (_g = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _g.show_vendor,
5408
5437
  show_sku: (_h = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _h.show_sku,
5409
- show_price: (_i = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _i.show_price
5438
+ show_price: (_i = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _i.show_price,
5439
+ language_button_add_to_cart: languageSettings == null ? void 0 : languageSettings.add_to_cart,
5440
+ language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
5410
5441
  },
5411
5442
  showOptionOutOfStock: true,
5412
5443
  isComponentJsVersion: isJsVersion,
@@ -5439,7 +5470,9 @@ const SearchWidget = (props) => {
5439
5470
  setting: {
5440
5471
  show_vendor: (_o = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _o.show_vendor,
5441
5472
  show_sku: (_p = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _p.show_sku,
5442
- show_price: (_q = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _q.show_price
5473
+ show_price: (_q = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _q.show_price,
5474
+ language_button_add_to_cart: languageSettings == null ? void 0 : languageSettings.add_to_cart,
5475
+ language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
5443
5476
  },
5444
5477
  showOptionOutOfStock: true,
5445
5478
  isComponentJsVersion: isJsVersion,
@@ -5450,7 +5483,7 @@ const SearchWidget = (props) => {
5450
5483
  onAfterRenderProduct
5451
5484
  }
5452
5485
  )
5453
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-search-form-result-product-disabled", children: "No product were found" })
5486
+ ] }) : /* @__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" })
5454
5487
  ] })
5455
5488
  ] }),
5456
5489
  (searchResultProduct == null ? void 0 : searchResultProduct.length) || Object.keys(suggestionSettings).length && ((_s = (_r = suggestionSettings[suggestionIndex]) == null ? void 0 : _r.products) == null ? void 0 : _s.active) && ((_v = (_u = (_t = suggestionSettings[suggestionIndex]) == null ? void 0 : _t.products) == null ? void 0 : _u.list) == null ? void 0 : _v.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5460,7 +5493,8 @@ const SearchWidget = (props) => {
5460
5493
  keyword,
5461
5494
  isComponentJsVersion: isJsVersion,
5462
5495
  urlSearchResult,
5463
- query
5496
+ query,
5497
+ languageSettings
5464
5498
  }
5465
5499
  ) }) : null
5466
5500
  ] }) }) })