instantsearch.js 4.82.0 → 4.83.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.
@@ -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
 
@@ -337,6 +337,24 @@ declare type AutocompleteWidgetParams<TItem extends BaseHit> = {
337
337
  showSuggestions?: Partial<Pick<IndexConfig<{
338
338
  query: string;
339
339
  }>, 'indexName' | 'getURL' | 'templates' | 'cssClasses'>>;
340
+ showRecent?: boolean | {
341
+ /**
342
+ * Storage key to use in the local storage.
343
+ */
344
+ storageKey?: string;
345
+ templates?: Partial<{
346
+ /**
347
+ * Template to use for each result. This template will receive an object containing a single record.
348
+ */
349
+ item: Template<{
350
+ item: {
351
+ query: string;
352
+ };
353
+ onSelect: () => void;
354
+ onRemoveRecentSearch: () => void;
355
+ }>;
356
+ }>;
357
+ };
340
358
  getSearchPageURL?: (nextUiState: IndexUiState) => string;
341
359
  onSelect?: AutocompleteIndexConfig<TItem>['onSelect'];
342
360
  /**
@@ -643,9 +661,9 @@ declare type ChatRenderState<TUiMessage extends UIMessage = UIMessage> = {
643
661
  */
644
662
  onClearTransitionEnd: () => void;
645
663
  /**
646
- * Tools configuration passed to the connector.
664
+ * Tools configuration with addToolResult bound, ready to be used by the UI.
647
665
  */
648
- tools: Record<string, Omit<UserClientSideTool, 'layoutComponent'>>;
666
+ tools: ClientSideTools;
649
667
  } & Pick<AbstractChat<TUiMessage>, 'addToolResult' | 'clearError' | 'error' | 'id' | 'messages' | 'regenerate' | 'resumeStream' | 'sendMessage' | 'status' | 'stop'>;
650
668
 
651
669
  declare type ChatWidgetDescription<TUiMessage extends UIMessage = UIMessage> = {
@@ -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
 
@@ -337,6 +337,24 @@ declare type AutocompleteWidgetParams<TItem extends BaseHit> = {
337
337
  showSuggestions?: Partial<Pick<IndexConfig<{
338
338
  query: string;
339
339
  }>, 'indexName' | 'getURL' | 'templates' | 'cssClasses'>>;
340
+ showRecent?: boolean | {
341
+ /**
342
+ * Storage key to use in the local storage.
343
+ */
344
+ storageKey?: string;
345
+ templates?: Partial<{
346
+ /**
347
+ * Template to use for each result. This template will receive an object containing a single record.
348
+ */
349
+ item: Template<{
350
+ item: {
351
+ query: string;
352
+ };
353
+ onSelect: () => void;
354
+ onRemoveRecentSearch: () => void;
355
+ }>;
356
+ }>;
357
+ };
340
358
  getSearchPageURL?: (nextUiState: IndexUiState) => string;
341
359
  onSelect?: AutocompleteIndexConfig<TItem>['onSelect'];
342
360
  /**
@@ -643,9 +661,9 @@ declare type ChatRenderState<TUiMessage extends UIMessage = UIMessage> = {
643
661
  */
644
662
  onClearTransitionEnd: () => void;
645
663
  /**
646
- * Tools configuration passed to the connector.
664
+ * Tools configuration with addToolResult bound, ready to be used by the UI.
647
665
  */
648
- tools: Record<string, Omit<UserClientSideTool, 'layoutComponent'>>;
666
+ tools: ClientSideTools;
649
667
  } & Pick<AbstractChat<TUiMessage>, 'addToolResult' | 'clearError' | 'error' | 'id' | 'messages' | 'regenerate' | 'resumeStream' | 'sendMessage' | 'status' | 'stop'>;
650
668
 
651
669
  declare type ChatWidgetDescription<TUiMessage extends UIMessage = UIMessage> = {