@brainbase-labs/chat-widget 0.1.18 → 0.1.20
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/embed/index.js +22 -3
- package/dist/index.cjs +277 -16
- package/dist/index.d.ts +88 -2
- package/dist/index.js +22917 -4225
- package/dist/styles.css +1 -1
- package/package.json +4 -1
- package/styles.css +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,9 +12,17 @@ declare interface ChatContainerProps {
|
|
|
12
12
|
messages: MessageType[];
|
|
13
13
|
toolCalls?: ToolCall[];
|
|
14
14
|
isLoading: boolean;
|
|
15
|
+
showTypingIndicator?: boolean;
|
|
16
|
+
isExpanded?: boolean;
|
|
17
|
+
headerSubtitle?: string;
|
|
18
|
+
voiceTokenUrl?: string;
|
|
19
|
+
voiceAgentName?: string;
|
|
20
|
+
enableVoiceMode?: boolean;
|
|
15
21
|
onSendMessage: (message: string) => void;
|
|
16
22
|
onClose?: () => void;
|
|
23
|
+
onBack?: () => void;
|
|
17
24
|
onNewChat?: () => void;
|
|
25
|
+
onExpandWindow?: () => void;
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
export declare const ChatHeader: default_2.FC<ChatHeaderProps>;
|
|
@@ -22,11 +30,18 @@ export declare const ChatHeader: default_2.FC<ChatHeaderProps>;
|
|
|
22
30
|
declare interface ChatHeaderProps {
|
|
23
31
|
agentName?: string;
|
|
24
32
|
agentLogoUrl?: string;
|
|
33
|
+
/** Description shown below agent name (e.g., "The team can also help") */
|
|
34
|
+
headerSubtitle?: string;
|
|
25
35
|
welcomeTitle?: string;
|
|
26
36
|
welcomeSubtitle?: string;
|
|
27
37
|
onClose?: () => void;
|
|
38
|
+
onBack?: () => void;
|
|
28
39
|
onNewChatRequest?: () => void;
|
|
29
|
-
|
|
40
|
+
onExpandWindow?: () => void;
|
|
41
|
+
onDownloadTranscript?: () => void;
|
|
42
|
+
showMenuButton?: boolean;
|
|
43
|
+
/** Whether the widget is currently expanded */
|
|
44
|
+
isExpanded?: boolean;
|
|
30
45
|
/** When true, shows a compact header without welcome text */
|
|
31
46
|
compact?: boolean;
|
|
32
47
|
}
|
|
@@ -38,6 +53,8 @@ declare interface ChatToggleButtonProps {
|
|
|
38
53
|
agentName?: string;
|
|
39
54
|
agentLogoUrl?: string;
|
|
40
55
|
unreadCount?: number;
|
|
56
|
+
/** Custom icon - can be a Lucide icon name (string), image URL, or React node */
|
|
57
|
+
customIcon?: string | default_2.ReactNode;
|
|
41
58
|
}
|
|
42
59
|
|
|
43
60
|
export declare const ChatWidget: default_2.FC<ChatWidgetProps>;
|
|
@@ -57,14 +74,69 @@ export declare interface ChatWidgetProps {
|
|
|
57
74
|
defaultOpen?: boolean;
|
|
58
75
|
/** Override primary color */
|
|
59
76
|
primaryColor?: string;
|
|
77
|
+
/** Accent color for buttons and icons - NOT header (defaults to primaryColor) */
|
|
78
|
+
accentColor?: string;
|
|
79
|
+
/** Use gradient on header (default: false) */
|
|
80
|
+
primaryGradient?: boolean;
|
|
81
|
+
/** Use gradient on accent elements like buttons and icons (default: false) */
|
|
82
|
+
accentGradient?: boolean;
|
|
83
|
+
/** Header text color (default: based on theme - black for light/dark, gray for granite) */
|
|
84
|
+
headerTextColor?: string;
|
|
85
|
+
/** Stream messages token by token (default: false - show full message when complete) */
|
|
86
|
+
streamMessages?: boolean;
|
|
87
|
+
/** Artificial delay range in seconds [min, max] for typing indicator and response.
|
|
88
|
+
* Adds random delay before showing dots and before showing response.
|
|
89
|
+
* Default: undefined (no artificial delay, just 1s delay for typing indicator) */
|
|
90
|
+
artificialDelay?: [number, number];
|
|
91
|
+
/** Home page hero image URL (optional) */
|
|
92
|
+
homeImage?: string;
|
|
93
|
+
/** Home page title text (optional) */
|
|
94
|
+
homeTitle?: string;
|
|
95
|
+
/** Home page description text (optional) */
|
|
96
|
+
homeDescription?: string;
|
|
97
|
+
/** URL to open when home page info card is clicked (optional) */
|
|
98
|
+
homeLink?: string;
|
|
99
|
+
/** Time in seconds before the widget auto-opens and sends a trigger message.
|
|
100
|
+
* When set, the widget will automatically open after this delay and send a hidden
|
|
101
|
+
* message to trigger the agent. Default: undefined (never auto-opens) */
|
|
102
|
+
timeToOpen?: number;
|
|
103
|
+
/** URL for the LiveKit token endpoint (e.g., 'https://your-app.com/api/token').
|
|
104
|
+
* Required for voice mode to work. */
|
|
105
|
+
voiceTokenUrl?: string;
|
|
106
|
+
/** Agent name for voice mode dispatch. Default: 'voice-agent' */
|
|
107
|
+
voiceAgentName?: string;
|
|
108
|
+
/** Enable voice mode (audio button in input). Default: false */
|
|
109
|
+
enableVoiceMode?: boolean;
|
|
110
|
+
/** Show the collapse button (circle with down arrow) when widget is open. Default: true */
|
|
111
|
+
showCollapseButton?: boolean;
|
|
60
112
|
/** Override agent name */
|
|
61
113
|
agentName?: string;
|
|
114
|
+
/** Override agent role (e.g., "AI Agent", "Support Bot") */
|
|
115
|
+
agentRole?: string;
|
|
116
|
+
/** Description shown below agent name in header (e.g., "The team can also help") */
|
|
117
|
+
headerSubtitle?: string;
|
|
62
118
|
/** Override agent logo URL */
|
|
63
119
|
agentLogoUrl?: string;
|
|
120
|
+
/** Agent name font size in pixels (default: 16) */
|
|
121
|
+
agentNameFontSize?: number;
|
|
122
|
+
/** Custom icon for the toggle button (when closed). Can be a URL or React node */
|
|
123
|
+
toggleIcon?: string | React.ReactNode;
|
|
64
124
|
/** Override welcome message */
|
|
65
125
|
welcomeMessage?: string;
|
|
66
126
|
/** Override branding visibility */
|
|
67
127
|
showBranding?: boolean;
|
|
128
|
+
/** Widget width in pixels (default: 420) */
|
|
129
|
+
width?: number;
|
|
130
|
+
/** Widget height in pixels (default: 720) */
|
|
131
|
+
height?: number;
|
|
132
|
+
/** Expanded widget width in pixels (default: 640) */
|
|
133
|
+
expandedWidth?: number;
|
|
134
|
+
/** Expanded widget height in pixels (default: 800) */
|
|
135
|
+
expandedHeight?: number;
|
|
136
|
+
/** Message font size in pixels (default: 15) */
|
|
137
|
+
messageFontSize?: number;
|
|
138
|
+
/** Theme: 'light' (default), 'dark', or 'granite' */
|
|
139
|
+
theme?: ChatWidgetTheme;
|
|
68
140
|
/** Custom CSS class */
|
|
69
141
|
className?: string;
|
|
70
142
|
/** Callback when session starts */
|
|
@@ -77,6 +149,8 @@ export declare interface ChatWidgetProps {
|
|
|
77
149
|
onError?: (error: Error) => void;
|
|
78
150
|
}
|
|
79
151
|
|
|
152
|
+
declare type ChatWidgetTheme = 'light' | 'dark' | 'granite';
|
|
153
|
+
|
|
80
154
|
export declare function clearSession(embedId: string): void;
|
|
81
155
|
|
|
82
156
|
export declare function createAPIClient(engineBaseUrl?: string): BrainbaseAPIClient;
|
|
@@ -90,6 +164,7 @@ export declare interface DeploymentConfig {
|
|
|
90
164
|
flowId: string;
|
|
91
165
|
welcomeMessage?: string;
|
|
92
166
|
agentName?: string;
|
|
167
|
+
agentRole?: string;
|
|
93
168
|
agentLogoUrl?: string;
|
|
94
169
|
primaryColor?: string;
|
|
95
170
|
styling?: Record<string, unknown>;
|
|
@@ -111,6 +186,10 @@ declare interface MessageInputProps {
|
|
|
111
186
|
onSend: (message: string) => void;
|
|
112
187
|
disabled?: boolean;
|
|
113
188
|
placeholder?: string;
|
|
189
|
+
onAttachment?: () => void;
|
|
190
|
+
onEmoji?: () => void;
|
|
191
|
+
onGif?: () => void;
|
|
192
|
+
onVoice?: () => void;
|
|
114
193
|
}
|
|
115
194
|
|
|
116
195
|
export declare const MessageList: default_2.FC<MessageListProps>;
|
|
@@ -119,14 +198,17 @@ declare interface MessageListProps {
|
|
|
119
198
|
messages: MessageType[];
|
|
120
199
|
toolCalls?: ToolCall[];
|
|
121
200
|
isLoading: boolean;
|
|
201
|
+
showTypingIndicator?: boolean;
|
|
122
202
|
agentName?: string;
|
|
203
|
+
agentRole?: string;
|
|
123
204
|
agentLogoUrl?: string;
|
|
124
205
|
}
|
|
125
206
|
|
|
126
207
|
declare interface MessageProps {
|
|
127
208
|
message: MessageType;
|
|
128
209
|
agentName?: string;
|
|
129
|
-
|
|
210
|
+
agentRole?: string;
|
|
211
|
+
isLastAssistantMessage?: boolean;
|
|
130
212
|
}
|
|
131
213
|
|
|
132
214
|
export declare type MessageRole = 'user' | 'assistant' | 'system';
|
|
@@ -213,6 +295,8 @@ declare interface UseChatOptions {
|
|
|
213
295
|
config: DeploymentConfig;
|
|
214
296
|
apiClient: BrainbaseAPIClient | MockAPIClient;
|
|
215
297
|
mockMode?: boolean;
|
|
298
|
+
streamMessages?: boolean;
|
|
299
|
+
artificialDelay?: [number, number];
|
|
216
300
|
onSessionStart?: (sessionId: string) => void;
|
|
217
301
|
onSessionEnd?: (session: Session) => void;
|
|
218
302
|
onMessage?: (message: MessageType) => void;
|
|
@@ -223,9 +307,11 @@ export declare interface UseChatReturn {
|
|
|
223
307
|
messages: MessageType[];
|
|
224
308
|
toolCalls: ToolCall[];
|
|
225
309
|
isLoading: boolean;
|
|
310
|
+
showTypingIndicator: boolean;
|
|
226
311
|
error: Error | null;
|
|
227
312
|
sessionId: string | null;
|
|
228
313
|
sendMessage: (content: string) => Promise<void>;
|
|
314
|
+
sendTriggerMessage: () => Promise<void>;
|
|
229
315
|
endSession: () => Promise<void>;
|
|
230
316
|
clearMessages: () => void;
|
|
231
317
|
startNewSession: () => Promise<string>;
|