instantsearch.js 4.44.0 → 4.45.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/cjs/connectors/hits-per-page/connectHitsPerPage.js +3 -1
  3. package/cjs/connectors/numeric-menu/connectNumericMenu.js +31 -43
  4. package/cjs/connectors/range/connectRange.js +7 -46
  5. package/cjs/connectors/rating-menu/connectRatingMenu.js +10 -4
  6. package/cjs/connectors/sort-by/connectSortBy.js +3 -1
  7. package/cjs/lib/version.js +1 -1
  8. package/cjs/widgets/clear-refinements/clear-refinements.js +2 -2
  9. package/dist/instantsearch.development.d.ts +29 -10
  10. package/dist/instantsearch.development.js +113 -124
  11. package/dist/instantsearch.development.js.map +1 -1
  12. package/dist/instantsearch.production.d.ts +29 -10
  13. package/dist/instantsearch.production.min.d.ts +29 -10
  14. package/dist/instantsearch.production.min.js +2 -2
  15. package/dist/instantsearch.production.min.js.map +1 -1
  16. package/es/components/Answers/Answers.d.ts +2 -2
  17. package/es/components/Hits/Hits.d.ts +2 -2
  18. package/es/components/InfiniteHits/InfiniteHits.d.ts +2 -2
  19. package/es/connectors/answers/connectAnswers.d.ts +2 -2
  20. package/es/connectors/autocomplete/connectAutocomplete.d.ts +2 -2
  21. package/es/connectors/hits-per-page/connectHitsPerPage.d.ts +5 -0
  22. package/es/connectors/hits-per-page/connectHitsPerPage.js +3 -1
  23. package/es/connectors/numeric-menu/connectNumericMenu.d.ts +8 -0
  24. package/es/connectors/numeric-menu/connectNumericMenu.js +32 -44
  25. package/es/connectors/range/connectRange.js +8 -47
  26. package/es/connectors/rating-menu/connectRatingMenu.d.ts +2 -0
  27. package/es/connectors/rating-menu/connectRatingMenu.js +10 -4
  28. package/es/connectors/sort-by/connectSortBy.d.ts +5 -0
  29. package/es/connectors/sort-by/connectSortBy.js +3 -1
  30. package/es/lib/insights/client.d.ts +2 -2
  31. package/es/lib/utils/createSendEventForHits.d.ts +3 -3
  32. package/es/lib/version.d.ts +1 -1
  33. package/es/lib/version.js +1 -1
  34. package/es/types/connector.d.ts +2 -2
  35. package/es/widgets/clear-refinements/clear-refinements.js +2 -2
  36. package/package.json +4 -3
