@xpert-ai/chatkit-react 0.0.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/index.d.ts +53 -0
- package/dist/index.js +1469 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ChatKitEvents } from '@xpert-ai/chatkit-types';
|
|
2
|
+
import { ChatKitOptions } from '@xpert-ai/chatkit-types';
|
|
3
|
+
import * as React_2 from 'react';
|
|
4
|
+
import { XpertAIChatKit } from '@xpert-ai/chatkit-types';
|
|
5
|
+
|
|
6
|
+
export declare const ChatKit: React_2.ForwardRefExoticComponent<ChatKitProps & React_2.RefAttributes<XpertAIChatKit>>;
|
|
7
|
+
|
|
8
|
+
declare const CHATKIT_METHOD_NAMES: readonly ["focusComposer", "setThreadId", "sendUserMessage", "setComposerValue", "fetchUpdates", "sendCustomAction"];
|
|
9
|
+
|
|
10
|
+
declare type ChatKitControl = {
|
|
11
|
+
setInstance: (instance: XpertAIChatKit | null) => void;
|
|
12
|
+
options: ChatKitOptions;
|
|
13
|
+
handlers: ChatKitEventHandlers;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare type ChatKitEventHandlers = Partial<{
|
|
17
|
+
[K in keyof ChatKitEvents as ToEventHandlerKey<K>]: ChatKitEvents[K] extends CustomEvent<infer Detail> ? Detail extends undefined ? () => void : (event: Detail) => void : never;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
declare type ChatKitMethod = (typeof CHATKIT_METHOD_NAMES)[number];
|
|
21
|
+
|
|
22
|
+
declare type ChatKitMethods = {
|
|
23
|
+
[K in ChatKitMethod]: XpertAIChatKit[K];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
declare interface ChatKitProps extends React_2.HTMLAttributes<XpertAIChatKit> {
|
|
27
|
+
control: ChatKitControl;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare type DotToCamelCase<S extends string> = S extends `${infer Head}.${infer Tail}` ? `${Head}${Capitalize<DotToCamelCase<Tail>>}` : S;
|
|
31
|
+
|
|
32
|
+
declare type ToEventHandlerKey<K extends keyof ChatKitEvents> = DotToCamelCase<K> extends `chatkit${infer EventName}` ? `on${Capitalize<EventName>}` : never;
|
|
33
|
+
|
|
34
|
+
export declare function useChatKit(options: UseChatKitOptions): UseChatKitReturn;
|
|
35
|
+
|
|
36
|
+
declare type UseChatKitOptions = ChatKitOptions & ChatKitEventHandlers;
|
|
37
|
+
|
|
38
|
+
export declare type UseChatKitReturn = ChatKitMethods & {
|
|
39
|
+
control: ChatKitControl;
|
|
40
|
+
ref: React_2.RefObject<XpertAIChatKit | null>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { }
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
declare module 'react' {
|
|
47
|
+
namespace JSX {
|
|
48
|
+
interface IntrinsicElements {
|
|
49
|
+
'xpertai-chatkit': React.DetailedHTMLProps<React.HTMLAttributes<XpertAIChatKit>, XpertAIChatKit>;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|