@docsearch/react 4.4.0 → 4.5.0-beta.1

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
- import { SidepanelShortcuts, InitialAskAiMessage, DocSearchTheme } from '@docsearch/core';
1
+ import { SidepanelShortcuts, InitialAskAiMessage, DocSearchCallbacks, DocSearchTheme, DocSearchRef } from '@docsearch/core';
2
+ export { DocSearchCallbacks, DocSearchRef } from '@docsearch/core';
2
3
  import React, { JSX } from 'react';
3
4
 
4
5
  type AskAiSearchParameters = {
@@ -13,19 +14,7 @@ type AlgoliaLogoTranslations = Partial<{
13
14
  poweredByText: string;
14
15
  }>;
15
16
 
16
- type ConversationScreenTranslations = Partial<{
17
- /**
18
- * Text shown as an LLM disclaimer.
19
- */
20
- conversationDisclaimer: string;
21
- /**
22
- * Text shown while assistant is reasoning.
23
- */
24
- reasoningText: string;
25
- /**
26
- * Text show while assistant is thinking.
27
- */
28
- thinkingText: string;
17
+ type ToolCallTranslations = {
29
18
  /**
30
19
  * Text shown while assistant is preparing tool call.
31
20
  */
@@ -38,6 +27,21 @@ type ConversationScreenTranslations = Partial<{
38
27
  * Text shown while assistant is finished performing tool call.
39
28
  */
40
29
  toolCallResultText: string;
30
+ };
31
+
32
+ type ConversationScreenTranslations = Partial<ToolCallTranslations & {
33
+ /**
34
+ * Text shown as an LLM disclaimer.
35
+ */
36
+ conversationDisclaimer: string;
37
+ /**
38
+ * Text shown while assistant is reasoning.
39
+ */
40
+ reasoningText: string;
41
+ /**
42
+ * Text show while assistant is thinking.
43
+ */
44
+ thinkingText: string;
41
45
  /**
42
46
  * Text shown describing related sources.
43
47
  */
@@ -122,6 +126,19 @@ type HeaderTranslations = Partial<{
122
126
  viewConversationHistoryText: string;
123
127
  }>;
124
128
 
129
+ /**
130
+ * Imperative handle exposed by the Sidepanel component for programmatic control.
131
+ */
132
+ interface SidepanelRef {
133
+ /** Opens the sidepanel. */
134
+ open: () => void;
135
+ /** Closes the sidepanel. */
136
+ close: () => void;
137
+ /** Returns true once the component is mounted and ready. */
138
+ readonly isReady: boolean;
139
+ /** Returns true if the sidepanel is currently open. */
140
+ readonly isOpen: boolean;
141
+ }
125
142
  type SidepanelTranslations = Partial<{
126
143
  /**
127
144
  * Translation texts for the Sidepanel header.
@@ -200,14 +217,14 @@ type SidepanelProps = {
200
217
  * @default `{ 'Ctrl/Cmd+I': true }`
201
218
  */
202
219
  keyboardShortcuts?: SidepanelShortcuts;
220
+ useStagingEnv?: boolean;
203
221
  };
204
- type Props$1 = Omit<DocSearchSidepanelProps, 'button' | 'panel'> & SidepanelProps & {
222
+ declare const Sidepanel: React.ForwardRefExoticComponent<Omit<DocSearchSidepanelProps, "button" | "panel"> & SidepanelProps & {
205
223
  isOpen?: boolean;
206
224
  onOpen: () => void;
207
225
  onClose: () => void;
208
226
  initialMessage?: InitialAskAiMessage;
209
- };
210
- declare const Sidepanel: ({ isOpen, onOpen, onClose, assistantId, apiKey, appId, indexName, variant, searchParameters, pushSelector, width, expandedWidth, suggestedQuestions: suggestedQuestionsEnabled, translations, keyboardShortcuts, side, initialMessage, }: Props$1) => JSX.Element;
227
+ } & React.RefAttributes<SidepanelRef>>;
211
228
 
212
229
  type SidepanelButtonTranslations = Partial<{
213
230
  /**
@@ -248,7 +265,7 @@ type SidepanelButtonProps = {
248
265
  type Props = React.ComponentProps<'button'> & SidepanelButtonProps;
249
266
  declare const SidepanelButton: ({ variant, keyboardShortcuts, translations, ...props }: Props) => JSX.Element;
250
267
 
251
- type DocSearchSidepanelProps = {
268
+ type DocSearchSidepanelProps = DocSearchCallbacks & {
252
269
  /**
253
270
  * The assistant ID to use for the ask AI feature.
254
271
  */
@@ -289,8 +306,67 @@ type DocSearchSidepanelProps = {
289
306
  * Props specific to the Sidepanel panel.
290
307
  */
291
308
  panel?: Omit<SidepanelProps, 'keyboardShortcuts'>;
309
+ /**
310
+ * **Experimental:** Whether to use Agent Studio as the chat backend.
311
+ *
312
+ * This is an experimental feature and its API may change without notice in future releases.
313
+ * Use with caution in production environments.
314
+ *
315
+ * @default false
316
+ */
317
+ agentStudio?: boolean;
292
318
  };
293
- declare function DocSearchSidepanel({ keyboardShortcuts, theme, ...props }: DocSearchSidepanelProps): JSX.Element;
319
+ declare const DocSearchSidepanel: React.ForwardRefExoticComponent<DocSearchCallbacks & {
320
+ /**
321
+ * The assistant ID to use for the ask AI feature.
322
+ */
323
+ assistantId: string;
324
+ /**
325
+ * Public api key with search permissions for the index.
326
+ */
327
+ apiKey: string;
328
+ /**
329
+ * Algolia application id used by the search client.
330
+ */
331
+ appId: string;
332
+ /**
333
+ * The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
334
+ */
335
+ indexName: string;
336
+ /**
337
+ * The search parameters to use for the ask AI feature.
338
+ */
339
+ searchParameters?: AskAiSearchParameters;
340
+ /**
341
+ * Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.
342
+ *
343
+ * @default `{ 'Ctrl/Cmd+I': true }`
344
+ */
345
+ keyboardShortcuts?: SidepanelShortcuts;
346
+ /**
347
+ * Theme overrides applied to the Sidepanel button and panel.
348
+ *
349
+ * @default 'light'
350
+ */
351
+ theme?: DocSearchTheme;
352
+ /**
353
+ * Props specific to the Sidepanel button.
354
+ */
355
+ button?: Omit<SidepanelButtonProps, "keyboardShortcuts">;
356
+ /**
357
+ * Props specific to the Sidepanel panel.
358
+ */
359
+ panel?: Omit<SidepanelProps, "keyboardShortcuts">;
360
+ /**
361
+ * **Experimental:** Whether to use Agent Studio as the chat backend.
362
+ *
363
+ * This is an experimental feature and its API may change without notice in future releases.
364
+ * Use with caution in production environments.
365
+ *
366
+ * @default false
367
+ */
368
+ agentStudio?: boolean;
369
+ } & React.RefAttributes<DocSearchRef>>;
294
370
 
295
371
  export { DocSearchSidepanel, Sidepanel, SidepanelButton };
296
- export type { ButtonVariant, DocSearchSidepanelProps, SidepanelButtonProps, SidepanelButtonTranslations, SidepanelProps, SidepanelTranslations };
372
+ export type { ButtonVariant, DocSearchSidepanelProps, SidepanelButtonProps, SidepanelButtonTranslations, SidepanelProps, SidepanelRef, SidepanelTranslations };