@docsearch/react 4.3.2 → 4.5.0-beta.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/dist/esm/DocSearchButton.d.ts +2 -16
- package/dist/esm/DocSearchButton.js +1 -1
- package/dist/esm/DocSearchModal.d.ts +35 -18
- package/dist/esm/DocSearchModal.js +2 -2
- package/dist/esm/Sidepanel.d.ts +351 -0
- package/dist/esm/Sidepanel.js +3 -0
- package/dist/esm/index.d.ts +39 -6
- package/dist/esm/index.js +2 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/DocSearchModal.js +3 -3
- package/dist/umd/DocSearchModal.js.map +1 -1
- package/dist/umd/DocsearchButton.js +2 -2
- package/dist/umd/DocsearchButton.js.map +1 -1
- package/dist/umd/Sidepanel.js +5 -0
- package/dist/umd/Sidepanel.js.map +1 -0
- package/dist/umd/index.js +3 -3
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/useDocSearchKeyboardEvents.js +2 -2
- package/dist/umd/useDocSearchKeyboardEvents.js.map +1 -1
- package/dist/umd/useTheme.js +2 -2
- package/dist/umd/useTheme.js.map +1 -1
- package/dist/umd/version.js +2 -2
- package/dist/umd/version.js.map +1 -1
- package/package.json +16 -12
- package/sidepanel.js +1 -0
- package/style/sidepanel.js +1 -0
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BaseItem, AutocompleteState, AutocompleteContext, AutocompleteInsightsApi, AutocompleteOptions } from '@algolia/autocomplete-core';
|
|
2
|
+
import { InitialAskAiMessage, DocSearchModalShortcuts, DocSearchRef, OnAskAiToggle } from '@docsearch/core';
|
|
3
|
+
export { DocSearchRef } from '@docsearch/core';
|
|
2
4
|
import { Hit, LiteClient, SearchParamsObject } from 'algoliasearch/lite';
|
|
3
5
|
import React, { JSX } from 'react';
|
|
4
6
|
import { UIMessage } from '@ai-sdk/react';
|
|
@@ -192,6 +194,7 @@ type DocSearchAskAi = {
|
|
|
192
194
|
* @default false
|
|
193
195
|
*/
|
|
194
196
|
suggestedQuestions?: boolean;
|
|
197
|
+
useStagingEnv?: boolean;
|
|
195
198
|
};
|
|
196
199
|
interface DocSearchIndex {
|
|
197
200
|
name: string;
|
|
@@ -222,6 +225,19 @@ interface DocSearchProps {
|
|
|
222
225
|
* Configuration or assistant id to enable ask ai mode. Pass a string assistant id or a full config object.
|
|
223
226
|
*/
|
|
224
227
|
askAi?: DocSearchAskAi | string;
|
|
228
|
+
/**
|
|
229
|
+
* Intercept Ask AI requests (e.g. Submitting a prompt or selecting a suggested question).
|
|
230
|
+
*
|
|
231
|
+
* Return `true` to prevent the default modal Ask AI flow (no toggle, no sendMessage).
|
|
232
|
+
* Useful to route Ask AI into a different UI (e.g. `@docsearch/sidepanel-js`) without flicker.
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* Intercept Ask AI events (prompt submit, suggested question selection, etc).
|
|
236
|
+
*
|
|
237
|
+
* Return `true` to prevent *all* default Ask AI behavior that would normally follow
|
|
238
|
+
* (no toggle, no sendMessage, no internal Ask AI state updates).
|
|
239
|
+
*/
|
|
240
|
+
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
225
241
|
/**
|
|
226
242
|
* Theme overrides applied to the modal and related components.
|
|
227
243
|
*/
|
|
@@ -317,10 +333,12 @@ interface DocSearchProps {
|
|
|
317
333
|
recentSearchesWithFavoritesLimit?: number;
|
|
318
334
|
/**
|
|
319
335
|
* Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.
|
|
336
|
+
*
|
|
337
|
+
* @default `{ 'Ctrl/Cmd+K': true, '/': true }`
|
|
320
338
|
*/
|
|
321
|
-
keyboardShortcuts?:
|
|
339
|
+
keyboardShortcuts?: DocSearchModalShortcuts;
|
|
322
340
|
}
|
|
323
|
-
declare
|
|
341
|
+
declare const DocSearch: React.ForwardRefExoticComponent<DocSearchProps & React.RefAttributes<DocSearchRef>>;
|
|
324
342
|
declare function DocSearchInner(props: DocSearchProps): JSX.Element;
|
|
325
343
|
|
|
326
344
|
type ButtonTranslations = Partial<{
|
|
@@ -330,7 +348,7 @@ type ButtonTranslations = Partial<{
|
|
|
330
348
|
type DocSearchButtonProps = React.ComponentProps<'button'> & {
|
|
331
349
|
theme?: DocSearchTheme;
|
|
332
350
|
translations?: ButtonTranslations;
|
|
333
|
-
keyboardShortcuts?:
|
|
351
|
+
keyboardShortcuts?: DocSearchModalShortcuts;
|
|
334
352
|
};
|
|
335
353
|
declare const DocSearchButton: React.ForwardRefExoticComponent<Omit<DocSearchButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
336
354
|
|
|
@@ -385,6 +403,18 @@ type AskAiScreenTranslations = Partial<{
|
|
|
385
403
|
* Message that's shown when user has stopped the streaming of a message.
|
|
386
404
|
*/
|
|
387
405
|
stoppedStreamingText: string;
|
|
406
|
+
/**
|
|
407
|
+
* Error title shown if there is an error while chatting.
|
|
408
|
+
*/
|
|
409
|
+
errorTitleText: string;
|
|
410
|
+
/**
|
|
411
|
+
* Message shown when thread depth limit is exceeded (AI-217 error).
|
|
412
|
+
*/
|
|
413
|
+
threadDepthExceededMessage: string;
|
|
414
|
+
/**
|
|
415
|
+
* Button text for starting a new conversation after thread depth error.
|
|
416
|
+
*/
|
|
417
|
+
startNewConversationButtonText: string;
|
|
388
418
|
}>;
|
|
389
419
|
|
|
390
420
|
type ErrorScreenTranslations = Partial<{
|
|
@@ -441,6 +471,7 @@ type SearchBoxTranslations = Partial<{
|
|
|
441
471
|
conversationHistoryTitle: string;
|
|
442
472
|
startNewConversationText: string;
|
|
443
473
|
viewConversationHistoryText: string;
|
|
474
|
+
threadDepthErrorPlaceholder: string;
|
|
444
475
|
}>;
|
|
445
476
|
|
|
446
477
|
type ModalTranslations = Partial<{
|
|
@@ -450,12 +481,14 @@ type ModalTranslations = Partial<{
|
|
|
450
481
|
}> & ScreenStateTranslations;
|
|
451
482
|
type DocSearchModalProps = DocSearchProps & {
|
|
452
483
|
initialScrollY: number;
|
|
453
|
-
onAskAiToggle:
|
|
484
|
+
onAskAiToggle: OnAskAiToggle;
|
|
485
|
+
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
454
486
|
onClose?: () => void;
|
|
455
487
|
isAskAiActive?: boolean;
|
|
456
488
|
translations?: ModalTranslations;
|
|
489
|
+
isHybridModeSupported?: boolean;
|
|
457
490
|
};
|
|
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;
|
|
491
|
+
declare function DocSearchModal({ appId, apiKey, askAi, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, interceptAskAiEvent, isAskAiActive, recentSearchesLimit, recentSearchesWithFavoritesLimit, indices, indexName, searchParameters, isHybridModeSupported, ...props }: DocSearchModalProps): JSX.Element;
|
|
459
492
|
|
|
460
493
|
interface UseDocSearchKeyboardEventsProps {
|
|
461
494
|
isOpen: boolean;
|
|
@@ -469,7 +502,7 @@ interface UseDocSearchKeyboardEventsProps {
|
|
|
469
502
|
}
|
|
470
503
|
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, isAskAiActive, onAskAiToggle, searchButtonRef, keyboardShortcuts, }: UseDocSearchKeyboardEventsProps): void;
|
|
471
504
|
|
|
472
|
-
declare const version = "4.
|
|
505
|
+
declare const version = "4.5.0-beta.0";
|
|
473
506
|
|
|
474
507
|
export { DocSearch, DocSearchButton, DocSearchInner, DocSearchModal, useDocSearchKeyboardEvents, version };
|
|
475
508
|
export type { AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, SuggestedQuestion, SuggestedQuestionHit, UseDocSearchKeyboardEventsProps };
|