@botzki/react 0.1.2 → 0.1.4
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/README.md +156 -97
- package/dist/index.cjs +153 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1245 -9
- package/dist/index.d.ts +1245 -9
- package/dist/index.mjs +153 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,165 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default from 'react';
|
|
2
|
+
import React__default, { CSSProperties } from 'react';
|
|
3
3
|
import { Citation, ChatResponse, Botzki, BotzkiUser, WidgetOptions } from '@botzki/js';
|
|
4
4
|
export { BotzkiConfig, BotzkiUser, ChatOptions, ChatResponse, Citation, WidgetOptions } from '@botzki/js';
|
|
5
5
|
|
|
6
|
+
type AiBotEmotion = "neutral" | "happy" | "love" | "laugh" | "surprised" | "wow" | "sad" | "thinking" | "sleepy" | "wink";
|
|
7
|
+
type AiBotMotion = "jump" | "spin" | "bounce" | "wiggle" | "float";
|
|
8
|
+
type AiBotActivity = "idle" | "speaking" | "listening";
|
|
9
|
+
type AiBotShape = "pebble" | "circle" | "squircle" | "flower" | "blob";
|
|
10
|
+
interface AiBotOptions {
|
|
11
|
+
emotion?: AiBotEmotion;
|
|
12
|
+
activity?: AiBotActivity;
|
|
13
|
+
shape?: AiBotShape;
|
|
14
|
+
/** Plays once; change `motionKey` to replay the same motion. */
|
|
15
|
+
motion?: AiBotMotion | null;
|
|
16
|
+
motionKey?: number;
|
|
17
|
+
onMotionEnd?: (motion: AiBotMotion) => void;
|
|
18
|
+
/** Idle glances around the room. */
|
|
19
|
+
lookAround?: boolean;
|
|
20
|
+
/** Eyes follow the mouse pointer anywhere in the window. */
|
|
21
|
+
followCursor?: boolean;
|
|
22
|
+
/** Giggles when the pointer touches the body. */
|
|
23
|
+
hoverGiggle?: boolean;
|
|
24
|
+
/** Fires when the pointer starts a giggle. */
|
|
25
|
+
onTickle?: () => void;
|
|
26
|
+
/** Change to make the bot chuckle along softly, as if someone next to it were being tickled. */
|
|
27
|
+
chuckleKey?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface BotziAvatarProps extends AiBotOptions {
|
|
31
|
+
/** Gradient stops, light to dark. Defaults to white pebble with subtle light gray. */
|
|
32
|
+
colors?: readonly [string, string];
|
|
33
|
+
/** Color of eyes and mouth. Defaults to #000000. */
|
|
34
|
+
faceColor?: string;
|
|
35
|
+
/** Color of the eyes. Overrides faceColor. */
|
|
36
|
+
eyeColor?: string;
|
|
37
|
+
/** Color of the mouth. Overrides faceColor. */
|
|
38
|
+
mouthColor?: string;
|
|
39
|
+
/** Outline (stroke) color for the avatar body. */
|
|
40
|
+
outlineColor?: string;
|
|
41
|
+
/** Outline width in px. */
|
|
42
|
+
outlineWidth?: number | string;
|
|
43
|
+
/** Diameter of the body in px. Defaults to 36. */
|
|
44
|
+
size?: number;
|
|
45
|
+
label?: string;
|
|
46
|
+
className?: string;
|
|
47
|
+
style?: CSSProperties;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Official Botzki AI Character Avatar.
|
|
51
|
+
* Fully interactive SVG with cursor-following eyes, blinking, expressions, and physics.
|
|
52
|
+
*/
|
|
53
|
+
declare function BotziAvatar({ colors, faceColor, eyeColor, mouthColor, outlineColor, outlineWidth, size, label, className, style, shape, followCursor, ...options }: BotziAvatarProps): React.JSX.Element;
|
|
54
|
+
declare const AiBotAvatar: typeof BotziAvatar;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Avatar configuration options for customizing the Botzi character.
|
|
58
|
+
*/
|
|
59
|
+
interface BotzkiAvatarOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Two-stop gradient colors for the avatar body (e.g. `["#66a6ff", "#0059d4"]`).
|
|
62
|
+
*/
|
|
63
|
+
colors?: readonly [string, string];
|
|
64
|
+
/**
|
|
65
|
+
* Color for both eyes and mouth of the Botzi avatar. Defaults to "#ffffff".
|
|
66
|
+
*/
|
|
67
|
+
faceColor?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Custom color for the eyes. Overrides faceColor.
|
|
70
|
+
*/
|
|
71
|
+
eyeColor?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Custom color for the mouth. Overrides faceColor.
|
|
74
|
+
*/
|
|
75
|
+
mouthColor?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Procedural body shape ("pebble" | "circle" | "squircle" | "flower" | "blob").
|
|
78
|
+
* Defaults to "pebble".
|
|
79
|
+
*/
|
|
80
|
+
shape?: AiBotShape;
|
|
81
|
+
/**
|
|
82
|
+
* Diameter of the avatar body in pixels.
|
|
83
|
+
*/
|
|
84
|
+
size?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Whether avatar eyes follow the user's cursor movements. Defaults to true.
|
|
87
|
+
*/
|
|
88
|
+
followCursor?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Dynamic motion animation ("jump" | "spin" | "bounce" | "wiggle" | "float").
|
|
91
|
+
*/
|
|
92
|
+
motion?: AiBotMotion | null;
|
|
93
|
+
/**
|
|
94
|
+
* Facial expression emotion ("neutral" | "laugh" | "surprised" | "love" | "sad" | "sleepy" | "thinking" | "wink").
|
|
95
|
+
*/
|
|
96
|
+
emotion?: AiBotEmotion;
|
|
97
|
+
/**
|
|
98
|
+
* Outline stroke color for the avatar body.
|
|
99
|
+
*/
|
|
100
|
+
outlineColor?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Outline stroke width in px.
|
|
103
|
+
*/
|
|
104
|
+
outlineWidth?: number | string;
|
|
105
|
+
/**
|
|
106
|
+
* Background container color when nested inside a circular badge.
|
|
107
|
+
*/
|
|
108
|
+
background?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Additional avatar props passed directly into the `<BotziAvatar />` component.
|
|
111
|
+
*/
|
|
112
|
+
props?: Partial<BotziAvatarProps>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Floating launcher button customization options.
|
|
116
|
+
*/
|
|
117
|
+
interface BotzkiLauncherOptions {
|
|
118
|
+
/**
|
|
119
|
+
* Background color of the floating launcher button when closed.
|
|
120
|
+
* Defaults to "transparent".
|
|
121
|
+
*/
|
|
122
|
+
background?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Custom React icon node replacing the default avatar in the closed launcher.
|
|
125
|
+
*/
|
|
126
|
+
icon?: React__default.ReactNode;
|
|
127
|
+
/**
|
|
128
|
+
* Additional inline styles for the launcher button.
|
|
129
|
+
*/
|
|
130
|
+
style?: React__default.CSSProperties;
|
|
131
|
+
/**
|
|
132
|
+
* Background color for the launcher button when open (showing the 'X' icon).
|
|
133
|
+
* Defaults to primaryColor.
|
|
134
|
+
*/
|
|
135
|
+
closeBackground?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Color of the 'X' icon when open. Defaults to "#ffffff".
|
|
138
|
+
*/
|
|
139
|
+
closeColor?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Diameter of the launcher button in px. Defaults to 56.
|
|
142
|
+
*/
|
|
143
|
+
size?: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* An action proposed by the autonomous AI engine requiring visitor 2-step confirmation.
|
|
147
|
+
*/
|
|
148
|
+
interface ProposedBotAction {
|
|
149
|
+
actionId: string;
|
|
150
|
+
actionName: string;
|
|
151
|
+
displayName?: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
executionType?: "ServerWebhook" | "ClientEvent" | string;
|
|
154
|
+
parameters?: Record<string, any>;
|
|
155
|
+
requiresConfirmation?: boolean;
|
|
156
|
+
confirmationPrompt?: string;
|
|
157
|
+
successMessage?: string;
|
|
158
|
+
token: string;
|
|
159
|
+
status?: "pending" | "executing" | "completed" | "failed" | "cancelled";
|
|
160
|
+
result?: any;
|
|
161
|
+
error?: string;
|
|
162
|
+
}
|
|
6
163
|
/**
|
|
7
164
|
* Message representation inside React chat interfaces.
|
|
8
165
|
*/
|
|
@@ -11,9 +168,126 @@ interface BotzkiMessage {
|
|
|
11
168
|
role: "user" | "assistant" | "system";
|
|
12
169
|
content: string;
|
|
13
170
|
createdAt: Date;
|
|
171
|
+
imageBase64?: string;
|
|
172
|
+
imageUrl?: string;
|
|
173
|
+
audioUrl?: string;
|
|
174
|
+
audioDuration?: number;
|
|
175
|
+
fileUrl?: string;
|
|
176
|
+
fileName?: string;
|
|
177
|
+
fileSize?: number;
|
|
178
|
+
deliveryStatus?: string;
|
|
179
|
+
deliveryChannel?: string;
|
|
180
|
+
isTranscribing?: boolean;
|
|
14
181
|
citations?: Citation[];
|
|
15
182
|
isStreaming?: boolean;
|
|
16
183
|
error?: string;
|
|
184
|
+
senderType?: "user" | "assistant" | "system" | "operator";
|
|
185
|
+
senderName?: string;
|
|
186
|
+
escalation?: {
|
|
187
|
+
type?: string;
|
|
188
|
+
title?: string;
|
|
189
|
+
description?: string;
|
|
190
|
+
url?: string;
|
|
191
|
+
buttonText?: string;
|
|
192
|
+
};
|
|
193
|
+
proposedAction?: ProposedBotAction;
|
|
194
|
+
modelUsed?: string;
|
|
195
|
+
fallbackTriggered?: boolean;
|
|
196
|
+
piiRedacted?: boolean;
|
|
197
|
+
redactionsCount?: number;
|
|
198
|
+
localPrivacyMode?: boolean;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Persisted conversation session structure for multi-session chat history.
|
|
202
|
+
*/
|
|
203
|
+
interface BotzkiChatSession {
|
|
204
|
+
id: string;
|
|
205
|
+
title: string;
|
|
206
|
+
createdAt: string;
|
|
207
|
+
updatedAt: string;
|
|
208
|
+
messages: BotzkiMessage[];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Render properties passed to custom header render functions (`renderHeader`).
|
|
212
|
+
*/
|
|
213
|
+
interface BotzkiHeaderProps {
|
|
214
|
+
title: string;
|
|
215
|
+
subtitle: string;
|
|
216
|
+
isDark: boolean;
|
|
217
|
+
primaryColor: string;
|
|
218
|
+
isOpen?: boolean;
|
|
219
|
+
isExpanded?: boolean;
|
|
220
|
+
isHistoryOpen?: boolean;
|
|
221
|
+
botAvatar?: React__default.ReactNode | string;
|
|
222
|
+
onClose?: () => void;
|
|
223
|
+
onClear?: () => void;
|
|
224
|
+
onNewChat?: () => void;
|
|
225
|
+
toggleHistory?: () => void;
|
|
226
|
+
toggleExpand?: () => void;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Render properties passed to custom message render functions (`renderMessage`).
|
|
230
|
+
*/
|
|
231
|
+
interface BotzkiMessageRenderProps {
|
|
232
|
+
message: BotzkiMessage;
|
|
233
|
+
index: number;
|
|
234
|
+
isUser: boolean;
|
|
235
|
+
isDark: boolean;
|
|
236
|
+
primaryColor: string;
|
|
237
|
+
onCopy?: () => void;
|
|
238
|
+
onSpeak?: () => void;
|
|
239
|
+
onFeedback?: (rating: "up" | "down") => void;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Options for sending a message through `sendMessage`.
|
|
243
|
+
*/
|
|
244
|
+
interface SendMessageOptions {
|
|
245
|
+
imageBase64?: string;
|
|
246
|
+
imageMimeType?: string;
|
|
247
|
+
imageUrl?: string;
|
|
248
|
+
audioUrl?: string;
|
|
249
|
+
audioDuration?: number;
|
|
250
|
+
fileUrl?: string;
|
|
251
|
+
fileName?: string;
|
|
252
|
+
fileSize?: number;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Render properties passed to custom composer render functions (`renderComposer`).
|
|
256
|
+
*/
|
|
257
|
+
interface BotzkiComposerRenderProps {
|
|
258
|
+
input: string;
|
|
259
|
+
setInput: (val: string) => void;
|
|
260
|
+
sendMessage: (text: string, options?: SendMessageOptions) => Promise<void>;
|
|
261
|
+
sendVoiceMessage?: (blob: Blob, options?: {
|
|
262
|
+
audioDuration?: number;
|
|
263
|
+
}) => Promise<void>;
|
|
264
|
+
isLoading: boolean;
|
|
265
|
+
isStreaming: boolean;
|
|
266
|
+
primaryColor: string;
|
|
267
|
+
isDark: boolean;
|
|
268
|
+
attachImage?: () => void;
|
|
269
|
+
pendingImage?: {
|
|
270
|
+
dataUrl: string;
|
|
271
|
+
name: string;
|
|
272
|
+
} | null;
|
|
273
|
+
removeImage?: () => void;
|
|
274
|
+
isListening?: boolean;
|
|
275
|
+
toggleListening?: () => void;
|
|
276
|
+
isRecordingVoiceNote?: boolean;
|
|
277
|
+
startVoiceRecording?: () => void;
|
|
278
|
+
stopVoiceRecording?: () => void;
|
|
279
|
+
cancelVoiceRecording?: () => void;
|
|
280
|
+
voiceRecordingDuration?: number;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Render properties passed to custom launcher render functions (`renderLauncher`).
|
|
284
|
+
*/
|
|
285
|
+
interface BotzkiLauncherRenderProps {
|
|
286
|
+
isOpen: boolean;
|
|
287
|
+
unreadCount?: number;
|
|
288
|
+
onClick: () => void;
|
|
289
|
+
primaryColor: string;
|
|
290
|
+
isHovered: boolean;
|
|
17
291
|
}
|
|
18
292
|
/**
|
|
19
293
|
* Configuration options for the `useChat` hook.
|
|
@@ -45,13 +319,21 @@ interface UseChatOptions {
|
|
|
45
319
|
initialMessages?: BotzkiMessage[];
|
|
46
320
|
/**
|
|
47
321
|
* Whether to persist the conversation and session in browser localStorage.
|
|
48
|
-
* @default
|
|
322
|
+
* @default false
|
|
49
323
|
*/
|
|
50
324
|
persistSession?: boolean;
|
|
51
325
|
/**
|
|
52
326
|
* Custom localStorage key prefix for session and message caching.
|
|
53
327
|
*/
|
|
54
328
|
storageKey?: string;
|
|
329
|
+
/**
|
|
330
|
+
* Custom visitor CRM metadata attributes (e.g. membership: 'premium', account_status: 'locked').
|
|
331
|
+
*/
|
|
332
|
+
visitorData?: Record<string, string>;
|
|
333
|
+
/**
|
|
334
|
+
* Custom tags / segments for conversation categorization (e.g. ['vip', 'billing']).
|
|
335
|
+
*/
|
|
336
|
+
tags?: string[];
|
|
55
337
|
/**
|
|
56
338
|
* Preferred ISO 639-1 language code (e.g. 'en', 'es', 'de').
|
|
57
339
|
*/
|
|
@@ -61,6 +343,25 @@ interface UseChatOptions {
|
|
|
61
343
|
* @default true
|
|
62
344
|
*/
|
|
63
345
|
stream?: boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Whether to play the synthesized Web Audio notification chime on incoming messages when backgrounded.
|
|
348
|
+
* @default true
|
|
349
|
+
*/
|
|
350
|
+
enableSoundAlert?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Whether to flash the browser document title on incoming messages when backgrounded.
|
|
353
|
+
* @default true
|
|
354
|
+
*/
|
|
355
|
+
enableTabTitleNotification?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Whether Zero-Install Ghost Co-Browsing screen assist is enabled on the client.
|
|
358
|
+
* @default true
|
|
359
|
+
*/
|
|
360
|
+
enableCoBrowse?: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Callback fired immediately when a user sends a message.
|
|
363
|
+
*/
|
|
364
|
+
onSendMessage?: (message: BotzkiMessage) => void;
|
|
64
365
|
/**
|
|
65
366
|
* Callback fired whenever a full response is received from the bot.
|
|
66
367
|
*/
|
|
@@ -73,6 +374,50 @@ interface UseChatOptions {
|
|
|
73
374
|
* Callback fired when an error occurs during message transmission.
|
|
74
375
|
*/
|
|
75
376
|
onError?: (error: Error) => void;
|
|
377
|
+
/**
|
|
378
|
+
* Callback fired when the visitor requests escalation to a human support operator.
|
|
379
|
+
*/
|
|
380
|
+
onEscalationRequest?: (details: {
|
|
381
|
+
reason?: string;
|
|
382
|
+
visitorName?: string;
|
|
383
|
+
visitorEmail?: string;
|
|
384
|
+
}) => void;
|
|
385
|
+
/**
|
|
386
|
+
* Callback fired when a human support operator joins / takes over the conversation.
|
|
387
|
+
*/
|
|
388
|
+
onOperatorJoined?: (operator: {
|
|
389
|
+
id?: string;
|
|
390
|
+
name: string;
|
|
391
|
+
avatarUrl?: string;
|
|
392
|
+
}) => void;
|
|
393
|
+
/**
|
|
394
|
+
* Callback fired when the human support operator marks the ticket as Resolved.
|
|
395
|
+
*/
|
|
396
|
+
onTicketResolved?: (ticketId: string) => void;
|
|
397
|
+
/**
|
|
398
|
+
* Callback fired when the visitor submits a 1-5 star CSAT rating after resolution.
|
|
399
|
+
*/
|
|
400
|
+
onCsatSubmit?: (rating: number, feedback?: string) => void;
|
|
401
|
+
/**
|
|
402
|
+
* Callback fired when the AI proposes an autonomous action card (2-step guardrail).
|
|
403
|
+
*/
|
|
404
|
+
onActionProposed?: (action: ProposedBotAction) => void;
|
|
405
|
+
/**
|
|
406
|
+
* Callback fired when the visitor confirms and executes a proposed action.
|
|
407
|
+
*/
|
|
408
|
+
onActionExecuted?: (action: ProposedBotAction, result: any) => void;
|
|
409
|
+
/**
|
|
410
|
+
* Callback fired when the visitor cancels a proposed action.
|
|
411
|
+
*/
|
|
412
|
+
onActionCancelled?: (action: ProposedBotAction, reason?: string) => void;
|
|
413
|
+
/**
|
|
414
|
+
* Callback fired when the visitor accepts a Ghost Co-Browsing screen assist session.
|
|
415
|
+
*/
|
|
416
|
+
onCoBrowseStart?: (operatorName?: string | null) => void;
|
|
417
|
+
/**
|
|
418
|
+
* Callback fired when a Ghost Co-Browsing screen assist session ends.
|
|
419
|
+
*/
|
|
420
|
+
onCoBrowseEnd?: () => void;
|
|
76
421
|
}
|
|
77
422
|
/**
|
|
78
423
|
* Return type and state of the `useChat` hook.
|
|
@@ -102,11 +447,15 @@ interface UseChatReturn {
|
|
|
102
447
|
imageMimeType?: string;
|
|
103
448
|
}) => Promise<void>;
|
|
104
449
|
/**
|
|
105
|
-
* Programmatically sends a message with optional image attachment.
|
|
450
|
+
* Programmatically sends a message with optional image attachment or audio voice message.
|
|
106
451
|
*/
|
|
107
|
-
sendMessage: (content: string, options?:
|
|
108
|
-
|
|
109
|
-
|
|
452
|
+
sendMessage: (content: string, options?: SendMessageOptions) => Promise<void>;
|
|
453
|
+
/**
|
|
454
|
+
* Programmatically sends an audio voice note recording, transcribing it and requesting an assistant response.
|
|
455
|
+
*/
|
|
456
|
+
sendVoiceMessage?: (blob: Blob, options?: {
|
|
457
|
+
audioDuration?: number;
|
|
458
|
+
audioUrl?: string;
|
|
110
459
|
}) => Promise<void>;
|
|
111
460
|
/**
|
|
112
461
|
* Appends a message to the conversation history without triggering an API call.
|
|
@@ -150,6 +499,105 @@ interface UseChatReturn {
|
|
|
150
499
|
* Sets or updates active conversation session identifier.
|
|
151
500
|
*/
|
|
152
501
|
setSessionId: (id: string) => void;
|
|
502
|
+
/**
|
|
503
|
+
* Whether the chat is currently in human operator mode or waiting for an agent.
|
|
504
|
+
*/
|
|
505
|
+
isHumanHandoffActive?: boolean;
|
|
506
|
+
/**
|
|
507
|
+
* Whether the visitor is in queue waiting for a human agent to take over.
|
|
508
|
+
*/
|
|
509
|
+
isWaitingForHuman?: boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Information about the assigned human operator (if connected).
|
|
512
|
+
*/
|
|
513
|
+
assignedOperator?: {
|
|
514
|
+
id?: string;
|
|
515
|
+
name: string;
|
|
516
|
+
avatarUrl?: string;
|
|
517
|
+
} | null;
|
|
518
|
+
/**
|
|
519
|
+
* Whether the human operator is currently typing.
|
|
520
|
+
*/
|
|
521
|
+
isOperatorTyping?: boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Requests escalation to a human support operator.
|
|
524
|
+
*/
|
|
525
|
+
requestHumanHandoff?: (reason?: string, visitorName?: string, visitorEmail?: string, metadata?: {
|
|
526
|
+
customData?: Record<string, string>;
|
|
527
|
+
tags?: string[];
|
|
528
|
+
lastBrowsedPages?: string[];
|
|
529
|
+
}) => Promise<void>;
|
|
530
|
+
/**
|
|
531
|
+
* Cancels the active human escalation and returns to autonomous bot mode.
|
|
532
|
+
*/
|
|
533
|
+
cancelHumanHandoff?: () => Promise<void>;
|
|
534
|
+
/**
|
|
535
|
+
* ID of a recently resolved support ticket awaiting visitor CSAT rating.
|
|
536
|
+
*/
|
|
537
|
+
pendingCsatTicketId?: string | null;
|
|
538
|
+
/**
|
|
539
|
+
* Submits a 1-5 star CSAT rating and optional feedback for a resolved live chat session.
|
|
540
|
+
*/
|
|
541
|
+
submitHandoffFeedback?: (rating: number, feedback?: string) => Promise<void>;
|
|
542
|
+
/**
|
|
543
|
+
* Confirms and executes an autonomous action proposal (2-step confirmation guardrail).
|
|
544
|
+
*/
|
|
545
|
+
executeProposedAction?: (messageId: string, actionToken: string, confirmedParams?: Record<string, any>) => Promise<{
|
|
546
|
+
success: boolean;
|
|
547
|
+
result?: any;
|
|
548
|
+
error?: string;
|
|
549
|
+
}>;
|
|
550
|
+
/**
|
|
551
|
+
* Cancels a proposed autonomous action.
|
|
552
|
+
*/
|
|
553
|
+
cancelProposedAction?: (messageId: string, reason?: string) => Promise<void>;
|
|
554
|
+
/**
|
|
555
|
+
* Ghost Co-Browsing state and controls (Zero-Install Screen Assist).
|
|
556
|
+
*/
|
|
557
|
+
coBrowse?: CoBrowseState;
|
|
558
|
+
}
|
|
559
|
+
interface CoBrowsePointer {
|
|
560
|
+
xPercent: number;
|
|
561
|
+
yPercent: number;
|
|
562
|
+
selector?: string | null;
|
|
563
|
+
label?: string | null;
|
|
564
|
+
action: "move" | "click" | "highlight" | "leave";
|
|
565
|
+
}
|
|
566
|
+
interface CoBrowseHighlight {
|
|
567
|
+
xPercent: number;
|
|
568
|
+
yPercent: number;
|
|
569
|
+
selector?: string | null;
|
|
570
|
+
label?: string | null;
|
|
571
|
+
timestamp: number;
|
|
572
|
+
}
|
|
573
|
+
interface CoBrowseScroll {
|
|
574
|
+
scrollY: number;
|
|
575
|
+
scrollX?: number | null;
|
|
576
|
+
selector?: string | null;
|
|
577
|
+
timestamp?: number | null;
|
|
578
|
+
}
|
|
579
|
+
interface CoBrowseSnapshot {
|
|
580
|
+
url: string;
|
|
581
|
+
pathname: string;
|
|
582
|
+
title: string;
|
|
583
|
+
viewportWidth: number;
|
|
584
|
+
viewportHeight: number;
|
|
585
|
+
scrollX: number;
|
|
586
|
+
scrollY: number;
|
|
587
|
+
htmlSnapshot: string;
|
|
588
|
+
timestamp: number;
|
|
589
|
+
}
|
|
590
|
+
interface CoBrowseState {
|
|
591
|
+
enabled: boolean;
|
|
592
|
+
isRequested: boolean;
|
|
593
|
+
isActive: boolean;
|
|
594
|
+
operatorName: string | null;
|
|
595
|
+
pointer: CoBrowsePointer | null;
|
|
596
|
+
highlight?: CoBrowseHighlight | null;
|
|
597
|
+
highlightedSelector: string | null;
|
|
598
|
+
accept: () => Promise<void>;
|
|
599
|
+
decline: (reason?: string) => Promise<void>;
|
|
600
|
+
stop: (reason?: string) => Promise<void>;
|
|
153
601
|
}
|
|
154
602
|
/**
|
|
155
603
|
* Properties for `<BotzkiProvider>`.
|
|
@@ -221,17 +669,383 @@ interface BotzkiWidgetRef {
|
|
|
221
669
|
sendMessage: (message: string, imageBase64?: string) => Promise<void>;
|
|
222
670
|
/** Clears widget chat history */
|
|
223
671
|
clearMessages: () => void;
|
|
672
|
+
/** Starts a new fresh chat session */
|
|
673
|
+
newChat: () => void;
|
|
674
|
+
/** Expands the widget modal into maximized mode */
|
|
675
|
+
expand: () => void;
|
|
676
|
+
/** Collapses the widget modal back to compact size */
|
|
677
|
+
collapse: () => void;
|
|
678
|
+
/** Returns true if currently in expanded view */
|
|
679
|
+
isExpanded: () => boolean;
|
|
680
|
+
/** Opens the multi-session chat history drawer */
|
|
681
|
+
openHistory: () => void;
|
|
682
|
+
/** Closes the multi-session chat history drawer */
|
|
683
|
+
closeHistory: () => void;
|
|
684
|
+
/** Exports conversation as markdown or JSON */
|
|
685
|
+
exportChat: (format?: "markdown" | "json") => string;
|
|
224
686
|
/** Dynamically updates widget theme */
|
|
225
687
|
setTheme: (theme: "light" | "dark" | "auto") => void;
|
|
226
688
|
/** Dynamically updates widget primary accent color */
|
|
227
689
|
setPrimaryColor: (color: string) => void;
|
|
228
690
|
/** Updates identified visitor details */
|
|
229
691
|
setUser: (user: BotzkiUser) => void;
|
|
692
|
+
/** Returns the current unread message count */
|
|
693
|
+
getUnreadCount: () => number;
|
|
694
|
+
/** Clears unread message count and marks all messages as read */
|
|
695
|
+
markAsRead: () => void;
|
|
696
|
+
/** Programmatically requests human operator escalation */
|
|
697
|
+
requestHumanHandoff: (reason?: string, visitorName?: string, visitorEmail?: string) => Promise<void>;
|
|
698
|
+
/** Cancels active human escalation and returns to autonomous AI mode */
|
|
699
|
+
cancelHumanHandoff: () => Promise<void>;
|
|
700
|
+
/** Returns the current list of messages in the conversation */
|
|
701
|
+
getMessages: () => BotzkiMessage[];
|
|
702
|
+
/** Returns the active conversation session ID */
|
|
703
|
+
getSessionId: () => string;
|
|
704
|
+
/** Updates the active conversation session ID */
|
|
705
|
+
setSessionId: (id: string) => void;
|
|
706
|
+
/** Aborts active token streaming immediately */
|
|
707
|
+
stopStreaming: () => void;
|
|
708
|
+
/** Regenerates the last assistant response */
|
|
709
|
+
reloadLastMessage: () => Promise<void>;
|
|
230
710
|
}
|
|
231
711
|
/**
|
|
232
712
|
* Props for `<BotzkiWidget />`.
|
|
233
713
|
*/
|
|
234
|
-
interface BotzkiWidgetProps extends WidgetOptions {
|
|
714
|
+
interface BotzkiWidgetProps extends Omit<WidgetOptions, "botAvatar"> {
|
|
715
|
+
/**
|
|
716
|
+
* Structured avatar customization options (colors, shape, size, eyes, face, emotions).
|
|
717
|
+
*/
|
|
718
|
+
avatar?: BotzkiAvatarOptions;
|
|
719
|
+
/**
|
|
720
|
+
* Structured launcher button customization options (background, icon, size, close styling).
|
|
721
|
+
*/
|
|
722
|
+
launcher?: BotzkiLauncherOptions;
|
|
723
|
+
/**
|
|
724
|
+
* Custom launcher button render function to completely replace default launcher button.
|
|
725
|
+
*/
|
|
726
|
+
renderLauncher?: (props: BotzkiLauncherRenderProps) => React__default.ReactNode;
|
|
727
|
+
/**
|
|
728
|
+
* Custom header render function replacing the default header.
|
|
729
|
+
*/
|
|
730
|
+
renderHeader?: (props: BotzkiHeaderProps) => React__default.ReactNode;
|
|
731
|
+
/**
|
|
732
|
+
* Developer's custom React component rendered as the chat header.
|
|
733
|
+
*/
|
|
734
|
+
customHeader?: React__default.ReactNode;
|
|
735
|
+
/**
|
|
736
|
+
* Custom message bubble renderer slot.
|
|
737
|
+
*/
|
|
738
|
+
renderMessage?: (props: BotzkiMessageRenderProps) => React__default.ReactNode;
|
|
739
|
+
/**
|
|
740
|
+
* Custom composer input bar renderer slot.
|
|
741
|
+
*/
|
|
742
|
+
renderComposer?: (props: BotzkiComposerRenderProps) => React__default.ReactNode;
|
|
743
|
+
/**
|
|
744
|
+
* Custom welcome / empty screen renderer slot.
|
|
745
|
+
*/
|
|
746
|
+
renderWelcome?: () => React__default.ReactNode;
|
|
747
|
+
/**
|
|
748
|
+
* Custom visitor CRM metadata attributes passed during human escalation (e.g. membership: 'premium').
|
|
749
|
+
*/
|
|
750
|
+
visitorData?: Record<string, string>;
|
|
751
|
+
/**
|
|
752
|
+
* Custom tags / segments for conversation categorization (e.g. ['vip', 'billing']).
|
|
753
|
+
*/
|
|
754
|
+
tags?: string[];
|
|
755
|
+
/**
|
|
756
|
+
* Width of the floating chat window when collapsed (e.g. "380px" or 380).
|
|
757
|
+
* @default "380px"
|
|
758
|
+
*/
|
|
759
|
+
width?: string | number;
|
|
760
|
+
/**
|
|
761
|
+
* Height of the floating chat window when collapsed (e.g. "580px" or 580).
|
|
762
|
+
* @default "580px"
|
|
763
|
+
*/
|
|
764
|
+
height?: string | number;
|
|
765
|
+
/**
|
|
766
|
+
* Width of the floating chat window when expanded.
|
|
767
|
+
* @default "720px"
|
|
768
|
+
*/
|
|
769
|
+
expandedWidth?: string | number;
|
|
770
|
+
/**
|
|
771
|
+
* Height of the floating chat window when expanded.
|
|
772
|
+
* @default "calc(100vh - 100px)"
|
|
773
|
+
*/
|
|
774
|
+
expandedHeight?: string | number;
|
|
775
|
+
/**
|
|
776
|
+
* Whether to allow expanding / maximizing the widget window.
|
|
777
|
+
* @default true
|
|
778
|
+
*/
|
|
779
|
+
allowExpand?: boolean;
|
|
780
|
+
/**
|
|
781
|
+
* Whether to display the "+ New Chat" button in the header.
|
|
782
|
+
* @default true
|
|
783
|
+
*/
|
|
784
|
+
showNewChatButton?: boolean;
|
|
785
|
+
/**
|
|
786
|
+
* Whether to display the multi-session history button in the header.
|
|
787
|
+
* @default true
|
|
788
|
+
*/
|
|
789
|
+
showHistoryButton?: boolean;
|
|
790
|
+
/**
|
|
791
|
+
* Whether to display the 1-click Download Transcript button in the header.
|
|
792
|
+
* @default true
|
|
793
|
+
*/
|
|
794
|
+
showExportButton?: boolean;
|
|
795
|
+
/**
|
|
796
|
+
* Whether the floating chat window should start open on mount.
|
|
797
|
+
* @default false
|
|
798
|
+
*/
|
|
799
|
+
defaultOpen?: boolean;
|
|
800
|
+
/**
|
|
801
|
+
* Whether the floating chat window should start in maximized / expanded view.
|
|
802
|
+
* @default false
|
|
803
|
+
*/
|
|
804
|
+
defaultExpanded?: boolean;
|
|
805
|
+
/**
|
|
806
|
+
* Whether to play the synthesized Web Audio notification chime on incoming messages.
|
|
807
|
+
* @default true
|
|
808
|
+
*/
|
|
809
|
+
enableSoundAlert?: boolean;
|
|
810
|
+
/**
|
|
811
|
+
* Whether to show the "Talk to Support" human escalation button in the header.
|
|
812
|
+
* @default true
|
|
813
|
+
*/
|
|
814
|
+
enableHumanHandoff?: boolean;
|
|
815
|
+
/**
|
|
816
|
+
* Whether Zero-Install Ghost Co-Browsing screen assist is enabled on the client.
|
|
817
|
+
* @default true
|
|
818
|
+
*/
|
|
819
|
+
enableCoBrowse?: boolean;
|
|
820
|
+
/**
|
|
821
|
+
* Whether 2-Step Autonomous Action Confirmation Cards are enabled on the client.
|
|
822
|
+
* @default true
|
|
823
|
+
*/
|
|
824
|
+
enableActionEngine?: boolean;
|
|
825
|
+
/**
|
|
826
|
+
* Whether audio voice note recording is enabled in the composer toolbar.
|
|
827
|
+
* @default true
|
|
828
|
+
*/
|
|
829
|
+
enableVoiceNotes?: boolean;
|
|
830
|
+
/**
|
|
831
|
+
* Callback fired when the widget expand / collapse state changes.
|
|
832
|
+
*/
|
|
833
|
+
onExpandChange?: (isExpanded: boolean) => void;
|
|
834
|
+
/**
|
|
835
|
+
* Callback fired immediately when a user sends a message.
|
|
836
|
+
*/
|
|
837
|
+
onSendMessage?: (message: BotzkiMessage) => void;
|
|
838
|
+
/**
|
|
839
|
+
* Callback fired whenever a full response is received from the bot.
|
|
840
|
+
*/
|
|
841
|
+
onResponse?: (response: ChatResponse) => void;
|
|
842
|
+
/**
|
|
843
|
+
* Callback fired when a message turn finishes streaming.
|
|
844
|
+
*/
|
|
845
|
+
onFinish?: (message: BotzkiMessage) => void;
|
|
846
|
+
/**
|
|
847
|
+
* Callback fired when the visitor requests human support escalation.
|
|
848
|
+
*/
|
|
849
|
+
onEscalationRequest?: (details: {
|
|
850
|
+
reason?: string;
|
|
851
|
+
visitorName?: string;
|
|
852
|
+
visitorEmail?: string;
|
|
853
|
+
}) => void;
|
|
854
|
+
/**
|
|
855
|
+
* Callback fired when a human support operator joins the conversation.
|
|
856
|
+
*/
|
|
857
|
+
onOperatorJoined?: (operator: {
|
|
858
|
+
id?: string;
|
|
859
|
+
name: string;
|
|
860
|
+
avatarUrl?: string;
|
|
861
|
+
}) => void;
|
|
862
|
+
/**
|
|
863
|
+
* Callback fired when the human operator resolves the conversation.
|
|
864
|
+
*/
|
|
865
|
+
onTicketResolved?: (ticketId: string) => void;
|
|
866
|
+
/**
|
|
867
|
+
* Callback fired when the visitor submits a 1-5 star CSAT rating.
|
|
868
|
+
*/
|
|
869
|
+
onCsatSubmit?: (rating: number, feedback?: string) => void;
|
|
870
|
+
/**
|
|
871
|
+
* Callback fired when the AI proposes an autonomous action card.
|
|
872
|
+
*/
|
|
873
|
+
onActionProposed?: (action: ProposedBotAction) => void;
|
|
874
|
+
/**
|
|
875
|
+
* Callback fired when the visitor confirms and executes a proposed action.
|
|
876
|
+
*/
|
|
877
|
+
onActionExecuted?: (action: ProposedBotAction, result: any) => void;
|
|
878
|
+
/**
|
|
879
|
+
* Callback fired when the visitor cancels a proposed action.
|
|
880
|
+
*/
|
|
881
|
+
onActionCancelled?: (action: ProposedBotAction, reason?: string) => void;
|
|
882
|
+
/**
|
|
883
|
+
* Callback fired when the visitor accepts Ghost Co-Browsing screen assist.
|
|
884
|
+
*/
|
|
885
|
+
onCoBrowseStart?: (operatorName?: string | null) => void;
|
|
886
|
+
/**
|
|
887
|
+
* Callback fired when Ghost Co-Browsing screen assist ends.
|
|
888
|
+
*/
|
|
889
|
+
onCoBrowseEnd?: () => void;
|
|
890
|
+
/**
|
|
891
|
+
* Callback fired when the visitor clicks thumbs-up or thumbs-down on an answer.
|
|
892
|
+
*/
|
|
893
|
+
onFeedbackSubmit?: (messageId: string, rating: "up" | "down") => void;
|
|
894
|
+
/**
|
|
895
|
+
* Callback fired when the visitor clicks a grounded document citation.
|
|
896
|
+
*/
|
|
897
|
+
onCitationClick?: (citation: Citation) => void;
|
|
898
|
+
/**
|
|
899
|
+
* Callback fired when a proactive trigger activates.
|
|
900
|
+
*/
|
|
901
|
+
onTriggerActivated?: (trigger: {
|
|
902
|
+
id?: string;
|
|
903
|
+
name?: string;
|
|
904
|
+
triggerType?: string;
|
|
905
|
+
headline?: string;
|
|
906
|
+
message?: string;
|
|
907
|
+
}) => void;
|
|
908
|
+
/**
|
|
909
|
+
* Proactive teaser message displayed in a floating bubble next to launcher before opening.
|
|
910
|
+
*/
|
|
911
|
+
proactiveMessage?: string;
|
|
912
|
+
/**
|
|
913
|
+
* Milliseconds delay before displaying proactive message teaser. Defaults to 3000ms.
|
|
914
|
+
*/
|
|
915
|
+
proactiveDelay?: number;
|
|
916
|
+
/**
|
|
917
|
+
* Whether to evaluate and execute backend-defined proactive triggers (e.g. exit-intent, time on page, scroll).
|
|
918
|
+
* Defaults to true.
|
|
919
|
+
*/
|
|
920
|
+
enableTriggers?: boolean;
|
|
921
|
+
/**
|
|
922
|
+
* Unread notification count badge to display on top of launcher button.
|
|
923
|
+
* If omitted, unread messages are automatically tracked when widget is closed.
|
|
924
|
+
*/
|
|
925
|
+
unreadCount?: number;
|
|
926
|
+
/**
|
|
927
|
+
* Callback fired whenever the unread message count changes.
|
|
928
|
+
*/
|
|
929
|
+
onUnreadCountChange?: (count: number) => void;
|
|
930
|
+
/**
|
|
931
|
+
* Whether to display unread message count alert in browser document title when tab is backgrounded.
|
|
932
|
+
* @default true
|
|
933
|
+
*/
|
|
934
|
+
enableTabTitleNotification?: boolean;
|
|
935
|
+
/**
|
|
936
|
+
* Whether global keyboard shortcuts are active (Cmd+K / Ctrl+K to toggle, Escape to close).
|
|
937
|
+
* @default true
|
|
938
|
+
*/
|
|
939
|
+
enableHotkey?: boolean;
|
|
940
|
+
/**
|
|
941
|
+
* Callback fired when a new chat session is started.
|
|
942
|
+
*/
|
|
943
|
+
onNewChat?: () => void;
|
|
944
|
+
/**
|
|
945
|
+
* Custom avatar for the user shown next to user chat messages.
|
|
946
|
+
* Can be an image URL string or a React node. Defaults to a clean user icon.
|
|
947
|
+
*/
|
|
948
|
+
userAvatar?: React__default.ReactNode | string;
|
|
949
|
+
/**
|
|
950
|
+
* Whether to display avatars beside chat messages. Defaults to true.
|
|
951
|
+
*/
|
|
952
|
+
showAvatars?: boolean;
|
|
953
|
+
/**
|
|
954
|
+
* Whether to enable image/file upload attachments in the chat bar. Defaults to true.
|
|
955
|
+
*/
|
|
956
|
+
enableImageUpload?: boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Whether to enable microphone voice input (speech-to-text). Defaults to true.
|
|
959
|
+
*/
|
|
960
|
+
enableVoiceInput?: boolean;
|
|
961
|
+
/**
|
|
962
|
+
* Whether to enable text-to-speech read aloud on assistant responses. Defaults to true.
|
|
963
|
+
*/
|
|
964
|
+
enableVoiceOutput?: boolean;
|
|
965
|
+
/**
|
|
966
|
+
* Whether to show thumbs-up / thumbs-down helpful feedback buttons on assistant messages. Defaults to true.
|
|
967
|
+
*/
|
|
968
|
+
showFeedback?: boolean;
|
|
969
|
+
/**
|
|
970
|
+
* Whether to show grounded document citation badges beneath assistant answers. Defaults to true.
|
|
971
|
+
*/
|
|
972
|
+
showCitations?: boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Whether to display "Powered by Botzki" in the footer. Defaults to true.
|
|
975
|
+
*/
|
|
976
|
+
showBranding?: boolean;
|
|
977
|
+
/**
|
|
978
|
+
* Whether to display a copy button on assistant messages. Defaults to true.
|
|
979
|
+
*/
|
|
980
|
+
showCopyButton?: boolean;
|
|
981
|
+
/**
|
|
982
|
+
* Custom React icon to show in the closed floating launcher bubble.
|
|
983
|
+
* If omitted, defaults to the animated Botzi mascot avatar.
|
|
984
|
+
*/
|
|
985
|
+
launcherIcon?: React__default.ReactNode;
|
|
986
|
+
/**
|
|
987
|
+
* Background color for the launcher button when closed.
|
|
988
|
+
* Defaults to "transparent", letting the Botzi avatar float naturally with no colored circle behind it.
|
|
989
|
+
*/
|
|
990
|
+
launcherBackground?: string;
|
|
991
|
+
/**
|
|
992
|
+
* Additional inline styles for the floating launcher button.
|
|
993
|
+
*/
|
|
994
|
+
launcherStyle?: React__default.CSSProperties;
|
|
995
|
+
/**
|
|
996
|
+
* Background color for the launcher button when the chat window is open (showing the 'X' close icon).
|
|
997
|
+
* Defaults to primaryColor.
|
|
998
|
+
*/
|
|
999
|
+
closeButtonBackground?: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* Color for the 'X' close icon. Defaults to "#ffffff".
|
|
1002
|
+
*/
|
|
1003
|
+
closeButtonColor?: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* Custom gradient colors for the Botzi avatar body (e.g. `["#66a6ff", "#0059d4"]`).
|
|
1006
|
+
*/
|
|
1007
|
+
avatarColors?: readonly [string, string];
|
|
1008
|
+
/**
|
|
1009
|
+
* Color for both eyes and mouth of the Botzi avatar. Defaults to "#ffffff".
|
|
1010
|
+
*/
|
|
1011
|
+
avatarFaceColor?: string;
|
|
1012
|
+
/**
|
|
1013
|
+
* Custom color for the eyes. Overrides avatarFaceColor.
|
|
1014
|
+
*/
|
|
1015
|
+
avatarEyeColor?: string;
|
|
1016
|
+
/**
|
|
1017
|
+
* Custom color for the mouth. Overrides avatarFaceColor.
|
|
1018
|
+
*/
|
|
1019
|
+
avatarMouthColor?: string;
|
|
1020
|
+
/**
|
|
1021
|
+
* Body shape of the avatar ("pebble" | "circle" | "squircle" | "flower" | "blob").
|
|
1022
|
+
* Defaults to "pebble".
|
|
1023
|
+
*/
|
|
1024
|
+
avatarShape?: AiBotShape;
|
|
1025
|
+
/**
|
|
1026
|
+
* Size of the avatar inside the launcher button in px. Defaults to 54.
|
|
1027
|
+
*/
|
|
1028
|
+
avatarSize?: number;
|
|
1029
|
+
/**
|
|
1030
|
+
* Whether avatar eyes follow mouse cursor. Defaults to true.
|
|
1031
|
+
*/
|
|
1032
|
+
avatarFollowCursor?: boolean;
|
|
1033
|
+
/**
|
|
1034
|
+
* Complete avatar props object passed directly into `<BotziAvatar />`.
|
|
1035
|
+
*/
|
|
1036
|
+
avatarProps?: Partial<BotziAvatarProps>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Whether the Visual Empathy Engine is enabled.
|
|
1039
|
+
* When true, the avatar's procedural facial expressions and micro-motions react
|
|
1040
|
+
* dynamically to visitor sentiment (frustration, delight, curiosity, thinking).
|
|
1041
|
+
* Defaults to true.
|
|
1042
|
+
*/
|
|
1043
|
+
enableEmpathyEngine?: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* Custom avatar to display in the chat window header (React node or image URL).
|
|
1046
|
+
* Defaults to the Botzi mascot avatar.
|
|
1047
|
+
*/
|
|
1048
|
+
botAvatar?: React__default.ReactNode | string;
|
|
235
1049
|
/**
|
|
236
1050
|
* Optional bot ID. If omitted, uses value from `<BotzkiProvider>`.
|
|
237
1051
|
*/
|
|
@@ -256,6 +1070,62 @@ interface BotzkiWidgetProps extends WidgetOptions {
|
|
|
256
1070
|
* Callback fired when the widget chat window closes.
|
|
257
1071
|
*/
|
|
258
1072
|
onClose?: () => void;
|
|
1073
|
+
/**
|
|
1074
|
+
* Custom placeholder text for the message input textarea. Defaults to "Ask a question...".
|
|
1075
|
+
*/
|
|
1076
|
+
placeholder?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* Custom inline styles for the message input textarea.
|
|
1079
|
+
*/
|
|
1080
|
+
inputStyle?: React__default.CSSProperties;
|
|
1081
|
+
/**
|
|
1082
|
+
* Custom inline styles for the bottom composer input bar.
|
|
1083
|
+
*/
|
|
1084
|
+
composerStyle?: React__default.CSSProperties;
|
|
1085
|
+
/**
|
|
1086
|
+
* Custom background color for user message bubbles. Defaults to primaryColor.
|
|
1087
|
+
*/
|
|
1088
|
+
userBubbleColor?: string;
|
|
1089
|
+
/**
|
|
1090
|
+
* Custom text color for user message bubbles. Defaults to "#ffffff".
|
|
1091
|
+
*/
|
|
1092
|
+
userTextColor?: string;
|
|
1093
|
+
/**
|
|
1094
|
+
* Custom background color for assistant message bubbles.
|
|
1095
|
+
*/
|
|
1096
|
+
assistantBubbleColor?: string;
|
|
1097
|
+
/**
|
|
1098
|
+
* Custom text color for assistant message bubbles.
|
|
1099
|
+
*/
|
|
1100
|
+
assistantTextColor?: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* Custom font family for the chat widget.
|
|
1103
|
+
*/
|
|
1104
|
+
fontFamily?: string;
|
|
1105
|
+
/**
|
|
1106
|
+
* Custom base font size (e.g. "14px" or 14).
|
|
1107
|
+
*/
|
|
1108
|
+
fontSize?: string | number;
|
|
1109
|
+
/**
|
|
1110
|
+
* Custom inline styles for the chat header.
|
|
1111
|
+
*/
|
|
1112
|
+
headerStyle?: React__default.CSSProperties;
|
|
1113
|
+
/**
|
|
1114
|
+
* Custom inline styles for the messages scroll container.
|
|
1115
|
+
*/
|
|
1116
|
+
messagesContainerStyle?: React__default.CSSProperties;
|
|
1117
|
+
/**
|
|
1118
|
+
* Custom inline styles for the embedded chat container inside the widget.
|
|
1119
|
+
*/
|
|
1120
|
+
chatStyle?: React__default.CSSProperties;
|
|
1121
|
+
/**
|
|
1122
|
+
* Custom inline styles for the unread message count badge.
|
|
1123
|
+
*/
|
|
1124
|
+
badgeStyle?: React__default.CSSProperties;
|
|
1125
|
+
/**
|
|
1126
|
+
* Custom inline styles for the send/stop action button.
|
|
1127
|
+
*/
|
|
1128
|
+
sendButtonStyle?: React__default.CSSProperties;
|
|
259
1129
|
}
|
|
260
1130
|
|
|
261
1131
|
/**
|
|
@@ -293,6 +1163,52 @@ interface BotzkiChatProps extends UseChatOptions {
|
|
|
293
1163
|
* Title shown in the chat window header. Defaults to bot name or "AI Assistant".
|
|
294
1164
|
*/
|
|
295
1165
|
title?: string;
|
|
1166
|
+
/**
|
|
1167
|
+
* Structured avatar customization options object.
|
|
1168
|
+
*/
|
|
1169
|
+
avatar?: BotzkiAvatarOptions;
|
|
1170
|
+
/**
|
|
1171
|
+
* Custom avatar to display for the bot (React node or image URL).
|
|
1172
|
+
* Overrides the default animated Botzi character.
|
|
1173
|
+
*/
|
|
1174
|
+
botAvatar?: React__default.ReactNode | string;
|
|
1175
|
+
/**
|
|
1176
|
+
* Custom avatar to display for the user (React node or image URL).
|
|
1177
|
+
* Defaults to a sleek user silhouette icon.
|
|
1178
|
+
*/
|
|
1179
|
+
userAvatar?: React__default.ReactNode | string;
|
|
1180
|
+
/**
|
|
1181
|
+
* Whether to display avatars beside chat bubbles. Defaults to true.
|
|
1182
|
+
*/
|
|
1183
|
+
showAvatars?: boolean;
|
|
1184
|
+
/**
|
|
1185
|
+
* Whether to enable image/file upload attachments in the chat bar. Defaults to true.
|
|
1186
|
+
*/
|
|
1187
|
+
enableImageUpload?: boolean;
|
|
1188
|
+
/**
|
|
1189
|
+
* Whether to enable microphone speech-to-text dictation. Defaults to true.
|
|
1190
|
+
*/
|
|
1191
|
+
enableVoiceInput?: boolean;
|
|
1192
|
+
/**
|
|
1193
|
+
* Whether to enable text-to-speech read aloud on assistant responses. Defaults to true.
|
|
1194
|
+
*/
|
|
1195
|
+
enableVoiceOutput?: boolean;
|
|
1196
|
+
/**
|
|
1197
|
+
* Whether to show thumbs-up / thumbs-down helpful feedback buttons. Defaults to true.
|
|
1198
|
+
*/
|
|
1199
|
+
showFeedback?: boolean;
|
|
1200
|
+
/**
|
|
1201
|
+
* Whether to show document citation pills beneath assistant answers. Defaults to true.
|
|
1202
|
+
*/
|
|
1203
|
+
showCitations?: boolean;
|
|
1204
|
+
/**
|
|
1205
|
+
* Whether to display "Powered by Botzki" in the footer. Defaults to true.
|
|
1206
|
+
*/
|
|
1207
|
+
showBranding?: boolean;
|
|
1208
|
+
/**
|
|
1209
|
+
* Whether to display a copy button on assistant messages. Defaults to true.
|
|
1210
|
+
*/
|
|
1211
|
+
showCopyButton?: boolean;
|
|
296
1212
|
/**
|
|
297
1213
|
* Subtitle shown in the chat window header. Defaults to "Online".
|
|
298
1214
|
*/
|
|
@@ -337,17 +1253,221 @@ interface BotzkiChatProps extends UseChatOptions {
|
|
|
337
1253
|
* Whether to display the clear messages button. Defaults to true.
|
|
338
1254
|
*/
|
|
339
1255
|
showClearButton?: boolean;
|
|
1256
|
+
/**
|
|
1257
|
+
* Whether to show the "+ New Chat" button in the header. Defaults to true.
|
|
1258
|
+
*/
|
|
1259
|
+
showNewChatButton?: boolean;
|
|
1260
|
+
/**
|
|
1261
|
+
* Whether to show the chat history drawer button in the header. Defaults to true.
|
|
1262
|
+
*/
|
|
1263
|
+
showHistoryButton?: boolean;
|
|
1264
|
+
/**
|
|
1265
|
+
* Whether to display the maximize/minimize expand button in the header. Defaults to false.
|
|
1266
|
+
*/
|
|
1267
|
+
allowExpand?: boolean;
|
|
1268
|
+
/**
|
|
1269
|
+
* Controlled state of whether widget is expanded.
|
|
1270
|
+
*/
|
|
1271
|
+
isExpanded?: boolean;
|
|
1272
|
+
/**
|
|
1273
|
+
* Callback fired when the user toggles expand / minimize.
|
|
1274
|
+
*/
|
|
1275
|
+
onToggleExpand?: () => void;
|
|
1276
|
+
/**
|
|
1277
|
+
* Callback fired when a new chat session is started.
|
|
1278
|
+
*/
|
|
1279
|
+
onNewChat?: () => void;
|
|
1280
|
+
/**
|
|
1281
|
+
* Developer's custom header render function.
|
|
1282
|
+
*/
|
|
1283
|
+
renderHeader?: (props: BotzkiHeaderProps) => React__default.ReactNode;
|
|
1284
|
+
/**
|
|
1285
|
+
* Developer's custom React component rendered as the chat header.
|
|
1286
|
+
*/
|
|
1287
|
+
customHeader?: React__default.ReactNode;
|
|
1288
|
+
/**
|
|
1289
|
+
* Developer's custom message bubble renderer slot.
|
|
1290
|
+
*/
|
|
1291
|
+
renderMessage?: (props: BotzkiMessageRenderProps) => React__default.ReactNode;
|
|
1292
|
+
/**
|
|
1293
|
+
* Developer's custom composer input bar renderer slot.
|
|
1294
|
+
*/
|
|
1295
|
+
renderComposer?: (props: BotzkiComposerRenderProps) => React__default.ReactNode;
|
|
1296
|
+
/**
|
|
1297
|
+
* Developer's custom welcome / empty screen renderer slot.
|
|
1298
|
+
*/
|
|
1299
|
+
renderWelcome?: () => React__default.ReactNode;
|
|
1300
|
+
/**
|
|
1301
|
+
* Number of unread messages to highlight in the message list with a 'New Messages' separator.
|
|
1302
|
+
*/
|
|
1303
|
+
unreadCount?: number;
|
|
1304
|
+
/**
|
|
1305
|
+
* Index of the first unread message where the 'New Messages' divider is rendered.
|
|
1306
|
+
*/
|
|
1307
|
+
unreadFromIndex?: number;
|
|
1308
|
+
/**
|
|
1309
|
+
* Custom inline style overrides for the message input textarea.
|
|
1310
|
+
*/
|
|
1311
|
+
inputStyle?: React__default.CSSProperties;
|
|
1312
|
+
/**
|
|
1313
|
+
* Custom inline style overrides for the bottom composer container bar.
|
|
1314
|
+
*/
|
|
1315
|
+
composerStyle?: React__default.CSSProperties;
|
|
1316
|
+
/**
|
|
1317
|
+
* Custom background color for user message bubbles. Defaults to primaryColor.
|
|
1318
|
+
*/
|
|
1319
|
+
userBubbleColor?: string;
|
|
1320
|
+
/**
|
|
1321
|
+
* Custom text color for user message bubbles. Defaults to "#ffffff".
|
|
1322
|
+
*/
|
|
1323
|
+
userTextColor?: string;
|
|
1324
|
+
/**
|
|
1325
|
+
* Custom background color for assistant message bubbles.
|
|
1326
|
+
*/
|
|
1327
|
+
assistantBubbleColor?: string;
|
|
1328
|
+
/**
|
|
1329
|
+
* Custom text color for assistant message bubbles.
|
|
1330
|
+
*/
|
|
1331
|
+
assistantTextColor?: string;
|
|
1332
|
+
/**
|
|
1333
|
+
* Custom font family for the chat widget.
|
|
1334
|
+
*/
|
|
1335
|
+
fontFamily?: string;
|
|
1336
|
+
/**
|
|
1337
|
+
* Custom base font size (e.g. "14px" or 14).
|
|
1338
|
+
*/
|
|
1339
|
+
fontSize?: string | number;
|
|
1340
|
+
/**
|
|
1341
|
+
* Custom inline styles for the chat header.
|
|
1342
|
+
*/
|
|
1343
|
+
headerStyle?: React__default.CSSProperties;
|
|
1344
|
+
/**
|
|
1345
|
+
* Custom inline styles for the messages scroll container.
|
|
1346
|
+
*/
|
|
1347
|
+
messagesContainerStyle?: React__default.CSSProperties;
|
|
1348
|
+
/**
|
|
1349
|
+
* Custom inline styles for the send/stop action button.
|
|
1350
|
+
*/
|
|
1351
|
+
sendButtonStyle?: React__default.CSSProperties;
|
|
340
1352
|
/**
|
|
341
1353
|
* Optional external chat instance from useChat().
|
|
342
1354
|
*/
|
|
343
1355
|
chat?: ReturnType<typeof useChat>;
|
|
1356
|
+
avatarColors?: readonly [string, string];
|
|
1357
|
+
avatarFaceColor?: string;
|
|
1358
|
+
avatarEyeColor?: string;
|
|
1359
|
+
avatarMouthColor?: string;
|
|
1360
|
+
avatarShape?: AiBotShape;
|
|
1361
|
+
avatarSize?: number;
|
|
1362
|
+
headerAvatarBackground?: string;
|
|
1363
|
+
avatarFollowCursor?: boolean;
|
|
1364
|
+
avatarProps?: Partial<BotziAvatarProps>;
|
|
1365
|
+
enableEmpathyEngine?: boolean;
|
|
1366
|
+
/**
|
|
1367
|
+
* Whether to display the 1-click Download Transcript button in the header. Defaults to true.
|
|
1368
|
+
*/
|
|
1369
|
+
showExportButton?: boolean;
|
|
1370
|
+
/**
|
|
1371
|
+
* Whether to show the "Talk to Support" human escalation button in the header. Defaults to true.
|
|
1372
|
+
*/
|
|
1373
|
+
enableHumanHandoff?: boolean;
|
|
1374
|
+
/**
|
|
1375
|
+
* Whether 2-Step Autonomous Action Confirmation Cards are enabled. Defaults to true.
|
|
1376
|
+
*/
|
|
1377
|
+
enableActionEngine?: boolean;
|
|
1378
|
+
/**
|
|
1379
|
+
* Whether audio voice note recording is enabled in the composer toolbar. Defaults to true.
|
|
1380
|
+
*/
|
|
1381
|
+
enableVoiceNotes?: boolean;
|
|
1382
|
+
/**
|
|
1383
|
+
* Optional controlled state for the multi-session history drawer.
|
|
1384
|
+
*/
|
|
1385
|
+
isHistoryOpen?: boolean;
|
|
1386
|
+
/**
|
|
1387
|
+
* Callback fired when the history drawer open state changes.
|
|
1388
|
+
*/
|
|
1389
|
+
onHistoryOpenChange?: (open: boolean) => void;
|
|
1390
|
+
/**
|
|
1391
|
+
* Callback fired when the visitor clicks thumbs-up or thumbs-down on an answer.
|
|
1392
|
+
*/
|
|
1393
|
+
onFeedbackSubmit?: (messageId: string, rating: "up" | "down") => void;
|
|
1394
|
+
/**
|
|
1395
|
+
* Callback fired when the visitor clicks a grounded document citation.
|
|
1396
|
+
*/
|
|
1397
|
+
onCitationClick?: (citation: any) => void;
|
|
344
1398
|
}
|
|
345
1399
|
/**
|
|
346
1400
|
* Embedded, full-featured AI chat container for dashboards, sidebars, and dedicated support pages.
|
|
347
1401
|
* Fully responsive and self-contained with no external CSS dependencies.
|
|
348
1402
|
*/
|
|
349
|
-
declare function BotzkiChat({ title, subtitle, greeting, starterQuestions, theme, primaryColor, className, style, placeholder, onClose, showCloseButton, showClearButton, chat: externalChat, ...chatOptions }: BotzkiChatProps): React__default.JSX.Element;
|
|
1403
|
+
declare function BotzkiChat({ title, avatar, botAvatar, userAvatar, showAvatars, enableImageUpload, enableVoiceInput, enableVoiceOutput, enableVoiceNotes, enableHumanHandoff, enableActionEngine, showFeedback, showCitations, showBranding, showCopyButton, showExportButton, avatarColors, avatarFaceColor, avatarEyeColor, avatarMouthColor, avatarShape, avatarSize, headerAvatarBackground, avatarFollowCursor, avatarProps, enableEmpathyEngine, subtitle, greeting, starterQuestions, theme, primaryColor, className, style, placeholder, onClose, showCloseButton, showClearButton, showNewChatButton, showHistoryButton, allowExpand, isExpanded, onToggleExpand, onNewChat, isHistoryOpen: controlledHistoryOpen, onHistoryOpenChange, onFeedbackSubmit, onCitationClick, renderHeader, customHeader, renderMessage, renderComposer, renderWelcome, unreadCount, unreadFromIndex, inputStyle, composerStyle, userBubbleColor, userTextColor, assistantBubbleColor, assistantTextColor, fontFamily, fontSize, headerStyle, messagesContainerStyle, sendButtonStyle, chat: externalChat, ...chatOptions }: BotzkiChatProps): React__default.JSX.Element;
|
|
1404
|
+
|
|
1405
|
+
interface BotzkiMarkdownProps {
|
|
1406
|
+
content: string;
|
|
1407
|
+
isUser?: boolean;
|
|
1408
|
+
primaryColor?: string;
|
|
1409
|
+
isDark?: boolean;
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* High-performance, zero-dependency Markdown renderer designed specifically for AI chat streams.
|
|
1413
|
+
* Handles bold, italic, code blocks with copy, inline code, headings, lists, links, and blockquotes.
|
|
1414
|
+
*/
|
|
1415
|
+
declare function BotzkiMarkdown({ content, isUser, primaryColor, isDark, }: BotzkiMarkdownProps): React__default.JSX.Element | null;
|
|
350
1416
|
|
|
1417
|
+
interface BotzkiAudioPlayerProps {
|
|
1418
|
+
/**
|
|
1419
|
+
* URL of the audio file or blob object URL to play.
|
|
1420
|
+
*/
|
|
1421
|
+
audioUrl: string;
|
|
1422
|
+
/**
|
|
1423
|
+
* Pre-calculated audio duration in seconds.
|
|
1424
|
+
*/
|
|
1425
|
+
duration?: number;
|
|
1426
|
+
/**
|
|
1427
|
+
* Whether the player is inside a user chat bubble.
|
|
1428
|
+
* Controls waveform and button contrast colors.
|
|
1429
|
+
*/
|
|
1430
|
+
isUser?: boolean;
|
|
1431
|
+
/**
|
|
1432
|
+
* Brand primary accent color.
|
|
1433
|
+
*/
|
|
1434
|
+
primaryColor?: string;
|
|
1435
|
+
/**
|
|
1436
|
+
* Whether dark mode is active.
|
|
1437
|
+
*/
|
|
1438
|
+
isDark?: boolean;
|
|
1439
|
+
/**
|
|
1440
|
+
* Custom CSS class name.
|
|
1441
|
+
*/
|
|
1442
|
+
className?: string;
|
|
1443
|
+
/**
|
|
1444
|
+
* Custom inline styles.
|
|
1445
|
+
*/
|
|
1446
|
+
style?: React__default.CSSProperties;
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Modern, interactive Crisp/WhatsApp-style voice note player with waveform visualization,
|
|
1450
|
+
* seek scrubber, playback speed multiplier, and time tracking.
|
|
1451
|
+
*/
|
|
1452
|
+
declare function BotzkiAudioPlayer({ audioUrl, duration: initialDuration, isUser, primaryColor, isDark, className, style, }: BotzkiAudioPlayerProps): React__default.JSX.Element;
|
|
1453
|
+
|
|
1454
|
+
interface CoBrowseLaserPointerProps {
|
|
1455
|
+
coBrowse: CoBrowseState;
|
|
1456
|
+
}
|
|
1457
|
+
declare const CoBrowseLaserPointer: React__default.FC<CoBrowseLaserPointerProps>;
|
|
1458
|
+
|
|
1459
|
+
interface ProactiveTriggerInfo {
|
|
1460
|
+
id: string;
|
|
1461
|
+
name: string;
|
|
1462
|
+
urlPattern?: string;
|
|
1463
|
+
triggerType: "TimeOnPage" | "ScrollPercentage" | "ExitIntent";
|
|
1464
|
+
delaySeconds?: number;
|
|
1465
|
+
scrollPercentage?: number;
|
|
1466
|
+
headline: string;
|
|
1467
|
+
message: string;
|
|
1468
|
+
suggestedPrompts?: string[];
|
|
1469
|
+
priority?: number;
|
|
1470
|
+
}
|
|
351
1471
|
interface BotInfoData {
|
|
352
1472
|
id?: string;
|
|
353
1473
|
name?: string;
|
|
@@ -358,6 +1478,17 @@ interface BotInfoData {
|
|
|
358
1478
|
greeting?: string;
|
|
359
1479
|
starterQuestions?: string[];
|
|
360
1480
|
capabilities?: string[];
|
|
1481
|
+
humanHandoffEnabled?: boolean;
|
|
1482
|
+
handoffType?: string;
|
|
1483
|
+
handoffUrl?: string;
|
|
1484
|
+
handoffButtonText?: string;
|
|
1485
|
+
liveChatEnabled?: boolean;
|
|
1486
|
+
liveChatRequireEmail?: boolean;
|
|
1487
|
+
liveChatOfflineMessage?: string;
|
|
1488
|
+
liveChatWelcomeMessage?: string;
|
|
1489
|
+
liveChatIsOnline?: boolean;
|
|
1490
|
+
liveChatOutOfHoursBehavior?: string;
|
|
1491
|
+
activeTriggers?: ProactiveTriggerInfo[];
|
|
361
1492
|
[key: string]: unknown;
|
|
362
1493
|
}
|
|
363
1494
|
interface UseBotInfoReturn {
|
|
@@ -423,4 +1554,109 @@ interface UseVoiceTranscriptionReturn {
|
|
|
423
1554
|
*/
|
|
424
1555
|
declare function useVoiceTranscription(): UseVoiceTranscriptionReturn;
|
|
425
1556
|
|
|
426
|
-
|
|
1557
|
+
type VisitorSentiment = "frustrated" | "delighted" | "happy" | "curious" | "thinking" | "neutral";
|
|
1558
|
+
interface EmpathyEngineOptions {
|
|
1559
|
+
/** The message history to observe for visitor emotion cues. */
|
|
1560
|
+
messages?: BotzkiMessage[];
|
|
1561
|
+
/** Whether the AI assistant is currently thinking / streaming a response. */
|
|
1562
|
+
isLoading?: boolean;
|
|
1563
|
+
/** Whether streaming tokens are actively being appended. */
|
|
1564
|
+
isStreaming?: boolean;
|
|
1565
|
+
/** Whether visitor is waiting for a human agent handoff. */
|
|
1566
|
+
isWaitingForHuman?: boolean;
|
|
1567
|
+
/** Whether a human support operator is currently active in the chat. */
|
|
1568
|
+
isHumanHandoffActive?: boolean;
|
|
1569
|
+
/** Recent CSAT or message feedback rating ("up" | "down"). */
|
|
1570
|
+
feedbackRating?: "up" | "down" | null;
|
|
1571
|
+
/** Force an emotion override (disables auto-empathy until cleared). */
|
|
1572
|
+
manualEmotion?: AiBotEmotion;
|
|
1573
|
+
/** Force a motion override. */
|
|
1574
|
+
manualMotion?: AiBotMotion;
|
|
1575
|
+
/** Whether the empathy engine is active. Defaults to true. */
|
|
1576
|
+
enabled?: boolean;
|
|
1577
|
+
/** Cooldown in ms before returning to neutral after an emotional reaction. Defaults to 5000ms. */
|
|
1578
|
+
reactionCooldownMs?: number;
|
|
1579
|
+
}
|
|
1580
|
+
interface EmpathyEngineReturn {
|
|
1581
|
+
/** The active procedural emotion for the reactive avatar. */
|
|
1582
|
+
emotion: AiBotEmotion;
|
|
1583
|
+
/** The active procedural micro-motion for the reactive avatar. */
|
|
1584
|
+
motion: AiBotMotion | undefined;
|
|
1585
|
+
/** Numeric motion trigger key to re-trigger one-shot animations. */
|
|
1586
|
+
motionKey: number;
|
|
1587
|
+
/** Detected visitor sentiment profile. */
|
|
1588
|
+
sentiment: VisitorSentiment;
|
|
1589
|
+
/** Sentiment confidence score between -1.0 (deeply frustrated) to +1.0 (ecstatic). */
|
|
1590
|
+
sentimentScore: number;
|
|
1591
|
+
/** Human-readable explanation of why the avatar assumed this emotional state. */
|
|
1592
|
+
empathyReason: string;
|
|
1593
|
+
/** Trigger a manual celebration pulse (e.g. on successful checkout or issue resolved). */
|
|
1594
|
+
triggerCelebration: () => void;
|
|
1595
|
+
/** Trigger a sympathetic listening pulse (e.g. on operator escalation). */
|
|
1596
|
+
triggerSympathy: () => void;
|
|
1597
|
+
/** Reset avatar back to calm neutral baseline. */
|
|
1598
|
+
resetToNeutral: () => void;
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Rapid client-side lexical sentiment analyzer.
|
|
1602
|
+
* Returns sentiment class, polarity score (-1 to 1), and primary trigger word.
|
|
1603
|
+
*/
|
|
1604
|
+
declare function analyzeVisitorSentiment(text: string): {
|
|
1605
|
+
sentiment: VisitorSentiment;
|
|
1606
|
+
score: number;
|
|
1607
|
+
triggerWord?: string;
|
|
1608
|
+
};
|
|
1609
|
+
/**
|
|
1610
|
+
* Official Botzki "Visual Empathy Engine" Hook.
|
|
1611
|
+
* Synchronizes procedural SVG/Canvas avatar expressions, eye contact, and physics
|
|
1612
|
+
* with real-time visitor sentiment, conversation milestones, and support states.
|
|
1613
|
+
*/
|
|
1614
|
+
declare function useEmpathyEngine({ messages, isLoading, isStreaming, isWaitingForHuman, isHumanHandoffActive, feedbackRating, manualEmotion, manualMotion, enabled, reactionCooldownMs, }?: EmpathyEngineOptions): EmpathyEngineReturn;
|
|
1615
|
+
|
|
1616
|
+
interface UseCoBrowseOptions {
|
|
1617
|
+
botId: string;
|
|
1618
|
+
baseUrl?: string;
|
|
1619
|
+
sessionId: string;
|
|
1620
|
+
isHumanHandoffActive?: boolean;
|
|
1621
|
+
}
|
|
1622
|
+
declare function useCoBrowse({ botId, baseUrl, sessionId, isHumanHandoffActive, }: UseCoBrowseOptions): CoBrowseState;
|
|
1623
|
+
|
|
1624
|
+
/**
|
|
1625
|
+
* Ghost Co-Browsing DOM Snapshot Serializer
|
|
1626
|
+
* Zero-install, client-side, ephemeral DOM serialization with strict PII masking.
|
|
1627
|
+
*/
|
|
1628
|
+
|
|
1629
|
+
interface SnapshotOptions {
|
|
1630
|
+
maskInputs?: boolean;
|
|
1631
|
+
maxHtmlBytes?: number;
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Creates a sanitized, PII-masked DOM snapshot of the current document.
|
|
1635
|
+
*/
|
|
1636
|
+
declare function captureDomSnapshot(options?: SnapshotOptions): CoBrowseSnapshot;
|
|
1637
|
+
|
|
1638
|
+
/**
|
|
1639
|
+
* Official Web Audio API chime & tab-title alert utility for @botzki/react.
|
|
1640
|
+
* Provides soft synthesized chimes and tab title flashing when incoming
|
|
1641
|
+
* messages arrive while the visitor is viewing another browser tab.
|
|
1642
|
+
*/
|
|
1643
|
+
/**
|
|
1644
|
+
* Synthesizes a soft, pleasant notification chime using the native Web Audio API.
|
|
1645
|
+
* Two smooth sine waves (D5 587.33Hz -> A5 880Hz) with gentle exponential decay.
|
|
1646
|
+
* Zero external audio files, zero network bandwidth, zero CORS issues.
|
|
1647
|
+
*/
|
|
1648
|
+
declare function playVisitorNotificationChime(): void;
|
|
1649
|
+
/**
|
|
1650
|
+
* Flashes the browser tab title when an incoming message arrives while the tab is hidden.
|
|
1651
|
+
* Restores original document title as soon as the visitor focuses or returns to the page.
|
|
1652
|
+
*/
|
|
1653
|
+
declare function startTabTitleAlert(alertTitle?: string): void;
|
|
1654
|
+
/**
|
|
1655
|
+
* Triggers audio chime and tab-title alert if document is currently hidden.
|
|
1656
|
+
*/
|
|
1657
|
+
declare function notifyVisitorIncomingMessage(alertTitle?: string, options?: {
|
|
1658
|
+
enableSound?: boolean;
|
|
1659
|
+
enableTabTitle?: boolean;
|
|
1660
|
+
}): void;
|
|
1661
|
+
|
|
1662
|
+
export { type AiBotActivity, AiBotAvatar, type AiBotEmotion, type AiBotMotion, type AiBotShape, type BotInfoData, BotziAvatar, type BotziAvatarProps, BotzkiAudioPlayer, type BotzkiAudioPlayerProps, type BotzkiAvatarOptions, BotzkiChat, type BotzkiChatProps, type BotzkiChatSession, type BotzkiComposerRenderProps, type BotzkiContextValue, type BotzkiHeaderProps, type BotzkiLauncherOptions, type BotzkiLauncherRenderProps, BotzkiMarkdown, type BotzkiMarkdownProps, type BotzkiMessage, type BotzkiMessageRenderProps, BotzkiProvider, type BotzkiProviderProps, BotzkiWidget, type BotzkiWidgetProps, type BotzkiWidgetRef, CoBrowseLaserPointer, type CoBrowseLaserPointerProps, type CoBrowsePointer, type CoBrowseScroll, type CoBrowseSnapshot, type CoBrowseState, type EmpathyEngineOptions, type EmpathyEngineReturn, type FeedbackPayload, type LeadCapturePayload, type ProactiveTriggerInfo, type ProposedBotAction, type SendMessageOptions, type SnapshotOptions, type UseBotInfoReturn, type UseChatOptions, type UseChatReturn, type UseCoBrowseOptions, type UseFeedbackReturn, type UseLeadCaptureReturn, type UseVoiceTranscriptionReturn, type VisitorSentiment, analyzeVisitorSentiment, captureDomSnapshot, notifyVisitorIncomingMessage, playVisitorNotificationChime, startTabTitleAlert, useBotInfo, useBotzki, useChat, useCoBrowse, useEmpathyEngine, useFeedback, useLeadCapture, useOptionalBotzki, useVoiceTranscription };
|