instantsearch.js 4.39.1 → 4.39.2

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.
@@ -1472,7 +1472,7 @@ declare type HierarchicalMenuConnectorParams = {
1472
1472
  *
1473
1473
  * If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
1474
1474
  */
1475
- sortBy?: SortBy<HierarchicalMenuItem>;
1475
+ sortBy?: SortBy<SearchResults.HierarchicalFacet>;
1476
1476
  /**
1477
1477
  * Function to transform the items passed to the templates.
1478
1478
  */
@@ -2533,7 +2533,7 @@ declare type MenuConnectorParams = {
2533
2533
  *
2534
2534
  * If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
2535
2535
  */
2536
- sortBy?: SortBy<MenuItem>;
2536
+ sortBy?: SortBy<SearchResults.HierarchicalFacet>;
2537
2537
  /**
2538
2538
  * Function to transform the items passed to the templates.
2539
2539
  */
@@ -3877,7 +3877,7 @@ declare type RefinementListConnectorParams = {
3877
3877
  *
3878
3878
  * If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
3879
3879
  */
3880
- sortBy?: SortBy<RefinementListItem>;
3880
+ sortBy?: SortBy<SearchResults.FacetValue>;
3881
3881
  /**
3882
3882
  * Escapes the content of the facet values.
3883
3883
  */
@@ -4627,7 +4627,7 @@ declare type SnippetOptions = {
4627
4627
  /**
4628
4628
  * Transforms the given items.
4629
4629
  */
4630
- declare type SortBy<TItem> = ((a: TItem, b: TItem) => number) | Array<'count' | 'isRefined' | 'name:asc' | 'name:desc'>;
4630
+ declare type SortBy<TItem> = ((a: TItem, b: TItem) => number) | Array<SortByDirection<'count' | 'name' | 'isRefined'>>;
4631
4631
 
4632
4632
  /**
4633
4633
  * Sort by selector is a widget used for letting the user choose between different
@@ -4648,6 +4648,8 @@ declare type SortByConnectorParams = {
4648
4648
  transformItems?: TransformItems<SortByItem>;
4649
4649
  };
4650
4650
 
4651
+ declare type SortByDirection<TCriterion extends string> = TCriterion | `${TCriterion}:asc` | `${TCriterion}:desc`;
4652
+
4651
4653
  declare type SortByIndexDefinition = {
4652
4654
  /**
4653
4655
  * The name of the index to target.
@@ -1472,7 +1472,7 @@ declare type HierarchicalMenuConnectorParams = {
1472
1472
  *
1473
1473
  * If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
1474
1474
  */
1475
- sortBy?: SortBy<HierarchicalMenuItem>;
1475
+ sortBy?: SortBy<SearchResults.HierarchicalFacet>;
1476
1476
  /**
1477
1477
  * Function to transform the items passed to the templates.
1478
1478
  */
@@ -2533,7 +2533,7 @@ declare type MenuConnectorParams = {
2533
2533
  *
2534
2534
  * If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
2535
2535
  */
2536
- sortBy?: SortBy<MenuItem>;
2536
+ sortBy?: SortBy<SearchResults.HierarchicalFacet>;
2537
2537
  /**
2538
2538
  * Function to transform the items passed to the templates.
2539
2539
  */
@@ -3877,7 +3877,7 @@ declare type RefinementListConnectorParams = {
3877
3877
  *
3878
3878
  * If a facetOrdering is set in the index settings, it is used when sortBy isn't passed
3879
3879
  */
3880
- sortBy?: SortBy<RefinementListItem>;
3880
+ sortBy?: SortBy<SearchResults.FacetValue>;
3881
3881
  /**
3882
3882
  * Escapes the content of the facet values.
3883
3883
  */
@@ -4627,7 +4627,7 @@ declare type SnippetOptions = {
4627
4627
  /**
4628
4628
  * Transforms the given items.
4629
4629
  */
4630
- declare type SortBy<TItem> = ((a: TItem, b: TItem) => number) | Array<'count' | 'isRefined' | 'name:asc' | 'name:desc'>;
4630
+ declare type SortBy<TItem> = ((a: TItem, b: TItem) => number) | Array<SortByDirection<'count' | 'name' | 'isRefined'>>;
4631
4631
 
4632
4632
  /**
4633
4633
  * Sort by selector is a widget used for letting the user choose between different
@@ -4648,6 +4648,8 @@ declare type SortByConnectorParams = {
4648
4648
  transformItems?: TransformItems<SortByItem>;
4649
4649
  };
4650
4650
 
4651
+ declare type SortByDirection<TCriterion extends string> = TCriterion | `${TCriterion}:asc` | `${TCriterion}:desc`;
4652
+
4651
4653
  declare type SortByIndexDefinition = {
4652
4654
  /**
4653
4655
  * The name of the index to target.