@@ -173,7 +173,7 @@ declare type AnswersRenderState = {
173
173
  /**
174
174
  * The matched hits from Algolia API.
175
175
  */
176
- hits: Hits;
176
+ hits: Hit[];
177
177
  /**
178
178
  * Whether it's still loading the results from the Answers API.
179
179
  */
@@ -264,7 +264,7 @@ declare type AutocompleteRenderState = {
264
264
  /**
265
265
  * The resolved hits from the index matching the query.
266
266
  */
267
- hits: Hits;
267
+ hits: Hit[];
268
268
  /**
269
269
  * The full results object from the Algolia API.
270
270
  */
@@ -518,11 +518,11 @@ declare type BrowserHistoryArgs<TRouteState> = {
518
518
  getLocation(): Location;
519
519
  };
520
520
 
521
- declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => string;
521
+ declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => string;
522
522
 
523
523
  declare type BuiltInSendEventForFacet = (eventType: string, facetValue: string, eventName?: string) => void;
524
524
 
525
- declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => void;
525
+ declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => void;
526
526
 
527
527
  declare type BuiltInSendEventForToggle = (eventType: string, isRefined: boolean, eventName?: string) => void;
528
528
 
@@ -1769,11 +1769,6 @@ declare type HitHighlightResult = {
1769
1769
  [attribute: string]: HitAttributeHighlightResult | HitAttributeHighlightResult[] | HitHighlightResult[] | HitHighlightResult;
1770
1770
  };
1771
1771
 
1772
- /**
1773
- * @deprecated use Hit[] directly instead
1774
- */
1775
- declare type Hits = Hit[];
1776
-
1777
1772
  declare const hits: HitsWidget;
1778
1773
 
1779
1774
  declare type HitsConnector<THit extends BaseHit = BaseHit> = Connector<HitsWidgetDescription<THit>, HitsConnectorParams<THit>>;
@@ -1872,8 +1867,13 @@ declare type HitsPerPageRenderState = {
1872
1867
  refine: (value: number) => void;
1873
1868
  /**
1874
1869
  * Indicates whether or not the search has results.
1870
+ * @deprecated Use `canRefine` instead.
1875
1871
  */
1876
1872
  hasNoResults: boolean;
1873
+ /**
1874
+ * Indicates if search state can be refined.
1875
+ */
1876
+ canRefine: boolean;
1877
1877
  };
1878
1878
 
1879
1879
  declare type HitsPerPageRenderStateItem = {
@@ -2401,6 +2401,10 @@ declare type InstantSearchModule = {
2401
2401
  reverseHighlight: typeof helpers.reverseHighlight;
2402
2402
  snippet: typeof helpers.snippet;
2403
2403
  reverseSnippet: typeof helpers.reverseSnippet;
2404
+ /**
2405
+ * @deprecated use createInsightsMiddleware
2406
+ * @link https://www.algolia.com/doc/api-reference/widgets/insights/js/
2407
+ */
2404
2408
  insights: typeof helpers.insights;
2405
2409
  };
2406
2410
 
@@ -2855,8 +2859,16 @@ declare type NumericMenuRenderState = {
2855
2859
  createURL: CreateURL<NumericMenuRenderStateItem['value']>;
2856
2860
  /**
2857
2861
  * `true` if the last search contains no result
2862
+ * @deprecated Use `canRefine` instead.
2858
2863
  */
2859
2864
  hasNoResults: boolean;
2865
+ /**
2866
+ * Indicates if search state can be refined.
2867
+ *
2868
+ * This is `true` if the last search contains no result and
2869
+ * "All" range is selected
2870
+ */
2871
+ canRefine: boolean;
2860
2872
  /**
2861
2873
  * Sets the selected value and trigger a new search
2862
2874
  */
@@ -3721,6 +3733,8 @@ declare type RatingMenuRenderState = {
3721
3733
  refine: (value: string) => void;
3722
3734
  /**
3723
3735
  * `true` if the last search contains no result.
3736
+ *
3737
+ * @deprecated Use `canRefine` instead.
3724
3738
  */
3725
3739
  hasNoResults: boolean;
3726
3740
  /**
@@ -4240,7 +4254,7 @@ declare type RendererOptions<TWidgetParams> = {
4240
4254
  * The mutable list of hits. The may change depending
4241
4255
  * of the given transform items function.
4242
4256
  */
4243
- hits?: Hits;
4257
+ hits?: Hit[];
4244
4258
  /**
4245
4259
  * The current insights client, if any.
4246
4260
  */
@@ -4683,8 +4697,13 @@ declare type SortByRenderState = {
4683
4697
  refine: (value: string) => void;
4684
4698
  /**
4685
4699
  * `true` if the last search contains no result.
4700
+ * @deprecated Use `canRefine` instead.
4686
4701
  */
4687
4702
  hasNoResults: boolean;
4703
+ /**
4704
+ * `true` if we can refine.
4705
+ */
4706
+ canRefine: boolean;
4688
4707
  };
4689
4708
 
4690
4709
  declare type SortByWidget = WidgetFactory<SortByWidgetDescription & {
@@ -173,7 +173,7 @@ declare type AnswersRenderState = {
173
173
  /**
174
174
  * The matched hits from Algolia API.
175
175
  */
176
- hits: Hits;
176
+ hits: Hit[];
177
177
  /**
178
178
  * Whether it's still loading the results from the Answers API.
179
179
  */
@@ -264,7 +264,7 @@ declare type AutocompleteRenderState = {
264
264
  /**
265
265
  * The resolved hits from the index matching the query.
266
266
  */
267
- hits: Hits;
267
+ hits: Hit[];
268
268
  /**
269
269
  * The full results object from the Algolia API.
270
270
  */
@@ -518,11 +518,11 @@ declare type BrowserHistoryArgs<TRouteState> = {
518
518
  getLocation(): Location;
519
519
  };
520
520
 
521
- declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => string;
521
+ declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => string;
522
522
 
523
523
  declare type BuiltInSendEventForFacet = (eventType: string, facetValue: string, eventName?: string) => void;
524
524
 
525
- declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => void;
525
+ declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => void;
526
526
 
527
527
  declare type BuiltInSendEventForToggle = (eventType: string, isRefined: boolean, eventName?: string) => void;
528
528
 
@@ -1769,11 +1769,6 @@ declare type HitHighlightResult = {
1769
1769
  [attribute: string]: HitAttributeHighlightResult | HitAttributeHighlightResult[] | HitHighlightResult[] | HitHighlightResult;
1770
1770
  };
1771
1771
 
1772
- /**
1773
- * @deprecated use Hit[] directly instead
1774
- */
1775
- declare type Hits = Hit[];
1776
-
1777
1772
  declare const hits: HitsWidget;
1778
1773
 
1779
1774
  declare type HitsConnector<THit extends BaseHit = BaseHit> = Connector<HitsWidgetDescription<THit>, HitsConnectorParams<THit>>;
@@ -1872,8 +1867,13 @@ declare type HitsPerPageRenderState = {
1872
1867
  refine: (value: number) => void;
1873
1868
  /**
1874
1869
  * Indicates whether or not the search has results.
1870
+ * @deprecated Use `canRefine` instead.
1875
1871
  */
1876
1872
  hasNoResults: boolean;
1873
+ /**
1874
+ * Indicates if search state can be refined.
1875
+ */
1876
+ canRefine: boolean;
1877
1877
  };
1878
1878
 
1879
1879
  declare type HitsPerPageRenderStateItem = {
@@ -2401,6 +2401,10 @@ declare type InstantSearchModule = {
2401
2401
  reverseHighlight: typeof helpers.reverseHighlight;
2402
2402
  snippet: typeof helpers.snippet;
2403
2403
  reverseSnippet: typeof helpers.reverseSnippet;
2404
+ /**
2405
+ * @deprecated use createInsightsMiddleware
2406
+ * @link https://www.algolia.com/doc/api-reference/widgets/insights/js/
2407
+ */
2404
2408
  insights: typeof helpers.insights;
2405
2409
  };
2406
2410
 
@@ -2855,8 +2859,16 @@ declare type NumericMenuRenderState = {
2855
2859
  createURL: CreateURL<NumericMenuRenderStateItem['value']>;
2856
2860
  /**
2857
2861
  * `true` if the last search contains no result
2862
+ * @deprecated Use `canRefine` instead.
2858
2863
  */
2859
2864
  hasNoResults: boolean;
2865
+ /**
2866
+ * Indicates if search state can be refined.
2867
+ *
2868
+ * This is `true` if the last search contains no result and
2869
+ * "All" range is selected
2870
+ */
2871
+ canRefine: boolean;
2860
2872
  /**
2861
2873
  * Sets the selected value and trigger a new search
2862
2874
  */
@@ -3721,6 +3733,8 @@ declare type RatingMenuRenderState = {
3721
3733
  refine: (value: string) => void;
3722
3734
  /**
3723
3735
  * `true` if the last search contains no result.
3736
+ *
3737
+ * @deprecated Use `canRefine` instead.
3724
3738
  */
3725
3739
  hasNoResults: boolean;
3726
3740
  /**
@@ -4240,7 +4254,7 @@ declare type RendererOptions<TWidgetParams> = {
4240
4254
  * The mutable list of hits. The may change depending
4241
4255
  * of the given transform items function.
4242
4256
  */
4243
- hits?: Hits;
4257
+ hits?: Hit[];
4244
4258
  /**
4245
4259
  * The current insights client, if any.
4246
4260
  */
@@ -4683,8 +4697,13 @@ declare type SortByRenderState = {
4683
4697
  refine: (value: string) => void;
4684
4698
  /**
4685
4699
  * `true` if the last search contains no result.
4700
+ * @deprecated Use `canRefine` instead.
4686
4701
  */
4687
4702
  hasNoResults: boolean;
4703
+ /**
4704
+ * `true` if we can refine.
4705
+ */
4706
+ canRefine: boolean;
4688
4707
  };
4689
4708
 
4690
4709
  declare type SortByWidget = WidgetFactory<SortByWidgetDescription & {