@wallavi/widget 1.0.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/index.d.mts +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +630 -0
- package/dist/index.mjs +601 -0
- package/package.json +52 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type ToolPart = {
|
|
4
|
+
type: "tool";
|
|
5
|
+
toolCallId: string;
|
|
6
|
+
toolName: string;
|
|
7
|
+
input: Record<string, unknown>;
|
|
8
|
+
status: "running" | "done" | "error";
|
|
9
|
+
output?: unknown;
|
|
10
|
+
errorText?: string;
|
|
11
|
+
};
|
|
12
|
+
type MessagePart = {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "reasoning";
|
|
17
|
+
text: string;
|
|
18
|
+
} | ToolPart;
|
|
19
|
+
type Message = {
|
|
20
|
+
id: string;
|
|
21
|
+
role: "user" | "assistant";
|
|
22
|
+
parts: MessagePart[];
|
|
23
|
+
};
|
|
24
|
+
interface UserContext {
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
userId?: string;
|
|
27
|
+
userName?: string;
|
|
28
|
+
userEmail?: string;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
interface ChatWidgetConfig {
|
|
32
|
+
agentId: string;
|
|
33
|
+
workspaceId?: string;
|
|
34
|
+
agentName: string;
|
|
35
|
+
displayName?: string | null;
|
|
36
|
+
profilePicture?: string | null;
|
|
37
|
+
userMessageColor?: string;
|
|
38
|
+
initialMessages?: string[];
|
|
39
|
+
suggestedMessages?: string[];
|
|
40
|
+
messagePlaceholder?: string | null;
|
|
41
|
+
watermark?: boolean;
|
|
42
|
+
watermarkLogoUrl?: string;
|
|
43
|
+
footer?: string | null;
|
|
44
|
+
theme?: "light" | "dark";
|
|
45
|
+
showThinking?: boolean;
|
|
46
|
+
source?: string;
|
|
47
|
+
userContext?: UserContext;
|
|
48
|
+
}
|
|
49
|
+
interface ChatWidgetProps extends ChatWidgetConfig {
|
|
50
|
+
className?: string;
|
|
51
|
+
onClose?: () => void;
|
|
52
|
+
onReset?: () => void;
|
|
53
|
+
}
|
|
54
|
+
declare function getContrastColor(hex: string): string;
|
|
55
|
+
declare function formatToolName(name: string): string;
|
|
56
|
+
|
|
57
|
+
declare function ChatWidget({ agentId, workspaceId, agentName, displayName, profilePicture, userMessageColor, initialMessages, suggestedMessages, messagePlaceholder, watermark, watermarkLogoUrl, footer, theme, showThinking, source, className, onClose, onReset, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
58
|
+
|
|
59
|
+
interface UseChatOptions {
|
|
60
|
+
agentId: string;
|
|
61
|
+
workspaceId?: string;
|
|
62
|
+
source?: string;
|
|
63
|
+
userContext?: UserContext;
|
|
64
|
+
}
|
|
65
|
+
interface UseChatReturn {
|
|
66
|
+
messages: Message[];
|
|
67
|
+
input: string;
|
|
68
|
+
setInput: (v: string) => void;
|
|
69
|
+
streaming: boolean;
|
|
70
|
+
threadId: string;
|
|
71
|
+
send: (text?: string) => Promise<void>;
|
|
72
|
+
reset: () => void;
|
|
73
|
+
}
|
|
74
|
+
declare function useChat({ agentId, workspaceId, source, userContext, }: UseChatOptions): UseChatReturn;
|
|
75
|
+
|
|
76
|
+
export { ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, type Message, type MessagePart, type ToolPart, type UserContext, formatToolName, getContrastColor, useChat };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type ToolPart = {
|
|
4
|
+
type: "tool";
|
|
5
|
+
toolCallId: string;
|
|
6
|
+
toolName: string;
|
|
7
|
+
input: Record<string, unknown>;
|
|
8
|
+
status: "running" | "done" | "error";
|
|
9
|
+
output?: unknown;
|
|
10
|
+
errorText?: string;
|
|
11
|
+
};
|
|
12
|
+
type MessagePart = {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "reasoning";
|
|
17
|
+
text: string;
|
|
18
|
+
} | ToolPart;
|
|
19
|
+
type Message = {
|
|
20
|
+
id: string;
|
|
21
|
+
role: "user" | "assistant";
|
|
22
|
+
parts: MessagePart[];
|
|
23
|
+
};
|
|
24
|
+
interface UserContext {
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
userId?: string;
|
|
27
|
+
userName?: string;
|
|
28
|
+
userEmail?: string;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
interface ChatWidgetConfig {
|
|
32
|
+
agentId: string;
|
|
33
|
+
workspaceId?: string;
|
|
34
|
+
agentName: string;
|
|
35
|
+
displayName?: string | null;
|
|
36
|
+
profilePicture?: string | null;
|
|
37
|
+
userMessageColor?: string;
|
|
38
|
+
initialMessages?: string[];
|
|
39
|
+
suggestedMessages?: string[];
|
|
40
|
+
messagePlaceholder?: string | null;
|
|
41
|
+
watermark?: boolean;
|
|
42
|
+
watermarkLogoUrl?: string;
|
|
43
|
+
footer?: string | null;
|
|
44
|
+
theme?: "light" | "dark";
|
|
45
|
+
showThinking?: boolean;
|
|
46
|
+
source?: string;
|
|
47
|
+
userContext?: UserContext;
|
|
48
|
+
}
|
|
49
|
+
interface ChatWidgetProps extends ChatWidgetConfig {
|
|
50
|
+
className?: string;
|
|
51
|
+
onClose?: () => void;
|
|
52
|
+
onReset?: () => void;
|
|
53
|
+
}
|
|
54
|
+
declare function getContrastColor(hex: string): string;
|
|
55
|
+
declare function formatToolName(name: string): string;
|
|
56
|
+
|
|
57
|
+
declare function ChatWidget({ agentId, workspaceId, agentName, displayName, profilePicture, userMessageColor, initialMessages, suggestedMessages, messagePlaceholder, watermark, watermarkLogoUrl, footer, theme, showThinking, source, className, onClose, onReset, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
58
|
+
|
|
59
|
+
interface UseChatOptions {
|
|
60
|
+
agentId: string;
|
|
61
|
+
workspaceId?: string;
|
|
62
|
+
source?: string;
|
|
63
|
+
userContext?: UserContext;
|
|
64
|
+
}
|
|
65
|
+
interface UseChatReturn {
|
|
66
|
+
messages: Message[];
|
|
67
|
+
input: string;
|
|
68
|
+
setInput: (v: string) => void;
|
|
69
|
+
streaming: boolean;
|
|
70
|
+
threadId: string;
|
|
71
|
+
send: (text?: string) => Promise<void>;
|
|
72
|
+
reset: () => void;
|
|
73
|
+
}
|
|
74
|
+
declare function useChat({ agentId, workspaceId, source, userContext, }: UseChatOptions): UseChatReturn;
|
|
75
|
+
|
|
76
|
+
export { ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, type Message, type MessagePart, type ToolPart, type UserContext, formatToolName, getContrastColor, useChat };
|