instantsearch.js 4.66.0 → 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/connectors/hits/connectHits.js +2 -0
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +1 -0
- 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 +27 -2
- package/dist/instantsearch.development.js +538 -29
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +27 -2
- package/dist/instantsearch.production.min.d.ts +27 -2
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/hits/connectHits.js +2 -0
- package/es/connectors/infinite-hits/connectInfiniteHits.js +1 -0
- package/es/connectors/refinement-list/connectRefinementList.d.ts +2 -0
- 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
|
/**
|
|
@@ -4243,6 +4251,8 @@ declare type RefinementListRenderState = {
|
|
|
4243
4251
|
isFromSearch: boolean;
|
|
4244
4252
|
/**
|
|
4245
4253
|
* `true` if a refinement can be applied.
|
|
4254
|
+
* @MAJOR: reconsider how `canRefine` is computed so it both accounts for the
|
|
4255
|
+
* items returned in the main search and in SFFV.
|
|
4246
4256
|
*/
|
|
4247
4257
|
canRefine: boolean;
|
|
4248
4258
|
/**
|
|
@@ -4515,7 +4525,7 @@ declare type RequiredUiStateLifeCycle<TWidgetDescription extends WidgetDescripti
|
|
|
4515
4525
|
getWidgetSearchParameters: (state: SearchParameters, widgetSearchParametersOptions: {
|
|
4516
4526
|
uiState: Expand<Partial<TWidgetDescription['indexUiState'] & IndexUiState>>;
|
|
4517
4527
|
}) => SearchParameters;
|
|
4518
|
-
};
|
|
4528
|
+
} & (SearchWidgetLifeCycle<TWidgetDescription> | RecommendWidgetLifeCycle<TWidgetDescription>);
|
|
4519
4529
|
|
|
4520
4530
|
declare type RequiredWidgetLifeCycle<TWidgetDescription extends WidgetDescription> = {
|
|
4521
4531
|
/**
|
|
@@ -4526,6 +4536,10 @@ declare type RequiredWidgetLifeCycle<TWidgetDescription extends WidgetDescriptio
|
|
|
4526
4536
|
* Called once before the first search.
|
|
4527
4537
|
*/
|
|
4528
4538
|
init?: (options: InitOptions) => void;
|
|
4539
|
+
/**
|
|
4540
|
+
* Whether `render` should be called
|
|
4541
|
+
*/
|
|
4542
|
+
shouldRender?: (options: ShouldRenderOptions) => boolean;
|
|
4529
4543
|
/**
|
|
4530
4544
|
* Called after each search response has been received.
|
|
4531
4545
|
*/
|
|
@@ -4841,6 +4855,13 @@ declare type SearchBoxWidgetParams = {
|
|
|
4841
4855
|
queryHook?: (query: string, hook: (value: string) => void) => void;
|
|
4842
4856
|
};
|
|
4843
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
|
+
|
|
4844
4865
|
declare type SendEvent = (...args: [InsightsEvent] | [string, string, string?]) => void;
|
|
4845
4866
|
|
|
4846
4867
|
declare type SendEventForFacet = BuiltInSendEventForFacet & CustomSendEventForFacet;
|
|
@@ -4867,6 +4888,10 @@ declare type SharedRenderOptions = {
|
|
|
4867
4888
|
createURL: (nextState: SearchParameters | ((state: IndexUiState) => IndexUiState)) => string;
|
|
4868
4889
|
};
|
|
4869
4890
|
|
|
4891
|
+
declare type ShouldRenderOptions = {
|
|
4892
|
+
instantSearchInstance: InstantSearch;
|
|
4893
|
+
};
|
|
4894
|
+
|
|
4870
4895
|
declare function simpleStateMapping<TUiState extends UiState = UiState>(): StateMapping<TUiState, TUiState>;
|
|
4871
4896
|
|
|
4872
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
|
/**
|
|
@@ -4243,6 +4251,8 @@ declare type RefinementListRenderState = {
|
|
|
4243
4251
|
isFromSearch: boolean;
|
|
4244
4252
|
/**
|
|
4245
4253
|
* `true` if a refinement can be applied.
|
|
4254
|
+
* @MAJOR: reconsider how `canRefine` is computed so it both accounts for the
|
|
4255
|
+
* items returned in the main search and in SFFV.
|
|
4246
4256
|
*/
|
|
4247
4257
|
canRefine: boolean;
|
|
4248
4258
|
/**
|
|
@@ -4515,7 +4525,7 @@ declare type RequiredUiStateLifeCycle<TWidgetDescription extends WidgetDescripti
|
|
|
4515
4525
|
getWidgetSearchParameters: (state: SearchParameters, widgetSearchParametersOptions: {
|
|
4516
4526
|
uiState: Expand<Partial<TWidgetDescription['indexUiState'] & IndexUiState>>;
|
|
4517
4527
|
}) => SearchParameters;
|
|
4518
|
-
};
|
|
4528
|
+
} & (SearchWidgetLifeCycle<TWidgetDescription> | RecommendWidgetLifeCycle<TWidgetDescription>);
|
|
4519
4529
|
|
|
4520
4530
|
declare type RequiredWidgetLifeCycle<TWidgetDescription extends WidgetDescription> = {
|
|
4521
4531
|
/**
|
|
@@ -4526,6 +4536,10 @@ declare type RequiredWidgetLifeCycle<TWidgetDescription extends WidgetDescriptio
|
|
|
4526
4536
|
* Called once before the first search.
|
|
4527
4537
|
*/
|
|
4528
4538
|
init?: (options: InitOptions) => void;
|
|
4539
|
+
/**
|
|
4540
|
+
* Whether `render` should be called
|
|
4541
|
+
*/
|
|
4542
|
+
shouldRender?: (options: ShouldRenderOptions) => boolean;
|
|
4529
4543
|
/**
|
|
4530
4544
|
* Called after each search response has been received.
|
|
4531
4545
|
*/
|
|
@@ -4841,6 +4855,13 @@ declare type SearchBoxWidgetParams = {
|
|
|
4841
4855
|
queryHook?: (query: string, hook: (value: string) => void) => void;
|
|
4842
4856
|
};
|
|
4843
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
|
+
|
|
4844
4865
|
declare type SendEvent = (...args: [InsightsEvent] | [string, string, string?]) => void;
|
|
4845
4866
|
|
|
4846
4867
|
declare type SendEventForFacet = BuiltInSendEventForFacet & CustomSendEventForFacet;
|
|
@@ -4867,6 +4888,10 @@ declare type SharedRenderOptions = {
|
|
|
4867
4888
|
createURL: (nextState: SearchParameters | ((state: IndexUiState) => IndexUiState)) => string;
|
|
4868
4889
|
};
|
|
4869
4890
|
|
|
4891
|
+
declare type ShouldRenderOptions = {
|
|
4892
|
+
instantSearchInstance: InstantSearch;
|
|
4893
|
+
};
|
|
4894
|
+
|
|
4870
4895
|
declare function simpleStateMapping<TUiState extends UiState = UiState>(): StateMapping<TUiState, TUiState>;
|
|
4871
4896
|
|
|
4872
4897
|
declare function singleIndexStateMapping<TUiState extends UiState = UiState>(indexName: keyof TUiState): StateMapping<TUiState, TUiState[typeof indexName]>;
|