instantsearch.js 4.61.0 → 4.63.0

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 (33) hide show
  1. package/cjs/components/SearchBox/SearchBox.js +13 -7
  2. package/cjs/connectors/breadcrumb/connectBreadcrumb.js +10 -14
  3. package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +11 -13
  4. package/cjs/connectors/menu/connectMenu.js +11 -14
  5. package/cjs/connectors/numeric-menu/connectNumericMenu.js +10 -14
  6. package/cjs/connectors/rating-menu/connectRatingMenu.js +10 -14
  7. package/cjs/connectors/refinement-list/connectRefinementList.js +11 -13
  8. package/cjs/lib/InstantSearch.js +5 -2
  9. package/cjs/lib/routers/history.js +17 -4
  10. package/cjs/lib/version.js +1 -1
  11. package/cjs/middlewares/createInsightsMiddleware.js +16 -4
  12. package/dist/instantsearch.development.d.ts +20 -2
  13. package/dist/instantsearch.development.js +196 -155
  14. package/dist/instantsearch.development.js.map +1 -1
  15. package/dist/instantsearch.production.d.ts +20 -2
  16. package/dist/instantsearch.production.min.d.ts +20 -2
  17. package/dist/instantsearch.production.min.js +2 -2
  18. package/dist/instantsearch.production.min.js.map +1 -1
  19. package/es/components/SearchBox/SearchBox.js +13 -7
  20. package/es/connectors/breadcrumb/connectBreadcrumb.js +10 -14
  21. package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +11 -13
  22. package/es/connectors/menu/connectMenu.js +11 -14
  23. package/es/connectors/numeric-menu/connectNumericMenu.js +10 -14
  24. package/es/connectors/rating-menu/connectRatingMenu.js +10 -14
  25. package/es/connectors/refinement-list/connectRefinementList.js +11 -13
  26. package/es/lib/InstantSearch.d.ts +10 -0
  27. package/es/lib/InstantSearch.js +5 -2
  28. package/es/lib/routers/history.d.ts +10 -2
  29. package/es/lib/routers/history.js +18 -5
  30. package/es/lib/version.d.ts +1 -1
  31. package/es/lib/version.js +1 -1
  32. package/es/middlewares/createInsightsMiddleware.js +16 -4
  33. package/package.json +10 -10
@@ -486,11 +486,12 @@ declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
486
486
  private _start?;
487
487
  private _dispose?;
488
488
  private _push?;
489
+ private _cleanUrlOnDispose;
489
490
  /**
490
491
  * Initializes a new storage provider that syncs the search state to the URL
491
492
  * using web APIs (`window.location.pushState` and `onpopstate` event).
492
493
  */
493
- constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, start, dispose, push, }: BrowserHistoryArgs<TRouteState>);
494
+ constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, start, dispose, push, cleanUrlOnDispose, }: BrowserHistoryArgs<TRouteState>);
494
495
  /**
495
496
  * Reads the URL and returns a syncable UI search state.
496
497
  */
@@ -529,6 +530,13 @@ declare type BrowserHistoryArgs<TRouteState> = {
529
530
  start?: (onUpdate: () => void) => void;
530
531
  dispose?: () => void;
531
532
  push?: (url: string) => void;
533
+ /**
534
+ * Whether the URL should be cleaned up when the router is disposed.
535
+ * This can be useful when closing a modal containing InstantSearch, to
536
+ * remove active refinements from the URL.
537
+ * @default true
538
+ */
539
+ cleanUrlOnDispose?: boolean;
532
540
  };
533
541
 
534
542
  declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string, additionalData?: Record<string, any>) => string;
@@ -1813,7 +1821,7 @@ declare type HighlightProps_2 = Omit<HighlightProps_3, 'classNames'> & {
1813
1821
  classNames?: Partial<HighlightClassNames>;
1814
1822
  };
1815
1823
 
1816
- declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, start, dispose, push, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
1824
+ declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, start, dispose, push, cleanUrlOnDispose, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
1817
1825
 
1818
1826
  declare type Hit<THit extends BaseHit = Record<string, any>> = {
1819
1827
  __position: number;
@@ -2627,6 +2635,16 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2627
2635
  * @default false
2628
2636
  */
2629
2637
  preserveSharedStateOnUnmount?: boolean;
2638
+ /**
2639
+ * Changes the way root levels of hierarchical facets have their count displayed.
2640
+ *
2641
+ * If `false` (by default), the count of the refined root level is updated to match the count of the actively refined parent level.
2642
+ *
2643
+ * If `true`, the count of the root level stays the same as the count of all children levels.
2644
+ *
2645
+ * @default false
2646
+ */
2647
+ persistHierarchicalRootCount?: boolean;
2630
2648
  };
2631
2649
  };
2632
2650
 
@@ -486,11 +486,12 @@ declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
486
486
  private _start?;
487
487
  private _dispose?;
488
488
  private _push?;
489
+ private _cleanUrlOnDispose;
489
490
  /**
490
491
  * Initializes a new storage provider that syncs the search state to the URL
491
492
  * using web APIs (`window.location.pushState` and `onpopstate` event).
492
493
  */
493
- constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, start, dispose, push, }: BrowserHistoryArgs<TRouteState>);
494
+ constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, start, dispose, push, cleanUrlOnDispose, }: BrowserHistoryArgs<TRouteState>);
494
495
  /**
495
496
  * Reads the URL and returns a syncable UI search state.
496
497
  */
@@ -529,6 +530,13 @@ declare type BrowserHistoryArgs<TRouteState> = {
529
530
  start?: (onUpdate: () => void) => void;
530
531
  dispose?: () => void;
531
532
  push?: (url: string) => void;
533
+ /**
534
+ * Whether the URL should be cleaned up when the router is disposed.
535
+ * This can be useful when closing a modal containing InstantSearch, to
536
+ * remove active refinements from the URL.
537
+ * @default true
538
+ */
539
+ cleanUrlOnDispose?: boolean;
532
540
  };
533
541
 
534
542
  declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string, additionalData?: Record<string, any>) => string;
@@ -1813,7 +1821,7 @@ declare type HighlightProps_2 = Omit<HighlightProps_3, 'classNames'> & {
1813
1821
  classNames?: Partial<HighlightClassNames>;
1814
1822
  };
1815
1823
 
1816
- declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, start, dispose, push, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
1824
+ declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, start, dispose, push, cleanUrlOnDispose, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
1817
1825
 
1818
1826
  declare type Hit<THit extends BaseHit = Record<string, any>> = {
1819
1827
  __position: number;
@@ -2627,6 +2635,16 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2627
2635
  * @default false
2628
2636
  */
2629
2637
  preserveSharedStateOnUnmount?: boolean;
2638
+ /**
2639
+ * Changes the way root levels of hierarchical facets have their count displayed.
2640
+ *
2641
+ * If `false` (by default), the count of the refined root level is updated to match the count of the actively refined parent level.
2642
+ *
2643
+ * If `true`, the count of the root level stays the same as the count of all children levels.
2644
+ *
2645
+ * @default false
2646
+ */
2647
+ persistHierarchicalRootCount?: boolean;
2630
2648
  };
2631
2649
  };
2632
2650