@chatbotkit/react 1.24.0 → 1.26.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.
- package/dist/cjs/actions/complete.d.ts +1 -0
- package/dist/cjs/hooks/useWidgetInstance.cjs +5 -3
- package/dist/cjs/hooks/useWidgetInstance.d.ts +3 -40
- package/dist/cjs/hooks/useWidgetInstanceFunctions.d.ts +4 -3
- package/dist/cjs/hooks/useWidgetInstanceNotifications.d.ts +4 -3
- package/dist/esm/actions/complete.d.ts +1 -0
- package/dist/esm/hooks/useWidgetInstance.d.ts +3 -40
- package/dist/esm/hooks/useWidgetInstance.js +5 -3
- package/dist/esm/hooks/useWidgetInstanceFunctions.d.ts +4 -3
- package/dist/esm/hooks/useWidgetInstanceNotifications.d.ts +4 -3
- package/package.json +31 -27
|
@@ -56,6 +56,7 @@ export type OnFinishHandler = (arg0: {
|
|
|
56
56
|
}) => any;
|
|
57
57
|
export type Options = Omit<any, "messages" | "functions"> & {
|
|
58
58
|
client: import("@chatbotkit/sdk").ConversationClient;
|
|
59
|
+
backstory?: string;
|
|
59
60
|
messages: InputMessage[];
|
|
60
61
|
functions?: (InputFunction | (() => InputFunction | Promise<InputFunction>))[];
|
|
61
62
|
maxRecursion?: number;
|
|
@@ -26,12 +26,14 @@ function useWidgetInstance(selector, deps) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const chatbotkitWidget = (window).chatbotkitWidget;
|
|
30
|
+
if (chatbotkitWidget) {
|
|
31
|
+
chatbotkitWidget.instancePromise.then((instance) => setInstance(instance));
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
function onInit() {
|
|
34
|
-
|
|
35
|
+
const chatbotkitWidget = (window).chatbotkitWidget;
|
|
36
|
+
chatbotkitWidget.instancePromise.then((instance) => setInstance(instance));
|
|
35
37
|
}
|
|
36
38
|
window.addEventListener('chatbotkitWidgetInit', onInit);
|
|
37
39
|
return () => {
|
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
export function useWidgetInstance(selector?: string, deps?: any[]):
|
|
1
|
+
export function useWidgetInstance(selector?: string, deps?: any[]): ChatBotKitWidgetElementV2 | null;
|
|
2
2
|
export default useWidgetInstance;
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
type: string;
|
|
6
|
-
text: string;
|
|
7
|
-
};
|
|
8
|
-
export type WidgetNotification = {
|
|
9
|
-
text: string;
|
|
10
|
-
};
|
|
11
|
-
export type WidgetFunctionBase = {
|
|
12
|
-
description: string;
|
|
13
|
-
parameters: Record<string, any>;
|
|
14
|
-
};
|
|
15
|
-
export type WidgetFunctionWithResult = WidgetFunctionBase & {
|
|
16
|
-
result: {
|
|
17
|
-
data: any;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export type WidgetFunctionWithHandler = WidgetFunctionBase & {
|
|
21
|
-
handler: (args: any) => any;
|
|
22
|
-
};
|
|
23
|
-
export type WidgetFunction = WidgetFunctionWithResult | WidgetFunctionWithHandler;
|
|
24
|
-
export type WidgetRestartConversationFn = () => void;
|
|
25
|
-
export type WidgetSendMessageFn = (options: string | (({
|
|
26
|
-
message: string;
|
|
27
|
-
} | {
|
|
28
|
-
text: string;
|
|
29
|
-
}) & {
|
|
30
|
-
hidden?: boolean;
|
|
31
|
-
respond?: boolean;
|
|
32
|
-
})) => void;
|
|
33
|
-
export type ChatBotKitWidgetInstance = HTMLElement & {
|
|
34
|
-
ready: boolean;
|
|
35
|
-
readyPromise: Promise<boolean>;
|
|
36
|
-
messages?: WidgetMessage[] | null;
|
|
37
|
-
notifications?: Record<string, WidgetNotification> | null;
|
|
38
|
-
functions?: Record<string, WidgetFunction> | null;
|
|
39
|
-
restartConversation: WidgetRestartConversationFn;
|
|
40
|
-
sendMessage: WidgetSendMessageFn;
|
|
41
|
-
};
|
|
3
|
+
export type ChatBotKitWidgetElementV2 = any;
|
|
4
|
+
export type ChatBotKitGlobalObject = any;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function useWidgetInstanceFunctions(params?: {
|
|
2
2
|
selector?: string;
|
|
3
|
-
functions?: Record<string,
|
|
4
|
-
}, deps?: any[]):
|
|
3
|
+
functions?: Record<string, FunctionDefinition | null> | null;
|
|
4
|
+
}, deps?: any[]): ChatBotKitWidgetElementV2 | null;
|
|
5
5
|
export default useWidgetInstanceFunctions;
|
|
6
|
-
export type
|
|
6
|
+
export type FunctionDefinition = any;
|
|
7
|
+
export type ChatBotKitWidgetElementV2 = any;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function useWidgetInstanceNotifications(params?: {
|
|
2
2
|
selector?: string;
|
|
3
|
-
notifications?: Record<string,
|
|
4
|
-
}, deps?: any[]):
|
|
3
|
+
notifications?: Record<string, NotificationDefinition | null> | null;
|
|
4
|
+
}, deps?: any[]): ChatBotKitWidgetElementV2 | null;
|
|
5
5
|
export default useWidgetInstanceNotifications;
|
|
6
|
-
export type
|
|
6
|
+
export type NotificationDefinition = any;
|
|
7
|
+
export type ChatBotKitWidgetElementV2 = any;
|
|
@@ -56,6 +56,7 @@ export type OnFinishHandler = (arg0: {
|
|
|
56
56
|
}) => any;
|
|
57
57
|
export type Options = Omit<import("@chatbotkit/sdk/conversation/v1.js").ConversationCompleteRequest, "messages" | "functions"> & {
|
|
58
58
|
client: import("@chatbotkit/sdk").ConversationClient;
|
|
59
|
+
backstory?: string;
|
|
59
60
|
messages: InputMessage[];
|
|
60
61
|
functions?: (InputFunction | (() => InputFunction | Promise<InputFunction>))[];
|
|
61
62
|
maxRecursion?: number;
|
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
export function useWidgetInstance(selector?: string, deps?: any[]):
|
|
1
|
+
export function useWidgetInstance(selector?: string, deps?: any[]): ChatBotKitWidgetElementV2 | null;
|
|
2
2
|
export default useWidgetInstance;
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
type: string;
|
|
6
|
-
text: string;
|
|
7
|
-
};
|
|
8
|
-
export type WidgetNotification = {
|
|
9
|
-
text: string;
|
|
10
|
-
};
|
|
11
|
-
export type WidgetFunctionBase = {
|
|
12
|
-
description: string;
|
|
13
|
-
parameters: Record<string, any>;
|
|
14
|
-
};
|
|
15
|
-
export type WidgetFunctionWithResult = WidgetFunctionBase & {
|
|
16
|
-
result: {
|
|
17
|
-
data: any;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export type WidgetFunctionWithHandler = WidgetFunctionBase & {
|
|
21
|
-
handler: (args: any) => any;
|
|
22
|
-
};
|
|
23
|
-
export type WidgetFunction = WidgetFunctionWithResult | WidgetFunctionWithHandler;
|
|
24
|
-
export type WidgetRestartConversationFn = () => void;
|
|
25
|
-
export type WidgetSendMessageFn = (options: string | (({
|
|
26
|
-
message: string;
|
|
27
|
-
} | {
|
|
28
|
-
text: string;
|
|
29
|
-
}) & {
|
|
30
|
-
hidden?: boolean;
|
|
31
|
-
respond?: boolean;
|
|
32
|
-
})) => void;
|
|
33
|
-
export type ChatBotKitWidgetInstance = HTMLElement & {
|
|
34
|
-
ready: boolean;
|
|
35
|
-
readyPromise: Promise<boolean>;
|
|
36
|
-
messages?: WidgetMessage[] | null;
|
|
37
|
-
notifications?: Record<string, WidgetNotification> | null;
|
|
38
|
-
functions?: Record<string, WidgetFunction> | null;
|
|
39
|
-
restartConversation: WidgetRestartConversationFn;
|
|
40
|
-
sendMessage: WidgetSendMessageFn;
|
|
41
|
-
};
|
|
3
|
+
export type ChatBotKitWidgetElementV2 = import("@chatbotkit/widget/v2").ChatBotKitWidgetElementV2;
|
|
4
|
+
export type ChatBotKitGlobalObject = import("@chatbotkit/widget/v2").ChatBotKitGlobalObject;
|
|
@@ -22,12 +22,14 @@ export function useWidgetInstance(selector, deps) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const chatbotkitWidget = (window).chatbotkitWidget;
|
|
26
|
+
if (chatbotkitWidget) {
|
|
27
|
+
chatbotkitWidget.instancePromise.then((instance) => setInstance(instance));
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
30
|
function onInit() {
|
|
30
|
-
|
|
31
|
+
const chatbotkitWidget = (window).chatbotkitWidget;
|
|
32
|
+
chatbotkitWidget.instancePromise.then((instance) => setInstance(instance));
|
|
31
33
|
}
|
|
32
34
|
window.addEventListener('chatbotkitWidgetInit', onInit);
|
|
33
35
|
return () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function useWidgetInstanceFunctions(params?: {
|
|
2
2
|
selector?: string;
|
|
3
|
-
functions?: Record<string,
|
|
4
|
-
}, deps?: any[]):
|
|
3
|
+
functions?: Record<string, FunctionDefinition | null> | null;
|
|
4
|
+
}, deps?: any[]): ChatBotKitWidgetElementV2 | null;
|
|
5
5
|
export default useWidgetInstanceFunctions;
|
|
6
|
-
export type
|
|
6
|
+
export type FunctionDefinition = import("@chatbotkit/widget/v2").FunctionDefinition;
|
|
7
|
+
export type ChatBotKitWidgetElementV2 = import("@chatbotkit/widget/v2").ChatBotKitWidgetElementV2;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function useWidgetInstanceNotifications(params?: {
|
|
2
2
|
selector?: string;
|
|
3
|
-
notifications?: Record<string,
|
|
4
|
-
}, deps?: any[]):
|
|
3
|
+
notifications?: Record<string, NotificationDefinition | null> | null;
|
|
4
|
+
}, deps?: any[]): ChatBotKitWidgetElementV2 | null;
|
|
5
5
|
export default useWidgetInstanceNotifications;
|
|
6
|
-
export type
|
|
6
|
+
export type NotificationDefinition = import("@chatbotkit/widget/v2").NotificationDefinition;
|
|
7
|
+
export type ChatBotKitWidgetElementV2 = import("@chatbotkit/widget/v2").ChatBotKitWidgetElementV2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatbotkit/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "The fastest way to build advanced AI chat bots",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"engines": {
|
|
@@ -458,10 +458,33 @@
|
|
|
458
458
|
},
|
|
459
459
|
"./package.json": "./package.json"
|
|
460
460
|
},
|
|
461
|
+
"scripts": {
|
|
462
|
+
"build": "run-s build:*",
|
|
463
|
+
"build:01-cjs": "tsc -p tsconfig.cjs.json",
|
|
464
|
+
"build:01-cjs_rename": "node ../../scripts/rename-cjs.js",
|
|
465
|
+
"build:01-cjs_rewrite_cjs": "node ../../scripts/rewrite-cjs.js",
|
|
466
|
+
"build:01-cjs_rewrite_ts": "node ../../scripts/rewrite-ts.js",
|
|
467
|
+
"build:03-docs": "typedoc",
|
|
468
|
+
"build:02-esm": "tsc -p tsconfig.esm.json",
|
|
469
|
+
"build:00-exports": "node ../../scripts/create-standard-exports.js",
|
|
470
|
+
"build:00-types": "tsc -p tsconfig.types.json",
|
|
471
|
+
"check": "tsc -p tsconfig.check.json",
|
|
472
|
+
"clean": "run-p clean:*",
|
|
473
|
+
"clean:buildinfo": "rimraf *.tsbuildinfo",
|
|
474
|
+
"clean:dists": "rimraf dist",
|
|
475
|
+
"clean:exports": "run-s build:exports",
|
|
476
|
+
"clean:node_modules": "rimraf node_modules",
|
|
477
|
+
"clean:types": "rimraf types",
|
|
478
|
+
"lint": "eslint .",
|
|
479
|
+
"postpack": "node ../../scripts/create-standard-exports.js",
|
|
480
|
+
"prepack": "node ../../scripts/create-dist-exports.js",
|
|
481
|
+
"test": "true"
|
|
482
|
+
},
|
|
461
483
|
"types": "./dist/cjs/index.d.ts",
|
|
462
484
|
"dependencies": {
|
|
463
|
-
"
|
|
464
|
-
"@chatbotkit/
|
|
485
|
+
"@chatbotkit/sdk": "workspace:*",
|
|
486
|
+
"@chatbotkit/widget": "workspace:*",
|
|
487
|
+
"tslib": "^2.6.2"
|
|
465
488
|
},
|
|
466
489
|
"peerDependencies": {
|
|
467
490
|
"react": ">=18.0.0",
|
|
@@ -469,34 +492,15 @@
|
|
|
469
492
|
"react-markdown": "^8.0.4"
|
|
470
493
|
},
|
|
471
494
|
"devDependencies": {
|
|
495
|
+
"@types/react": "^18.2.0",
|
|
472
496
|
"npm-run-all": "^4.1.5",
|
|
497
|
+
"react-markdown": "^10.1.0",
|
|
473
498
|
"typedoc": "^0.28.14",
|
|
474
499
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
475
500
|
"typedoc-plugin-mdn-links": "^5.0.10",
|
|
476
|
-
"typescript": "^5.9"
|
|
477
|
-
"@types/react": "^18.2.0"
|
|
501
|
+
"typescript": "^5.9"
|
|
478
502
|
},
|
|
479
503
|
"files": [
|
|
480
504
|
"dist/**"
|
|
481
|
-
]
|
|
482
|
-
|
|
483
|
-
"build": "run-s build:*",
|
|
484
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
485
|
-
"build:cjs_rename": "node ../../scripts/rename-cjs.js",
|
|
486
|
-
"build:cjs_rewrite_cjs": "node ../../scripts/rewrite-cjs.js",
|
|
487
|
-
"build:cjs_rewrite_ts": "node ../../scripts/rewrite-ts.js",
|
|
488
|
-
"build:docs": "typedoc",
|
|
489
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
490
|
-
"build:exports": "node ../../scripts/create-standard-exports.js",
|
|
491
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
492
|
-
"check": "tsc -p tsconfig.check.json",
|
|
493
|
-
"clean": "run-p clean:*",
|
|
494
|
-
"clean:buildinfo": "rimraf *.tsbuildinfo",
|
|
495
|
-
"clean:dists": "rimraf dist",
|
|
496
|
-
"clean:exports": "run-s build:exports",
|
|
497
|
-
"clean:node_modules": "rimraf node_modules",
|
|
498
|
-
"clean:types": "rimraf types",
|
|
499
|
-
"lint": "eslint .",
|
|
500
|
-
"test": "true"
|
|
501
|
-
}
|
|
502
|
-
}
|
|
505
|
+
]
|
|
506
|
+
}
|