@docsearch/react 4.5.0-beta.0 → 4.5.0-beta.2
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/DocSearchModal.d.ts +9 -6
- package/dist/esm/DocSearchModal.js +1 -1
- package/dist/esm/Sidepanel.d.ts +34 -13
- package/dist/esm/Sidepanel.js +1 -1
- package/dist/esm/index.d.ts +40 -12
- package/dist/esm/index.js +1 -1
- package/dist/esm/useDocSearchKeyboardEvents.d.ts +12 -2
- package/dist/esm/useDocSearchKeyboardEvents.js +1 -1
- 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 +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 +2 -2
- package/dist/umd/useDocSearchKeyboardEvents.js.map +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 +3 -3
package/dist/esm/index.d.ts
CHANGED
|
@@ -121,11 +121,26 @@ interface SearchIndexTool {
|
|
|
121
121
|
hits?: any[];
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
+
interface AgentStudioSearchTool {
|
|
125
|
+
input: {
|
|
126
|
+
index: string;
|
|
127
|
+
query: string;
|
|
128
|
+
number_of_results: number;
|
|
129
|
+
facet_filters: any | null;
|
|
130
|
+
};
|
|
131
|
+
output: {
|
|
132
|
+
hits?: any[];
|
|
133
|
+
nbHits?: number;
|
|
134
|
+
queryID?: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
type Tools = {
|
|
138
|
+
searchIndex: SearchIndexTool;
|
|
139
|
+
algolia_search_index: AgentStudioSearchTool;
|
|
140
|
+
};
|
|
124
141
|
type AIMessage = UIMessage<{
|
|
125
142
|
stopped?: boolean;
|
|
126
|
-
}, UIDataTypes,
|
|
127
|
-
searchIndex: SearchIndexTool;
|
|
128
|
-
}>;
|
|
143
|
+
}, UIDataTypes, Tools>;
|
|
129
144
|
|
|
130
145
|
type StoredDocSearchHit = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'>;
|
|
131
146
|
type StoredAskAiMessage = AIMessage & {
|
|
@@ -183,7 +198,7 @@ type DocSearchAskAi = {
|
|
|
183
198
|
/**
|
|
184
199
|
* The assistant ID to use for the ask AI feature.
|
|
185
200
|
*/
|
|
186
|
-
assistantId: string
|
|
201
|
+
assistantId: string;
|
|
187
202
|
/**
|
|
188
203
|
* The search parameters to use for the ask AI feature.
|
|
189
204
|
*/
|
|
@@ -231,13 +246,16 @@ interface DocSearchProps {
|
|
|
231
246
|
* Return `true` to prevent the default modal Ask AI flow (no toggle, no sendMessage).
|
|
232
247
|
* Useful to route Ask AI into a different UI (e.g. `@docsearch/sidepanel-js`) without flicker.
|
|
233
248
|
*/
|
|
249
|
+
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
234
250
|
/**
|
|
235
|
-
*
|
|
251
|
+
* **Experimental:** Whether to use Agent Studio as the chat backend.
|
|
252
|
+
*
|
|
253
|
+
* This is an experimental feature and its API may change without notice in future releases.
|
|
254
|
+
* Use with caution in production environments.
|
|
236
255
|
*
|
|
237
|
-
*
|
|
238
|
-
* (no toggle, no sendMessage, no internal Ask AI state updates).
|
|
256
|
+
* @default false
|
|
239
257
|
*/
|
|
240
|
-
|
|
258
|
+
agentStudio?: boolean;
|
|
241
259
|
/**
|
|
242
260
|
* Theme overrides applied to the modal and related components.
|
|
243
261
|
*/
|
|
@@ -488,21 +506,31 @@ type DocSearchModalProps = DocSearchProps & {
|
|
|
488
506
|
translations?: ModalTranslations;
|
|
489
507
|
isHybridModeSupported?: boolean;
|
|
490
508
|
};
|
|
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;
|
|
509
|
+
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, agentStudio, ...props }: DocSearchModalProps): JSX.Element;
|
|
492
510
|
|
|
493
511
|
interface UseDocSearchKeyboardEventsProps {
|
|
494
512
|
isOpen: boolean;
|
|
495
513
|
onOpen: () => void;
|
|
496
514
|
onClose: () => void;
|
|
515
|
+
/**
|
|
516
|
+
* Deprecated: Still here for backwards compat.
|
|
517
|
+
*
|
|
518
|
+
* @deprecated
|
|
519
|
+
*/
|
|
497
520
|
onInput?: (event: KeyboardEvent) => void;
|
|
498
|
-
|
|
521
|
+
/**
|
|
522
|
+
* Deprecated: Still here for backwards compat.
|
|
523
|
+
*
|
|
524
|
+
* @deprecated
|
|
525
|
+
*/
|
|
526
|
+
searchButtonRef?: React.RefObject<HTMLButtonElement | null>;
|
|
499
527
|
isAskAiActive: boolean;
|
|
500
528
|
onAskAiToggle: (toggle: boolean) => void;
|
|
501
529
|
keyboardShortcuts?: KeyboardShortcuts;
|
|
502
530
|
}
|
|
503
|
-
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose,
|
|
531
|
+
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, isAskAiActive, onAskAiToggle, keyboardShortcuts, }: UseDocSearchKeyboardEventsProps): void;
|
|
504
532
|
|
|
505
|
-
declare const version = "4.5.0-beta.
|
|
533
|
+
declare const version = "4.5.0-beta.2";
|
|
506
534
|
|
|
507
535
|
export { DocSearch, DocSearchButton, DocSearchInner, DocSearchModal, useDocSearchKeyboardEvents, version };
|
|
508
536
|
export type { AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, SuggestedQuestion, SuggestedQuestionHit, UseDocSearchKeyboardEventsProps };
|