@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.
@@ -177,8 +177,9 @@ type AskAiSearchParameters = {
177
177
  filters?: string;
178
178
  attributesToRetrieve?: string[];
179
179
  restrictSearchableAttributes?: string[];
180
- distinct?: boolean;
180
+ distinct?: boolean | number | string;
181
181
  };
182
+ type AgentStudioSearchParameters = Record<string, Omit<AskAiSearchParameters, 'facetFilters'>>;
182
183
  type DocSearchAskAi = {
183
184
  /**
184
185
  * The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
@@ -199,10 +200,6 @@ type DocSearchAskAi = {
199
200
  * The assistant ID to use for the ask AI feature.
200
201
  */
201
202
  assistantId: string;
202
- /**
203
- * The search parameters to use for the ask AI feature.
204
- */
205
- searchParameters?: AskAiSearchParameters;
206
203
  /**
207
204
  * Enables displaying suggested questions on Ask AI's new conversation screen.
208
205
  *
@@ -210,7 +207,39 @@ type DocSearchAskAi = {
210
207
  */
211
208
  suggestedQuestions?: boolean;
212
209
  useStagingEnv?: boolean;
213
- };
210
+ } & ({
211
+ /**
212
+ * **Experimental:** Whether to use Agent Studio as the chat backend.
213
+ *
214
+ * This is an experimental feature and its API may change without notice in future releases.
215
+ * Use with caution in production environments.
216
+ *
217
+ * @default false
218
+ */
219
+ agentStudio?: never;
220
+ /**
221
+ * The search parameters to use for the ask AI feature.
222
+ *
223
+ * **NOTE**: If using `agentStudio = true`, the `searchParameters` object is
224
+ * keyed by the index name.
225
+ */
226
+ searchParameters?: AskAiSearchParameters;
227
+ } | {
228
+ agentStudio: false;
229
+ searchParameters?: AskAiSearchParameters;
230
+ } | {
231
+ agentStudio: true;
232
+ /**
233
+ * The search parameters to use for the ask AI feature.
234
+ * Keyed by the index name.
235
+ *
236
+ * @example
237
+ * {
238
+ * "INDEX_NAME": { distinct: false }
239
+ * }
240
+ */
241
+ searchParameters?: AgentStudioSearchParameters;
242
+ });
214
243
  interface DocSearchIndex {
215
244
  name: string;
216
245
  searchParameters?: SearchParamsObject;
@@ -247,15 +276,6 @@ interface DocSearchProps {
247
276
  * Useful to route Ask AI into a different UI (e.g. `@docsearch/sidepanel-js`) without flicker.
248
277
  */
249
278
  interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
250
- /**
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.
255
- *
256
- * @default false
257
- */
258
- agentStudio?: boolean;
259
279
  /**
260
280
  * Theme overrides applied to the modal and related components.
261
281
  */
@@ -506,7 +526,7 @@ type DocSearchModalProps = DocSearchProps & {
506
526
  translations?: ModalTranslations;
507
527
  isHybridModeSupported?: boolean;
508
528
  };
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;
529
+ 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;
510
530
 
511
531
  interface UseDocSearchKeyboardEventsProps {
512
532
  isOpen: boolean;
@@ -530,7 +550,7 @@ interface UseDocSearchKeyboardEventsProps {
530
550
  }
531
551
  declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, isAskAiActive, onAskAiToggle, keyboardShortcuts, }: UseDocSearchKeyboardEventsProps): void;
532
552
 
533
- declare const version = "4.5.0-beta.2";
553
+ declare const version = "4.5.0";
534
554
 
535
555
  export { DocSearch, DocSearchButton, DocSearchInner, DocSearchModal, useDocSearchKeyboardEvents, version };
536
- export type { AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, SuggestedQuestion, SuggestedQuestionHit, UseDocSearchKeyboardEventsProps };
556
+ export type { AgentStudioSearchParameters, AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, SuggestedQuestion, SuggestedQuestionHit, UseDocSearchKeyboardEventsProps };