@docsearch/react 4.0.1 → 4.2.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.
@@ -119,7 +119,9 @@ interface SearchIndexTool {
119
119
  hits?: any[];
120
120
  };
121
121
  }
122
- type AIMessage = UIMessage<unknown, UIDataTypes, {
122
+ type AIMessage = UIMessage<{
123
+ stopped?: boolean;
124
+ }, UIDataTypes, {
123
125
  searchIndex: SearchIndexTool;
124
126
  }>;
125
127
 
@@ -128,7 +130,8 @@ type StoredAskAiMessage = AIMessage & {
128
130
  /** Optional user feedback on this assistant message. */
129
131
  feedback?: 'dislike' | 'like';
130
132
  };
131
- type StoredAskAiState = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'> & {
133
+ type StoredAskAiState = StoredDocSearchHit & {
134
+ stopped?: boolean;
132
135
  messages?: StoredAskAiMessage[];
133
136
  };
134
137
 
@@ -141,6 +144,13 @@ type DocSearchTransformClient = {
141
144
  addAlgoliaAgent: LiteClient['addAlgoliaAgent'];
142
145
  transporter: Pick<LiteClient['transporter'], 'algoliaAgent'>;
143
146
  };
147
+ type AskAiSearchParameters = {
148
+ facetFilters?: string[];
149
+ filters?: string;
150
+ attributesToRetrieve?: string[];
151
+ restrictSearchableAttributes?: string[];
152
+ distinct?: boolean;
153
+ };
144
154
  type DocSearchAskAi = {
145
155
  /**
146
156
  * The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
@@ -164,9 +174,7 @@ type DocSearchAskAi = {
164
174
  /**
165
175
  * The search parameters to use for the ask AI feature.
166
176
  */
167
- searchParameters?: {
168
- facetFilters?: SearchParamsObject['facetFilters'];
169
- };
177
+ searchParameters?: AskAiSearchParameters;
170
178
  };
171
179
  interface DocSearchIndex {
172
180
  name: string;
@@ -309,6 +317,11 @@ type FooterTranslations = Partial<{
309
317
  poweredByText: string;
310
318
  }>;
311
319
 
320
+ type NewConversationTranslations = Partial<{
321
+ newConversationTitle: string;
322
+ newConversationDescription: string;
323
+ }>;
324
+
312
325
  type AskAiScreenTranslations = Partial<{
313
326
  disclaimerText: string;
314
327
  relatedSourcesText: string;
@@ -338,6 +351,10 @@ type AskAiScreenTranslations = Partial<{
338
351
  lastSeparator?: string;
339
352
  after?: string;
340
353
  };
354
+ /**
355
+ * Message that's shown when user has stopped the streaming of a message.
356
+ */
357
+ stoppedStreamingText: string;
341
358
  }>;
342
359
 
343
360
  type ErrorScreenTranslations = Partial<{
@@ -354,6 +371,7 @@ type NoResultsScreenTranslations = Partial<{
354
371
 
355
372
  type ResultsScreenTranslations = Partial<{
356
373
  askAiPlaceholder: string;
374
+ noResultsAskAiPlaceholder: string;
357
375
  }>;
358
376
 
359
377
  type StartScreenTranslations = Partial<{
@@ -373,6 +391,7 @@ type ScreenStateTranslations = Partial<{
373
391
  noResultsScreen: NoResultsScreenTranslations;
374
392
  resultsScreen: ResultsScreenTranslations;
375
393
  askAiScreen: AskAiScreenTranslations;
394
+ newConversation: NewConversationTranslations;
376
395
  }>;
377
396
 
378
397
  type SearchBoxTranslations = Partial<{
@@ -388,10 +407,15 @@ type SearchBoxTranslations = Partial<{
388
407
  searchInputLabel: string;
389
408
  backToKeywordSearchButtonText: string;
390
409
  backToKeywordSearchButtonAriaLabel: string;
410
+ newConversationPlaceholder: string;
411
+ conversationHistoryTitle: string;
412
+ startNewConversationText: string;
413
+ viewConversationHistoryText: string;
391
414
  }>;
392
415
 
393
416
  type ModalTranslations = Partial<{
394
417
  searchBox: SearchBoxTranslations;
418
+ newConversation: NewConversationTranslations;
395
419
  footer: FooterTranslations;
396
420
  }> & ScreenStateTranslations;
397
421
  type DocSearchModalProps = DocSearchProps & {
@@ -416,7 +440,7 @@ interface UseDocSearchKeyboardEventsProps {
416
440
  }
417
441
  declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, isAskAiActive, onAskAiToggle, searchButtonRef, keyboardShortcuts, }: UseDocSearchKeyboardEventsProps): void;
418
442
 
419
- declare const version = "4.0.1";
443
+ declare const version = "4.2.0";
420
444
 
421
445
  export { DocSearch, DocSearchButton, DocSearchModal, useDocSearchKeyboardEvents, version };
422
- export type { ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, UseDocSearchKeyboardEventsProps };
446
+ export type { AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, UseDocSearchKeyboardEventsProps };