instantsearch.js 4.82.0 → 4.84.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/chat/connectChat.js +11 -1
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/autocomplete/autocomplete.js +179 -49
- package/cjs/widgets/chat/chat.js +57 -6
- package/cjs/widgets/index/index.js +10 -12
- package/dist/instantsearch.development.d.ts +48 -5
- package/dist/instantsearch.development.js +634 -198
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +48 -5
- package/dist/instantsearch.production.min.d.ts +48 -5
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/chat/connectChat.d.ts +4 -4
- package/es/connectors/chat/connectChat.js +11 -1
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/widgets/autocomplete/autocomplete.d.ts +40 -3
- package/es/widgets/autocomplete/autocomplete.js +180 -50
- package/es/widgets/chat/chat.d.ts +41 -2
- package/es/widgets/chat/chat.js +57 -6
- package/es/widgets/index/index.d.ts +5 -0
- package/es/widgets/index/index.js +11 -13
- package/package.json +7 -7
|
@@ -5,6 +5,7 @@ import type { AutocompleteIndexClassNames } from 'instantsearch-ui-components';
|
|
|
5
5
|
import type { AutocompleteIndexConfig } from 'instantsearch-ui-components';
|
|
6
6
|
import { Banner } from 'algoliasearch-helper';
|
|
7
7
|
import type { CarouselProps } from 'instantsearch-ui-components';
|
|
8
|
+
import type { ClientSideTools } from 'instantsearch-ui-components';
|
|
8
9
|
import { CompositionClient } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
9
10
|
import EventEmitter from '@algolia/events';
|
|
10
11
|
import { FindAnswersOptions } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
@@ -33,7 +34,6 @@ import { SearchParameters } from 'algoliasearch-helper';
|
|
|
33
34
|
import { SearchResults } from 'algoliasearch-helper';
|
|
34
35
|
import type { TrendingItemsProps } from 'instantsearch-ui-components';
|
|
35
36
|
import type { UIMessage } from 'ai';
|
|
36
|
-
import type { UserClientSideTool } from 'instantsearch-ui-components';
|
|
37
37
|
import { VNode } from 'preact';
|
|
38
38
|
import type { VNode as VNode_2 } from 'instantsearch-ui-components';
|
|
39
39
|
|
|
@@ -309,7 +309,17 @@ declare type AutocompleteRenderState = {
|
|
|
309
309
|
refine: (query: string) => void;
|
|
310
310
|
};
|
|
311
311
|
|
|
312
|
-
declare type
|
|
312
|
+
declare type AutocompleteSearchParameters = Omit<PlainSearchParameters, 'index'>;
|
|
313
|
+
|
|
314
|
+
declare type AutocompleteTemplates = {
|
|
315
|
+
/**
|
|
316
|
+
* Template to use for the panel.
|
|
317
|
+
*/
|
|
318
|
+
panel?: Template<{
|
|
319
|
+
elements: PanelElements;
|
|
320
|
+
indices: AutocompleteRenderState['indices'];
|
|
321
|
+
}>;
|
|
322
|
+
};
|
|
313
323
|
|
|
314
324
|
declare type AutocompleteWidgetDescription = {
|
|
315
325
|
$$type: 'ais.autocomplete';
|
|
@@ -337,12 +347,34 @@ declare type AutocompleteWidgetParams<TItem extends BaseHit> = {
|
|
|
337
347
|
showSuggestions?: Partial<Pick<IndexConfig<{
|
|
338
348
|
query: string;
|
|
339
349
|
}>, 'indexName' | 'getURL' | 'templates' | 'cssClasses'>>;
|
|
350
|
+
showRecent?: boolean | {
|
|
351
|
+
/**
|
|
352
|
+
* Storage key to use in the local storage.
|
|
353
|
+
*/
|
|
354
|
+
storageKey?: string;
|
|
355
|
+
templates?: Partial<{
|
|
356
|
+
/**
|
|
357
|
+
* Template to use for each result. This template will receive an object containing a single record.
|
|
358
|
+
*/
|
|
359
|
+
item: Template<{
|
|
360
|
+
item: {
|
|
361
|
+
query: string;
|
|
362
|
+
};
|
|
363
|
+
onSelect: () => void;
|
|
364
|
+
onRemoveRecentSearch: () => void;
|
|
365
|
+
}>;
|
|
366
|
+
}>;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Search parameters to apply to the autocomplete indices.
|
|
370
|
+
*/
|
|
371
|
+
searchParameters?: AutocompleteSearchParameters;
|
|
340
372
|
getSearchPageURL?: (nextUiState: IndexUiState) => string;
|
|
341
373
|
onSelect?: AutocompleteIndexConfig<TItem>['onSelect'];
|
|
342
374
|
/**
|
|
343
375
|
* Templates to use for the widget.
|
|
344
376
|
*/
|
|
345
|
-
templates?: AutocompleteTemplates
|
|
377
|
+
templates?: AutocompleteTemplates;
|
|
346
378
|
/**
|
|
347
379
|
* CSS classes to add.
|
|
348
380
|
*/
|
|
@@ -643,9 +675,9 @@ declare type ChatRenderState<TUiMessage extends UIMessage = UIMessage> = {
|
|
|
643
675
|
*/
|
|
644
676
|
onClearTransitionEnd: () => void;
|
|
645
677
|
/**
|
|
646
|
-
* Tools configuration
|
|
678
|
+
* Tools configuration with addToolResult bound, ready to be used by the UI.
|
|
647
679
|
*/
|
|
648
|
-
tools:
|
|
680
|
+
tools: ClientSideTools;
|
|
649
681
|
} & Pick<AbstractChat<TUiMessage>, 'addToolResult' | 'clearError' | 'error' | 'id' | 'messages' | 'regenerate' | 'resumeStream' | 'sendMessage' | 'status' | 'stop'>;
|
|
650
682
|
|
|
651
683
|
declare type ChatWidgetDescription<TUiMessage extends UIMessage = UIMessage> = {
|
|
@@ -4869,6 +4901,10 @@ declare type IndexConfig<TItem extends BaseHit> = AutocompleteIndexConfig<TItem>
|
|
|
4869
4901
|
onSelect: () => void;
|
|
4870
4902
|
}>;
|
|
4871
4903
|
}>;
|
|
4904
|
+
/**
|
|
4905
|
+
* Search parameters to apply to this index.
|
|
4906
|
+
*/
|
|
4907
|
+
searchParameters?: AutocompleteSearchParameters;
|
|
4872
4908
|
cssClasses?: Partial<AutocompleteIndexClassNames>;
|
|
4873
4909
|
};
|
|
4874
4910
|
|
|
@@ -4929,6 +4965,11 @@ declare type IndexWidget<TUiState extends UiState = UiState> = Omit<Widget<Index
|
|
|
4929
4965
|
* @private
|
|
4930
4966
|
*/
|
|
4931
4967
|
_isolated: boolean;
|
|
4968
|
+
/**
|
|
4969
|
+
* Schedules a search for this index only.
|
|
4970
|
+
* @private
|
|
4971
|
+
*/
|
|
4972
|
+
scheduleLocalSearch: () => void;
|
|
4932
4973
|
};
|
|
4933
4974
|
|
|
4934
4975
|
declare type IndexWidgetDescription = {
|
|
@@ -6332,6 +6373,8 @@ declare type PanelCSSClasses = Partial<{
|
|
|
6332
6373
|
footer: string | string[];
|
|
6333
6374
|
}>;
|
|
6334
6375
|
|
|
6376
|
+
declare type PanelElements = Partial<Record<'recent' | 'suggestions' | (string & {}), preact.JSX.Element>>;
|
|
6377
|
+
|
|
6335
6378
|
declare type PanelRenderOptions<TWidgetFactory extends AnyWidgetFactory> = RenderOptions & GetWidgetRenderState<TWidgetFactory>;
|
|
6336
6379
|
|
|
6337
6380
|
declare type PanelTemplates<TWidget extends AnyWidgetFactory> = Partial<{
|