@docsearch/react 4.4.0 → 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.js +1 -1
- package/dist/esm/DocSearchModal.d.ts +17 -2
- package/dist/esm/DocSearchModal.js +1 -1
- package/dist/esm/Sidepanel.d.ts +62 -7
- package/dist/esm/Sidepanel.js +1 -1
- package/dist/esm/index.d.ts +20 -4
- 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 +2 -2
- 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 +2 -2
- package/dist/umd/Sidepanel.js.map +1 -1
- package/dist/umd/index.js +3 -3
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/useDocSearchKeyboardEvents.js +1 -1
- package/dist/umd/useTheme.js +1 -1
- package/dist/umd/version.js +2 -2
- package/dist/umd/version.js.map +1 -1
- package/package.json +10 -10
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseItem, AutocompleteState, AutocompleteContext, AutocompleteInsightsApi, AutocompleteOptions } from '@algolia/autocomplete-core';
|
|
2
|
-
import { DocSearchModalShortcuts, OnAskAiToggle } from '@docsearch/core';
|
|
2
|
+
import { InitialAskAiMessage, DocSearchModalShortcuts, DocSearchRef, OnAskAiToggle } from '@docsearch/core';
|
|
3
|
+
export { DocSearchRef } from '@docsearch/core';
|
|
3
4
|
import { Hit, LiteClient, SearchParamsObject } from 'algoliasearch/lite';
|
|
4
5
|
import React, { JSX } from 'react';
|
|
5
6
|
import { UIMessage } from '@ai-sdk/react';
|
|
@@ -193,6 +194,7 @@ type DocSearchAskAi = {
|
|
|
193
194
|
* @default false
|
|
194
195
|
*/
|
|
195
196
|
suggestedQuestions?: boolean;
|
|
197
|
+
useStagingEnv?: boolean;
|
|
196
198
|
};
|
|
197
199
|
interface DocSearchIndex {
|
|
198
200
|
name: string;
|
|
@@ -223,6 +225,19 @@ interface DocSearchProps {
|
|
|
223
225
|
* Configuration or assistant id to enable ask ai mode. Pass a string assistant id or a full config object.
|
|
224
226
|
*/
|
|
225
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;
|
|
226
241
|
/**
|
|
227
242
|
* Theme overrides applied to the modal and related components.
|
|
228
243
|
*/
|
|
@@ -323,7 +338,7 @@ interface DocSearchProps {
|
|
|
323
338
|
*/
|
|
324
339
|
keyboardShortcuts?: DocSearchModalShortcuts;
|
|
325
340
|
}
|
|
326
|
-
declare
|
|
341
|
+
declare const DocSearch: React.ForwardRefExoticComponent<DocSearchProps & React.RefAttributes<DocSearchRef>>;
|
|
327
342
|
declare function DocSearchInner(props: DocSearchProps): JSX.Element;
|
|
328
343
|
|
|
329
344
|
type ButtonTranslations = Partial<{
|
|
@@ -467,12 +482,13 @@ type ModalTranslations = Partial<{
|
|
|
467
482
|
type DocSearchModalProps = DocSearchProps & {
|
|
468
483
|
initialScrollY: number;
|
|
469
484
|
onAskAiToggle: OnAskAiToggle;
|
|
485
|
+
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
470
486
|
onClose?: () => void;
|
|
471
487
|
isAskAiActive?: boolean;
|
|
472
488
|
translations?: ModalTranslations;
|
|
473
489
|
isHybridModeSupported?: boolean;
|
|
474
490
|
};
|
|
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;
|
|
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;
|
|
476
492
|
|
|
477
493
|
interface UseDocSearchKeyboardEventsProps {
|
|
478
494
|
isOpen: boolean;
|
|
@@ -486,7 +502,7 @@ interface UseDocSearchKeyboardEventsProps {
|
|
|
486
502
|
}
|
|
487
503
|
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, isAskAiActive, onAskAiToggle, searchButtonRef, keyboardShortcuts, }: UseDocSearchKeyboardEventsProps): void;
|
|
488
504
|
|
|
489
|
-
declare const version = "4.
|
|
505
|
+
declare const version = "4.5.0-beta.0";
|
|
490
506
|
|
|
491
507
|
export { DocSearch, DocSearchButton, DocSearchInner, DocSearchModal, useDocSearchKeyboardEvents, version };
|
|
492
508
|
export type { AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, SuggestedQuestion, SuggestedQuestionHit, UseDocSearchKeyboardEventsProps };
|