@sledge-app/react-instant-search 2.0.68 → 2.0.69

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.
@@ -10769,14 +10769,22 @@ const ResultProduct = React__default.memo((props) => {
10769
10769
  let sort = soldProductAtEnd ? ["availability:asc"] : [];
10770
10770
  if (clickedSortId)
10771
10771
  sort.push(clickedSortId);
10772
- if (collectionDefaultSortBy && ((_a2 = sort == null ? void 0 : sort.some) == null ? void 0 : _a2.call(sort, (item) => item.includes("featuredSort."))) && (instantSearchSettings == null ? void 0 : instantSearchSettings.featured_as_collection_default_sort)) {
10773
- const sortMap = getSortMap({
10774
- activeCollectionId: collectionId,
10775
- collectionAllId: instantSearchSettings == null ? void 0 : instantSearchSettings.collections_all_id
10776
- });
10772
+ if ((_a2 = sort == null ? void 0 : sort.some) == null ? void 0 : _a2.call(sort, (item) => item.includes("featuredSort."))) {
10777
10773
  sort = sort.map((item) => {
10774
+ var _a3;
10778
10775
  if (item.includes("featuredSort.")) {
10779
- return sortMap[collectionDefaultSortBy];
10776
+ if (collectionDefaultSortBy && (instantSearchSettings == null ? void 0 : instantSearchSettings.featured_as_collection_default_sort)) {
10777
+ const sortMap = getSortMap({
10778
+ activeCollectionId: collectionId,
10779
+ collectionAllId: instantSearchSettings == null ? void 0 : instantSearchSettings.collections_all_id
10780
+ });
10781
+ return sortMap[collectionDefaultSortBy];
10782
+ } else {
10783
+ const collectionIdSelected = collectionId || (instantSearchSettings == null ? void 0 : instantSearchSettings.collections_all_id) || "";
10784
+ if (collectionIdSelected && ((_a3 = instantSearchSettings == null ? void 0 : instantSearchSettings.have_merchandising_settings) == null ? void 0 : _a3[collectionIdSelected])) {
10785
+ return `merchandising.${collectionIdSelected}.position:asc`;
10786
+ }
10787
+ }
10780
10788
  }
10781
10789
  return item;
10782
10790
  });