instantsearch.js 4.32.0 → 4.33.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.
- package/CHANGELOG.md +15 -0
- package/cjs/connectors/powered-by/connectPoweredBy.js +13 -4
- package/cjs/lib/InstantSearch.js +4 -2
- package/cjs/lib/infiniteHitsCache/sessionStorage.js +16 -12
- package/cjs/lib/routers/history.js +89 -42
- package/cjs/lib/utils/detect-insights-client.js +10 -1
- package/cjs/lib/utils/index.js +10 -1
- package/cjs/lib/utils/safelyRunOnBrowser.js +30 -0
- package/cjs/lib/version.js +1 -1
- package/cjs/lib/voiceSearchHelper/index.js +5 -0
- package/cjs/middlewares/createMetadataMiddleware.js +12 -3
- package/dist/instantsearch.development.d.ts +13 -2
- package/dist/instantsearch.development.js +161 -66
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.development.min.d.ts +13 -2
- package/dist/instantsearch.production.d.ts +13 -2
- package/dist/instantsearch.production.min.d.ts +13 -2
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/powered-by/connectPoweredBy.js +14 -5
- package/es/lib/InstantSearch.js +4 -2
- package/es/lib/infiniteHitsCache/sessionStorage.js +17 -14
- package/es/lib/routers/history.d.ts +13 -2
- package/es/lib/routers/history.js +88 -42
- package/es/lib/utils/detect-insights-client.js +9 -1
- package/es/lib/utils/index.d.ts +1 -0
- package/es/lib/utils/index.js +2 -1
- package/es/lib/utils/safelyRunOnBrowser.d.ts +14 -0
- package/es/lib/utils/safelyRunOnBrowser.js +23 -0
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/lib/voiceSearchHelper/index.js +5 -0
- package/es/middlewares/createMetadataMiddleware.js +12 -3
- package/package.json +2 -2
|
@@ -455,13 +455,23 @@ declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
|
|
|
455
455
|
* It should be symmetrical to `createURL`.
|
|
456
456
|
*/
|
|
457
457
|
private readonly parseURL;
|
|
458
|
+
/**
|
|
459
|
+
* Returns the location to store in the history.
|
|
460
|
+
* @default () => window.location
|
|
461
|
+
*/
|
|
462
|
+
private readonly getLocation;
|
|
458
463
|
private writeTimer?;
|
|
459
464
|
private _onPopState;
|
|
465
|
+
/**
|
|
466
|
+
* Indicates if history.pushState should be executed.
|
|
467
|
+
* It needs to avoid pushing state to history in case of back/forward in browser
|
|
468
|
+
*/
|
|
469
|
+
private shouldPushState;
|
|
460
470
|
/**
|
|
461
471
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
462
472
|
* using web APIs (`window.location.pushState` and `onpopstate` event).
|
|
463
473
|
*/
|
|
464
|
-
constructor({ windowTitle, writeDelay, createURL, parseURL, }: BrowserHistoryArgs<TRouteState>);
|
|
474
|
+
constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, }: BrowserHistoryArgs<TRouteState>);
|
|
465
475
|
/**
|
|
466
476
|
* Reads the URL and returns a syncable UI search state.
|
|
467
477
|
*/
|
|
@@ -494,6 +504,7 @@ declare type BrowserHistoryArgs<TRouteState> = {
|
|
|
494
504
|
writeDelay: number;
|
|
495
505
|
createURL: CreateURL_2<TRouteState>;
|
|
496
506
|
parseURL: ParseURL<TRouteState>;
|
|
507
|
+
getLocation(): Location;
|
|
497
508
|
};
|
|
498
509
|
|
|
499
510
|
declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => string;
|
|
@@ -1723,7 +1734,7 @@ declare type HighlightOptions = {
|
|
|
1723
1734
|
}>;
|
|
1724
1735
|
};
|
|
1725
1736
|
|
|
1726
|
-
declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
|
|
1737
|
+
declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
|
|
1727
1738
|
|
|
1728
1739
|
declare type Hit = {
|
|
1729
1740
|
__position: number;
|
|
@@ -455,13 +455,23 @@ declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
|
|
|
455
455
|
* It should be symmetrical to `createURL`.
|
|
456
456
|
*/
|
|
457
457
|
private readonly parseURL;
|
|
458
|
+
/**
|
|
459
|
+
* Returns the location to store in the history.
|
|
460
|
+
* @default () => window.location
|
|
461
|
+
*/
|
|
462
|
+
private readonly getLocation;
|
|
458
463
|
private writeTimer?;
|
|
459
464
|
private _onPopState;
|
|
465
|
+
/**
|
|
466
|
+
* Indicates if history.pushState should be executed.
|
|
467
|
+
* It needs to avoid pushing state to history in case of back/forward in browser
|
|
468
|
+
*/
|
|
469
|
+
private shouldPushState;
|
|
460
470
|
/**
|
|
461
471
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
462
472
|
* using web APIs (`window.location.pushState` and `onpopstate` event).
|
|
463
473
|
*/
|
|
464
|
-
constructor({ windowTitle, writeDelay, createURL, parseURL, }: BrowserHistoryArgs<TRouteState>);
|
|
474
|
+
constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, }: BrowserHistoryArgs<TRouteState>);
|
|
465
475
|
/**
|
|
466
476
|
* Reads the URL and returns a syncable UI search state.
|
|
467
477
|
*/
|
|
@@ -494,6 +504,7 @@ declare type BrowserHistoryArgs<TRouteState> = {
|
|
|
494
504
|
writeDelay: number;
|
|
495
505
|
createURL: CreateURL_2<TRouteState>;
|
|
496
506
|
parseURL: ParseURL<TRouteState>;
|
|
507
|
+
getLocation(): Location;
|
|
497
508
|
};
|
|
498
509
|
|
|
499
510
|
declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => string;
|
|
@@ -1723,7 +1734,7 @@ declare type HighlightOptions = {
|
|
|
1723
1734
|
}>;
|
|
1724
1735
|
};
|
|
1725
1736
|
|
|
1726
|
-
declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
|
|
1737
|
+
declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
|
|
1727
1738
|
|
|
1728
1739
|
declare type Hit = {
|
|
1729
1740
|
__position: number;
|
|
@@ -455,13 +455,23 @@ declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
|
|
|
455
455
|
* It should be symmetrical to `createURL`.
|
|
456
456
|
*/
|
|
457
457
|
private readonly parseURL;
|
|
458
|
+
/**
|
|
459
|
+
* Returns the location to store in the history.
|
|
460
|
+
* @default () => window.location
|
|
461
|
+
*/
|
|
462
|
+
private readonly getLocation;
|
|
458
463
|
private writeTimer?;
|
|
459
464
|
private _onPopState;
|
|
465
|
+
/**
|
|
466
|
+
* Indicates if history.pushState should be executed.
|
|
467
|
+
* It needs to avoid pushing state to history in case of back/forward in browser
|
|
468
|
+
*/
|
|
469
|
+
private shouldPushState;
|
|
460
470
|
/**
|
|
461
471
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
462
472
|
* using web APIs (`window.location.pushState` and `onpopstate` event).
|
|
463
473
|
*/
|
|
464
|
-
constructor({ windowTitle, writeDelay, createURL, parseURL, }: BrowserHistoryArgs<TRouteState>);
|
|
474
|
+
constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, }: BrowserHistoryArgs<TRouteState>);
|
|
465
475
|
/**
|
|
466
476
|
* Reads the URL and returns a syncable UI search state.
|
|
467
477
|
*/
|
|
@@ -494,6 +504,7 @@ declare type BrowserHistoryArgs<TRouteState> = {
|
|
|
494
504
|
writeDelay: number;
|
|
495
505
|
createURL: CreateURL_2<TRouteState>;
|
|
496
506
|
parseURL: ParseURL<TRouteState>;
|
|
507
|
+
getLocation(): Location;
|
|
497
508
|
};
|
|
498
509
|
|
|
499
510
|
declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => string;
|
|
@@ -1723,7 +1734,7 @@ declare type HighlightOptions = {
|
|
|
1723
1734
|
}>;
|
|
1724
1735
|
};
|
|
1725
1736
|
|
|
1726
|
-
declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
|
|
1737
|
+
declare function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
|
|
1727
1738
|
|
|
1728
1739
|
declare type Hit = {
|
|
1729
1740
|
__position: number;
|