@vanira/sdk 0.0.31 → 0.0.33
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/api/services/ChatService.d.ts +2 -2
- package/dist/core/VaniraAI.d.ts +16 -0
- package/dist/core/WebRTCClient.d.ts +12 -0
- package/dist/vanira-sdk.es.js +22 -22
- package/dist/vanira-sdk.js +25 -25
- package/dist/vanira-sdk.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,10 +9,10 @@ export interface ChatMessage {
|
|
|
9
9
|
export declare class ChatService {
|
|
10
10
|
static setChatUrl(url: string): void;
|
|
11
11
|
static createChatProspect(prospectGroupId: string): Promise<string>;
|
|
12
|
-
static fetchWelcomeMessage(agentId: string, prospectId: string, widgetId?: string,
|
|
12
|
+
static fetchWelcomeMessage(agentId: string, prospectId: string, widgetId?: string, _pkKey?: string): Promise<ChatMessage & {
|
|
13
13
|
chatId?: string;
|
|
14
14
|
}>;
|
|
15
|
-
static sendChatMessage(agentId: string, prospectId: string, message: string, chatId: string | null, onChunk: (text: string) => void, onWidget: (widget: any) => void, onDone: (newChatId: string | null) => void, widgetId?: string,
|
|
15
|
+
static sendChatMessage(agentId: string, prospectId: string, message: string, chatId: string | null, onChunk: (text: string) => void, onWidget: (widget: any) => void, onDone: (newChatId: string | null) => void, widgetId?: string, _pkKey?: string): Promise<void>;
|
|
16
16
|
static listenForAdminReplies(inboxId: string, sender: string, onMessage: (content: string) => void): {
|
|
17
17
|
close: () => void;
|
|
18
18
|
};
|
package/dist/core/VaniraAI.d.ts
CHANGED
|
@@ -134,6 +134,22 @@ export declare class VaniraAI {
|
|
|
134
134
|
* client.triggerInterrupt('user_opened_checkout', { cart_value: 299 });
|
|
135
135
|
*/
|
|
136
136
|
triggerInterrupt(actionName: string, data?: Record<string, any>): void;
|
|
137
|
+
/**
|
|
138
|
+
* Upload a file (photo, document, screenshot) to the AI agent during a live call.
|
|
139
|
+
* Handles the HTTP upload and DataChannel notification automatically.
|
|
140
|
+
*
|
|
141
|
+
* @param file - File or Blob to upload (JPEG, PNG, GIF, WebP, PDF — max 50 MB)
|
|
142
|
+
* @param reason - Routing key: 'general' | 'kyc_photo' | 'damage_photo' | 'selfie' | 'document' | 'screenshot'
|
|
143
|
+
* @param message - Optional text the user wants to say about the file
|
|
144
|
+
* @returns `{ media_id, url }` on success
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* const { media_id, url } = await client.uploadMedia(file, 'damage_photo', 'Photo of the damage');
|
|
148
|
+
*/
|
|
149
|
+
uploadMedia(file: File | Blob, reason?: string, message?: string): Promise<{
|
|
150
|
+
media_id: string;
|
|
151
|
+
url: string;
|
|
152
|
+
}>;
|
|
137
153
|
private _setStatus;
|
|
138
154
|
private _inferServerUrl;
|
|
139
155
|
private _assertConnected;
|
|
@@ -74,6 +74,18 @@ export declare class WebRTCClient {
|
|
|
74
74
|
* Trigger a client-side interrupt — cuts AI audio and forces it to react to a UI event.
|
|
75
75
|
*/
|
|
76
76
|
triggerActionInterrupt(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Uploads a file (photo, document, screenshot) to the media server
|
|
79
|
+
* and notifies the AI agent via the WebRTC control DataChannel.
|
|
80
|
+
*
|
|
81
|
+
* @param file The file to upload (image, PDF, document)
|
|
82
|
+
* @param reason Routing key for backend processing (default: 'general')
|
|
83
|
+
* @param message Optional user text message about the file
|
|
84
|
+
*/
|
|
85
|
+
uploadMedia(file: File | Blob, reason?: string, message?: string): Promise<{
|
|
86
|
+
media_id: string;
|
|
87
|
+
url: string;
|
|
88
|
+
}>;
|
|
77
89
|
/**
|
|
78
90
|
* Fetch active STUN/TURN ICE servers from the Vanira API.
|
|
79
91
|
* @param apiKey Your sk_live_* or pk_live_* key
|