@docsearch/js 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.
- package/dist/esm/index.d.ts +70 -19
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/index.js +3 -3
- package/dist/umd/index.js.map +1 -1
- package/package.json +12 -9
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,6 +2,26 @@ import { InsightsMethodMap as InsightsMethodMap$1, InsightsClient as InsightsCli
|
|
|
2
2
|
import React, { JSX } from 'react';
|
|
3
3
|
import { JSX as JSX$1 } from 'preact';
|
|
4
4
|
|
|
5
|
+
interface DocSearchModalShortcuts {
|
|
6
|
+
/**
|
|
7
|
+
* Enable/disable the Ctrl/Cmd+K shortcut to toggle the DocSearch modal.
|
|
8
|
+
*
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
'Ctrl/Cmd+K'?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Enable/disable the / shortcut to open the DocSearch modal.
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
'/'?: boolean;
|
|
18
|
+
}
|
|
19
|
+
type InitialAskAiMessage = {
|
|
20
|
+
query: string;
|
|
21
|
+
messageId?: string;
|
|
22
|
+
suggestedQuestionId?: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
5
25
|
type Cache = {
|
|
6
26
|
/**
|
|
7
27
|
* Gets the value of the given `key`.
|
|
@@ -6686,21 +6706,6 @@ declare type InsightsOption = {
|
|
|
6686
6706
|
interface AutocompleteOptions<TItem extends BaseItem> extends AutocompleteOptions$1<TItem>, InsightsOption {
|
|
6687
6707
|
}
|
|
6688
6708
|
|
|
6689
|
-
interface DocSearchModalShortcuts {
|
|
6690
|
-
/**
|
|
6691
|
-
* Enable/disable the Ctrl/Cmd+K shortcut to toggle the DocSearch modal.
|
|
6692
|
-
*
|
|
6693
|
-
* @default true
|
|
6694
|
-
*/
|
|
6695
|
-
'Ctrl/Cmd+K'?: boolean;
|
|
6696
|
-
/**
|
|
6697
|
-
* Enable/disable the / shortcut to open the DocSearch modal.
|
|
6698
|
-
*
|
|
6699
|
-
* @default true
|
|
6700
|
-
*/
|
|
6701
|
-
'/'?: boolean;
|
|
6702
|
-
}
|
|
6703
|
-
|
|
6704
6709
|
// ==================================================================================================
|
|
6705
6710
|
// JSON Schema Draft 07
|
|
6706
6711
|
// ==================================================================================================
|
|
@@ -8421,7 +8426,7 @@ type DocSearchAskAi = {
|
|
|
8421
8426
|
/**
|
|
8422
8427
|
* The assistant ID to use for the ask AI feature.
|
|
8423
8428
|
*/
|
|
8424
|
-
assistantId: string
|
|
8429
|
+
assistantId: string;
|
|
8425
8430
|
/**
|
|
8426
8431
|
* The search parameters to use for the ask AI feature.
|
|
8427
8432
|
*/
|
|
@@ -8432,6 +8437,7 @@ type DocSearchAskAi = {
|
|
|
8432
8437
|
* @default false
|
|
8433
8438
|
*/
|
|
8434
8439
|
suggestedQuestions?: boolean;
|
|
8440
|
+
useStagingEnv?: boolean;
|
|
8435
8441
|
};
|
|
8436
8442
|
interface DocSearchIndex {
|
|
8437
8443
|
name: string;
|
|
@@ -8462,6 +8468,22 @@ interface DocSearchProps$1 {
|
|
|
8462
8468
|
* Configuration or assistant id to enable ask ai mode. Pass a string assistant id or a full config object.
|
|
8463
8469
|
*/
|
|
8464
8470
|
askAi?: DocSearchAskAi | string;
|
|
8471
|
+
/**
|
|
8472
|
+
* Intercept Ask AI requests (e.g. Submitting a prompt or selecting a suggested question).
|
|
8473
|
+
*
|
|
8474
|
+
* Return `true` to prevent the default modal Ask AI flow (no toggle, no sendMessage).
|
|
8475
|
+
* Useful to route Ask AI into a different UI (e.g. `@docsearch/sidepanel-js`) without flicker.
|
|
8476
|
+
*/
|
|
8477
|
+
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
8478
|
+
/**
|
|
8479
|
+
* **Experimental:** Whether to use Agent Studio as the chat backend.
|
|
8480
|
+
*
|
|
8481
|
+
* This is an experimental feature and its API may change without notice in future releases.
|
|
8482
|
+
* Use with caution in production environments.
|
|
8483
|
+
*
|
|
8484
|
+
* @default false
|
|
8485
|
+
*/
|
|
8486
|
+
agentStudio?: boolean;
|
|
8465
8487
|
/**
|
|
8466
8488
|
* Theme overrides applied to the modal and related components.
|
|
8467
8489
|
*/
|
|
@@ -8696,7 +8718,36 @@ type ModalTranslations = Partial<{
|
|
|
8696
8718
|
footer: FooterTranslations;
|
|
8697
8719
|
}> & ScreenStateTranslations;
|
|
8698
8720
|
|
|
8699
|
-
|
|
8721
|
+
/**
|
|
8722
|
+
* Instance returned by docsearch() for programmatic control.
|
|
8723
|
+
*/
|
|
8724
|
+
interface DocSearchInstance {
|
|
8725
|
+
/** Returns true once the component is mounted and ready. */
|
|
8726
|
+
readonly isReady: boolean;
|
|
8727
|
+
/** Returns true if the modal is currently open. */
|
|
8728
|
+
readonly isOpen: boolean;
|
|
8729
|
+
/** Opens the search modal. */
|
|
8730
|
+
open(): void;
|
|
8731
|
+
/** Closes the search modal. */
|
|
8732
|
+
close(): void;
|
|
8733
|
+
/** Opens Ask AI mode (modal). */
|
|
8734
|
+
openAskAi(initialMessage?: InitialAskAiMessage): void;
|
|
8735
|
+
/** Unmounts the DocSearch component and cleans up. */
|
|
8736
|
+
destroy(): void;
|
|
8737
|
+
}
|
|
8738
|
+
/**
|
|
8739
|
+
* Lifecycle callbacks for the DocSearch instance.
|
|
8740
|
+
*/
|
|
8741
|
+
interface DocSearchCallbacks {
|
|
8742
|
+
/** Called once DocSearch is mounted and ready for interaction. */
|
|
8743
|
+
onReady?: () => void;
|
|
8744
|
+
/** Called when the modal opens. */
|
|
8745
|
+
onOpen?: () => void;
|
|
8746
|
+
/** Called when the modal closes. */
|
|
8747
|
+
onClose?: () => void;
|
|
8748
|
+
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
8749
|
+
}
|
|
8750
|
+
type DocSearchProps = DocSearchCallbacks & Omit<DocSearchProps$1, 'onSidepanelClose' | 'onSidepanelOpen'> & {
|
|
8700
8751
|
container: HTMLElement | string;
|
|
8701
8752
|
environment?: typeof window;
|
|
8702
8753
|
};
|
|
@@ -8704,7 +8755,7 @@ declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => JSX
|
|
|
8704
8755
|
type TemplateHelpers = Record<string, unknown> & {
|
|
8705
8756
|
html: typeof html;
|
|
8706
8757
|
};
|
|
8707
|
-
declare function docsearch(allProps: DocSearchProps):
|
|
8758
|
+
declare function docsearch(allProps: DocSearchProps): DocSearchInstance;
|
|
8708
8759
|
|
|
8709
8760
|
export { docsearch as default };
|
|
8710
|
-
export type { DocSearchProps, TemplateHelpers };
|
|
8761
|
+
export type { DocSearchCallbacks, DocSearchInstance, DocSearchProps, TemplateHelpers };
|