instantsearch.js 4.66.1 → 4.67.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/cjs/lib/InstantSearch.js +1 -1
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/index/index.js +68 -13
- package/dist/instantsearch.development.d.ts +25 -2
- package/dist/instantsearch.development.js +485 -30
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +25 -2
- package/dist/instantsearch.production.min.d.ts +25 -2
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/lib/InstantSearch.js +1 -1
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/types/widget.d.ts +21 -2
- package/es/widgets/index/index.js +68 -13
- package/es/widgets/panel/panel.d.ts +1 -1
- package/package.json +7 -7
|
@@ -15,6 +15,7 @@ import type { InsightsMethodMap as InsightsMethodMap_2 } from 'search-insights';
|
|
|
15
15
|
import type * as Places from 'places.js';
|
|
16
16
|
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
17
17
|
import { default as qs_2 } from 'qs';
|
|
18
|
+
import type { RecommendParameters } from 'algoliasearch-helper';
|
|
18
19
|
import { SearchClient } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
19
20
|
import { SearchOptions } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
20
21
|
import type { SearchParameters } from 'algoliasearch-helper';
|
|
@@ -242,7 +243,7 @@ declare type AtLeastOne<TTarget, TMapped = {
|
|
|
242
243
|
[Key in keyof TTarget]: Pick<TTarget, Key>;
|
|
243
244
|
}> = Partial<TTarget> & TMapped[keyof TMapped];
|
|
244
245
|
|
|
245
|
-
declare type AugmentedWidget<TWidgetFactory extends AnyWidgetFactory, TOverriddenKeys extends keyof Widget = 'init' | 'render' | 'dispose'> = Omit<ReturnType<TWidgetFactory>, TOverriddenKeys> & Pick<Required<Widget>, TOverriddenKeys>;
|
|
246
|
+
declare type AugmentedWidget<TWidgetFactory extends AnyWidgetFactory, TOverriddenKeys extends keyof Widget = 'init' | 'render' | 'dispose'> = Omit<ReturnType<TWidgetFactory>, TOverriddenKeys | 'dependsOn' | 'getWidgetParameters'> & Pick<Required<Widget>, TOverriddenKeys>;
|
|
246
247
|
|
|
247
248
|
declare type AutocompleteConnector = Connector<AutocompleteWidgetDescription, AutocompleteConnectorParams>;
|
|
248
249
|
|
|
@@ -4007,6 +4008,13 @@ declare type Read<THit extends BaseHit> = ({ state, }: {
|
|
|
4007
4008
|
state: PlainSearchParameters;
|
|
4008
4009
|
}) => InfiniteHitsCachedHits<THit> | null;
|
|
4009
4010
|
|
|
4011
|
+
declare type RecommendWidgetLifeCycle<TWidgetDescription extends WidgetDescription> = {
|
|
4012
|
+
dependsOn?: 'recommend';
|
|
4013
|
+
getWidgetParameters: (state: RecommendParameters, widgetParametersOptions: {
|
|
4014
|
+
uiState: Expand<Partial<TWidgetDescription['indexUiState'] & IndexUiState>>;
|
|
4015
|
+
}) => RecommendParameters;
|
|
4016
|
+
};
|
|
4017
|
+
|
|
4010
4018
|
declare type ReconfigurableOptions = Places.ReconfigurableOptions;
|
|
4011
4019
|
|
|
4012
4020
|
/**
|
|
@@ -4517,7 +4525,7 @@ declare type RequiredUiStateLifeCycle<TWidgetDescription extends WidgetDescripti
|
|
|
4517
4525
|
getWidgetSearchParameters: (state: SearchParameters, widgetSearchParametersOptions: {
|
|
4518
4526
|
uiState: Expand<Partial<TWidgetDescription['indexUiState'] & IndexUiState>>;
|
|
4519
4527
|
}) => SearchParameters;
|
|
4520
|
-
};
|
|
4528
|
+
} & (SearchWidgetLifeCycle<TWidgetDescription> | RecommendWidgetLifeCycle<TWidgetDescription>);
|
|
4521
4529
|
|
|
4522
4530
|
declare type RequiredWidgetLifeCycle<TWidgetDescription extends WidgetDescription> = {
|
|
4523
4531
|
/**
|
|
@@ -4528,6 +4536,10 @@ declare type RequiredWidgetLifeCycle<TWidgetDescription extends WidgetDescriptio
|
|
|
4528
4536
|
* Called once before the first search.
|
|
4529
4537
|
*/
|
|
4530
4538
|
init?: (options: InitOptions) => void;
|
|
4539
|
+
/**
|
|
4540
|
+
* Whether `render` should be called
|
|
4541
|
+
*/
|
|
4542
|
+
shouldRender?: (options: ShouldRenderOptions) => boolean;
|
|
4531
4543
|
/**
|
|
4532
4544
|
* Called after each search response has been received.
|
|
4533
4545
|
*/
|
|
@@ -4843,6 +4855,13 @@ declare type SearchBoxWidgetParams = {
|
|
|
4843
4855
|
queryHook?: (query: string, hook: (value: string) => void) => void;
|
|
4844
4856
|
};
|
|
4845
4857
|
|
|
4858
|
+
declare type SearchWidgetLifeCycle<TWidgetDescription extends WidgetDescription> = {
|
|
4859
|
+
dependsOn?: 'search';
|
|
4860
|
+
getWidgetParameters?: (state: SearchParameters, widgetParametersOptions: {
|
|
4861
|
+
uiState: Expand<Partial<TWidgetDescription['indexUiState'] & IndexUiState>>;
|
|
4862
|
+
}) => SearchParameters;
|
|
4863
|
+
};
|
|
4864
|
+
|
|
4846
4865
|
declare type SendEvent = (...args: [InsightsEvent] | [string, string, string?]) => void;
|
|
4847
4866
|
|
|
4848
4867
|
declare type SendEventForFacet = BuiltInSendEventForFacet & CustomSendEventForFacet;
|
|
@@ -4869,6 +4888,10 @@ declare type SharedRenderOptions = {
|
|
|
4869
4888
|
createURL: (nextState: SearchParameters | ((state: IndexUiState) => IndexUiState)) => string;
|
|
4870
4889
|
};
|
|
4871
4890
|
|
|
4891
|
+
declare type ShouldRenderOptions = {
|
|
4892
|
+
instantSearchInstance: InstantSearch;
|
|
4893
|
+
};
|
|
4894
|
+
|
|
4872
4895
|
declare function simpleStateMapping<TUiState extends UiState = UiState>(): StateMapping<TUiState, TUiState>;
|
|
4873
4896
|
|
|
4874
4897
|
declare function singleIndexStateMapping<TUiState extends UiState = UiState>(indexName: keyof TUiState): StateMapping<TUiState, TUiState[typeof indexName]>;
|
|
@@ -15,6 +15,7 @@ import type { InsightsMethodMap as InsightsMethodMap_2 } from 'search-insights';
|
|
|
15
15
|
import type * as Places from 'places.js';
|
|
16
16
|
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
17
17
|
import { default as qs_2 } from 'qs';
|
|
18
|
+
import type { RecommendParameters } from 'algoliasearch-helper';
|
|
18
19
|
import { SearchClient } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
19
20
|
import { SearchOptions } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
20
21
|
import type { SearchParameters } from 'algoliasearch-helper';
|
|
@@ -242,7 +243,7 @@ declare type AtLeastOne<TTarget, TMapped = {
|
|
|
242
243
|
[Key in keyof TTarget]: Pick<TTarget, Key>;
|
|
243
244
|
}> = Partial<TTarget> & TMapped[keyof TMapped];
|
|
244
245
|
|
|
245
|
-
declare type AugmentedWidget<TWidgetFactory extends AnyWidgetFactory, TOverriddenKeys extends keyof Widget = 'init' | 'render' | 'dispose'> = Omit<ReturnType<TWidgetFactory>, TOverriddenKeys> & Pick<Required<Widget>, TOverriddenKeys>;
|
|
246
|
+
declare type AugmentedWidget<TWidgetFactory extends AnyWidgetFactory, TOverriddenKeys extends keyof Widget = 'init' | 'render' | 'dispose'> = Omit<ReturnType<TWidgetFactory>, TOverriddenKeys | 'dependsOn' | 'getWidgetParameters'> & Pick<Required<Widget>, TOverriddenKeys>;
|
|
246
247
|
|
|
247
248
|
declare type AutocompleteConnector = Connector<AutocompleteWidgetDescription, AutocompleteConnectorParams>;
|
|
248
249
|
|
|
@@ -4007,6 +4008,13 @@ declare type Read<THit extends BaseHit> = ({ state, }: {
|
|
|
4007
4008
|
state: PlainSearchParameters;
|
|
4008
4009
|
}) => InfiniteHitsCachedHits<THit> | null;
|
|
4009
4010
|
|
|
4011
|
+
declare type RecommendWidgetLifeCycle<TWidgetDescription extends WidgetDescription> = {
|
|
4012
|
+
dependsOn?: 'recommend';
|
|
4013
|
+
getWidgetParameters: (state: RecommendParameters, widgetParametersOptions: {
|
|
4014
|
+
uiState: Expand<Partial<TWidgetDescription['indexUiState'] & IndexUiState>>;
|
|
4015
|
+
}) => RecommendParameters;
|
|
4016
|
+
};
|
|
4017
|
+
|
|
4010
4018
|
declare type ReconfigurableOptions = Places.ReconfigurableOptions;
|
|
4011
4019
|
|
|
4012
4020
|
/**
|
|
@@ -4517,7 +4525,7 @@ declare type RequiredUiStateLifeCycle<TWidgetDescription extends WidgetDescripti
|
|
|
4517
4525
|
getWidgetSearchParameters: (state: SearchParameters, widgetSearchParametersOptions: {
|
|
4518
4526
|
uiState: Expand<Partial<TWidgetDescription['indexUiState'] & IndexUiState>>;
|
|
4519
4527
|
}) => SearchParameters;
|
|
4520
|
-
};
|
|
4528
|
+
} & (SearchWidgetLifeCycle<TWidgetDescription> | RecommendWidgetLifeCycle<TWidgetDescription>);
|
|
4521
4529
|
|
|
4522
4530
|
declare type RequiredWidgetLifeCycle<TWidgetDescription extends WidgetDescription> = {
|
|
4523
4531
|
/**
|
|
@@ -4528,6 +4536,10 @@ declare type RequiredWidgetLifeCycle<TWidgetDescription extends WidgetDescriptio
|
|
|
4528
4536
|
* Called once before the first search.
|
|
4529
4537
|
*/
|
|
4530
4538
|
init?: (options: InitOptions) => void;
|
|
4539
|
+
/**
|
|
4540
|
+
* Whether `render` should be called
|
|
4541
|
+
*/
|
|
4542
|
+
shouldRender?: (options: ShouldRenderOptions) => boolean;
|
|
4531
4543
|
/**
|
|
4532
4544
|
* Called after each search response has been received.
|
|
4533
4545
|
*/
|
|
@@ -4843,6 +4855,13 @@ declare type SearchBoxWidgetParams = {
|
|
|
4843
4855
|
queryHook?: (query: string, hook: (value: string) => void) => void;
|
|
4844
4856
|
};
|
|
4845
4857
|
|
|
4858
|
+
declare type SearchWidgetLifeCycle<TWidgetDescription extends WidgetDescription> = {
|
|
4859
|
+
dependsOn?: 'search';
|
|
4860
|
+
getWidgetParameters?: (state: SearchParameters, widgetParametersOptions: {
|
|
4861
|
+
uiState: Expand<Partial<TWidgetDescription['indexUiState'] & IndexUiState>>;
|
|
4862
|
+
}) => SearchParameters;
|
|
4863
|
+
};
|
|
4864
|
+
|
|
4846
4865
|
declare type SendEvent = (...args: [InsightsEvent] | [string, string, string?]) => void;
|
|
4847
4866
|
|
|
4848
4867
|
declare type SendEventForFacet = BuiltInSendEventForFacet & CustomSendEventForFacet;
|
|
@@ -4869,6 +4888,10 @@ declare type SharedRenderOptions = {
|
|
|
4869
4888
|
createURL: (nextState: SearchParameters | ((state: IndexUiState) => IndexUiState)) => string;
|
|
4870
4889
|
};
|
|
4871
4890
|
|
|
4891
|
+
declare type ShouldRenderOptions = {
|
|
4892
|
+
instantSearchInstance: InstantSearch;
|
|
4893
|
+
};
|
|
4894
|
+
|
|
4872
4895
|
declare function simpleStateMapping<TUiState extends UiState = UiState>(): StateMapping<TUiState, TUiState>;
|
|
4873
4896
|
|
|
4874
4897
|
declare function singleIndexStateMapping<TUiState extends UiState = UiState>(indexName: keyof TUiState): StateMapping<TUiState, TUiState[typeof indexName]>;
|