instantsearch.js 4.42.0 → 4.44.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 +29 -0
- package/cjs/components/Highlight/Highlight.js +33 -0
- package/cjs/components/InternalHighlight/InternalHighlight.js +16 -0
- package/cjs/components/ReverseHighlight/ReverseHighlight.js +33 -0
- package/cjs/components/ReverseSnippet/ReverseSnippet.js +33 -0
- package/cjs/components/Snippet/Snippet.js +33 -0
- package/cjs/connectors/rating-menu/connectRatingMenu.js +1 -1
- package/cjs/helpers/components/Highlight.js +45 -0
- package/cjs/helpers/components/ReverseHighlight.js +58 -0
- package/cjs/helpers/components/ReverseSnippet.js +58 -0
- package/cjs/helpers/components/Snippet.js +45 -0
- package/cjs/helpers/components/index.js +57 -0
- package/cjs/lib/InstantSearch.js +11 -1
- package/cjs/lib/version.js +1 -1
- package/cjs/types/algoliasearch.js +18 -1
- package/dist/instantsearch.development.d.ts +12 -31
- package/dist/instantsearch.development.js +20 -10
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +12 -31
- package/dist/instantsearch.production.min.d.ts +12 -31
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Highlight/Highlight.d.ts +7 -0
- package/es/components/Highlight/Highlight.js +24 -0
- package/es/components/InternalHighlight/InternalHighlight.d.ts +2 -0
- package/es/components/InternalHighlight/InternalHighlight.js +6 -0
- package/es/components/ReverseHighlight/ReverseHighlight.d.ts +7 -0
- package/es/components/ReverseHighlight/ReverseHighlight.js +24 -0
- package/es/components/ReverseSnippet/ReverseSnippet.d.ts +7 -0
- package/es/components/ReverseSnippet/ReverseSnippet.js +24 -0
- package/es/components/Snippet/Snippet.d.ts +7 -0
- package/es/components/Snippet/Snippet.js +24 -0
- package/es/connectors/geo-search/connectGeoSearch.d.ts +10 -10
- package/es/connectors/rating-menu/connectRatingMenu.js +1 -1
- package/es/helpers/components/Highlight.d.ts +10 -0
- package/es/helpers/components/Highlight.js +31 -0
- package/es/helpers/components/ReverseHighlight.d.ts +10 -0
- package/es/helpers/components/ReverseHighlight.js +44 -0
- package/es/helpers/components/ReverseSnippet.d.ts +10 -0
- package/es/helpers/components/ReverseSnippet.js +44 -0
- package/es/helpers/components/Snippet.d.ts +10 -0
- package/es/helpers/components/Snippet.js +31 -0
- package/es/helpers/components/index.d.ts +4 -0
- package/es/helpers/components/index.js +4 -0
- package/es/lib/InstantSearch.js +11 -1
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/types/algoliasearch.d.ts +1 -40
- package/es/types/algoliasearch.js +2 -0
- package/es/types/index.js +1 -0
- package/es/types/results.d.ts +1 -1
- package/es/types/utils.d.ts +4 -0
- package/package.json +6 -3
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
2
|
|
|
3
|
-
import type algoliasearch from 'algoliasearch/lite';
|
|
4
3
|
import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
|
|
5
|
-
import type * as ClientSearch from '@algolia/client-search';
|
|
6
4
|
import EventEmitter from '@algolia/events';
|
|
5
|
+
import { FindAnswersOptions } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
7
6
|
import type { InsightsClient as InsightsClient_2 } from 'search-insights';
|
|
8
7
|
import type { InsightsMethodMap } from 'search-insights';
|
|
9
8
|
import type * as Places from 'places.js';
|
|
10
9
|
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
11
10
|
import { default as qs_2 } from 'qs';
|
|
11
|
+
import { SearchClient } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
12
12
|
import type { SearchParameters } from 'algoliasearch-helper';
|
|
13
13
|
import type { SearchResults } from 'algoliasearch-helper';
|
|
14
14
|
|
|
@@ -34,7 +34,7 @@ declare type AlgoliaHit<THit extends BaseHit = Record<string, any>> = {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
_distinctSeqID?: number;
|
|
37
|
-
|
|
37
|
+
_geoloc?: GeoLoc;
|
|
38
38
|
} & THit;
|
|
39
39
|
|
|
40
40
|
declare const analytics: AnalyticsWidget;
|
|
@@ -1075,18 +1075,12 @@ declare type CustomSendEventForHits = (customPayload: any) => void;
|
|
|
1075
1075
|
|
|
1076
1076
|
declare type CustomSendEventForToggle = (customPayload: any) => void;
|
|
1077
1077
|
|
|
1078
|
-
declare type DefaultSearchClient = ReturnType<typeof algoliasearch>;
|
|
1079
|
-
|
|
1080
1078
|
declare type DisposeOptions = {
|
|
1081
1079
|
helper: AlgoliaSearchHelper;
|
|
1082
1080
|
state: SearchParameters;
|
|
1083
1081
|
parent: IndexWidget;
|
|
1084
1082
|
};
|
|
1085
1083
|
|
|
1086
|
-
declare type DummySearchClientV4 = {
|
|
1087
|
-
readonly transporter: any;
|
|
1088
|
-
};
|
|
1089
|
-
|
|
1090
1084
|
declare const dynamicWidgets: DynamicWidgetsWidget;
|
|
1091
1085
|
|
|
1092
1086
|
declare type DynamicWidgetsConnector = Connector<DynamicWidgetsWidgetDescription, DynamicWidgetsConnectorParams>;
|
|
@@ -1175,9 +1169,7 @@ declare const EXPERIMENTAL_connectDynamicWidgets: DynamicWidgetsConnector;
|
|
|
1175
1169
|
/** @deprecated use dynamicWidgets */
|
|
1176
1170
|
declare const EXPERIMENTAL_dynamicWidgets: DynamicWidgetsWidget;
|
|
1177
1171
|
|
|
1178
|
-
declare type
|
|
1179
|
-
|
|
1180
|
-
declare type GeoHit = Hit & Required<Pick<Hit, '_geoLoc'>>;
|
|
1172
|
+
declare type GeoHit<THit extends BaseHit = Record<string, any>> = Hit<THit> & Required<Pick<Hit, '_geoloc'>>;
|
|
1181
1173
|
|
|
1182
1174
|
declare type GeoLoc = {
|
|
1183
1175
|
lat: number;
|
|
@@ -1199,9 +1191,9 @@ declare type GeoLoc = {
|
|
|
1199
1191
|
*/
|
|
1200
1192
|
declare const geoSearch: GeoSearchWidget;
|
|
1201
1193
|
|
|
1202
|
-
declare type GeoSearchConnector = Connector<GeoSearchWidgetDescription
|
|
1194
|
+
declare type GeoSearchConnector<THit extends BaseHit = Record<string, any>> = Connector<GeoSearchWidgetDescription<THit>, GeoSearchConnectorParams<THit>>;
|
|
1203
1195
|
|
|
1204
|
-
declare type GeoSearchConnectorParams = {
|
|
1196
|
+
declare type GeoSearchConnectorParams<THit extends BaseHit = Record<string, any>> = {
|
|
1205
1197
|
/**
|
|
1206
1198
|
* If true, refine will be triggered as you move the map.
|
|
1207
1199
|
* @default true
|
|
@@ -1211,7 +1203,7 @@ declare type GeoSearchConnectorParams = {
|
|
|
1211
1203
|
* Function to transform the items passed to the templates.
|
|
1212
1204
|
* @default items => items
|
|
1213
1205
|
*/
|
|
1214
|
-
transformItems?: TransformItems<GeoHit
|
|
1206
|
+
transformItems?: TransformItems<GeoHit<THit>>;
|
|
1215
1207
|
};
|
|
1216
1208
|
|
|
1217
1209
|
declare type GeoSearchCSSClasses = Partial<{
|
|
@@ -1257,7 +1249,7 @@ declare type GeoSearchMarker<TOptions> = {
|
|
|
1257
1249
|
};
|
|
1258
1250
|
};
|
|
1259
1251
|
|
|
1260
|
-
declare type GeoSearchRenderState = {
|
|
1252
|
+
declare type GeoSearchRenderState<THit extends BaseHit = Record<string, any>> = {
|
|
1261
1253
|
/**
|
|
1262
1254
|
* Reset the current bounding box refinement.
|
|
1263
1255
|
*/
|
|
@@ -1281,7 +1273,7 @@ declare type GeoSearchRenderState = {
|
|
|
1281
1273
|
/**
|
|
1282
1274
|
* The matched hits from Algolia API.
|
|
1283
1275
|
*/
|
|
1284
|
-
items: GeoHit
|
|
1276
|
+
items: Array<GeoHit<THit>>;
|
|
1285
1277
|
/**
|
|
1286
1278
|
* The current position of the search.
|
|
1287
1279
|
*/
|
|
@@ -1321,11 +1313,11 @@ declare type GeoSearchWidget = WidgetFactory<GeoSearchWidgetDescription & {
|
|
|
1321
1313
|
$$widgetType: 'ais.geoSearch';
|
|
1322
1314
|
}, GeoSearchConnectorParams, GeoSearchWidgetParams>;
|
|
1323
1315
|
|
|
1324
|
-
declare type GeoSearchWidgetDescription = {
|
|
1316
|
+
declare type GeoSearchWidgetDescription<THit extends BaseHit = Record<string, any>> = {
|
|
1325
1317
|
$$type: 'ais.geoSearch';
|
|
1326
|
-
renderState: GeoSearchRenderState
|
|
1318
|
+
renderState: GeoSearchRenderState<THit>;
|
|
1327
1319
|
indexRenderState: {
|
|
1328
|
-
geoSearch: WidgetRenderState<GeoSearchRenderState
|
|
1320
|
+
geoSearch: WidgetRenderState<GeoSearchRenderState<THit>, GeoSearchConnectorParams<THit>>;
|
|
1329
1321
|
};
|
|
1330
1322
|
indexUiState: {
|
|
1331
1323
|
geoSearch: {
|
|
@@ -4582,17 +4574,6 @@ declare type SearchBoxWidgetParams = {
|
|
|
4582
4574
|
queryHook?: (query: string, hook: (value: string) => void) => void;
|
|
4583
4575
|
};
|
|
4584
4576
|
|
|
4585
|
-
declare type SearchClient = {
|
|
4586
|
-
search: DefaultSearchClient['search'];
|
|
4587
|
-
searchForFacetValues: DefaultSearchClient['searchForFacetValues'];
|
|
4588
|
-
addAlgoliaAgent?: DefaultSearchClient['addAlgoliaAgent'];
|
|
4589
|
-
initIndex?: (indexName: string) => SearchIndex extends {
|
|
4590
|
-
findAnswers: any;
|
|
4591
|
-
} ? Partial<Pick<SearchIndex, 'findAnswers'>> : SearchIndex;
|
|
4592
|
-
};
|
|
4593
|
-
|
|
4594
|
-
declare type SearchIndex = ReturnType<DefaultSearchClient['initIndex']>;
|
|
4595
|
-
|
|
4596
4577
|
declare type SendEvent = (...args: [InsightsEvent] | [string, string, string?]) => void;
|
|
4597
4578
|
|
|
4598
4579
|
declare type SendEventForFacet = BuiltInSendEventForFacet & CustomSendEventForFacet;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
2
|
|
|
3
|
-
import type algoliasearch from 'algoliasearch/lite';
|
|
4
3
|
import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
|
|
5
|
-
import type * as ClientSearch from '@algolia/client-search';
|
|
6
4
|
import EventEmitter from '@algolia/events';
|
|
5
|
+
import { FindAnswersOptions } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
7
6
|
import type { InsightsClient as InsightsClient_2 } from 'search-insights';
|
|
8
7
|
import type { InsightsMethodMap } from 'search-insights';
|
|
9
8
|
import type * as Places from 'places.js';
|
|
10
9
|
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
11
10
|
import { default as qs_2 } from 'qs';
|
|
11
|
+
import { SearchClient } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
12
12
|
import type { SearchParameters } from 'algoliasearch-helper';
|
|
13
13
|
import type { SearchResults } from 'algoliasearch-helper';
|
|
14
14
|
|
|
@@ -34,7 +34,7 @@ declare type AlgoliaHit<THit extends BaseHit = Record<string, any>> = {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
_distinctSeqID?: number;
|
|
37
|
-
|
|
37
|
+
_geoloc?: GeoLoc;
|
|
38
38
|
} & THit;
|
|
39
39
|
|
|
40
40
|
declare const analytics: AnalyticsWidget;
|
|
@@ -1075,18 +1075,12 @@ declare type CustomSendEventForHits = (customPayload: any) => void;
|
|
|
1075
1075
|
|
|
1076
1076
|
declare type CustomSendEventForToggle = (customPayload: any) => void;
|
|
1077
1077
|
|
|
1078
|
-
declare type DefaultSearchClient = ReturnType<typeof algoliasearch>;
|
|
1079
|
-
|
|
1080
1078
|
declare type DisposeOptions = {
|
|
1081
1079
|
helper: AlgoliaSearchHelper;
|
|
1082
1080
|
state: SearchParameters;
|
|
1083
1081
|
parent: IndexWidget;
|
|
1084
1082
|
};
|
|
1085
1083
|
|
|
1086
|
-
declare type DummySearchClientV4 = {
|
|
1087
|
-
readonly transporter: any;
|
|
1088
|
-
};
|
|
1089
|
-
|
|
1090
1084
|
declare const dynamicWidgets: DynamicWidgetsWidget;
|
|
1091
1085
|
|
|
1092
1086
|
declare type DynamicWidgetsConnector = Connector<DynamicWidgetsWidgetDescription, DynamicWidgetsConnectorParams>;
|
|
@@ -1175,9 +1169,7 @@ declare const EXPERIMENTAL_connectDynamicWidgets: DynamicWidgetsConnector;
|
|
|
1175
1169
|
/** @deprecated use dynamicWidgets */
|
|
1176
1170
|
declare const EXPERIMENTAL_dynamicWidgets: DynamicWidgetsWidget;
|
|
1177
1171
|
|
|
1178
|
-
declare type
|
|
1179
|
-
|
|
1180
|
-
declare type GeoHit = Hit & Required<Pick<Hit, '_geoLoc'>>;
|
|
1172
|
+
declare type GeoHit<THit extends BaseHit = Record<string, any>> = Hit<THit> & Required<Pick<Hit, '_geoloc'>>;
|
|
1181
1173
|
|
|
1182
1174
|
declare type GeoLoc = {
|
|
1183
1175
|
lat: number;
|
|
@@ -1199,9 +1191,9 @@ declare type GeoLoc = {
|
|
|
1199
1191
|
*/
|
|
1200
1192
|
declare const geoSearch: GeoSearchWidget;
|
|
1201
1193
|
|
|
1202
|
-
declare type GeoSearchConnector = Connector<GeoSearchWidgetDescription
|
|
1194
|
+
declare type GeoSearchConnector<THit extends BaseHit = Record<string, any>> = Connector<GeoSearchWidgetDescription<THit>, GeoSearchConnectorParams<THit>>;
|
|
1203
1195
|
|
|
1204
|
-
declare type GeoSearchConnectorParams = {
|
|
1196
|
+
declare type GeoSearchConnectorParams<THit extends BaseHit = Record<string, any>> = {
|
|
1205
1197
|
/**
|
|
1206
1198
|
* If true, refine will be triggered as you move the map.
|
|
1207
1199
|
* @default true
|
|
@@ -1211,7 +1203,7 @@ declare type GeoSearchConnectorParams = {
|
|
|
1211
1203
|
* Function to transform the items passed to the templates.
|
|
1212
1204
|
* @default items => items
|
|
1213
1205
|
*/
|
|
1214
|
-
transformItems?: TransformItems<GeoHit
|
|
1206
|
+
transformItems?: TransformItems<GeoHit<THit>>;
|
|
1215
1207
|
};
|
|
1216
1208
|
|
|
1217
1209
|
declare type GeoSearchCSSClasses = Partial<{
|
|
@@ -1257,7 +1249,7 @@ declare type GeoSearchMarker<TOptions> = {
|
|
|
1257
1249
|
};
|
|
1258
1250
|
};
|
|
1259
1251
|
|
|
1260
|
-
declare type GeoSearchRenderState = {
|
|
1252
|
+
declare type GeoSearchRenderState<THit extends BaseHit = Record<string, any>> = {
|
|
1261
1253
|
/**
|
|
1262
1254
|
* Reset the current bounding box refinement.
|
|
1263
1255
|
*/
|
|
@@ -1281,7 +1273,7 @@ declare type GeoSearchRenderState = {
|
|
|
1281
1273
|
/**
|
|
1282
1274
|
* The matched hits from Algolia API.
|
|
1283
1275
|
*/
|
|
1284
|
-
items: GeoHit
|
|
1276
|
+
items: Array<GeoHit<THit>>;
|
|
1285
1277
|
/**
|
|
1286
1278
|
* The current position of the search.
|
|
1287
1279
|
*/
|
|
@@ -1321,11 +1313,11 @@ declare type GeoSearchWidget = WidgetFactory<GeoSearchWidgetDescription & {
|
|
|
1321
1313
|
$$widgetType: 'ais.geoSearch';
|
|
1322
1314
|
}, GeoSearchConnectorParams, GeoSearchWidgetParams>;
|
|
1323
1315
|
|
|
1324
|
-
declare type GeoSearchWidgetDescription = {
|
|
1316
|
+
declare type GeoSearchWidgetDescription<THit extends BaseHit = Record<string, any>> = {
|
|
1325
1317
|
$$type: 'ais.geoSearch';
|
|
1326
|
-
renderState: GeoSearchRenderState
|
|
1318
|
+
renderState: GeoSearchRenderState<THit>;
|
|
1327
1319
|
indexRenderState: {
|
|
1328
|
-
geoSearch: WidgetRenderState<GeoSearchRenderState
|
|
1320
|
+
geoSearch: WidgetRenderState<GeoSearchRenderState<THit>, GeoSearchConnectorParams<THit>>;
|
|
1329
1321
|
};
|
|
1330
1322
|
indexUiState: {
|
|
1331
1323
|
geoSearch: {
|
|
@@ -4582,17 +4574,6 @@ declare type SearchBoxWidgetParams = {
|
|
|
4582
4574
|
queryHook?: (query: string, hook: (value: string) => void) => void;
|
|
4583
4575
|
};
|
|
4584
4576
|
|
|
4585
|
-
declare type SearchClient = {
|
|
4586
|
-
search: DefaultSearchClient['search'];
|
|
4587
|
-
searchForFacetValues: DefaultSearchClient['searchForFacetValues'];
|
|
4588
|
-
addAlgoliaAgent?: DefaultSearchClient['addAlgoliaAgent'];
|
|
4589
|
-
initIndex?: (indexName: string) => SearchIndex extends {
|
|
4590
|
-
findAnswers: any;
|
|
4591
|
-
} ? Partial<Pick<SearchIndex, 'findAnswers'>> : SearchIndex;
|
|
4592
|
-
};
|
|
4593
|
-
|
|
4594
|
-
declare type SearchIndex = ReturnType<DefaultSearchClient['initIndex']>;
|
|
4595
|
-
|
|
4596
4577
|
declare type SendEvent = (...args: [InsightsEvent] | [string, string, string?]) => void;
|
|
4597
4578
|
|
|
4598
4579
|
declare type SendEventForFacet = BuiltInSendEventForFacet & CustomSendEventForFacet;
|