@vanira/sdk 0.0.86 → 0.0.88
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/headless/index.cjs +321 -103
- package/dist/headless/index.js +15140 -13888
- package/dist/index.d.ts +71 -1
- package/dist/platforms/browser.cjs +24 -8
- package/dist/platforms/browser.js +2138 -2011
- package/dist/platforms/react-native.cjs +17 -1
- package/dist/platforms/react-native.js +416 -289
- package/dist/vanira-sdk.es.js +9781 -8390
- package/dist/vanira-sdk.js +328 -110
- package/dist/vanira-sdk.umd.js +326 -97
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ export interface VaniraClientConfig {
|
|
|
18
18
|
callId?: string;
|
|
19
19
|
iceServers?: RTCIceServer[];
|
|
20
20
|
prospectId?: string;
|
|
21
|
+
prospectName?: string;
|
|
22
|
+
welcomeMessage?: string;
|
|
23
|
+
extraDetails?: Record<string, unknown>;
|
|
21
24
|
sessionBehavior?: 'continue' | 'new';
|
|
22
25
|
runtime?: unknown;
|
|
23
26
|
liveVision?: Record<string, unknown>;
|
|
@@ -44,6 +47,12 @@ export interface ClientToolCall {
|
|
|
44
47
|
export interface TranscriptionEvent {
|
|
45
48
|
text: string;
|
|
46
49
|
isFinal: boolean;
|
|
50
|
+
role?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ClientToolResultEvent {
|
|
54
|
+
toolCallId: string;
|
|
55
|
+
result: unknown;
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
export class VaniraClient {
|
|
@@ -57,11 +66,26 @@ export class VaniraClient {
|
|
|
57
66
|
on(event: 'disconnected', callback: () => void): this;
|
|
58
67
|
on(event: 'error', callback: (message: string) => void): this;
|
|
59
68
|
on(event: 'transcription', callback: (payload: TranscriptionEvent) => void): this;
|
|
69
|
+
on(
|
|
70
|
+
event: 'session_started',
|
|
71
|
+
callback: (payload: {prospectId: string; callId: string; serverUrl: string}) => void,
|
|
72
|
+
): this;
|
|
60
73
|
on(
|
|
61
74
|
event: 'preset',
|
|
62
75
|
callback: (payload: {toolCall: unknown; client: unknown}) => void,
|
|
63
76
|
): this;
|
|
64
77
|
on(event: 'tool_call', callback: (payload: ClientToolCall) => void): this;
|
|
78
|
+
on(event: 'tool_result', callback: (payload: ClientToolResultEvent) => void): this;
|
|
79
|
+
off(event: 'connected', callback: () => void): this;
|
|
80
|
+
off(event: 'disconnected', callback: () => void): this;
|
|
81
|
+
off(event: 'error', callback: (message: string) => void): this;
|
|
82
|
+
off(event: 'transcription', callback: (payload: TranscriptionEvent) => void): this;
|
|
83
|
+
off(
|
|
84
|
+
event: 'session_started',
|
|
85
|
+
callback: (payload: {prospectId: string; callId: string; serverUrl: string}) => void,
|
|
86
|
+
): this;
|
|
87
|
+
off(event: 'tool_call', callback: (payload: ClientToolCall) => void): this;
|
|
88
|
+
off(event: 'tool_result', callback: (payload: ClientToolResultEvent) => void): this;
|
|
65
89
|
off(event: string, callback: (...args: unknown[]) => void): this;
|
|
66
90
|
start(): Promise<{callId: string; prospectId: string; serverUrl: string}>;
|
|
67
91
|
stop(): void;
|
|
@@ -176,7 +200,53 @@ export class VaniraWidget {
|
|
|
176
200
|
export type VaniraCallBoxStatus = VaniraClientStatus;
|
|
177
201
|
export type VaniraCustomToolCall = ClientToolCall;
|
|
178
202
|
|
|
179
|
-
export
|
|
203
|
+
export interface VaniraCallBoxRenderProps {
|
|
204
|
+
status: VaniraCallBoxStatus;
|
|
205
|
+
startCall: () => Promise<void>;
|
|
206
|
+
endCall: () => void;
|
|
207
|
+
client: VaniraClient | null;
|
|
208
|
+
error: string | null;
|
|
209
|
+
voiceActivity: 'idle' | 'listening' | 'speaking';
|
|
210
|
+
isSpeaking: boolean;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface VaniraCallBoxProps {
|
|
214
|
+
agentId: string;
|
|
215
|
+
apiKey?: string;
|
|
216
|
+
token?: string;
|
|
217
|
+
prospectId?: string;
|
|
218
|
+
backendUrl?: string;
|
|
219
|
+
sessionBehavior?: 'continue' | 'new';
|
|
220
|
+
callId?: string;
|
|
221
|
+
serverUrl?: string;
|
|
222
|
+
prospectName?: string;
|
|
223
|
+
welcomeMessage?: string;
|
|
224
|
+
extraDetails?: Record<string, unknown>;
|
|
225
|
+
iceServers?: RTCIceServer[];
|
|
226
|
+
autoStart?: boolean;
|
|
227
|
+
sessionKey?: string | number;
|
|
228
|
+
onClose?: () => void;
|
|
229
|
+
onMinimize?: () => void;
|
|
230
|
+
onNavigate?: (path: string) => void;
|
|
231
|
+
onCustomTool?: (call: VaniraCustomToolCall, client: VaniraClient, raw: unknown) => void;
|
|
232
|
+
onConnected?: () => void;
|
|
233
|
+
onDisconnected?: () => void;
|
|
234
|
+
onError?: (error: unknown) => void;
|
|
235
|
+
onTranscription?: (text: string, isFinal: boolean) => void;
|
|
236
|
+
onRemoteTrack?: (track: MediaStreamTrack, stream: MediaStream) => void;
|
|
237
|
+
onClientChange?: (client: VaniraClient | null) => void;
|
|
238
|
+
children?: (props: VaniraCallBoxRenderProps) => React.ReactNode;
|
|
239
|
+
label?: string;
|
|
240
|
+
endLabel?: string;
|
|
241
|
+
title?: string;
|
|
242
|
+
primaryColor?: string;
|
|
243
|
+
secondaryColor?: string;
|
|
244
|
+
avatarUrl?: string;
|
|
245
|
+
showPortrait?: boolean;
|
|
246
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
247
|
+
className?: string;
|
|
248
|
+
style?: React.CSSProperties;
|
|
249
|
+
}
|
|
180
250
|
export function VaniraCallBox(props: VaniraCallBoxProps): React.JSX.Element;
|
|
181
251
|
export function VaniraCallBoxChrome(props: Record<string, unknown>): React.JSX.Element;
|
|
182
252
|
|