@vanira/sdk 0.0.91 → 0.0.93
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 +116 -83
- package/dist/headless/index.js +6278 -6007
- package/dist/platforms/browser.cjs +30 -28
- package/dist/platforms/browser.js +2040 -1955
- package/dist/platforms/react-native.cjs +4 -2
- package/dist/platforms/react-native.js +399 -314
- package/dist/vanira-sdk.es.js +7926 -7655
- package/dist/vanira-sdk.js +142 -109
- package/dist/vanira-sdk.umd.js +150 -117
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (
|
|
4
|
-
class
|
|
1
|
+
var Z = Object.defineProperty;
|
|
2
|
+
var F = (i, e, t) => e in i ? Z(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var d = (i, e, t) => F(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
class ee {
|
|
5
5
|
pause() {
|
|
6
6
|
}
|
|
7
7
|
cleanup() {
|
|
@@ -9,12 +9,12 @@ class Z {
|
|
|
9
9
|
onEnded(e) {
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class te {
|
|
13
13
|
createRemotePlayer(e) {
|
|
14
|
-
return new
|
|
14
|
+
return new ee();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
class
|
|
17
|
+
class ne {
|
|
18
18
|
async getUserAudio(e) {
|
|
19
19
|
return navigator.mediaDevices.getUserMedia({
|
|
20
20
|
audio: e
|
|
@@ -24,7 +24,7 @@ class F {
|
|
|
24
24
|
e.getTracks().forEach((t) => t.stop());
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
class
|
|
27
|
+
class ie {
|
|
28
28
|
create(e) {
|
|
29
29
|
return new globalThis.RTCPeerConnection({
|
|
30
30
|
iceServers: e.iceServers,
|
|
@@ -32,24 +32,24 @@ class ee {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
class
|
|
35
|
+
class ae {
|
|
36
36
|
bind(e, t) {
|
|
37
|
-
return e.onopen = () => t.onOpen(), e.onerror = (
|
|
38
|
-
if (typeof
|
|
39
|
-
t.onMessage({ text:
|
|
37
|
+
return e.onopen = () => t.onOpen(), e.onerror = (n) => t.onError(n), e.onmessage = (n) => {
|
|
38
|
+
if (typeof n.data == "string") {
|
|
39
|
+
t.onMessage({ text: n.data });
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
42
|
+
if (n.data instanceof ArrayBuffer) {
|
|
43
43
|
try {
|
|
44
|
-
const
|
|
45
|
-
(r == null ? void 0 : r.event) === "client_tool_call" && t.onMessage({ text:
|
|
44
|
+
const a = new TextDecoder().decode(n.data), r = JSON.parse(a);
|
|
45
|
+
(r == null ? void 0 : r.event) === "client_tool_call" && t.onMessage({ text: a });
|
|
46
46
|
} catch {
|
|
47
47
|
}
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
}, {
|
|
51
|
-
send(
|
|
52
|
-
e.readyState === "open" && e.send(
|
|
51
|
+
send(n) {
|
|
52
|
+
e.readyState === "open" && e.send(n);
|
|
53
53
|
},
|
|
54
54
|
isOpen() {
|
|
55
55
|
return e.readyState === "open";
|
|
@@ -60,8 +60,83 @@ class te {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const re = "https://api.vanira.io", se = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
64
|
+
function I(i) {
|
|
65
|
+
return se[i] ?? String(i + 1);
|
|
66
|
+
}
|
|
67
|
+
function z(i) {
|
|
68
|
+
const e = i.trim();
|
|
69
|
+
return e.startsWith("'") && e.endsWith("'") && e.length >= 2 || e.startsWith('"') && e.endsWith('"') && e.length >= 2 ? e.slice(1, -1).replace(/\\'/g, "'").replace(/\\"/g, '"') : e;
|
|
70
|
+
}
|
|
71
|
+
function oe(i) {
|
|
72
|
+
const e = i.trim();
|
|
73
|
+
if (!e) return;
|
|
74
|
+
try {
|
|
75
|
+
return JSON.parse(e);
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
if (!(e.startsWith("[") && e.endsWith("]"))) return;
|
|
79
|
+
const t = e.slice(1, -1).trim();
|
|
80
|
+
if (!t) return [];
|
|
81
|
+
const n = [...t.matchAll(/'((?:\\'|[^'])*)'|"((?:\\"|[^"])*)"/g)].map((a) => (a[1] ?? a[2] ?? "").replace(/\\'/g, "'").replace(/\\"/g, '"'));
|
|
82
|
+
return n.length > 0 ? n : t.split(",").map((a) => z(a)).filter(Boolean);
|
|
83
|
+
}
|
|
84
|
+
function ce(i) {
|
|
85
|
+
const e = i.trim();
|
|
86
|
+
return e.startsWith("[") && e.endsWith("]") && (e.includes("'") || e.includes('"') || e.includes(","));
|
|
87
|
+
}
|
|
88
|
+
function v(i) {
|
|
89
|
+
if (i == null) return [];
|
|
90
|
+
if (typeof i == "string") {
|
|
91
|
+
const e = i.trim();
|
|
92
|
+
if (!e) return [];
|
|
93
|
+
const t = oe(e);
|
|
94
|
+
if (t !== void 0) return v(t);
|
|
95
|
+
const n = e.includes("|") ? "|" : e.includes(`
|
|
96
|
+
`) ? `
|
|
97
|
+
` : ",";
|
|
98
|
+
return e.split(n).map((a) => z(a)).filter(Boolean).map((a, r) => ({ id: I(r), label: a }));
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(i)) {
|
|
101
|
+
const e = [], t = (n, a) => {
|
|
102
|
+
const r = n.trim();
|
|
103
|
+
r && e.push({ id: a && a.trim() || I(e.length), label: r });
|
|
104
|
+
};
|
|
105
|
+
return i.forEach((n) => {
|
|
106
|
+
if (typeof n == "string") {
|
|
107
|
+
const a = n.trim();
|
|
108
|
+
if (ce(a)) {
|
|
109
|
+
v(a).forEach((r) => t(r.label));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
t(a);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (Array.isArray(n)) {
|
|
116
|
+
v(n).forEach((a) => t(a.label));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (n && typeof n == "object") {
|
|
120
|
+
const a = n, r = String(a.label ?? a.text ?? a.name ?? "").trim() || String(a.value ?? "").trim();
|
|
121
|
+
if (!r) return;
|
|
122
|
+
const c = String(a.id ?? a.value ?? I(e.length)).trim() || I(e.length);
|
|
123
|
+
t(r, c);
|
|
124
|
+
}
|
|
125
|
+
}), e;
|
|
126
|
+
}
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
function le(i, e) {
|
|
130
|
+
const t = v(i == null ? void 0 : i.options);
|
|
131
|
+
return t.length > 0 ? t : v(e == null ? void 0 : e.options);
|
|
132
|
+
}
|
|
133
|
+
function de(i, e) {
|
|
134
|
+
const t = typeof (i == null ? void 0 : i.question) == "string" ? i.question.trim() : "";
|
|
135
|
+
return t || (typeof (e == null ? void 0 : e.question) == "string" ? e.question.trim() : "");
|
|
136
|
+
}
|
|
137
|
+
const s = {
|
|
64
138
|
Form: "vanira_form",
|
|
139
|
+
Mcq: "vanira_mcq",
|
|
65
140
|
Calendar: "vanira_calendar",
|
|
66
141
|
Navigate: "vanira_navigate",
|
|
67
142
|
Upload: "vanira_upload",
|
|
@@ -87,33 +162,34 @@ const ie = "https://api.vanira.io", s = {
|
|
|
87
162
|
KycDocumentCapture: "vanira_kyc_document_capture",
|
|
88
163
|
KycSelfieCapture: "vanira_kyc_selfie_capture",
|
|
89
164
|
KycSignatureCapture: "vanira_kyc_signature_capture"
|
|
90
|
-
},
|
|
165
|
+
}, he = Object.values(s), ue = new Set(he), pe = /* @__PURE__ */ new Set([
|
|
91
166
|
s.KycDocumentCapture,
|
|
92
167
|
s.KycSelfieCapture,
|
|
93
168
|
s.KycSignatureCapture
|
|
94
169
|
]);
|
|
95
170
|
[
|
|
96
|
-
...
|
|
171
|
+
...pe,
|
|
97
172
|
s.Form,
|
|
173
|
+
s.Mcq,
|
|
98
174
|
s.Upload,
|
|
99
175
|
s.Camera,
|
|
100
176
|
s.ClipRegion,
|
|
101
177
|
s.ScreenVision,
|
|
102
178
|
s.Navigate
|
|
103
179
|
];
|
|
104
|
-
function
|
|
105
|
-
return !!
|
|
180
|
+
function W(i) {
|
|
181
|
+
return !!i && ue.has(i);
|
|
106
182
|
}
|
|
107
|
-
function
|
|
108
|
-
if (typeof
|
|
183
|
+
function Y(i) {
|
|
184
|
+
if (typeof i == "string")
|
|
109
185
|
try {
|
|
110
|
-
return JSON.parse(
|
|
186
|
+
return JSON.parse(i);
|
|
111
187
|
} catch {
|
|
112
188
|
return {};
|
|
113
189
|
}
|
|
114
|
-
return
|
|
190
|
+
return i && typeof i == "object" ? i : {};
|
|
115
191
|
}
|
|
116
|
-
const
|
|
192
|
+
const j = {
|
|
117
193
|
type_on_whiteboard: s.TypeText,
|
|
118
194
|
write_on_whiteboard: s.TypeText,
|
|
119
195
|
write_on_white_board: s.TypeText,
|
|
@@ -158,85 +234,94 @@ const $ = {
|
|
|
158
234
|
capture_kyc_selfie: s.KycSelfieCapture,
|
|
159
235
|
kyc_signature_capture: s.KycSignatureCapture,
|
|
160
236
|
capture_kyc_signature: s.KycSignatureCapture,
|
|
161
|
-
signature_capture: s.KycSignatureCapture
|
|
162
|
-
|
|
237
|
+
signature_capture: s.KycSignatureCapture,
|
|
238
|
+
ask_multiple_choice: s.Mcq,
|
|
239
|
+
show_mcq: s.Mcq,
|
|
240
|
+
present_mcq: s.Mcq,
|
|
241
|
+
mcq_question: s.Mcq
|
|
242
|
+
}, q = {
|
|
163
243
|
vanira_tab_screenshot: s.ScreenVision,
|
|
164
244
|
vanira_document_capture: s.KycDocumentCapture,
|
|
165
245
|
vanira_selfie_capture: s.KycSelfieCapture,
|
|
166
246
|
vanira_signature_capture: s.KycSignatureCapture,
|
|
167
247
|
vanira_kyc_signature: s.KycSignatureCapture
|
|
168
248
|
};
|
|
169
|
-
function
|
|
170
|
-
const t =
|
|
171
|
-
return Array.isArray(t) ? t.some((
|
|
249
|
+
function me(i, e) {
|
|
250
|
+
const t = i.commands ?? (e == null ? void 0 : e.commands) ?? i.construction ?? (e == null ? void 0 : e.construction) ?? i.geogebra_commands ?? (e == null ? void 0 : e.geogebra_commands) ?? i.script ?? (e == null ? void 0 : e.script);
|
|
251
|
+
return Array.isArray(t) ? t.some((n) => String(n).trim().length > 0) : typeof t == "string" && t.trim().length > 0;
|
|
172
252
|
}
|
|
173
|
-
function
|
|
174
|
-
const t =
|
|
253
|
+
function fe(i, e) {
|
|
254
|
+
const t = i.material_id ?? (e == null ? void 0 : e.material_id) ?? i.materialId ?? (e == null ? void 0 : e.materialId);
|
|
175
255
|
return typeof t == "string" && t.trim().length > 0;
|
|
176
256
|
}
|
|
177
|
-
function
|
|
178
|
-
const t =
|
|
257
|
+
function _e(i, e) {
|
|
258
|
+
const t = i.latex_text ?? (e == null ? void 0 : e.latex_text);
|
|
179
259
|
return typeof t == "string" && t.trim().length > 0;
|
|
180
260
|
}
|
|
181
|
-
function G(
|
|
182
|
-
const t =
|
|
261
|
+
function G(i, e) {
|
|
262
|
+
const t = i.text_to_type ?? (e == null ? void 0 : e.text_to_type) ?? i.text ?? (e == null ? void 0 : e.text) ?? i.value ?? (e == null ? void 0 : e.value);
|
|
183
263
|
return typeof t == "string" && t.trim().length > 0;
|
|
184
264
|
}
|
|
185
|
-
function
|
|
186
|
-
const t =
|
|
187
|
-
return Array.isArray(t) ? t.length > 0 : typeof t == "string" ? t.split(",").map((
|
|
265
|
+
function ye(i, e) {
|
|
266
|
+
const t = i.fields ?? (e == null ? void 0 : e.fields);
|
|
267
|
+
return Array.isArray(t) ? t.length > 0 : typeof t == "string" ? t.split(",").map((n) => n.trim()).filter(Boolean).length > 0 : !1;
|
|
268
|
+
}
|
|
269
|
+
function Se(i, e) {
|
|
270
|
+
return de(i, e).length > 0 && le(i, e).length > 0;
|
|
188
271
|
}
|
|
189
|
-
function
|
|
190
|
-
const t =
|
|
272
|
+
function ge(i, e) {
|
|
273
|
+
const t = i == null ? void 0 : i.preset_id;
|
|
191
274
|
if (typeof t == "string") {
|
|
192
|
-
if (
|
|
193
|
-
const r =
|
|
275
|
+
if (W(t)) return t;
|
|
276
|
+
const r = q[t];
|
|
194
277
|
if (r) return r;
|
|
195
278
|
}
|
|
196
|
-
const
|
|
197
|
-
if (typeof
|
|
198
|
-
if (
|
|
199
|
-
const r =
|
|
279
|
+
const a = Y(e).preset_id;
|
|
280
|
+
if (typeof a == "string") {
|
|
281
|
+
if (W(a)) return a;
|
|
282
|
+
const r = q[a];
|
|
200
283
|
if (r) return r;
|
|
201
284
|
}
|
|
202
285
|
}
|
|
203
|
-
function
|
|
204
|
-
const
|
|
205
|
-
let
|
|
206
|
-
if (
|
|
286
|
+
function we(i, e, t) {
|
|
287
|
+
const n = Y(e);
|
|
288
|
+
let a = ge(i, n);
|
|
289
|
+
if (a === s.Form && G(n, i) && !ye(n, i))
|
|
207
290
|
return s.TypeText;
|
|
208
|
-
if (
|
|
291
|
+
if (a) return a;
|
|
209
292
|
const r = String(t ?? "").trim().toLowerCase();
|
|
210
|
-
if (r &&
|
|
211
|
-
return
|
|
212
|
-
if (
|
|
293
|
+
if (r && j[r])
|
|
294
|
+
return j[r];
|
|
295
|
+
if (me(n, i) || fe(n, i))
|
|
213
296
|
return s.GeoGebra;
|
|
214
|
-
if (
|
|
297
|
+
if (_e(n, i))
|
|
215
298
|
return s.WriteLatexText;
|
|
216
|
-
if (G(
|
|
299
|
+
if (G(n, i))
|
|
217
300
|
return s.TypeText;
|
|
301
|
+
if (Se(n, i))
|
|
302
|
+
return s.Mcq;
|
|
218
303
|
}
|
|
219
|
-
const
|
|
220
|
-
function
|
|
221
|
-
return `vanira_latest_call_id_${
|
|
304
|
+
const b = "vanira_latest_call_id", A = "vanira_prospect_id";
|
|
305
|
+
function E(i) {
|
|
306
|
+
return `vanira_latest_call_id_${i}`;
|
|
222
307
|
}
|
|
223
|
-
function
|
|
224
|
-
return `vanira_prospect_id_${
|
|
308
|
+
function x(i) {
|
|
309
|
+
return `vanira_prospect_id_${i}`;
|
|
225
310
|
}
|
|
226
|
-
function
|
|
227
|
-
return `vanira_call_meta_${
|
|
311
|
+
function Q(i) {
|
|
312
|
+
return `vanira_call_meta_${i}`;
|
|
228
313
|
}
|
|
229
|
-
function S(
|
|
230
|
-
if (!
|
|
314
|
+
function S(i, e) {
|
|
315
|
+
if (!i) return null;
|
|
231
316
|
try {
|
|
232
|
-
return
|
|
317
|
+
return i.getItem(e);
|
|
233
318
|
} catch {
|
|
234
319
|
return null;
|
|
235
320
|
}
|
|
236
321
|
}
|
|
237
|
-
function
|
|
238
|
-
if (typeof window > "u" || !
|
|
239
|
-
const e = [], t = S(window.localStorage,
|
|
322
|
+
function J(i) {
|
|
323
|
+
if (typeof window > "u" || !i) return null;
|
|
324
|
+
const e = [], t = S(window.localStorage, Q(i));
|
|
240
325
|
if (t)
|
|
241
326
|
try {
|
|
242
327
|
const h = JSON.parse(t);
|
|
@@ -247,136 +332,136 @@ function W(a) {
|
|
|
247
332
|
});
|
|
248
333
|
} catch {
|
|
249
334
|
}
|
|
250
|
-
const
|
|
335
|
+
const n = (h, m, o) => {
|
|
251
336
|
h && e.push({
|
|
252
337
|
callId: h,
|
|
253
|
-
prospectId:
|
|
338
|
+
prospectId: m || void 0,
|
|
254
339
|
updatedAt: o
|
|
255
340
|
});
|
|
256
|
-
},
|
|
257
|
-
return
|
|
258
|
-
S(window.localStorage,
|
|
259
|
-
|
|
341
|
+
}, a = S(window.localStorage, x(i)), r = S(window.sessionStorage, x(i)), c = S(window.localStorage, A);
|
|
342
|
+
return n(
|
|
343
|
+
S(window.localStorage, E(i)),
|
|
344
|
+
a || c,
|
|
260
345
|
2
|
|
261
|
-
),
|
|
262
|
-
S(window.sessionStorage,
|
|
346
|
+
), n(
|
|
347
|
+
S(window.sessionStorage, E(i)),
|
|
263
348
|
r || c,
|
|
264
349
|
1
|
|
265
|
-
),
|
|
350
|
+
), n(S(window.localStorage, b), c, 0), n(S(window.sessionStorage, b), c, 0), e.length ? (e.sort((h, m) => m.updatedAt - h.updatedAt), e[0]) : null;
|
|
266
351
|
}
|
|
267
|
-
function
|
|
268
|
-
var
|
|
269
|
-
if (typeof window > "u" || !
|
|
270
|
-
const
|
|
352
|
+
function ve(i, e, t) {
|
|
353
|
+
var a, r, c, h, m, o, u, l, p;
|
|
354
|
+
if (typeof window > "u" || !i || !e) return;
|
|
355
|
+
const n = {
|
|
271
356
|
callId: e,
|
|
272
357
|
prospectId: t,
|
|
273
358
|
updatedAt: Date.now()
|
|
274
359
|
};
|
|
275
360
|
try {
|
|
276
|
-
(
|
|
361
|
+
(a = window.localStorage) == null || a.setItem(Q(i), JSON.stringify(n)), (r = window.localStorage) == null || r.setItem(E(i), e), (c = window.sessionStorage) == null || c.setItem(E(i), e), t && ((h = window.localStorage) == null || h.setItem(x(i), t), (m = window.sessionStorage) == null || m.setItem(x(i), t)), (o = window.localStorage) == null || o.setItem(b, e), (u = window.sessionStorage) == null || u.setItem(b, e), t && ((l = window.localStorage) == null || l.setItem(A, t), (p = window.sessionStorage) == null || p.setItem(A, t));
|
|
277
362
|
} catch {
|
|
278
363
|
}
|
|
279
364
|
}
|
|
280
|
-
const
|
|
365
|
+
const Ce = /* @__PURE__ */ new Set([
|
|
281
366
|
"client_tool_call",
|
|
282
367
|
"clearAudio",
|
|
283
368
|
"client_tool_cancel"
|
|
284
369
|
]);
|
|
285
|
-
function
|
|
286
|
-
if (!
|
|
287
|
-
const e =
|
|
288
|
-
return typeof e == "string" &&
|
|
370
|
+
function Ie(i) {
|
|
371
|
+
if (!i || typeof i != "object") return !1;
|
|
372
|
+
const e = i.event;
|
|
373
|
+
return typeof e == "string" && Ce.has(e);
|
|
289
374
|
}
|
|
290
|
-
const
|
|
291
|
-
function
|
|
292
|
-
return (
|
|
375
|
+
const k = 16 * 1024, Te = 256 * 1024;
|
|
376
|
+
function R(i, e) {
|
|
377
|
+
return (i == null ? void 0 : i.readyState) === "open" && (e == null ? void 0 : e.readyState) === "open";
|
|
293
378
|
}
|
|
294
|
-
function
|
|
379
|
+
function be(i, e) {
|
|
295
380
|
return {
|
|
296
|
-
control: (
|
|
381
|
+
control: (i == null ? void 0 : i.readyState) ?? "missing",
|
|
297
382
|
mediaBytes: (e == null ? void 0 : e.readyState) ?? "missing"
|
|
298
383
|
};
|
|
299
384
|
}
|
|
300
|
-
async function
|
|
301
|
-
if (
|
|
385
|
+
async function Ee(i, e, t = 8e3) {
|
|
386
|
+
if (R(i, e))
|
|
302
387
|
return !0;
|
|
303
|
-
const
|
|
304
|
-
for (; Date.now() <
|
|
305
|
-
if (
|
|
388
|
+
const n = Date.now() + t;
|
|
389
|
+
for (; Date.now() < n; ) {
|
|
390
|
+
if (R(i, e))
|
|
306
391
|
return !0;
|
|
307
|
-
await new Promise((
|
|
392
|
+
await new Promise((a) => setTimeout(a, 50));
|
|
308
393
|
}
|
|
309
|
-
return
|
|
394
|
+
return R(i, e);
|
|
310
395
|
}
|
|
311
|
-
async function H(
|
|
312
|
-
for (;
|
|
396
|
+
async function H(i) {
|
|
397
|
+
for (; i.bufferedAmount > Te; )
|
|
313
398
|
await new Promise((e) => setTimeout(e, 10));
|
|
314
399
|
}
|
|
315
|
-
async function
|
|
400
|
+
async function xe(i) {
|
|
316
401
|
const {
|
|
317
402
|
bytes: e,
|
|
318
403
|
filename: t,
|
|
319
|
-
contentType:
|
|
320
|
-
reason:
|
|
404
|
+
contentType: n,
|
|
405
|
+
reason: a,
|
|
321
406
|
message: r,
|
|
322
407
|
callId: c,
|
|
323
408
|
mediaBytesChannel: h,
|
|
324
|
-
sendControlEvent:
|
|
409
|
+
sendControlEvent: m,
|
|
325
410
|
uploadId: o = crypto.randomUUID(),
|
|
326
411
|
uploadKind: u = "media"
|
|
327
|
-
} =
|
|
328
|
-
|
|
412
|
+
} = i, l = e.byteLength, p = l === 0 ? 0 : Math.ceil(l / k);
|
|
413
|
+
m("client_media_upload_start", {
|
|
329
414
|
data: {
|
|
330
415
|
upload_id: o,
|
|
331
416
|
call_id: c,
|
|
332
|
-
reason:
|
|
417
|
+
reason: a,
|
|
333
418
|
message: r,
|
|
334
419
|
filename: t,
|
|
335
|
-
content_type:
|
|
420
|
+
content_type: n,
|
|
336
421
|
size: l,
|
|
337
422
|
chunk_count: p,
|
|
338
423
|
upload_kind: u
|
|
339
424
|
}
|
|
340
425
|
});
|
|
341
|
-
const
|
|
342
|
-
for (let
|
|
426
|
+
const f = new Uint8Array(e);
|
|
427
|
+
for (let _ = 0; _ < l; _ += k) {
|
|
343
428
|
await H(h);
|
|
344
|
-
const
|
|
345
|
-
h.send(
|
|
429
|
+
const g = Math.min(_ + k, l);
|
|
430
|
+
h.send(f.subarray(_, g));
|
|
346
431
|
}
|
|
347
|
-
return await H(h),
|
|
432
|
+
return await H(h), m("client_media_upload_complete", {
|
|
348
433
|
data: {
|
|
349
434
|
upload_id: o,
|
|
350
435
|
call_id: c,
|
|
351
|
-
reason:
|
|
436
|
+
reason: a,
|
|
352
437
|
message: r,
|
|
353
438
|
chunk_count: p,
|
|
354
439
|
upload_kind: u
|
|
355
440
|
}
|
|
356
|
-
}), { media_id: o, url: "", content_type:
|
|
441
|
+
}), { media_id: o, url: "", content_type: n };
|
|
357
442
|
}
|
|
358
|
-
async function
|
|
359
|
-
return typeof
|
|
443
|
+
async function ke(i) {
|
|
444
|
+
return typeof i.arrayBuffer == "function" ? i.arrayBuffer() : new Response(i).arrayBuffer();
|
|
360
445
|
}
|
|
361
|
-
const
|
|
362
|
-
let
|
|
363
|
-
function
|
|
364
|
-
typeof window > "u" || (
|
|
365
|
-
|
|
366
|
-
},
|
|
446
|
+
const Re = 15e3, P = "vanira-connect-stall-prompt";
|
|
447
|
+
let C = null;
|
|
448
|
+
function Ae(i = Re) {
|
|
449
|
+
typeof window > "u" || (w(!1), C = setTimeout(() => {
|
|
450
|
+
C = null, Pe(), window.dispatchEvent(new CustomEvent("vanira:connect-stall"));
|
|
451
|
+
}, i));
|
|
367
452
|
}
|
|
368
|
-
function
|
|
369
|
-
|
|
453
|
+
function w(i = !0) {
|
|
454
|
+
C !== null && (clearTimeout(C), C = null), i && M();
|
|
370
455
|
}
|
|
371
|
-
function
|
|
372
|
-
var
|
|
373
|
-
typeof document > "u" || (
|
|
456
|
+
function M() {
|
|
457
|
+
var i;
|
|
458
|
+
typeof document > "u" || (i = document.getElementById(P)) == null || i.remove();
|
|
374
459
|
}
|
|
375
|
-
function
|
|
376
|
-
var t,
|
|
377
|
-
if (typeof document > "u" || document.getElementById(
|
|
378
|
-
const
|
|
379
|
-
|
|
460
|
+
function Pe() {
|
|
461
|
+
var t, n;
|
|
462
|
+
if (typeof document > "u" || document.getElementById(P)) return;
|
|
463
|
+
const i = document.createElement("div");
|
|
464
|
+
i.id = P, i.setAttribute("role", "alertdialog"), i.setAttribute("aria-modal", "true"), i.setAttribute("aria-labelledby", "vanira-stall-title"), i.style.cssText = [
|
|
380
465
|
"position:fixed",
|
|
381
466
|
"inset:0",
|
|
382
467
|
"z-index:2147483646",
|
|
@@ -412,17 +497,17 @@ function Ce() {
|
|
|
412
497
|
<p style="margin:12px 0 0;font-size:12px;color:#888">
|
|
413
498
|
Tip: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
|
|
414
499
|
</p>
|
|
415
|
-
`,
|
|
416
|
-
|
|
417
|
-
}), (
|
|
500
|
+
`, i.appendChild(e), document.body.appendChild(i), (t = e.querySelector("#vanira-stall-refresh")) == null || t.addEventListener("click", () => {
|
|
501
|
+
M(), window.location.reload();
|
|
502
|
+
}), (n = e.querySelector("#vanira-stall-dismiss")) == null || n.addEventListener("click", () => M());
|
|
418
503
|
}
|
|
419
|
-
function
|
|
504
|
+
function Me(i) {
|
|
420
505
|
return null;
|
|
421
506
|
}
|
|
422
|
-
function
|
|
507
|
+
function T() {
|
|
423
508
|
return typeof window > "u" ? "/" : `${window.location.pathname}${window.location.search}${window.location.hash}` || "/";
|
|
424
509
|
}
|
|
425
|
-
class
|
|
510
|
+
class Ue {
|
|
426
511
|
constructor(e) {
|
|
427
512
|
d(this, "active", !1);
|
|
428
513
|
d(this, "initialSent", !1);
|
|
@@ -437,7 +522,7 @@ class Ie {
|
|
|
437
522
|
this.sendContext = e.sendContext, this.isReady = e.isReady ?? (() => !0);
|
|
438
523
|
}
|
|
439
524
|
start() {
|
|
440
|
-
typeof window > "u" || this.active || (this.active = !0, this.initialSent = !1, this.lastRoute =
|
|
525
|
+
typeof window > "u" || this.active || (this.active = !0, this.initialSent = !1, this.lastRoute = T(), this.attachListeners(), this.scheduleInitialContextSend());
|
|
441
526
|
}
|
|
442
527
|
stop() {
|
|
443
528
|
if (!(!this.active && this.cleanupFns.length === 0)) {
|
|
@@ -469,11 +554,11 @@ class Ie {
|
|
|
469
554
|
attachListeners() {
|
|
470
555
|
const e = (r, c = 0) => {
|
|
471
556
|
const h = () => {
|
|
472
|
-
const
|
|
473
|
-
|
|
557
|
+
const m = T();
|
|
558
|
+
m !== this.lastRoute && this.handleRouteChange(m, r);
|
|
474
559
|
};
|
|
475
560
|
c > 0 ? window.setTimeout(h, c) : queueMicrotask(h);
|
|
476
|
-
}, t = () => e("popstate"),
|
|
561
|
+
}, t = () => e("popstate"), n = () => e("hashchange"), a = (r) => {
|
|
477
562
|
const c = r.detail;
|
|
478
563
|
if ((c == null ? void 0 : c.initiated_by) === "agent") {
|
|
479
564
|
e("vanira_navigate_agent", 120);
|
|
@@ -481,41 +566,41 @@ class Ie {
|
|
|
481
566
|
}
|
|
482
567
|
e("vanira_navigate", 120);
|
|
483
568
|
};
|
|
484
|
-
window.addEventListener("popstate", t), window.addEventListener("hashchange",
|
|
569
|
+
window.addEventListener("popstate", t), window.addEventListener("hashchange", n), window.addEventListener("vanira:navigate", a), this.cleanupFns.push(
|
|
485
570
|
() => window.removeEventListener("popstate", t),
|
|
486
|
-
() => window.removeEventListener("hashchange",
|
|
487
|
-
() => window.removeEventListener("vanira:navigate",
|
|
571
|
+
() => window.removeEventListener("hashchange", n),
|
|
572
|
+
() => window.removeEventListener("vanira:navigate", a)
|
|
488
573
|
), this.originalPushState = history.pushState.bind(history), this.originalReplaceState = history.replaceState.bind(history), history.pushState = (...r) => {
|
|
489
574
|
this.originalPushState(...r), e("pushState");
|
|
490
575
|
}, history.replaceState = (...r) => {
|
|
491
576
|
this.originalReplaceState(...r), e("replaceState");
|
|
492
577
|
}, this.routePollTimer = window.setInterval(() => {
|
|
493
578
|
if (!this.active) return;
|
|
494
|
-
const r =
|
|
579
|
+
const r = T();
|
|
495
580
|
r !== this.lastRoute && this.handleRouteChange(r, "location_poll");
|
|
496
581
|
}, 1e3);
|
|
497
582
|
}
|
|
498
583
|
handleRouteChange(e, t) {
|
|
499
584
|
if (!this.active) return;
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
585
|
+
const n = this.lastRoute;
|
|
586
|
+
if (n === e) return;
|
|
502
587
|
if (this.lastRoute = e, !this.initialSent) {
|
|
503
588
|
this.scheduleInitialContextSend();
|
|
504
589
|
return;
|
|
505
590
|
}
|
|
506
|
-
!this.isReady() ||
|
|
591
|
+
!this.isReady() || Me() || this.sendRouteContext("route_changed", n, t, "user");
|
|
507
592
|
}
|
|
508
|
-
sendRouteContext(e, t,
|
|
509
|
-
const r =
|
|
593
|
+
sendRouteContext(e, t, n, a = "user") {
|
|
594
|
+
const r = T();
|
|
510
595
|
this.lastRoute = r;
|
|
511
596
|
const c = {
|
|
512
597
|
ui_state: "page_navigation",
|
|
513
|
-
navigation_led_by:
|
|
598
|
+
navigation_led_by: a,
|
|
514
599
|
current_route: r,
|
|
515
600
|
current_page: r,
|
|
516
601
|
user_action: e === "call_started" ? "call_started_on_page" : "user_navigated"
|
|
517
602
|
};
|
|
518
|
-
e === "call_started" ? c.message = `User started the call while viewing ${r}.` : (c.previous_route = t ?? "", c.message = `User navigated from ${t || "(unknown)"} to ${r}.`,
|
|
603
|
+
e === "call_started" ? c.message = `User started the call while viewing ${r}.` : (c.previous_route = t ?? "", c.message = `User navigated from ${t || "(unknown)"} to ${r}.`, n && (c.navigation_source = n));
|
|
519
604
|
try {
|
|
520
605
|
this.sendContext(c);
|
|
521
606
|
} catch {
|
|
@@ -567,26 +652,26 @@ const y = class y {
|
|
|
567
652
|
d(this, "liveVision");
|
|
568
653
|
d(this, "liveVisionAutoStarted", !1);
|
|
569
654
|
d(this, "connectStallTimeoutMs");
|
|
570
|
-
var
|
|
655
|
+
var m;
|
|
571
656
|
if (!e.agentId) throw new Error("agentId is required");
|
|
572
|
-
const t = !!(e.apiKey || e.token),
|
|
657
|
+
const t = !!(e.apiKey || e.token), n = !!(e.serverUrl && e.callId), a = y.normalizeIceServers(
|
|
573
658
|
e.iceServers
|
|
574
659
|
);
|
|
575
|
-
if (!t && !
|
|
660
|
+
if (!t && !n)
|
|
576
661
|
throw new Error(
|
|
577
662
|
"apiKey or token is required — or pass serverUrl and callId from a prior POST /calls/create"
|
|
578
663
|
);
|
|
579
|
-
this.agentId = e.agentId, this.sessionBehavior = e.sessionBehavior, this.serverUrl = (e.serverUrl || "").replace(/\/$/, ""), this.apiKey = e.apiKey, this.token = e.token, this.prospectName = e.prospectName, this.welcomeMessage = ((
|
|
664
|
+
this.agentId = e.agentId, this.sessionBehavior = e.sessionBehavior, this.serverUrl = (e.serverUrl || "").replace(/\/$/, ""), this.apiKey = e.apiKey, this.token = e.token, this.prospectName = e.prospectName, this.welcomeMessage = ((m = e.welcomeMessage) == null ? void 0 : m.trim()) || void 0, this.extraDetails = e.extraDetails, this.backendUrl = (e.backendUrl || re).replace(/\/$/, ""), a.length && (this.iceServers = a), n && (this.callSessionLoaded = !0);
|
|
580
665
|
const r = typeof window < "u";
|
|
581
666
|
this.prospectId = e.prospectId;
|
|
582
667
|
const c = e.sessionBehavior === "continue";
|
|
583
668
|
if (c && r && !e.callId) {
|
|
584
|
-
const o =
|
|
669
|
+
const o = J(this.agentId);
|
|
585
670
|
o && (e.callId || (this.callId = o.callId), !this.prospectId && o.prospectId && (this.prospectId = o.prospectId));
|
|
586
671
|
}
|
|
587
672
|
if (!this.prospectId && r)
|
|
588
673
|
try {
|
|
589
|
-
const o =
|
|
674
|
+
const o = J(this.agentId);
|
|
590
675
|
this.prospectId = (o == null ? void 0 : o.prospectId) || window.sessionStorage && window.sessionStorage.getItem("vanira_prospect_id") || window.localStorage && window.localStorage.getItem("vanira_prospect_id") || void 0;
|
|
591
676
|
} catch {
|
|
592
677
|
}
|
|
@@ -596,13 +681,13 @@ const y = class y {
|
|
|
596
681
|
h == null || h(o), this.emit("session_started", o);
|
|
597
682
|
}, this.liveVision = e.liveVision, this.connectStallTimeoutMs = e.connectStallTimeoutMs ?? 15e3, this.onConnected = () => {
|
|
598
683
|
var o;
|
|
599
|
-
|
|
684
|
+
w(), this._status = "connected", (o = e.onConnected) == null || o.call(e), this.emit("connected"), this.maybeAutoStartLiveCamera();
|
|
600
685
|
}, this.onDisconnected = () => {
|
|
601
686
|
var o;
|
|
602
|
-
|
|
687
|
+
w(), this._status = "disconnected", (o = e.onDisconnected) == null || o.call(e), this.emit("disconnected");
|
|
603
688
|
}, this.onError = (o) => {
|
|
604
689
|
var l;
|
|
605
|
-
|
|
690
|
+
w(), this._status = "error";
|
|
606
691
|
const u = typeof o == "string" ? o : (o == null ? void 0 : o.message) || "Connection error";
|
|
607
692
|
(l = e.onError) == null || l.call(e, o), this.emit("error", u);
|
|
608
693
|
}, this.onTranscription = (o, u, l) => {
|
|
@@ -623,7 +708,7 @@ const y = class y {
|
|
|
623
708
|
client_fields: u.client_fields || {}
|
|
624
709
|
};
|
|
625
710
|
l.name && l.tool_call_id && this.emit("tool_call", l);
|
|
626
|
-
}, this.runtime = e.runtime, typeof window < "u" && e.trackRouteContext !== !1 && (this.routeTracker = new
|
|
711
|
+
}, this.runtime = e.runtime, typeof window < "u" && e.trackRouteContext !== !1 && (this.routeTracker = new Ue({
|
|
627
712
|
sendContext: (o) => this.sendContextUpdate(o),
|
|
628
713
|
isReady: () => {
|
|
629
714
|
var o;
|
|
@@ -649,7 +734,7 @@ const y = class y {
|
|
|
649
734
|
*/
|
|
650
735
|
async connect() {
|
|
651
736
|
var t;
|
|
652
|
-
this._status = "connecting", this.connectStallTimeoutMs > 0 &&
|
|
737
|
+
this._status = "connecting", this.connectStallTimeoutMs > 0 && Ae(this.connectStallTimeoutMs);
|
|
653
738
|
const e = ++this.connectGeneration;
|
|
654
739
|
if (await this.loadCallSession(), !this.isConnectCancelled(e)) {
|
|
655
740
|
if (!this.serverUrl)
|
|
@@ -663,14 +748,14 @@ const y = class y {
|
|
|
663
748
|
}
|
|
664
749
|
try {
|
|
665
750
|
this.appliedRemoteCandidates.clear(), this.remoteDescSet = !1, this.pendingServerIce = [], this.icePollStop = !1, this.stopRemoteIcePolling();
|
|
666
|
-
const
|
|
751
|
+
const n = this.getIceServers();
|
|
667
752
|
this.pc = new RTCPeerConnection({
|
|
668
|
-
iceServers:
|
|
753
|
+
iceServers: n,
|
|
669
754
|
iceTransportPolicy: "all"
|
|
670
755
|
});
|
|
671
|
-
let
|
|
756
|
+
let a;
|
|
672
757
|
try {
|
|
673
|
-
|
|
758
|
+
a = await navigator.mediaDevices.getUserMedia({
|
|
674
759
|
audio: {
|
|
675
760
|
echoCancellation: !0,
|
|
676
761
|
noiseSuppression: !0,
|
|
@@ -681,25 +766,25 @@ const y = class y {
|
|
|
681
766
|
});
|
|
682
767
|
} catch (l) {
|
|
683
768
|
if (l.name === "NotAllowedError" || l.name === "PermissionDeniedError" || (t = l.message) != null && t.includes("Permission denied")) {
|
|
684
|
-
const p = navigator.userAgent,
|
|
685
|
-
let
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
throw
|
|
769
|
+
const p = navigator.userAgent, f = /iPad|iPhone|iPod/.test(p) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
770
|
+
let _ = "Microphone access denied. Please allow microphone access in your browser settings.";
|
|
771
|
+
f && (p.includes("CriOS") ? _ = "Microphone access blocked. Please enable it in iOS Settings > Chrome > Microphone, then reload the page." : p.includes("FxiOS") ? _ = "Microphone access blocked. Please enable it in iOS Settings > Firefox > Microphone, then reload the page." : _ = "Microphone access blocked. Please enable it in iOS Settings > Safari > Microphone (or tap 'aA' > Website Settings > Allow Microphone).");
|
|
772
|
+
const g = new Error(_);
|
|
773
|
+
throw g.name = l.name, g;
|
|
689
774
|
}
|
|
690
775
|
throw l;
|
|
691
776
|
}
|
|
692
777
|
if (this.isConnectCancelled(e)) {
|
|
693
|
-
|
|
778
|
+
a.getTracks().forEach((l) => l.stop());
|
|
694
779
|
return;
|
|
695
780
|
}
|
|
696
|
-
if (this.localStream =
|
|
697
|
-
|
|
781
|
+
if (this.localStream = a, !this.pc || this.isConnectCancelled(e)) {
|
|
782
|
+
a.getTracks().forEach((l) => l.stop());
|
|
698
783
|
return;
|
|
699
784
|
}
|
|
700
|
-
if (this.onLocalStream(
|
|
785
|
+
if (this.onLocalStream(a), a.getTracks().forEach((l) => {
|
|
701
786
|
var p;
|
|
702
|
-
(p = this.pc) == null || p.addTrack(l,
|
|
787
|
+
(p = this.pc) == null || p.addTrack(l, a);
|
|
703
788
|
}), !this.pc)
|
|
704
789
|
throw new Error("RTCPeerConnection was closed unexpectedly");
|
|
705
790
|
this.dataChannel = this.pc.createDataChannel("control"), this.dataChannel.onopen = () => {
|
|
@@ -715,8 +800,8 @@ const y = class y {
|
|
|
715
800
|
try {
|
|
716
801
|
const p = new TextDecoder().decode(l.data);
|
|
717
802
|
try {
|
|
718
|
-
const
|
|
719
|
-
|
|
803
|
+
const f = JSON.parse(p);
|
|
804
|
+
Ie(f) && this.handleControlEvent(f);
|
|
720
805
|
} catch {
|
|
721
806
|
}
|
|
722
807
|
} catch {
|
|
@@ -731,16 +816,16 @@ const y = class y {
|
|
|
731
816
|
}, this.mediaBytesChannel = this.pc.createDataChannel("media-bytes", { ordered: !0 }), this.mediaBytesChannel.binaryType = "arraybuffer", this.mediaBytesChannel.onopen = () => {
|
|
732
817
|
}, this.mediaBytesChannel.onerror = (l) => {
|
|
733
818
|
}, this.pc.ontrack = (l) => {
|
|
734
|
-
const p = l.track,
|
|
735
|
-
p.kind === "audio" ? (this.audioElement = new Audio(), this.audioElement.srcObject =
|
|
819
|
+
const p = l.track, f = l.streams[0];
|
|
820
|
+
p.kind === "audio" ? (this.audioElement = new Audio(), this.audioElement.srcObject = f, this.audioElement.play().catch((_) => {
|
|
736
821
|
}), this.audioElement.onended = () => {
|
|
737
822
|
this.sendEvent("playedStream"), typeof window < "u" && window.dispatchEvent(new CustomEvent("vanira:agent-playback-ended"));
|
|
738
|
-
}, this.onRemoteTrack(p,
|
|
823
|
+
}, this.onRemoteTrack(p, f)) : p.kind === "video" && this.onRemoteTrack(p, f);
|
|
739
824
|
};
|
|
740
825
|
const r = () => {
|
|
741
|
-
var
|
|
742
|
-
const l = ((
|
|
743
|
-
((
|
|
826
|
+
var f, _, g, L, O, D, N, V, K, B, $;
|
|
827
|
+
const l = ((f = this.pc) == null ? void 0 : f.connectionState) === "connected" || ((_ = this.pc) == null ? void 0 : _.iceConnectionState) === "connected" || ((g = this.pc) == null ? void 0 : g.iceConnectionState) === "completed", p = ((L = this.pc) == null ? void 0 : L.connectionState) === "failed" || ((O = this.pc) == null ? void 0 : O.iceConnectionState) === "failed" || ((D = this.pc) == null ? void 0 : D.connectionState) === "closed" || ((N = this.pc) == null ? void 0 : N.iceConnectionState) === "closed" || ((V = this.pc) == null ? void 0 : V.connectionState) === "disconnected" || ((K = this.pc) == null ? void 0 : K.iceConnectionState) === "disconnected";
|
|
828
|
+
((B = this.pc) == null ? void 0 : B.connectionState) === "connected" && this.stopRemoteIcePolling(), l && !this.connected ? (this.connected = !0, ($ = this.routeTracker) == null || $.start(), this.onConnected()) : p && this.connected && (this.connected = !1, this.liveVisionAutoStarted = !1, this.onDisconnected());
|
|
744
829
|
};
|
|
745
830
|
this.pc.onconnectionstatechange = r, this.pc.oniceconnectionstatechange = r;
|
|
746
831
|
const c = this.getIceTrickleUrl();
|
|
@@ -749,7 +834,7 @@ const y = class y {
|
|
|
749
834
|
};
|
|
750
835
|
const h = await this.pc.createOffer();
|
|
751
836
|
if (this.isConnectCancelled(e) || (await this.pc.setLocalDescription(h), this.isConnectCancelled(e))) return;
|
|
752
|
-
const
|
|
837
|
+
const m = this.serverUrl.includes("?") ? this.serverUrl : `${this.serverUrl}/webrtc?agent=${this.agentId}_${this.callId}`, o = await fetch(m, {
|
|
753
838
|
method: "POST",
|
|
754
839
|
headers: { "Content-Type": "application/json" },
|
|
755
840
|
body: JSON.stringify({
|
|
@@ -766,45 +851,45 @@ const y = class y {
|
|
|
766
851
|
const { answer: u } = await o.json();
|
|
767
852
|
if (this.isConnectCancelled(e) || !this.pc || (await this.pc.setRemoteDescription(u), this.isConnectCancelled(e)) || (this.remoteDescSet = !0, await this.flushPendingServerIce(), this.isConnectCancelled(e))) return;
|
|
768
853
|
this.startRemoteIcePolling(c);
|
|
769
|
-
} catch (
|
|
854
|
+
} catch (n) {
|
|
770
855
|
if (this.isConnectCancelled(e)) return;
|
|
771
|
-
throw this.disconnect(), this.onError(
|
|
856
|
+
throw this.disconnect(), this.onError(n.message || n), n;
|
|
772
857
|
}
|
|
773
858
|
}
|
|
774
859
|
}
|
|
775
860
|
createCallCacheKey(e, t) {
|
|
776
|
-
const
|
|
861
|
+
const n = this.apiKey ? `key:${this.apiKey.slice(0, 16)}` : `token:${(this.token || "").slice(-16)}`;
|
|
777
862
|
return [
|
|
778
863
|
this.backendUrl,
|
|
779
864
|
this.agentId,
|
|
780
865
|
e,
|
|
781
866
|
t || "",
|
|
782
867
|
this.prospectId || "",
|
|
783
|
-
|
|
868
|
+
n
|
|
784
869
|
].join("|");
|
|
785
870
|
}
|
|
786
|
-
async postCreateCall(e, t,
|
|
787
|
-
var h,
|
|
788
|
-
const
|
|
871
|
+
async postCreateCall(e, t, n) {
|
|
872
|
+
var h, m, o;
|
|
873
|
+
const a = await fetch(`${this.backendUrl}/calls/create`, {
|
|
789
874
|
method: "POST",
|
|
790
875
|
headers: e,
|
|
791
876
|
body: JSON.stringify({
|
|
792
877
|
agent_id: this.agentId,
|
|
793
878
|
type: ((h = this.runtime) == null ? void 0 : h.callType) || "web",
|
|
794
879
|
mode: t,
|
|
795
|
-
...(
|
|
880
|
+
...(m = this.runtime) != null && m.runtimeName ? { runtime: this.runtime.runtimeName } : {},
|
|
796
881
|
prospect_id: this.prospectId,
|
|
797
882
|
...this.prospectName ? { prospect_name: this.prospectName } : {},
|
|
798
883
|
...this.welcomeMessage ? { welcome_message: this.welcomeMessage } : {},
|
|
799
884
|
...this.extraDetails && Object.keys(this.extraDetails).length ? { extra_details: this.extraDetails } : {},
|
|
800
|
-
...
|
|
885
|
+
...n ? { call_id: n } : {}
|
|
801
886
|
})
|
|
802
887
|
});
|
|
803
|
-
if (!
|
|
804
|
-
const u = await
|
|
805
|
-
throw new Error(`[VaniraClient] createCall failed (${
|
|
888
|
+
if (!a.ok) {
|
|
889
|
+
const u = await a.json().catch(() => ({}));
|
|
890
|
+
throw new Error(`[VaniraClient] createCall failed (${a.status}): ${((o = u == null ? void 0 : u.detail) == null ? void 0 : o.message) || (u == null ? void 0 : u.message) || a.statusText}`);
|
|
806
891
|
}
|
|
807
|
-
const r = await
|
|
892
|
+
const r = await a.json();
|
|
808
893
|
if (!r.call_id || !r.worker_url)
|
|
809
894
|
throw new Error("[VaniraClient] /calls/create response missing call_id or worker_url");
|
|
810
895
|
const c = y.normalizeIceServers(r.ice_servers);
|
|
@@ -818,7 +903,7 @@ const y = class y {
|
|
|
818
903
|
};
|
|
819
904
|
}
|
|
820
905
|
applyCreateCallSession(e) {
|
|
821
|
-
if (this.callId = e.callId, this.prospectId = e.prospectId || this.prospectId, this.serverUrl = e.serverUrl, this.iceServers = e.iceServers, this.callSessionLoaded = !0,
|
|
906
|
+
if (this.callId = e.callId, this.prospectId = e.prospectId || this.prospectId, this.serverUrl = e.serverUrl, this.iceServers = e.iceServers, this.callSessionLoaded = !0, ve(this.agentId, this.callId || "", this.prospectId), this.onSessionStarted && this.prospectId && this.callId && !this.sessionStartedEmitted)
|
|
822
907
|
try {
|
|
823
908
|
this.onSessionStarted({ prospectId: this.prospectId, callId: this.callId, serverUrl: this.serverUrl }), this.sessionStartedEmitted = !0;
|
|
824
909
|
} catch {
|
|
@@ -834,10 +919,10 @@ const y = class y {
|
|
|
834
919
|
throw new Error("[VaniraClient] apiKey or token is required to create a call session");
|
|
835
920
|
const e = { "Content-Type": "application/json" };
|
|
836
921
|
this.apiKey ? e["X-API-Key"] = this.apiKey : this.token && (e.Authorization = this.token.startsWith("Bearer ") ? this.token : `Bearer ${this.token}`);
|
|
837
|
-
const t = this.sessionBehavior === "continue" ? this.callId : void 0,
|
|
838
|
-
let r = y.inflightCreates.get(
|
|
839
|
-
r || (r = this.postCreateCall(e,
|
|
840
|
-
y.inflightCreates.get(
|
|
922
|
+
const t = this.sessionBehavior === "continue" ? this.callId : void 0, n = this.sessionBehavior === "continue" ? "continue" : "new", a = this.createCallCacheKey(n, t);
|
|
923
|
+
let r = y.inflightCreates.get(a);
|
|
924
|
+
r || (r = this.postCreateCall(e, n, t), y.inflightCreates.set(a, r), r.finally(() => {
|
|
925
|
+
y.inflightCreates.get(a) === r && y.inflightCreates.delete(a);
|
|
841
926
|
}));
|
|
842
927
|
const c = await r;
|
|
843
928
|
this.applyCreateCallSession(c);
|
|
@@ -850,11 +935,11 @@ const y = class y {
|
|
|
850
935
|
static normalizeIceServers(e) {
|
|
851
936
|
if (!Array.isArray(e)) return [];
|
|
852
937
|
const t = [];
|
|
853
|
-
for (const
|
|
854
|
-
const
|
|
938
|
+
for (const n of e) {
|
|
939
|
+
const a = n == null ? void 0 : n.urls, r = Array.isArray(a) ? a.filter(Boolean) : typeof a == "string" && a.trim() ? [a.trim()] : [];
|
|
855
940
|
if (!r.length) continue;
|
|
856
|
-
const c = { urls: r.length === 1 ? r[0] : r }, h =
|
|
857
|
-
h && (c.username = h),
|
|
941
|
+
const c = { urls: r.length === 1 ? r[0] : r }, h = n.username, m = n.credential;
|
|
942
|
+
h && (c.username = h), m && (c.credential = m), t.push(c);
|
|
858
943
|
}
|
|
859
944
|
return t;
|
|
860
945
|
}
|
|
@@ -881,14 +966,14 @@ const y = class y {
|
|
|
881
966
|
}
|
|
882
967
|
async sendRemoteIceCandidate(e, t) {
|
|
883
968
|
try {
|
|
884
|
-
const
|
|
969
|
+
const n = await fetch(t, {
|
|
885
970
|
method: "POST",
|
|
886
971
|
headers: { "Content-Type": "application/json" },
|
|
887
972
|
body: JSON.stringify({ candidate: e.toJSON() })
|
|
888
973
|
});
|
|
889
|
-
if (
|
|
890
|
-
const
|
|
891
|
-
await this.applyServerIceCandidates(
|
|
974
|
+
if (n.ok) {
|
|
975
|
+
const a = await n.json();
|
|
976
|
+
await this.applyServerIceCandidates(a.candidates);
|
|
892
977
|
}
|
|
893
978
|
} catch {
|
|
894
979
|
}
|
|
@@ -901,9 +986,9 @@ const y = class y {
|
|
|
901
986
|
return;
|
|
902
987
|
}
|
|
903
988
|
for (const t of e) {
|
|
904
|
-
const
|
|
905
|
-
if (!this.appliedRemoteCandidates.has(
|
|
906
|
-
this.appliedRemoteCandidates.add(
|
|
989
|
+
const n = JSON.stringify(t);
|
|
990
|
+
if (!this.appliedRemoteCandidates.has(n)) {
|
|
991
|
+
this.appliedRemoteCandidates.add(n);
|
|
907
992
|
try {
|
|
908
993
|
await this.pc.addIceCandidate(t);
|
|
909
994
|
} catch {
|
|
@@ -917,9 +1002,9 @@ const y = class y {
|
|
|
917
1002
|
const e = this.pendingServerIce;
|
|
918
1003
|
this.pendingServerIce = [];
|
|
919
1004
|
for (const t of e) {
|
|
920
|
-
const
|
|
921
|
-
if (!this.appliedRemoteCandidates.has(
|
|
922
|
-
this.appliedRemoteCandidates.add(
|
|
1005
|
+
const n = JSON.stringify(t);
|
|
1006
|
+
if (!this.appliedRemoteCandidates.has(n)) {
|
|
1007
|
+
this.appliedRemoteCandidates.add(n);
|
|
923
1008
|
try {
|
|
924
1009
|
await this.pc.addIceCandidate(t);
|
|
925
1010
|
} catch {
|
|
@@ -931,11 +1016,11 @@ const y = class y {
|
|
|
931
1016
|
this.icePollStop = !1, this.pollServerIce(e);
|
|
932
1017
|
}
|
|
933
1018
|
async pollServerIce(e) {
|
|
934
|
-
var
|
|
1019
|
+
var n;
|
|
935
1020
|
const t = Date.now() + 15e3;
|
|
936
1021
|
for (; !this.icePollStop && Date.now() < t; ) {
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
1022
|
+
const a = (n = this.pc) == null ? void 0 : n.connectionState;
|
|
1023
|
+
if (a === "connected" || a === "failed" || a === "closed") break;
|
|
939
1024
|
try {
|
|
940
1025
|
const r = await fetch(e, { method: "GET" });
|
|
941
1026
|
if (r.ok) {
|
|
@@ -954,17 +1039,17 @@ const y = class y {
|
|
|
954
1039
|
* Send control event via DataChannel
|
|
955
1040
|
*/
|
|
956
1041
|
sendEvent(e, t = {}) {
|
|
957
|
-
var
|
|
958
|
-
if (((
|
|
959
|
-
const
|
|
960
|
-
this.dataChannel.send(JSON.stringify(
|
|
1042
|
+
var n;
|
|
1043
|
+
if (((n = this.dataChannel) == null ? void 0 : n.readyState) === "open") {
|
|
1044
|
+
const a = { event: e, ...t };
|
|
1045
|
+
this.dataChannel.send(JSON.stringify(a));
|
|
961
1046
|
}
|
|
962
1047
|
}
|
|
963
1048
|
/** Wait for control DataChannel, then send (live vision lifecycle events). */
|
|
964
|
-
async sendEventWhenReady(e, t = {},
|
|
1049
|
+
async sendEventWhenReady(e, t = {}, n = 1e4) {
|
|
965
1050
|
var r;
|
|
966
|
-
const
|
|
967
|
-
for (; Date.now() <
|
|
1051
|
+
const a = Date.now() + n;
|
|
1052
|
+
for (; Date.now() < a; ) {
|
|
968
1053
|
if (((r = this.dataChannel) == null ? void 0 : r.readyState) === "open")
|
|
969
1054
|
return this.sendEvent(e, t), !0;
|
|
970
1055
|
await new Promise((c) => setTimeout(c, 50));
|
|
@@ -1015,40 +1100,40 @@ const y = class y {
|
|
|
1015
1100
|
break;
|
|
1016
1101
|
case "transcription":
|
|
1017
1102
|
{
|
|
1018
|
-
const
|
|
1019
|
-
e.role ?? e.speaker ??
|
|
1103
|
+
const n = e.data && typeof e.data == "object" ? e.data : {}, a = String(e.text ?? n.text ?? "").trim(), r = e.isFinal ?? e.is_final ?? n.isFinal ?? n.is_final, c = r === void 0 ? !0 : r === !0 || r === "true", h = String(
|
|
1104
|
+
e.role ?? e.speaker ?? n.role ?? n.speaker ?? ""
|
|
1020
1105
|
).trim() || void 0;
|
|
1021
|
-
|
|
1106
|
+
a && this.onTranscription(a, c, h);
|
|
1022
1107
|
}
|
|
1023
1108
|
break;
|
|
1024
1109
|
case "mark":
|
|
1025
1110
|
break;
|
|
1026
1111
|
case "client_tool_cancel": {
|
|
1027
|
-
const
|
|
1028
|
-
this.dispatchBoardAbort("Tool cancelled by server",
|
|
1112
|
+
const a = (e.data || e).tool_call_id || e.tool_call_id;
|
|
1113
|
+
this.dispatchBoardAbort("Tool cancelled by server", a);
|
|
1029
1114
|
break;
|
|
1030
1115
|
}
|
|
1031
1116
|
case "client_tool_call": {
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1117
|
+
const n = e.tool_call || e.data || e, a = (n == null ? void 0 : n.tool_call_id) || (n == null ? void 0 : n.call_id) || e.tool_call_id || "";
|
|
1118
|
+
a && ((t = this.dataChannel) == null ? void 0 : t.readyState) === "open" && this.dataChannel.send(JSON.stringify({
|
|
1034
1119
|
event: "client_tool_ack",
|
|
1035
|
-
data: { tool_call_id:
|
|
1120
|
+
data: { tool_call_id: a }
|
|
1036
1121
|
}));
|
|
1037
|
-
const r = (
|
|
1122
|
+
const r = (n == null ? void 0 : n.arguments) || (n == null ? void 0 : n.args) || {}, c = (n == null ? void 0 : n.client_fields) || {}, h = (n == null ? void 0 : n.name) || (n == null ? void 0 : n.tool_name) || "", m = we(c, r, h);
|
|
1038
1123
|
if (h === "end_call") {
|
|
1039
|
-
|
|
1124
|
+
a && this.sendToolResult(a, {
|
|
1040
1125
|
status: "client_ack_end_call",
|
|
1041
1126
|
message: "Ending call."
|
|
1042
1127
|
}), window.setTimeout(() => this.disconnect(), 120);
|
|
1043
1128
|
break;
|
|
1044
1129
|
}
|
|
1045
|
-
if (
|
|
1130
|
+
if (m) {
|
|
1046
1131
|
window.dispatchEvent(new CustomEvent("vanira:preset", {
|
|
1047
|
-
detail: { toolCall:
|
|
1048
|
-
})), this.onClientToolCall(
|
|
1132
|
+
detail: { toolCall: n, client: this }
|
|
1133
|
+
})), this.onClientToolCall(n);
|
|
1049
1134
|
break;
|
|
1050
1135
|
}
|
|
1051
|
-
this.onClientToolCall(
|
|
1136
|
+
this.onClientToolCall(n);
|
|
1052
1137
|
break;
|
|
1053
1138
|
}
|
|
1054
1139
|
}
|
|
@@ -1058,7 +1143,7 @@ const y = class y {
|
|
|
1058
1143
|
*/
|
|
1059
1144
|
disconnect() {
|
|
1060
1145
|
var e;
|
|
1061
|
-
|
|
1146
|
+
w(), this.connectGeneration++, this.stopRemoteIcePolling(), this.appliedRemoteCandidates.clear(), this.remoteDescSet = !1, this.pendingServerIce = [], this.audioElement && (this.audioElement.pause(), this.audioElement.srcObject = null), this.dataChannel && (this.dataChannel.close(), this.dataChannel = null), this.mediaBytesChannel && (this.mediaBytesChannel.close(), this.mediaBytesChannel = null), this.pc && (this.pc.getSenders().forEach((t) => {
|
|
1062
1147
|
t.track && t.track.stop();
|
|
1063
1148
|
}), this.pc.close(), this.pc = null), this.localStream && (this.localStream.getTracks().forEach((t) => {
|
|
1064
1149
|
try {
|
|
@@ -1072,12 +1157,12 @@ const y = class y {
|
|
|
1072
1157
|
* Uses track.enabled (not pause) so audio resumes correctly when unmuted.
|
|
1073
1158
|
*/
|
|
1074
1159
|
setMicrophoneMuted(e) {
|
|
1075
|
-
var t,
|
|
1076
|
-
this.micMuted = e, (t = this.localStream) == null || t.getAudioTracks().forEach((
|
|
1077
|
-
|
|
1078
|
-
}), (
|
|
1160
|
+
var t, n;
|
|
1161
|
+
this.micMuted = e, (t = this.localStream) == null || t.getAudioTracks().forEach((a) => {
|
|
1162
|
+
a.enabled = !e;
|
|
1163
|
+
}), (n = this.pc) == null || n.getSenders().forEach((a) => {
|
|
1079
1164
|
var r;
|
|
1080
|
-
((r =
|
|
1165
|
+
((r = a.track) == null ? void 0 : r.kind) === "audio" && (a.track.enabled = !e);
|
|
1081
1166
|
});
|
|
1082
1167
|
}
|
|
1083
1168
|
isMicrophoneMuted() {
|
|
@@ -1090,9 +1175,9 @@ const y = class y {
|
|
|
1090
1175
|
return e !== this.connectGeneration;
|
|
1091
1176
|
}
|
|
1092
1177
|
/** Notify WidgetPresetRenderer to cancel in-flight board animations */
|
|
1093
|
-
dispatchBoardAbort(e, t,
|
|
1178
|
+
dispatchBoardAbort(e, t, n) {
|
|
1094
1179
|
typeof window > "u" || window.dispatchEvent(new CustomEvent("vanira:board_abort", {
|
|
1095
|
-
detail: { reason: e, toolCallId: t, presetId:
|
|
1180
|
+
detail: { reason: e, toolCallId: t, presetId: n }
|
|
1096
1181
|
}));
|
|
1097
1182
|
}
|
|
1098
1183
|
/**
|
|
@@ -1181,8 +1266,8 @@ const y = class y {
|
|
|
1181
1266
|
* @param reason Routing key for backend processing (default: 'general')
|
|
1182
1267
|
* @param message Optional user text message about the file
|
|
1183
1268
|
*/
|
|
1184
|
-
async uploadMedia(e, t = "general",
|
|
1185
|
-
return await
|
|
1269
|
+
async uploadMedia(e, t = "general", n = "") {
|
|
1270
|
+
return await Ee(this.dataChannel, this.mediaBytesChannel) ? this._uploadMediaViaDataChannel(e, t, n) : (be(this.dataChannel, this.mediaBytesChannel), this._uploadMediaViaHTTP(e, t, n));
|
|
1186
1271
|
}
|
|
1187
1272
|
/**
|
|
1188
1273
|
* Upload a live vision / screen frame — HTTP only for now, never sends client_media_update.
|
|
@@ -1191,55 +1276,55 @@ const y = class y {
|
|
|
1191
1276
|
* Frames require a real media_url (server rejects empty). WebRTC upload returns url="" until
|
|
1192
1277
|
* the server adds client_media_upload_ready ack — use HTTP for frame JPEGs until then.
|
|
1193
1278
|
*/
|
|
1194
|
-
async uploadMediaFrame(e, t = "camera_capture",
|
|
1195
|
-
const
|
|
1279
|
+
async uploadMediaFrame(e, t = "camera_capture", n) {
|
|
1280
|
+
const a = n && !(e instanceof File) ? new File([e], n, { type: e.type || "image/jpeg" }) : e, { media_id: r, url: c, contentType: h } = await this._postMediaUpload(a, t, !0);
|
|
1196
1281
|
if (!r || !c)
|
|
1197
1282
|
throw new Error("Frame upload failed: server response missing media_id or url");
|
|
1198
1283
|
return { media_id: r, url: c, content_type: h };
|
|
1199
1284
|
}
|
|
1200
1285
|
/** WebRTC media-bytes path (control start/complete + binary chunks). */
|
|
1201
|
-
async _uploadBytesViaDataChannel(e, t,
|
|
1286
|
+
async _uploadBytesViaDataChannel(e, t, n, a, r) {
|
|
1202
1287
|
if (!this.callId || !this.mediaBytesChannel)
|
|
1203
1288
|
throw new Error("Upload failed: call not ready for WebRTC media upload.");
|
|
1204
|
-
const c = r || (e instanceof File ? e.name :
|
|
1205
|
-
return
|
|
1206
|
-
bytes:
|
|
1289
|
+
const c = r || (e instanceof File ? e.name : a === "frame" ? "frame.jpg" : "upload.bin"), h = e.type || (a === "frame" ? "image/jpeg" : "application/octet-stream"), m = await ke(e);
|
|
1290
|
+
return xe({
|
|
1291
|
+
bytes: m,
|
|
1207
1292
|
filename: c,
|
|
1208
1293
|
contentType: h,
|
|
1209
1294
|
reason: t,
|
|
1210
|
-
message:
|
|
1295
|
+
message: n,
|
|
1211
1296
|
callId: this.callId,
|
|
1212
1297
|
mediaBytesChannel: this.mediaBytesChannel,
|
|
1213
1298
|
sendControlEvent: (o, u) => this.sendEvent(o, u),
|
|
1214
|
-
uploadKind:
|
|
1299
|
+
uploadKind: a
|
|
1215
1300
|
});
|
|
1216
1301
|
}
|
|
1217
|
-
async _uploadMediaViaDataChannel(e, t,
|
|
1218
|
-
const
|
|
1219
|
-
return { media_id:
|
|
1302
|
+
async _uploadMediaViaDataChannel(e, t, n) {
|
|
1303
|
+
const a = await this._uploadBytesViaDataChannel(e, t, n, "media");
|
|
1304
|
+
return { media_id: a.media_id, url: a.url };
|
|
1220
1305
|
}
|
|
1221
1306
|
/** HTTP fallback — original uploadMedia behavior (unchanged). */
|
|
1222
|
-
async _uploadMediaViaHTTP(e, t = "general",
|
|
1223
|
-
const { media_id:
|
|
1307
|
+
async _uploadMediaViaHTTP(e, t = "general", n = "") {
|
|
1308
|
+
const { media_id: a, url: r, contentType: c } = await this._postMediaUpload(e, t, !0);
|
|
1224
1309
|
return this.sendMediaUpdate({
|
|
1225
|
-
media_id:
|
|
1310
|
+
media_id: a,
|
|
1226
1311
|
media_url: r,
|
|
1227
1312
|
content_type: c,
|
|
1228
1313
|
reason: t,
|
|
1229
|
-
message:
|
|
1230
|
-
}), { media_id:
|
|
1314
|
+
message: n
|
|
1315
|
+
}), { media_id: a, url: r };
|
|
1231
1316
|
}
|
|
1232
|
-
async _postMediaUpload(e, t,
|
|
1317
|
+
async _postMediaUpload(e, t, n = !1) {
|
|
1233
1318
|
if (!this.serverUrl)
|
|
1234
1319
|
throw new Error("Upload failed: serverUrl is not set. Connect the VaniraClient first.");
|
|
1235
1320
|
if (!this.callId)
|
|
1236
1321
|
throw new Error("Upload failed: callId is missing.");
|
|
1237
|
-
const
|
|
1238
|
-
if (!
|
|
1322
|
+
const a = this.getWorkerOrigin();
|
|
1323
|
+
if (!a)
|
|
1239
1324
|
throw new Error(
|
|
1240
1325
|
"Upload failed: worker_url is not set. Connect the call before uploading media."
|
|
1241
1326
|
);
|
|
1242
|
-
const r = `${
|
|
1327
|
+
const r = `${a}/media/upload`, c = new FormData();
|
|
1243
1328
|
c.append("file", e), c.append("call_id", this.callId), c.append("reason", t);
|
|
1244
1329
|
const h = await fetch(r, {
|
|
1245
1330
|
method: "POST",
|
|
@@ -1253,10 +1338,10 @@ const y = class y {
|
|
|
1253
1338
|
}
|
|
1254
1339
|
throw new Error(`Upload failed: ${p}`);
|
|
1255
1340
|
}
|
|
1256
|
-
const
|
|
1341
|
+
const m = await h.json(), o = m.media_id, u = m.url, l = m.content_type || e.type;
|
|
1257
1342
|
if (!o || !u)
|
|
1258
1343
|
throw new Error("Upload failed: server response missing media_id or url");
|
|
1259
|
-
return
|
|
1344
|
+
return n ? { media_id: o, url: u, contentType: l } : { media_id: o, url: u, contentType: l };
|
|
1260
1345
|
}
|
|
1261
1346
|
// ─── Event emitter (replaces retired VaniraAI) ───────────────────────────
|
|
1262
1347
|
get status() {
|
|
@@ -1269,12 +1354,12 @@ const y = class y {
|
|
|
1269
1354
|
return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t), this;
|
|
1270
1355
|
}
|
|
1271
1356
|
off(e, t) {
|
|
1272
|
-
var
|
|
1273
|
-
return (
|
|
1357
|
+
var n;
|
|
1358
|
+
return (n = this.listeners.get(e)) == null || n.delete(t), this;
|
|
1274
1359
|
}
|
|
1275
1360
|
emit(e, t) {
|
|
1276
|
-
var
|
|
1277
|
-
(
|
|
1361
|
+
var n;
|
|
1362
|
+
(n = this.listeners.get(e)) == null || n.forEach((a) => a(t));
|
|
1278
1363
|
}
|
|
1279
1364
|
/** Alias for connect() — VaniraAI compatibility */
|
|
1280
1365
|
async start() {
|
|
@@ -1305,8 +1390,8 @@ const y = class y {
|
|
|
1305
1390
|
};
|
|
1306
1391
|
/** Dedupes concurrent POST /calls/create (e.g. React StrictMode double-mount). */
|
|
1307
1392
|
d(y, "inflightCreates", /* @__PURE__ */ new Map());
|
|
1308
|
-
let
|
|
1309
|
-
const
|
|
1393
|
+
let U = y;
|
|
1394
|
+
const Le = {
|
|
1310
1395
|
supportsAudioEndedEvent: !1,
|
|
1311
1396
|
supportsScreenShare: !1,
|
|
1312
1397
|
supportsDom: !1,
|
|
@@ -1314,40 +1399,40 @@ const be = {
|
|
|
1314
1399
|
supportsCustomElements: !1,
|
|
1315
1400
|
supportsLocalStorage: !1,
|
|
1316
1401
|
supportsBroadcastChannel: !1
|
|
1317
|
-
},
|
|
1402
|
+
}, Oe = {
|
|
1318
1403
|
name: "react-native",
|
|
1319
1404
|
callType: "web",
|
|
1320
1405
|
runtimeName: "react-native",
|
|
1321
1406
|
callIdPrefix: "rn_",
|
|
1322
|
-
capabilities:
|
|
1323
|
-
audio: new
|
|
1324
|
-
media: new
|
|
1325
|
-
peer: new
|
|
1326
|
-
dataChannel: new
|
|
1407
|
+
capabilities: Le,
|
|
1408
|
+
audio: new te(),
|
|
1409
|
+
media: new ne(),
|
|
1410
|
+
peer: new ie(),
|
|
1411
|
+
dataChannel: new ae()
|
|
1327
1412
|
};
|
|
1328
|
-
function
|
|
1329
|
-
return new
|
|
1330
|
-
...
|
|
1331
|
-
runtime:
|
|
1413
|
+
function X(i) {
|
|
1414
|
+
return new U({
|
|
1415
|
+
...i,
|
|
1416
|
+
runtime: Oe
|
|
1332
1417
|
});
|
|
1333
1418
|
}
|
|
1334
|
-
const
|
|
1335
|
-
function
|
|
1336
|
-
return
|
|
1419
|
+
const Ve = X;
|
|
1420
|
+
function De(i) {
|
|
1421
|
+
return X(i);
|
|
1337
1422
|
}
|
|
1338
|
-
const
|
|
1423
|
+
const Ke = De;
|
|
1339
1424
|
export {
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1425
|
+
te as RNAudioAdapter,
|
|
1426
|
+
ae as RNDataChannelAdapter,
|
|
1427
|
+
ne as RNMediaAdapter,
|
|
1428
|
+
ie as RNPeerAdapter,
|
|
1429
|
+
U as VaniraAI,
|
|
1430
|
+
U as VaniraClient,
|
|
1431
|
+
U as WebRTCClient,
|
|
1432
|
+
Ve as createReactNativeAI,
|
|
1433
|
+
X as createReactNativeClient,
|
|
1434
|
+
Ke as createVaniraAI,
|
|
1435
|
+
De as createVaniraClient,
|
|
1436
|
+
Le as reactNativeCapabilities,
|
|
1437
|
+
Oe as reactNativeRuntime
|
|
1353
1438
|
};
|