@docsearch/react 4.3.2 → 4.4.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.
@@ -1,4 +1,5 @@
1
1
  import { BaseItem, AutocompleteState, AutocompleteContext, AutocompleteInsightsApi, AutocompleteOptions } from '@algolia/autocomplete-core';
2
+ import { DocSearchModalShortcuts, OnAskAiToggle } from '@docsearch/core';
2
3
  import { Hit, LiteClient, SearchParamsObject } from 'algoliasearch/lite';
3
4
  import React, { JSX } from 'react';
4
5
  import { UIMessage } from '@ai-sdk/react';
@@ -317,8 +318,10 @@ interface DocSearchProps {
317
318
  recentSearchesWithFavoritesLimit?: number;
318
319
  /**
319
320
  * Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.
321
+ *
322
+ * @default `{ 'Ctrl/Cmd+K': true, '/': true }`
320
323
  */
321
- keyboardShortcuts?: KeyboardShortcuts;
324
+ keyboardShortcuts?: DocSearchModalShortcuts;
322
325
  }
323
326
  declare function DocSearch(props: DocSearchProps): JSX.Element;
324
327
  declare function DocSearchInner(props: DocSearchProps): JSX.Element;
@@ -330,7 +333,7 @@ type ButtonTranslations = Partial<{
330
333
  type DocSearchButtonProps = React.ComponentProps<'button'> & {
331
334
  theme?: DocSearchTheme;
332
335
  translations?: ButtonTranslations;
333
- keyboardShortcuts?: KeyboardShortcuts;
336
+ keyboardShortcuts?: DocSearchModalShortcuts;
334
337
  };
335
338
  declare const DocSearchButton: React.ForwardRefExoticComponent<Omit<DocSearchButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
336
339
 
@@ -385,6 +388,18 @@ type AskAiScreenTranslations = Partial<{
385
388
  * Message that's shown when user has stopped the streaming of a message.
386
389
  */
387
390
  stoppedStreamingText: string;
391
+ /**
392
+ * Error title shown if there is an error while chatting.
393
+ */
394
+ errorTitleText: string;
395
+ /**
396
+ * Message shown when thread depth limit is exceeded (AI-217 error).
397
+ */
398
+ threadDepthExceededMessage: string;
399
+ /**
400
+ * Button text for starting a new conversation after thread depth error.
401
+ */
402
+ startNewConversationButtonText: string;
388
403
  }>;
389
404
 
390
405
  type ErrorScreenTranslations = Partial<{
@@ -441,6 +456,7 @@ type SearchBoxTranslations = Partial<{
441
456
  conversationHistoryTitle: string;
442
457
  startNewConversationText: string;
443
458
  viewConversationHistoryText: string;
459
+ threadDepthErrorPlaceholder: string;
444
460
  }>;
445
461
 
446
462
  type ModalTranslations = Partial<{
@@ -450,12 +466,13 @@ type ModalTranslations = Partial<{
450
466
  }> & ScreenStateTranslations;
451
467
  type DocSearchModalProps = DocSearchProps & {
452
468
  initialScrollY: number;
453
- onAskAiToggle: (toggle: boolean) => void;
469
+ onAskAiToggle: OnAskAiToggle;
454
470
  onClose?: () => void;
455
471
  isAskAiActive?: boolean;
456
472
  translations?: ModalTranslations;
473
+ isHybridModeSupported?: boolean;
457
474
  };
458
- declare function DocSearchModal({ appId, apiKey, askAi, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, isAskAiActive, recentSearchesLimit, recentSearchesWithFavoritesLimit, indices, indexName, searchParameters, ...props }: DocSearchModalProps): JSX.Element;
475
+ declare function DocSearchModal({ appId, apiKey, askAi, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, isAskAiActive, recentSearchesLimit, recentSearchesWithFavoritesLimit, indices, indexName, searchParameters, isHybridModeSupported, ...props }: DocSearchModalProps): JSX.Element;
459
476
 
460
477
  interface UseDocSearchKeyboardEventsProps {
461
478
  isOpen: boolean;
@@ -469,7 +486,7 @@ interface UseDocSearchKeyboardEventsProps {
469
486
  }
470
487
  declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, isAskAiActive, onAskAiToggle, searchButtonRef, keyboardShortcuts, }: UseDocSearchKeyboardEventsProps): void;
471
488
 
472
- declare const version = "4.3.2";
489
+ declare const version = "4.4.0";
473
490
 
474
491
  export { DocSearch, DocSearchButton, DocSearchInner, DocSearchModal, useDocSearchKeyboardEvents, version };
475
492
  export type { AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, SuggestedQuestion, SuggestedQuestionHit, UseDocSearchKeyboardEventsProps };