@docsearch/react 4.5.0-beta.2 → 4.5.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.
@@ -7,8 +7,9 @@ type AskAiSearchParameters = {
7
7
  filters?: string;
8
8
  attributesToRetrieve?: string[];
9
9
  restrictSearchableAttributes?: string[];
10
- distinct?: boolean;
10
+ distinct?: boolean | number | string;
11
11
  };
12
+ type AgentStudioSearchParameters = Record<string, Omit<AskAiSearchParameters, 'facetFilters'>>;
12
13
 
13
14
  type AlgoliaLogoTranslations = Partial<{
14
15
  poweredByText: string;
@@ -70,6 +71,10 @@ type ConversationScreenTranslations = Partial<ToolCallTranslations & {
70
71
  * Message displayed after feedback action.
71
72
  **/
72
73
  thanksForFeedbackText: string;
74
+ /**
75
+ * Error title shown if there is an error while chatting.
76
+ */
77
+ errorTitleText: any;
73
78
  }>;
74
79
 
75
80
  type NewConversationScreenTranslations = Partial<{
@@ -161,7 +166,7 @@ type SidepanelTranslations = Partial<{
161
166
  **/
162
167
  logo: AlgoliaLogoTranslations;
163
168
  }>;
164
- type SidepanelProps = {
169
+ type SidepanelProps$1 = {
165
170
  /**
166
171
  * Variant of the Sidepanel positioning.
167
172
  *
@@ -219,12 +224,13 @@ type SidepanelProps = {
219
224
  keyboardShortcuts?: SidepanelShortcuts;
220
225
  useStagingEnv?: boolean;
221
226
  };
222
- declare const Sidepanel: React.ForwardRefExoticComponent<Omit<DocSearchSidepanelProps, "button" | "panel"> & SidepanelProps & {
227
+ type Props$1 = Omit<DocSearchSidepanelProps, 'button' | 'panel'> & SidepanelProps$1 & SidepanelSearchParameters & {
223
228
  isOpen?: boolean;
224
229
  onOpen: () => void;
225
230
  onClose: () => void;
226
231
  initialMessage?: InitialAskAiMessage;
227
- } & React.RefAttributes<SidepanelRef>>;
232
+ };
233
+ declare const Sidepanel: React.ForwardRefExoticComponent<Props$1 & React.RefAttributes<SidepanelRef>>;
228
234
 
229
235
  type SidepanelButtonTranslations = Partial<{
230
236
  /**
@@ -265,58 +271,40 @@ type SidepanelButtonProps = {
265
271
  type Props = React.ComponentProps<'button'> & SidepanelButtonProps;
266
272
  declare const SidepanelButton: ({ variant, keyboardShortcuts, translations, ...props }: Props) => JSX.Element;
267
273
 
268
- type DocSearchSidepanelProps = DocSearchCallbacks & {
274
+ type SidepanelSearchParameters = {
269
275
  /**
270
- * The assistant ID to use for the ask AI feature.
271
- */
272
- assistantId: string;
273
- /**
274
- * Public api key with search permissions for the index.
275
- */
276
- apiKey: string;
277
- /**
278
- * Algolia application id used by the search client.
279
- */
280
- appId: string;
281
- /**
282
- * The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
283
- */
284
- indexName: string;
285
- /**
286
- * The search parameters to use for the ask AI feature.
287
- */
288
- searchParameters?: AskAiSearchParameters;
289
- /**
290
- * Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.
276
+ * **Experimental:** Whether to use Agent Studio as the chat backend.
291
277
  *
292
- * @default `{ 'Ctrl/Cmd+I': true }`
293
- */
294
- keyboardShortcuts?: SidepanelShortcuts;
295
- /**
296
- * Theme overrides applied to the Sidepanel button and panel.
278
+ * This is an experimental feature and its API may change without notice in future releases.
279
+ * Use with caution in production environments.
297
280
  *
298
- * @default 'light'
299
- */
300
- theme?: DocSearchTheme;
301
- /**
302
- * Props specific to the Sidepanel button.
281
+ * @default false
303
282
  */
304
- button?: Omit<SidepanelButtonProps, 'keyboardShortcuts'>;
283
+ agentStudio?: never;
305
284
  /**
306
- * Props specific to the Sidepanel panel.
285
+ * The search parameters to use for the ask AI feature.
286
+ *
287
+ * **NOTE**: If using `agentStudio = true`, the `searchParameters` object is
288
+ * keyed by the index name.
307
289
  */
308
- panel?: Omit<SidepanelProps, 'keyboardShortcuts'>;
290
+ searchParameters?: AskAiSearchParameters;
291
+ } | {
292
+ agentStudio: false;
293
+ searchParameters?: AskAiSearchParameters;
294
+ } | {
295
+ agentStudio: true;
309
296
  /**
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.
297
+ * The search parameters to use for the ask AI feature.
298
+ * Keyed by the index name.
314
299
  *
315
- * @default false
300
+ * @example
301
+ * {
302
+ * "INDEX_NAME": { distinct: false }
303
+ * }
316
304
  */
317
- agentStudio?: boolean;
305
+ searchParameters?: AgentStudioSearchParameters;
318
306
  };
319
- declare const DocSearchSidepanel: React.ForwardRefExoticComponent<DocSearchCallbacks & {
307
+ type DocSearchSidepanelProps = DocSearchCallbacks & {
320
308
  /**
321
309
  * The assistant ID to use for the ask AI feature.
322
310
  */
@@ -333,10 +321,6 @@ declare const DocSearchSidepanel: React.ForwardRefExoticComponent<DocSearchCallb
333
321
  * The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
334
322
  */
335
323
  indexName: string;
336
- /**
337
- * The search parameters to use for the ask AI feature.
338
- */
339
- searchParameters?: AskAiSearchParameters;
340
324
  /**
341
325
  * Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.
342
326
  *
@@ -352,21 +336,14 @@ declare const DocSearchSidepanel: React.ForwardRefExoticComponent<DocSearchCallb
352
336
  /**
353
337
  * Props specific to the Sidepanel button.
354
338
  */
355
- button?: Omit<SidepanelButtonProps, "keyboardShortcuts">;
339
+ button?: Omit<SidepanelButtonProps, 'keyboardShortcuts'>;
356
340
  /**
357
341
  * Props specific to the Sidepanel panel.
358
342
  */
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>>;
343
+ panel?: Omit<SidepanelProps$1, 'keyboardShortcuts'>;
344
+ };
345
+ type SidepanelProps = DocSearchSidepanelProps & SidepanelSearchParameters;
346
+ declare const DocSearchSidepanel: React.ForwardRefExoticComponent<SidepanelProps & React.RefAttributes<DocSearchRef>>;
370
347
 
371
348
  export { DocSearchSidepanel, Sidepanel, SidepanelButton };
372
- export type { ButtonVariant, DocSearchSidepanelProps, SidepanelButtonProps, SidepanelButtonTranslations, SidepanelProps, SidepanelRef, SidepanelTranslations };
349
+ export type { ButtonVariant, DocSearchSidepanelProps, SidepanelButtonProps, SidepanelButtonTranslations, SidepanelProps$1 as SidepanelProps, SidepanelRef, SidepanelSearchParameters, SidepanelTranslations };