instantsearch.js 4.46.3 → 4.47.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 +14 -0
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +4 -1
- package/cjs/lib/InstantSearch.js +45 -6
- package/cjs/lib/utils/createSendEventForFacet.js +2 -1
- package/cjs/lib/utils/createSendEventForHits.js +1 -1
- package/cjs/lib/utils/index.js +13 -0
- package/cjs/lib/utils/render-args.js +47 -0
- package/cjs/lib/version.js +1 -1
- package/cjs/middlewares/createMetadataMiddleware.js +1 -15
- package/cjs/widgets/hierarchical-menu/defaultTemplates.js +3 -2
- package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +4 -0
- package/cjs/widgets/index/index.js +6 -84
- package/dist/instantsearch.development.d.ts +27 -4
- package/dist/instantsearch.development.js +107 -112
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +27 -4
- package/dist/instantsearch.production.min.d.ts +27 -4
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +4 -1
- package/es/connectors/search-box/connectSearchBox.d.ts +1 -0
- package/es/lib/InstantSearch.d.ts +17 -4
- package/es/lib/InstantSearch.js +45 -6
- package/es/lib/utils/createSendEventForFacet.d.ts +4 -3
- package/es/lib/utils/createSendEventForFacet.js +2 -1
- package/es/lib/utils/createSendEventForHits.js +1 -1
- package/es/lib/utils/defer.d.ts +2 -2
- package/es/lib/utils/index.d.ts +1 -0
- package/es/lib/utils/index.js +1 -0
- package/es/lib/utils/render-args.d.ts +34 -0
- package/es/lib/utils/render-args.js +38 -0
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/middlewares/createMetadataMiddleware.js +2 -16
- package/es/types/widget.d.ts +4 -0
- package/es/widgets/hierarchical-menu/defaultTemplates.js +3 -2
- package/es/widgets/hierarchical-menu/hierarchical-menu.d.ts +4 -0
- package/es/widgets/hierarchical-menu/hierarchical-menu.js +4 -0
- package/es/widgets/index/index.js +7 -85
- package/package.json +7 -7
|
@@ -1516,6 +1516,10 @@ declare type HierarchicalMenuCSSClasses = Partial<{
|
|
|
1516
1516
|
* CSS class to add to each link (when using the default template).
|
|
1517
1517
|
*/
|
|
1518
1518
|
link: string | string[];
|
|
1519
|
+
/**
|
|
1520
|
+
* CSS class to add to the link of each selected item element (when using the default template).
|
|
1521
|
+
*/
|
|
1522
|
+
selectedItemLink: string | string[];
|
|
1519
1523
|
/**
|
|
1520
1524
|
* CSS class to add to each label (when using the default template).
|
|
1521
1525
|
*/
|
|
@@ -2317,7 +2321,6 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2317
2321
|
renderState: RenderState;
|
|
2318
2322
|
_stalledSearchDelay: number;
|
|
2319
2323
|
_searchStalledTimer: any;
|
|
2320
|
-
_isSearchStalled: boolean;
|
|
2321
2324
|
_initialUiState: TUiState;
|
|
2322
2325
|
_initialResults: InitialResults | null;
|
|
2323
2326
|
_createURL: CreateURL<TUiState>;
|
|
@@ -2328,6 +2331,19 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2328
2331
|
instance: MiddlewareDefinition;
|
|
2329
2332
|
}>;
|
|
2330
2333
|
sendEventToInsights: (event: InsightsEvent) => void;
|
|
2334
|
+
/**
|
|
2335
|
+
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
2336
|
+
*/
|
|
2337
|
+
status: InstantSearchStatus;
|
|
2338
|
+
/**
|
|
2339
|
+
* The last returned error from the Search API.
|
|
2340
|
+
* The error gets cleared when the next valid search response is rendered.
|
|
2341
|
+
*/
|
|
2342
|
+
error: Error | undefined;
|
|
2343
|
+
/**
|
|
2344
|
+
* @deprecated use `status === 'stalled'` instead
|
|
2345
|
+
*/
|
|
2346
|
+
get _isSearchStalled(): boolean;
|
|
2331
2347
|
constructor(options: InstantSearchOptions<TUiState, TRouteState>);
|
|
2332
2348
|
/**
|
|
2333
2349
|
* Hooks a middleware into the InstantSearch lifecycle.
|
|
@@ -2381,11 +2397,11 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2381
2397
|
* @return {undefined} This method does not return anything
|
|
2382
2398
|
*/
|
|
2383
2399
|
dispose(): void;
|
|
2384
|
-
scheduleSearch: ((
|
|
2400
|
+
scheduleSearch: (() => void) & {
|
|
2385
2401
|
wait(): Promise<void>;
|
|
2386
2402
|
cancel(): void;
|
|
2387
2403
|
};
|
|
2388
|
-
scheduleRender: ((
|
|
2404
|
+
scheduleRender: ((shouldResetStatus?: boolean) => void) & {
|
|
2389
2405
|
wait(): Promise<void>;
|
|
2390
2406
|
cancel(): void;
|
|
2391
2407
|
};
|
|
@@ -2397,7 +2413,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2397
2413
|
*/
|
|
2398
2414
|
setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState), callOnStateChange?: boolean): void;
|
|
2399
2415
|
getUiState(): TUiState;
|
|
2400
|
-
onInternalStateChange: ((
|
|
2416
|
+
onInternalStateChange: (() => void) & {
|
|
2401
2417
|
wait(): Promise<void>;
|
|
2402
2418
|
cancel(): void;
|
|
2403
2419
|
};
|
|
@@ -2525,6 +2541,8 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
|
|
|
2525
2541
|
insightsClient?: InsightsClient;
|
|
2526
2542
|
};
|
|
2527
2543
|
|
|
2544
|
+
declare type InstantSearchStatus = 'idle' | 'loading' | 'stalled' | 'error';
|
|
2545
|
+
|
|
2528
2546
|
declare type InternalMiddleware<TUiState extends UiState = UiState> = (options: MiddlewareOptions) => MiddlewareDefinition<TUiState>;
|
|
2529
2547
|
|
|
2530
2548
|
declare function isMetadataEnabled(): boolean;
|
|
@@ -4592,6 +4610,7 @@ declare type SearchBoxRenderState = {
|
|
|
4592
4610
|
* `true` if the search results takes more than a certain time to come back
|
|
4593
4611
|
* from Algolia servers. This can be configured on the InstantSearch constructor with the attribute
|
|
4594
4612
|
* `stalledSearchDelay` which is 200ms, by default.
|
|
4613
|
+
* @deprecated use `instantSearchInstance.status` instead
|
|
4595
4614
|
*/
|
|
4596
4615
|
isSearchStalled: boolean;
|
|
4597
4616
|
};
|
|
@@ -4703,9 +4722,13 @@ declare type SharedRenderOptions = {
|
|
|
4703
4722
|
state: SearchParameters;
|
|
4704
4723
|
renderState: IndexRenderState;
|
|
4705
4724
|
helper: AlgoliaSearchHelper;
|
|
4725
|
+
/** @deprecated use `status` instead */
|
|
4706
4726
|
searchMetadata: {
|
|
4727
|
+
/** @deprecated use `status === "stalled"` instead */
|
|
4707
4728
|
isSearchStalled: boolean;
|
|
4708
4729
|
};
|
|
4730
|
+
status: InstantSearch['status'];
|
|
4731
|
+
error: InstantSearch['error'];
|
|
4709
4732
|
createURL(state: SearchParameters): string;
|
|
4710
4733
|
};
|
|
4711
4734
|
|
|
@@ -1516,6 +1516,10 @@ declare type HierarchicalMenuCSSClasses = Partial<{
|
|
|
1516
1516
|
* CSS class to add to each link (when using the default template).
|
|
1517
1517
|
*/
|
|
1518
1518
|
link: string | string[];
|
|
1519
|
+
/**
|
|
1520
|
+
* CSS class to add to the link of each selected item element (when using the default template).
|
|
1521
|
+
*/
|
|
1522
|
+
selectedItemLink: string | string[];
|
|
1519
1523
|
/**
|
|
1520
1524
|
* CSS class to add to each label (when using the default template).
|
|
1521
1525
|
*/
|
|
@@ -2317,7 +2321,6 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2317
2321
|
renderState: RenderState;
|
|
2318
2322
|
_stalledSearchDelay: number;
|
|
2319
2323
|
_searchStalledTimer: any;
|
|
2320
|
-
_isSearchStalled: boolean;
|
|
2321
2324
|
_initialUiState: TUiState;
|
|
2322
2325
|
_initialResults: InitialResults | null;
|
|
2323
2326
|
_createURL: CreateURL<TUiState>;
|
|
@@ -2328,6 +2331,19 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2328
2331
|
instance: MiddlewareDefinition;
|
|
2329
2332
|
}>;
|
|
2330
2333
|
sendEventToInsights: (event: InsightsEvent) => void;
|
|
2334
|
+
/**
|
|
2335
|
+
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
2336
|
+
*/
|
|
2337
|
+
status: InstantSearchStatus;
|
|
2338
|
+
/**
|
|
2339
|
+
* The last returned error from the Search API.
|
|
2340
|
+
* The error gets cleared when the next valid search response is rendered.
|
|
2341
|
+
*/
|
|
2342
|
+
error: Error | undefined;
|
|
2343
|
+
/**
|
|
2344
|
+
* @deprecated use `status === 'stalled'` instead
|
|
2345
|
+
*/
|
|
2346
|
+
get _isSearchStalled(): boolean;
|
|
2331
2347
|
constructor(options: InstantSearchOptions<TUiState, TRouteState>);
|
|
2332
2348
|
/**
|
|
2333
2349
|
* Hooks a middleware into the InstantSearch lifecycle.
|
|
@@ -2381,11 +2397,11 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2381
2397
|
* @return {undefined} This method does not return anything
|
|
2382
2398
|
*/
|
|
2383
2399
|
dispose(): void;
|
|
2384
|
-
scheduleSearch: ((
|
|
2400
|
+
scheduleSearch: (() => void) & {
|
|
2385
2401
|
wait(): Promise<void>;
|
|
2386
2402
|
cancel(): void;
|
|
2387
2403
|
};
|
|
2388
|
-
scheduleRender: ((
|
|
2404
|
+
scheduleRender: ((shouldResetStatus?: boolean) => void) & {
|
|
2389
2405
|
wait(): Promise<void>;
|
|
2390
2406
|
cancel(): void;
|
|
2391
2407
|
};
|
|
@@ -2397,7 +2413,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2397
2413
|
*/
|
|
2398
2414
|
setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState), callOnStateChange?: boolean): void;
|
|
2399
2415
|
getUiState(): TUiState;
|
|
2400
|
-
onInternalStateChange: ((
|
|
2416
|
+
onInternalStateChange: (() => void) & {
|
|
2401
2417
|
wait(): Promise<void>;
|
|
2402
2418
|
cancel(): void;
|
|
2403
2419
|
};
|
|
@@ -2525,6 +2541,8 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
|
|
|
2525
2541
|
insightsClient?: InsightsClient;
|
|
2526
2542
|
};
|
|
2527
2543
|
|
|
2544
|
+
declare type InstantSearchStatus = 'idle' | 'loading' | 'stalled' | 'error';
|
|
2545
|
+
|
|
2528
2546
|
declare type InternalMiddleware<TUiState extends UiState = UiState> = (options: MiddlewareOptions) => MiddlewareDefinition<TUiState>;
|
|
2529
2547
|
|
|
2530
2548
|
declare function isMetadataEnabled(): boolean;
|
|
@@ -4592,6 +4610,7 @@ declare type SearchBoxRenderState = {
|
|
|
4592
4610
|
* `true` if the search results takes more than a certain time to come back
|
|
4593
4611
|
* from Algolia servers. This can be configured on the InstantSearch constructor with the attribute
|
|
4594
4612
|
* `stalledSearchDelay` which is 200ms, by default.
|
|
4613
|
+
* @deprecated use `instantSearchInstance.status` instead
|
|
4595
4614
|
*/
|
|
4596
4615
|
isSearchStalled: boolean;
|
|
4597
4616
|
};
|
|
@@ -4703,9 +4722,13 @@ declare type SharedRenderOptions = {
|
|
|
4703
4722
|
state: SearchParameters;
|
|
4704
4723
|
renderState: IndexRenderState;
|
|
4705
4724
|
helper: AlgoliaSearchHelper;
|
|
4725
|
+
/** @deprecated use `status` instead */
|
|
4706
4726
|
searchMetadata: {
|
|
4727
|
+
/** @deprecated use `status === "stalled"` instead */
|
|
4707
4728
|
isSearchStalled: boolean;
|
|
4708
4729
|
};
|
|
4730
|
+
status: InstantSearch['status'];
|
|
4731
|
+
error: InstantSearch['error'];
|
|
4709
4732
|
createURL(state: SearchParameters): string;
|
|
4710
4733
|
};
|
|
4711
4734
|
|