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