instantsearch.js 4.62.0 → 4.63.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.
@@ -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;
@@ -5328,9 +5336,7 @@ declare type ToggleRefinementTemplates = Partial<{
5328
5336
  /**
5329
5337
  * the text that describes the toggle action
5330
5338
  */
5331
- labelText: Template<ToggleRefinementValue & {
5332
- name: string;
5333
- }>;
5339
+ labelText: Template<ToggleRefinementRenderState['value']>;
5334
5340
  }>;
5335
5341
 
5336
5342
  declare type ToggleRefinementValue = {
@@ -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;
@@ -5328,9 +5336,7 @@ declare type ToggleRefinementTemplates = Partial<{
5328
5336
  /**
5329
5337
  * the text that describes the toggle action
5330
5338
  */
5331
- labelText: Template<ToggleRefinementValue & {
5332
- name: string;
5333
- }>;
5339
+ labelText: Template<ToggleRefinementRenderState['value']>;
5334
5340
  }>;
5335
5341
 
5336
5342
  declare type ToggleRefinementValue = {