@d-id/client-sdk 1.0.18-beta.5 → 1.0.18-beta.7

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.
Files changed (38) hide show
  1. package/dist/index.js +143 -152
  2. package/dist/index.umd.cjs +1 -1
  3. package/dist/src/index.d.ts +1 -1
  4. package/dist/src/lib/api/agents.d.ts +1 -1
  5. package/dist/src/lib/api/clipStream.d.ts +1 -1
  6. package/dist/src/lib/api/getClient.d.ts +1 -1
  7. package/dist/src/lib/api/knowledge.d.ts +1 -1
  8. package/dist/src/lib/api/talkStream.d.ts +1 -1
  9. package/dist/src/lib/auth/getAuthHeader.d.ts +1 -1
  10. package/dist/src/lib/connectToSocket.d.ts +1 -1
  11. package/dist/src/lib/createAgentManager.d.ts +1 -1
  12. package/dist/src/lib/createStreamingManager.d.ts +2 -6
  13. package/dist/src/lib/environment.d.ts +7 -2
  14. package/dist/{types → src/types}/entities/agents/manager.d.ts +1 -1
  15. package/dist/{types → src/types}/index.d.ts +1 -1
  16. package/package.json +2 -2
  17. /package/dist/{types → src/types}/StreamScript.d.ts +0 -0
  18. /package/dist/{types → src/types}/auth.d.ts +0 -0
  19. /package/dist/{types → src/types}/entities/agents/agent.d.ts +0 -0
  20. /package/dist/{types → src/types}/entities/agents/chat.d.ts +0 -0
  21. /package/dist/{types → src/types}/entities/agents/index.d.ts +0 -0
  22. /package/dist/{types → src/types}/entities/agents/knowledge.d.ts +0 -0
  23. /package/dist/{types → src/types}/entities/agents/llm.d.ts +0 -0
  24. /package/dist/{types → src/types}/entities/agents/presenter.d.ts +0 -0
  25. /package/dist/{types → src/types}/entities/index.d.ts +0 -0
  26. /package/dist/{types → src/types}/entities/knowledge/document.d.ts +0 -0
  27. /package/dist/{types → src/types}/entities/knowledge/index.d.ts +0 -0
  28. /package/dist/{types → src/types}/entities/knowledge/knowledge.d.ts +0 -0
  29. /package/dist/{types → src/types}/entities/knowledge/record.d.ts +0 -0
  30. /package/dist/{types → src/types}/entities/knowledge/retrival.d.ts +0 -0
  31. /package/dist/{types → src/types}/entities/video.d.ts +0 -0
  32. /package/dist/{types → src/types}/stream/api/clip.d.ts +0 -0
  33. /package/dist/{types → src/types}/stream/api/index.d.ts +0 -0
  34. /package/dist/{types → src/types}/stream/api/talk.d.ts +0 -0
  35. /package/dist/{types → src/types}/stream/index.d.ts +0 -0
  36. /package/dist/{types → src/types}/stream/rtc.d.ts +0 -0
  37. /package/dist/{types → src/types}/stream/stream.d.ts +0 -0
  38. /package/dist/{types → src/types}/tts.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- const f = "https://api-dev.d-id.com", b = "wss://notifications.d-id.com";
2
- function M(e) {
1
+ const h = "https://api.d-id.com", z = "wss://notifications.d-id.com";
2
+ function P(e) {
3
3
  if (e.type === "bearer")
4
4
  return `Bearer ${e.token}`;
5
5
  if (e.type === "basic")
@@ -8,13 +8,13 @@ function M(e) {
8
8
  return `Client-Key ${e.clientKey}`;
9
9
  throw new Error(`Unknown auth type: ${e}`);
10
10
  }
11
- function S(e, a = f) {
11
+ function $(e, a = h) {
12
12
  const o = async (t, n) => {
13
13
  const r = await fetch(a + (t != null && t.startsWith("/") ? t : `/${t}`), {
14
14
  ...n,
15
15
  headers: {
16
16
  ...n == null ? void 0 : n.headers,
17
- Authorization: M(e),
17
+ Authorization: P(e),
18
18
  "Content-Type": "application/json"
19
19
  }
20
20
  });
@@ -54,8 +54,8 @@ function S(e, a = f) {
54
54
  }
55
55
  };
56
56
  }
57
- function z(e, a = f) {
58
- const o = S(e, `${a}/agents`);
57
+ function T(e, a = h) {
58
+ const o = $(e, `${a}/agents`);
59
59
  return {
60
60
  create(t, n) {
61
61
  return o.post("/", t, n);
@@ -80,8 +80,8 @@ function z(e, a = f) {
80
80
  }
81
81
  };
82
82
  }
83
- function Z(e, a = f) {
84
- const o = S(e, `${a}/knowledge`);
83
+ function Z(e, a = h) {
84
+ const o = $(e, `${a}/knowledge`);
85
85
  return {
86
86
  createKnowledge(t, n) {
87
87
  return o.post("/", t, n);
@@ -117,8 +117,8 @@ function Z(e, a = f) {
117
117
  }
118
118
  };
119
119
  }
120
- const T = (e) => new Promise((a) => setTimeout(a, e));
121
- function U(e) {
120
+ const U = (e) => new Promise((a) => setTimeout(a, e));
121
+ function b(e) {
122
122
  return new Promise((a, o) => {
123
123
  const {
124
124
  callbacks: t,
@@ -126,14 +126,14 @@ function U(e) {
126
126
  auth: r
127
127
  } = e, {
128
128
  onMessage: c = null,
129
- onOpen: u = null,
130
- onClose: m = null,
131
- onError: g = null
132
- } = t || {}, d = new WebSocket(`${n}?authorization=${M(r)}`);
133
- d.onmessage = c, d.onclose = m, d.onerror = (i) => {
134
- console.log(i), g == null || g(i), o(i);
135
- }, d.onopen = (i) => {
136
- u == null || u(i), a(d);
129
+ onOpen: g = null,
130
+ onClose: p = null,
131
+ onError: l = null
132
+ } = t || {}, i = new WebSocket(`${n}?authorization=${P(r)}`);
133
+ i.onmessage = c, i.onclose = p, i.onerror = (d) => {
134
+ console.log(d), l == null || l(d), o(d);
135
+ }, i.onopen = (d) => {
136
+ g == null || g(d), a(i);
137
137
  };
138
138
  });
139
139
  }
@@ -144,35 +144,33 @@ async function q(e) {
144
144
  let o = null;
145
145
  for (let t = 0; (o == null ? void 0 : o.readyState) !== WebSocket.OPEN; t++)
146
146
  try {
147
- o = await U(e);
147
+ o = await b(e);
148
148
  } catch (n) {
149
149
  if (t === a)
150
150
  throw n;
151
- await T(t * 500);
151
+ await U(t * 500);
152
152
  }
153
153
  return o;
154
154
  }
155
- async function B(e, a = b) {
155
+ async function B(e, a = z) {
156
156
  const o = [], t = await q({
157
157
  auth: e,
158
158
  host: a,
159
159
  callbacks: {
160
160
  onMessage: (n) => {
161
- console.log("event", n), o.forEach((r) => r(n));
161
+ o.forEach((r) => r(n));
162
162
  }
163
163
  }
164
164
  });
165
165
  return {
166
166
  socket: t,
167
167
  terminate: () => t.close(),
168
- subscribeToEvents: (n) => {
169
- o.push(n);
170
- }
168
+ subscribeToEvents: (n) => o.push(n)
171
169
  };
172
170
  }
173
- var L = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(L || {}), N = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(N || {}), v = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(v || {}), A = /* @__PURE__ */ ((e) => (e.ChatAnswer = "chat/answer", e.ChatPartial = "chat/partial", e.StreamDone = "stream/done", e.StreamStarted = "stream/started", e))(A || {}), J = /* @__PURE__ */ ((e) => (e.Unrated = "Unrated", e.Positive = "Positive", e.Negative = "Negative", e))(J || {}), W = /* @__PURE__ */ ((e) => (e.KnowledgeProcessing = "knowledge/processing", e.KnowledgeIndexing = "knowledge/indexing", e.KnowledgeFailed = "knowledge/error", e.KnowledgeDone = "knowledge/done", e))(W || {}), F = /* @__PURE__ */ ((e) => (e.Knowledge = "knowledge", e.Document = "document", e.Record = "record", e))(F || {}), H = /* @__PURE__ */ ((e) => (e.Pdf = "pdf", e.Text = "text", e.Html = "html", e.Word = "word", e.Json = "json", e.Markdown = "markdown", e.Csv = "csv", e.Excel = "excel", e.Powerpoint = "powerpoint", e.Archive = "archive", e.Image = "image", e.Audio = "audio", e.Video = "video", e))(H || {}), $ = /* @__PURE__ */ ((e) => (e.Clip = "clip", e.Talk = "talk", e))($ || {});
174
- function V(e, a = f) {
175
- const o = S(e, `${a}/chats/ratings`);
171
+ var L = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(L || {}), N = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(N || {}), S = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(S || {}), k = /* @__PURE__ */ ((e) => (e.ChatAnswer = "chat/answer", e.ChatPartial = "chat/partial", e.StreamDone = "stream/done", e.StreamStarted = "stream/started", e))(k || {}), J = /* @__PURE__ */ ((e) => (e.Unrated = "Unrated", e.Positive = "Positive", e.Negative = "Negative", e))(J || {}), W = /* @__PURE__ */ ((e) => (e.KnowledgeProcessing = "knowledge/processing", e.KnowledgeIndexing = "knowledge/indexing", e.KnowledgeFailed = "knowledge/error", e.KnowledgeDone = "knowledge/done", e))(W || {}), F = /* @__PURE__ */ ((e) => (e.Knowledge = "knowledge", e.Document = "document", e.Record = "record", e))(F || {}), H = /* @__PURE__ */ ((e) => (e.Pdf = "pdf", e.Text = "text", e.Html = "html", e.Word = "word", e.Json = "json", e.Markdown = "markdown", e.Csv = "csv", e.Excel = "excel", e.Powerpoint = "powerpoint", e.Archive = "archive", e.Image = "image", e.Audio = "audio", e.Video = "video", e))(H || {}), f = /* @__PURE__ */ ((e) => (e.Clip = "clip", e.Talk = "talk", e))(f || {});
172
+ function V(e, a = h) {
173
+ const o = $(e, `${a}/chats/ratings`);
176
174
  return {
177
175
  create(t, n) {
178
176
  return o.post("/", t, n);
@@ -189,94 +187,93 @@ function V(e, a = f) {
189
187
  };
190
188
  }
191
189
  function D(e) {
192
- return e.presenter.type === $.Clip ? {
193
- videoType: $.Clip,
190
+ return e.presenter.type === f.Clip ? {
191
+ videoType: f.Clip,
194
192
  driver_id: e.presenter.driver_id,
195
193
  presenter_id: e.presenter.presenter_id
196
194
  } : {
197
- videoType: $.Talk,
195
+ videoType: f.Talk,
198
196
  source_url: e.presenter.source_url
199
197
  };
200
198
  }
201
- function K(e, a, o) {
202
- return new Promise(async (t, n) => {
203
- var u;
204
- const r = ((u = a.callbacks) == null ? void 0 : u.onConnectionStateChange) ?? null;
205
- a.callbacks.onConnectionStateChange = async (m) => {
206
- if (r && r(m), m === "connected") {
207
- const g = await o.newChat(e.id);
208
- r && c.onCallback("onConnectionStateChange", r), t({
209
- chat: g,
210
- streamingAPI: c
211
- });
212
- } else
213
- m === "failed" && n(new Error("Cannot create connection"));
214
- };
215
- const c = await Y(D(e), a);
199
+ function M(e, a, o, t) {
200
+ return new Promise(async (n, r) => {
201
+ const c = await Y(D(e), {
202
+ ...a,
203
+ callbacks: {
204
+ ...a.callbacks,
205
+ onConnectionStateChange: async (g) => {
206
+ var p, l;
207
+ g === "connected" ? (t || (t = await o.newChat(e.id)), n({
208
+ chat: t,
209
+ streamingManager: c
210
+ })) : g === "failed" && r(new Error("Cannot create connection")), (l = (p = a.callbacks).onConnectionStateChange) == null || l.call(p, g);
211
+ }
212
+ }
213
+ });
216
214
  });
217
215
  }
218
216
  async function O(e, a) {
219
- const o = a.baseURL || f, t = new AbortController(), n = z(a.auth, o), r = V(a.auth, o), c = await n.getById(e), u = await B(a.auth);
220
- return K(c, a, n).then((m) => {
221
- let {
222
- chat: g,
223
- streamingAPI: d
224
- } = m;
225
- return {
226
- agent: c,
227
- async reconnectToChat() {
228
- await K(c, a, n).then((i) => {
229
- g = i.chat, d = i.streamingAPI;
230
- });
231
- },
232
- terminate() {
233
- return t.abort(), u.terminate(), d.terminate();
234
- },
235
- chatId: g.id,
236
- chat(i) {
237
- return n.chat(e, g.id, {
238
- sessionId: d.sessionId,
239
- streamId: d.streamId,
240
- messages: i
241
- }, {
242
- signal: t.signal
243
- });
244
- },
245
- rate(i, w) {
246
- return w ? r.update(w, i) : r.create(i);
247
- },
248
- speak(i) {
249
- if (!c)
250
- throw new Error("Agent not initializated");
251
- let w;
252
- return i.type === "text" ? w = {
253
- script: {
254
- type: "text",
255
- provider: i.provider,
256
- input: i.input,
257
- ssml: i.ssml || !1
258
- }
259
- } : i.type === "audio" && (w = {
260
- script: {
261
- type: "audio",
262
- audio_url: i.audio_url
263
- }
264
- }), d.speak(w);
265
- },
266
- onChatEvents(i) {
267
- u.subscribeToEvents(i);
268
- },
269
- onConnectionEvents(i) {
270
- d.onCallback("onConnectionStateChange", i);
271
- },
272
- onVideoEvents(i) {
273
- d.onCallback("onVideoStateChange", i);
274
- }
275
- };
276
- });
217
+ const o = a.baseURL || h, t = new AbortController(), n = T(a.auth, o), r = V(a.auth, o), c = await n.getById(e), g = await B(a.auth);
218
+ let {
219
+ chat: p,
220
+ streamingManager: l
221
+ } = await M(c, a, n);
222
+ return {
223
+ agent: c,
224
+ async reconnectToChat() {
225
+ const {
226
+ streamingManager: i
227
+ } = await M(c, a, n, p);
228
+ l = i;
229
+ },
230
+ terminate() {
231
+ return t.abort(), g.terminate(), l.terminate();
232
+ },
233
+ chatId: p.id,
234
+ chat(i) {
235
+ return n.chat(e, p.id, {
236
+ sessionId: l.sessionId,
237
+ streamId: l.streamId,
238
+ messages: i
239
+ }, {
240
+ signal: t.signal
241
+ });
242
+ },
243
+ rate(i, d) {
244
+ return d ? r.update(d, i) : r.create(i);
245
+ },
246
+ speak(i) {
247
+ if (!c)
248
+ throw new Error("Agent not initializated");
249
+ let d;
250
+ return i.type === "text" ? d = {
251
+ script: {
252
+ type: "text",
253
+ provider: i.provider,
254
+ input: i.input,
255
+ ssml: i.ssml || !1
256
+ }
257
+ } : i.type === "audio" && (d = {
258
+ script: {
259
+ type: "audio",
260
+ audio_url: i.audio_url
261
+ }
262
+ }), l.speak(d);
263
+ },
264
+ onChatEvents(i) {
265
+ g.subscribeToEvents(i);
266
+ },
267
+ onConnectionEvents(i) {
268
+ l.onCallback("onConnectionStateChange", i);
269
+ },
270
+ onVideoEvents(i) {
271
+ l.onCallback("onVideoStateChange", i);
272
+ }
273
+ };
277
274
  }
278
275
  function G(e, a) {
279
- const o = S(e, a);
276
+ const o = $(e, a);
280
277
  return {
281
278
  createStream(t) {
282
279
  return o.post("/clips/streams", {
@@ -311,7 +308,7 @@ function G(e, a) {
311
308
  };
312
309
  }
313
310
  function Q(e, a) {
314
- const o = S(e, a);
311
+ const o = $(e, a);
315
312
  return {
316
313
  createStream(t, n) {
317
314
  return o.post("/talks/streams", {
@@ -346,90 +343,84 @@ function Q(e, a) {
346
343
  }
347
344
  };
348
345
  }
349
- let E = !1;
350
- const C = (e, a) => E && console.log(e, a), X = (window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection).bind(window);
346
+ let K = !1;
347
+ const m = (e, a) => K && console.log(e, a), X = (window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection).bind(window);
351
348
  async function Y(e, {
352
349
  debug: a = !1,
353
350
  callbacks: o,
354
351
  auth: t,
355
- baseURL: n = f
352
+ baseURL: n = h
356
353
  }) {
357
- E = a;
354
+ K = a;
358
355
  const r = {
359
356
  ...o
360
357
  }, {
361
358
  startConnection: c,
362
- sendStreamRequest: u,
363
- close: m,
364
- createStream: g,
365
- addIceCandidate: d
366
- } = e.videoType === $.Clip ? G(t, n) : Q(t, n), {
367
- id: i,
368
- offer: w,
359
+ sendStreamRequest: g,
360
+ close: p,
361
+ createStream: l,
362
+ addIceCandidate: i
363
+ } = e.videoType === f.Clip ? G(t, n) : Q(t, n), {
364
+ id: d,
365
+ offer: E,
369
366
  ice_servers: R,
370
- session_id: h
371
- } = await g(e), l = new X({
367
+ session_id: C
368
+ } = await l(e), u = new X({
372
369
  iceServers: R
373
- }), y = l.createDataChannel("JanusDataChannel");
374
- if (!h)
370
+ }), A = u.createDataChannel("JanusDataChannel");
371
+ if (!C)
375
372
  throw new Error("Could not create session_id");
376
- l.onicecandidate = (s) => {
377
- C("peerConnection.onicecandidate", s), s.candidate && s.candidate.sdpMid && s.candidate.sdpMLineIndex !== null && d(i, {
373
+ u.onicecandidate = (s) => {
374
+ m("peerConnection.onicecandidate", s), s.candidate && s.candidate.sdpMid && s.candidate.sdpMLineIndex !== null && i(d, {
378
375
  candidate: s.candidate.candidate,
379
376
  sdpMid: s.candidate.sdpMid,
380
377
  sdpMLineIndex: s.candidate.sdpMLineIndex
381
- }, h);
382
- }, l.oniceconnectionstatechange = () => {
378
+ }, C);
379
+ }, u.oniceconnectionstatechange = () => {
383
380
  var s;
384
- C("peerConnection.oniceconnectionstatechange => " + l.iceConnectionState), (s = r.onConnectionStateChange) == null || s.call(r, l.iceConnectionState);
385
- }, l.ontrack = (s) => {
386
- var p;
387
- C("peerConnection.ontrack", s), (p = r.onSrcObjectReady) == null || p.call(r, s.streams[0]);
388
- }, y.onmessage = (s) => {
389
- var p, k, P;
390
- if (y.readyState === "open") {
381
+ m("peerConnection.oniceconnectionstatechange => " + u.iceConnectionState), (s = r.onConnectionStateChange) == null || s.call(r, u.iceConnectionState);
382
+ }, u.ontrack = (s) => {
383
+ var w;
384
+ m("peerConnection.ontrack", s), (w = r.onSrcObjectReady) == null || w.call(r, s.streams[0]);
385
+ }, A.onmessage = (s) => {
386
+ var w, v, I;
387
+ if (A.readyState === "open") {
391
388
  const [_, x] = s.data.split(":");
392
- _ === A.StreamDone ? (p = r.onVideoStateChange) == null || p.call(r, v.Stop) : _ === A.StreamStarted ? (k = r.onVideoStateChange) == null || k.call(r, v.Start) : (P = r.onMessage) == null || P.call(r, _, decodeURIComponent(x));
389
+ _ === k.StreamDone ? (w = r.onVideoStateChange) == null || w.call(r, S.Stop) : _ === k.StreamStarted ? (v = r.onVideoStateChange) == null || v.call(r, S.Start) : (I = r.onMessage) == null || I.call(r, _, decodeURIComponent(x));
393
390
  }
394
- }, await l.setRemoteDescription(w), C("set remote description OK");
395
- const I = await l.createAnswer();
396
- return C("create answer OK"), await l.setLocalDescription(I), C("set local description OK"), await c(i, I, h), C("start connection OK"), {
391
+ }, await u.setRemoteDescription(E), m("set remote description OK");
392
+ const y = await u.createAnswer();
393
+ return m("create answer OK"), await u.setLocalDescription(y), m("set local description OK"), await c(d, y, C), m("start connection OK"), {
397
394
  /**
398
395
  * Method to send request to server to get clip or talk depend on you payload
399
396
  * @param payload
400
397
  */
401
398
  speak(s) {
402
- return u(i, h, s);
399
+ return g(d, C, s);
403
400
  },
404
401
  /**
405
402
  * Method to close RTC connection
406
403
  */
407
404
  async terminate() {
408
- var s, p;
409
- i && (l && (l.close(), l.oniceconnectionstatechange = null, l.onnegotiationneeded = null, l.onicecandidate = null, l.ontrack = null), await m(i, h).catch((k) => {
410
- }), (s = r.onConnectionStateChange) == null || s.call(r, "closed"), (p = r.onVideoStateChange) == null || p.call(r, v.Stop));
405
+ var s, w;
406
+ d && (u && (u.close(), u.oniceconnectionstatechange = null, u.onnegotiationneeded = null, u.onicecandidate = null, u.ontrack = null), await p(d, C).catch((v) => {
407
+ }), (s = r.onConnectionStateChange) == null || s.call(r, "closed"), (w = r.onVideoStateChange) == null || w.call(r, S.Stop));
411
408
  },
412
409
  /**
413
410
  * Session identifier information, should be returned in the body of all streaming requests
414
411
  */
415
- sessionId: h,
412
+ sessionId: C,
416
413
  /**
417
414
  * Id of current RTC stream
418
415
  */
419
- streamId: i,
416
+ streamId: d,
420
417
  /**
421
418
  * Method to add callback that will be trigered on supported events
422
419
  * @param eventName
423
420
  * @param callback
424
421
  */
425
- onCallback(s, p) {
426
- r[s] = p;
427
- },
428
- /**
429
- * existing callback is internal method to pass calbacks added after create in new connection
430
- */
431
- getCallbacks() {
432
- return r;
422
+ onCallback(s, w) {
423
+ r[s] = w;
433
424
  }
434
425
  };
435
426
  }
@@ -442,8 +433,8 @@ export {
442
433
  W as Subject,
443
434
  N as VoiceAccess,
444
435
  O as createAgentManager,
445
- z as createAgentsApi,
446
- S as createClient,
436
+ T as createAgentsApi,
437
+ $ as createClient,
447
438
  Z as createKnowledgeApi,
448
439
  Y as createStreamingManager,
449
440
  D as getAgentStreamArgs
@@ -1 +1 @@
1
- (function(d,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(d=typeof globalThis<"u"?globalThis:d||self,p(d.index={}))})(this,function(d){"use strict";const p="https://api-dev.d-id.com",V="wss://notifications.d-id.com";function P(e){if(e.type==="bearer")return`Bearer ${e.token}`;if(e.type==="basic")return`Basic ${btoa(`${e.username}:${e.password}`)}`;if(e.type==="key")return`Client-Key ${e.clientKey}`;throw new Error(`Unknown auth type: ${e}`)}function S(e,a=p){const o=async(t,n)=>{const r=await fetch(a+(t!=null&&t.startsWith("/")?t:`/${t}`),{...n,headers:{...n==null?void 0:n.headers,Authorization:P(e),"Content-Type":"application/json"}});if(!r.ok){let c=await r.text().catch(()=>"Failed to fetch");throw new Error(c)}return r.json()};return{get(t,n){return o(t,{...n,method:"GET"})},post(t,n,r){return o(t,{...r,body:JSON.stringify(n),method:"POST"})},delete(t,n,r){return o(t,{...r,body:JSON.stringify(n),method:"DELETE"})},patch(t,n,r){return o(t,{...r,body:JSON.stringify(n),method:"PATCH"})}}}function I(e,a=p){const o=S(e,`${a}/agents`);return{create(t,n){return o.post("/",t,n)},getAgents(t,n){return o.get(`/${t?`?tag=${t}`:""}`,n).then(r=>r??[])},getById(t,n){return o.get(`/${t}`,n)},delete(t,n){return o.delete(`/${t}`,void 0,n)},update(t,n,r){return o.patch(`/${t}`,n,r)},newChat(t,n){return o.post(`/${t}/chat`,void 0,n)},chat(t,n,r,c){return o.post(`/${t}/chat/${n}`,r,c)}}}function x(e,a=p){const o=S(e,`${a}/knowledge`);return{createKnowledge(t,n){return o.post("/",t,n)},getKnowledgeBase(t){return o.get("/",t)},getKnowledge(t,n){return o.get(`/${t}`,n)},deleteKnowledge(t,n){return o.delete(`/${t}`,void 0,n)},createDocument(t,n,r){return o.post(`/${t}/documents`,n,r)},deleteDocument(t,n,r){return o.delete(`/${t}/documents/${n}`,void 0,r)},getDocuments(t,n){return o.get(`/${t}/documents`,n)},getDocument(t,n,r){return o.get(`/${t}/documents/${n}`,r)},getRecords(t,n,r){return o.get(`/${t}/documents/${n}/records`,r)},query(t,n,r){return o.post(`/${t}/query`,{query:n},r)}}}const D=e=>new Promise(a=>setTimeout(a,e));function F(e){return new Promise((a,o)=>{const{callbacks:t,host:n,auth:r}=e,{onMessage:c=null,onOpen:g=null,onClose:w=null,onError:m=null}=t||{},l=new WebSocket(`${n}?authorization=${P(r)}`);l.onmessage=c,l.onclose=w,l.onerror=i=>{console.log(i),m==null||m(i),o(i)},l.onopen=i=>{g==null||g(i),a(l)}})}async function H(e){const{retries:a=1}=e;let o=null;for(let t=0;(o==null?void 0:o.readyState)!==WebSocket.OPEN;t++)try{o=await F(e)}catch(n){if(t===a)throw n;await D(t*500)}return o}async function M(e,a=V){const o=[],t=await H({auth:e,host:a,callbacks:{onMessage:n=>{console.log("event",n),o.forEach(r=>r(n))}}});return{socket:t,terminate:()=>t.close(),subscribeToEvents:n=>{o.push(n)}}}var K=(e=>(e.Amazon="amazon",e.Microsoft="microsoft",e.Afflorithmics="afflorithmics",e.Elevenlabs="elevenlabs",e))(K||{}),R=(e=>(e.Public="public",e.Premium="premium",e.Private="private",e))(R||{}),A=(e=>(e.Start="START",e.Stop="STOP",e))(A||{}),k=(e=>(e.ChatAnswer="chat/answer",e.ChatPartial="chat/partial",e.StreamDone="stream/done",e.StreamStarted="stream/started",e))(k||{}),E=(e=>(e.Unrated="Unrated",e.Positive="Positive",e.Negative="Negative",e))(E||{}),b=(e=>(e.KnowledgeProcessing="knowledge/processing",e.KnowledgeIndexing="knowledge/indexing",e.KnowledgeFailed="knowledge/error",e.KnowledgeDone="knowledge/done",e))(b||{}),T=(e=>(e.Knowledge="knowledge",e.Document="document",e.Record="record",e))(T||{}),z=(e=>(e.Pdf="pdf",e.Text="text",e.Html="html",e.Word="word",e.Json="json",e.Markdown="markdown",e.Csv="csv",e.Excel="excel",e.Powerpoint="powerpoint",e.Archive="archive",e.Image="image",e.Audio="audio",e.Video="video",e))(z||{}),v=(e=>(e.Clip="clip",e.Talk="talk",e))(v||{});function G(e,a=p){const o=S(e,`${a}/chats/ratings`);return{create(t,n){return o.post("/",t,n)},getByKnowledge(t,n){return o.get(`/${t}`,n).then(r=>r??[])},update(t,n,r){return o.patch(`/${t}`,n,r)},delete(t,n){return o.delete(`/${t}`,n)}}}function U(e){return e.presenter.type===v.Clip?{videoType:v.Clip,driver_id:e.presenter.driver_id,presenter_id:e.presenter.presenter_id}:{videoType:v.Talk,source_url:e.presenter.source_url}}function q(e,a,o){return new Promise(async(t,n)=>{var g;const r=((g=a.callbacks)==null?void 0:g.onConnectionStateChange)??null;a.callbacks.onConnectionStateChange=async w=>{if(r&&r(w),w==="connected"){const m=await o.newChat(e.id);r&&c.onCallback("onConnectionStateChange",r),t({chat:m,streamingAPI:c})}else w==="failed"&&n(new Error("Cannot create connection"))};const c=await L(U(e),a)})}async function Q(e,a){const o=a.baseURL||p,t=new AbortController,n=I(a.auth,o),r=G(a.auth,o),c=await n.getById(e),g=await M(a.auth);return q(c,a,n).then(w=>{let{chat:m,streamingAPI:l}=w;return{agent:c,async reconnectToChat(){await q(c,a,n).then(i=>{m=i.chat,l=i.streamingAPI})},terminate(){return t.abort(),g.terminate(),l.terminate()},chatId:m.id,chat(i){return n.chat(e,m.id,{sessionId:l.sessionId,streamId:l.streamId,messages:i},{signal:t.signal})},rate(i,h){return h?r.update(h,i):r.create(i)},speak(i){if(!c)throw new Error("Agent not initializated");let h;return i.type==="text"?h={script:{type:"text",provider:i.provider,input:i.input,ssml:i.ssml||!1}}:i.type==="audio"&&(h={script:{type:"audio",audio_url:i.audio_url}}),l.speak(h)},onChatEvents(i){g.subscribeToEvents(i)},onConnectionEvents(i){l.onCallback("onConnectionStateChange",i)},onVideoEvents(i){l.onCallback("onVideoStateChange",i)}}})}function X(e,a){const o=S(e,a);return{createStream(t){return o.post("/clips/streams",{driver_id:t.driver_id,presenter_id:t.presenter_id,compatibility_mode:t.compatibility_mode})},startConnection(t,n,r){return o.post(`/clips/streams/${t}/sdp`,{session_id:r,answer:n})},addIceCandidate(t,n,r){return o.post(`/clips/streams/${t}/ice`,{session_id:r,...n})},sendStreamRequest(t,n,r){return o.post(`/clips/streams/${t}`,{session_id:n,...r})},close(t,n){return o.delete(`/clips/streams/${t}`,{session_id:n})}}}function Y(e,a){const o=S(e,a);return{createStream(t,n){return o.post("/talks/streams",{source_url:t.source_url,driver_url:t.driver_url,face:t.face,config:t.config},n)},startConnection(t,n,r,c){return o.post(`/talks/streams/${t}/sdp`,{session_id:r,answer:n},c)},addIceCandidate(t,n,r,c){return o.post(`/talks/streams/${t}/ice`,{session_id:r,...n},c)},sendStreamRequest(t,n,r,c){return o.post(`/talks/streams/${t}`,{session_id:n,...r},c)},close(t,n,r){return o.delete(`/talks/streams/${t}`,{session_id:n},r)}}}let B=!1;const C=(e,a)=>B&&console.log(e,a),Z=(window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection).bind(window);async function L(e,{debug:a=!1,callbacks:o,auth:t,baseURL:n=p}){B=a;const r={...o},{startConnection:c,sendStreamRequest:g,close:w,createStream:m,addIceCandidate:l}=e.videoType===v.Clip?X(t,n):Y(t,n),{id:i,offer:h,ice_servers:O,session_id:$}=await m(e),u=new Z({iceServers:O}),N=u.createDataChannel("JanusDataChannel");if(!$)throw new Error("Could not create session_id");u.onicecandidate=s=>{C("peerConnection.onicecandidate",s),s.candidate&&s.candidate.sdpMid&&s.candidate.sdpMLineIndex!==null&&l(i,{candidate:s.candidate.candidate,sdpMid:s.candidate.sdpMid,sdpMLineIndex:s.candidate.sdpMLineIndex},$)},u.oniceconnectionstatechange=()=>{var s;C("peerConnection.oniceconnectionstatechange => "+u.iceConnectionState),(s=r.onConnectionStateChange)==null||s.call(r,u.iceConnectionState)},u.ontrack=s=>{var f;C("peerConnection.ontrack",s),(f=r.onSrcObjectReady)==null||f.call(r,s.streams[0])},N.onmessage=s=>{var f,_,W;if(N.readyState==="open"){const[y,j]=s.data.split(":");y===k.StreamDone?(f=r.onVideoStateChange)==null||f.call(r,A.Stop):y===k.StreamStarted?(_=r.onVideoStateChange)==null||_.call(r,A.Start):(W=r.onMessage)==null||W.call(r,y,decodeURIComponent(j))}},await u.setRemoteDescription(h),C("set remote description OK");const J=await u.createAnswer();return C("create answer OK"),await u.setLocalDescription(J),C("set local description OK"),await c(i,J,$),C("start connection OK"),{speak(s){return g(i,$,s)},async terminate(){var s,f;i&&(u&&(u.close(),u.oniceconnectionstatechange=null,u.onnegotiationneeded=null,u.onicecandidate=null,u.ontrack=null),await w(i,$).catch(_=>{}),(s=r.onConnectionStateChange)==null||s.call(r,"closed"),(f=r.onVideoStateChange)==null||f.call(r,A.Stop))},sessionId:$,streamId:i,onCallback(s,f){r[s]=f},getCallbacks(){return r}}}d.DocumentType=z,d.KnowledgeType=T,d.Providers=K,d.RateState=E,d.SocketManager=M,d.Subject=b,d.VoiceAccess=R,d.createAgentManager=Q,d.createAgentsApi=I,d.createClient=S,d.createKnowledgeApi=x,d.createStreamingManager=L,d.getAgentStreamArgs=U,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ (function(l,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(l=typeof globalThis<"u"?globalThis:l||self,w(l.index={}))})(this,function(l){"use strict";const w="https://api.d-id.com",W="wss://notifications.d-id.com";function y(e){if(e.type==="bearer")return`Bearer ${e.token}`;if(e.type==="basic")return`Basic ${btoa(`${e.username}:${e.password}`)}`;if(e.type==="key")return`Client-Key ${e.clientKey}`;throw new Error(`Unknown auth type: ${e}`)}function h(e,i=w){const a=async(t,n)=>{const r=await fetch(i+(t!=null&&t.startsWith("/")?t:`/${t}`),{...n,headers:{...n==null?void 0:n.headers,Authorization:y(e),"Content-Type":"application/json"}});if(!r.ok){let c=await r.text().catch(()=>"Failed to fetch");throw new Error(c)}return r.json()};return{get(t,n){return a(t,{...n,method:"GET"})},post(t,n,r){return a(t,{...r,body:JSON.stringify(n),method:"POST"})},delete(t,n,r){return a(t,{...r,body:JSON.stringify(n),method:"DELETE"})},patch(t,n,r){return a(t,{...r,body:JSON.stringify(n),method:"PATCH"})}}}function M(e,i=w){const a=h(e,`${i}/agents`);return{create(t,n){return a.post("/",t,n)},getAgents(t,n){return a.get(`/${t?`?tag=${t}`:""}`,n).then(r=>r??[])},getById(t,n){return a.get(`/${t}`,n)},delete(t,n){return a.delete(`/${t}`,void 0,n)},update(t,n,r){return a.patch(`/${t}`,n,r)},newChat(t,n){return a.post(`/${t}/chat`,void 0,n)},chat(t,n,r,c){return a.post(`/${t}/chat/${n}`,r,c)}}}function V(e,i=w){const a=h(e,`${i}/knowledge`);return{createKnowledge(t,n){return a.post("/",t,n)},getKnowledgeBase(t){return a.get("/",t)},getKnowledge(t,n){return a.get(`/${t}`,n)},deleteKnowledge(t,n){return a.delete(`/${t}`,void 0,n)},createDocument(t,n,r){return a.post(`/${t}/documents`,n,r)},deleteDocument(t,n,r){return a.delete(`/${t}/documents/${n}`,void 0,r)},getDocuments(t,n){return a.get(`/${t}/documents`,n)},getDocument(t,n,r){return a.get(`/${t}/documents/${n}`,r)},getRecords(t,n,r){return a.get(`/${t}/documents/${n}/records`,r)},query(t,n,r){return a.post(`/${t}/query`,{query:n},r)}}}const x=e=>new Promise(i=>setTimeout(i,e));function D(e){return new Promise((i,a)=>{const{callbacks:t,host:n,auth:r}=e,{onMessage:c=null,onOpen:m=null,onClose:p=null,onError:u=null}=t||{},o=new WebSocket(`${n}?authorization=${y(r)}`);o.onmessage=c,o.onclose=p,o.onerror=d=>{console.log(d),u==null||u(d),a(d)},o.onopen=d=>{m==null||m(d),i(o)}})}async function F(e){const{retries:i=1}=e;let a=null;for(let t=0;(a==null?void 0:a.readyState)!==WebSocket.OPEN;t++)try{a=await D(e)}catch(n){if(t===i)throw n;await x(t*500)}return a}async function P(e,i=W){const a=[],t=await F({auth:e,host:i,callbacks:{onMessage:n=>{a.forEach(r=>r(n))}}});return{socket:t,terminate:()=>t.close(),subscribeToEvents:n=>a.push(n)}}var I=(e=>(e.Amazon="amazon",e.Microsoft="microsoft",e.Afflorithmics="afflorithmics",e.Elevenlabs="elevenlabs",e))(I||{}),K=(e=>(e.Public="public",e.Premium="premium",e.Private="private",e))(K||{}),v=(e=>(e.Start="START",e.Stop="STOP",e))(v||{}),A=(e=>(e.ChatAnswer="chat/answer",e.ChatPartial="chat/partial",e.StreamDone="stream/done",e.StreamStarted="stream/started",e))(A||{}),R=(e=>(e.Unrated="Unrated",e.Positive="Positive",e.Negative="Negative",e))(R||{}),E=(e=>(e.KnowledgeProcessing="knowledge/processing",e.KnowledgeIndexing="knowledge/indexing",e.KnowledgeFailed="knowledge/error",e.KnowledgeDone="knowledge/done",e))(E||{}),T=(e=>(e.Knowledge="knowledge",e.Document="document",e.Record="record",e))(T||{}),b=(e=>(e.Pdf="pdf",e.Text="text",e.Html="html",e.Word="word",e.Json="json",e.Markdown="markdown",e.Csv="csv",e.Excel="excel",e.Powerpoint="powerpoint",e.Archive="archive",e.Image="image",e.Audio="audio",e.Video="video",e))(b||{}),$=(e=>(e.Clip="clip",e.Talk="talk",e))($||{});function H(e,i=w){const a=h(e,`${i}/chats/ratings`);return{create(t,n){return a.post("/",t,n)},getByKnowledge(t,n){return a.get(`/${t}`,n).then(r=>r??[])},update(t,n,r){return a.patch(`/${t}`,n,r)},delete(t,n){return a.delete(`/${t}`,n)}}}function z(e){return e.presenter.type===$.Clip?{videoType:$.Clip,driver_id:e.presenter.driver_id,presenter_id:e.presenter.presenter_id}:{videoType:$.Talk,source_url:e.presenter.source_url}}function U(e,i,a,t){return new Promise(async(n,r)=>{const c=await B(z(e),{...i,callbacks:{...i.callbacks,onConnectionStateChange:async m=>{var p,u;m==="connected"?(t||(t=await a.newChat(e.id)),n({chat:t,streamingManager:c})):m==="failed"&&r(new Error("Cannot create connection")),(u=(p=i.callbacks).onConnectionStateChange)==null||u.call(p,m)}}})})}async function G(e,i){const a=i.baseURL||w,t=new AbortController,n=M(i.auth,a),r=H(i.auth,a),c=await n.getById(e),m=await P(i.auth);let{chat:p,streamingManager:u}=await U(c,i,n);return{agent:c,async reconnectToChat(){const{streamingManager:o}=await U(c,i,n,p);u=o},terminate(){return t.abort(),m.terminate(),u.terminate()},chatId:p.id,chat(o){return n.chat(e,p.id,{sessionId:u.sessionId,streamId:u.streamId,messages:o},{signal:t.signal})},rate(o,d){return d?r.update(d,o):r.create(o)},speak(o){if(!c)throw new Error("Agent not initializated");let d;return o.type==="text"?d={script:{type:"text",provider:o.provider,input:o.input,ssml:o.ssml||!1}}:o.type==="audio"&&(d={script:{type:"audio",audio_url:o.audio_url}}),u.speak(d)},onChatEvents(o){m.subscribeToEvents(o)},onConnectionEvents(o){u.onCallback("onConnectionStateChange",o)},onVideoEvents(o){u.onCallback("onVideoStateChange",o)}}}function Q(e,i){const a=h(e,i);return{createStream(t){return a.post("/clips/streams",{driver_id:t.driver_id,presenter_id:t.presenter_id,compatibility_mode:t.compatibility_mode})},startConnection(t,n,r){return a.post(`/clips/streams/${t}/sdp`,{session_id:r,answer:n})},addIceCandidate(t,n,r){return a.post(`/clips/streams/${t}/ice`,{session_id:r,...n})},sendStreamRequest(t,n,r){return a.post(`/clips/streams/${t}`,{session_id:n,...r})},close(t,n){return a.delete(`/clips/streams/${t}`,{session_id:n})}}}function X(e,i){const a=h(e,i);return{createStream(t,n){return a.post("/talks/streams",{source_url:t.source_url,driver_url:t.driver_url,face:t.face,config:t.config},n)},startConnection(t,n,r,c){return a.post(`/talks/streams/${t}/sdp`,{session_id:r,answer:n},c)},addIceCandidate(t,n,r,c){return a.post(`/talks/streams/${t}/ice`,{session_id:r,...n},c)},sendStreamRequest(t,n,r,c){return a.post(`/talks/streams/${t}`,{session_id:n,...r},c)},close(t,n,r){return a.delete(`/talks/streams/${t}`,{session_id:n},r)}}}let q=!1;const C=(e,i)=>q&&console.log(e,i),Y=(window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection).bind(window);async function B(e,{debug:i=!1,callbacks:a,auth:t,baseURL:n=w}){q=i;const r={...a},{startConnection:c,sendStreamRequest:m,close:p,createStream:u,addIceCandidate:o}=e.videoType===$.Clip?Q(t,n):X(t,n),{id:d,offer:Z,ice_servers:O,session_id:S}=await u(e),g=new Y({iceServers:O}),L=g.createDataChannel("JanusDataChannel");if(!S)throw new Error("Could not create session_id");g.onicecandidate=s=>{C("peerConnection.onicecandidate",s),s.candidate&&s.candidate.sdpMid&&s.candidate.sdpMLineIndex!==null&&o(d,{candidate:s.candidate.candidate,sdpMid:s.candidate.sdpMid,sdpMLineIndex:s.candidate.sdpMLineIndex},S)},g.oniceconnectionstatechange=()=>{var s;C("peerConnection.oniceconnectionstatechange => "+g.iceConnectionState),(s=r.onConnectionStateChange)==null||s.call(r,g.iceConnectionState)},g.ontrack=s=>{var f;C("peerConnection.ontrack",s),(f=r.onSrcObjectReady)==null||f.call(r,s.streams[0])},L.onmessage=s=>{var f,_,J;if(L.readyState==="open"){const[k,j]=s.data.split(":");k===A.StreamDone?(f=r.onVideoStateChange)==null||f.call(r,v.Stop):k===A.StreamStarted?(_=r.onVideoStateChange)==null||_.call(r,v.Start):(J=r.onMessage)==null||J.call(r,k,decodeURIComponent(j))}},await g.setRemoteDescription(Z),C("set remote description OK");const N=await g.createAnswer();return C("create answer OK"),await g.setLocalDescription(N),C("set local description OK"),await c(d,N,S),C("start connection OK"),{speak(s){return m(d,S,s)},async terminate(){var s,f;d&&(g&&(g.close(),g.oniceconnectionstatechange=null,g.onnegotiationneeded=null,g.onicecandidate=null,g.ontrack=null),await p(d,S).catch(_=>{}),(s=r.onConnectionStateChange)==null||s.call(r,"closed"),(f=r.onVideoStateChange)==null||f.call(r,v.Stop))},sessionId:S,streamId:d,onCallback(s,f){r[s]=f}}}l.DocumentType=b,l.KnowledgeType=T,l.Providers=I,l.RateState=R,l.SocketManager=P,l.Subject=E,l.VoiceAccess=K,l.createAgentManager=G,l.createAgentsApi=M,l.createClient=h,l.createKnowledgeApi=V,l.createStreamingManager=B,l.getAgentStreamArgs=z,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
@@ -4,4 +4,4 @@ export * from './lib/api/knowledge';
4
4
  export * from './lib/connectToSocket';
5
5
  export * from './lib/createAgentManager';
6
6
  export * from './lib/createStreamingManager';
7
- export * from '../types/index';
7
+ export * from './types/index';
@@ -1,4 +1,4 @@
1
- import { Agent, AgentPayload, Auth, Chat, ChatPayload, ChatResponse } from '../../../types/index';
1
+ import { Agent, AgentPayload, Auth, Chat, ChatPayload, ChatResponse } from '../../types/index';
2
2
  export declare function createAgentsApi(auth: Auth, host?: string): {
3
3
  create(payload: AgentPayload, options?: RequestInit): Promise<Agent>;
4
4
  getAgents(tag?: string, options?: RequestInit): Promise<Agent[]>;
@@ -1,2 +1,2 @@
1
- import { Auth, RtcApi } from '../../../types/index';
1
+ import { Auth, RtcApi } from '../../types/index';
2
2
  export declare function createApi(auth: Auth, host: string): RtcApi;
@@ -1,4 +1,4 @@
1
- import { Auth } from '../../../types/auth';
1
+ import { Auth } from '../../types/auth';
2
2
  export declare function createClient(auth: Auth, host?: string): {
3
3
  get<T = any>(url: string, options?: RequestInit): Promise<T>;
4
4
  post<T_1 = any>(url: string, body?: any, options?: RequestInit): Promise<T_1>;
@@ -1,4 +1,4 @@
1
- import { Auth, CreateDocumentPayload, DocumentData, KnowledgeData, KnowledgePayload, QueryResult, RecordData } from '../../../types/index';
1
+ import { Auth, CreateDocumentPayload, DocumentData, KnowledgeData, KnowledgePayload, QueryResult, RecordData } from '../../types/index';
2
2
  export declare function createKnowledgeApi(auth: Auth, host?: string): {
3
3
  createKnowledge(payload: KnowledgePayload, options?: RequestInit): Promise<KnowledgeData>;
4
4
  getKnowledgeBase(options?: RequestInit): Promise<KnowledgeData[]>;
@@ -1,2 +1,2 @@
1
- import { Auth, RtcApi } from '../../../types/index';
1
+ import { Auth, RtcApi } from '../../types/index';
2
2
  export declare function createApi(auth: Auth, host: string): RtcApi;
@@ -1,2 +1,2 @@
1
- import { Auth } from '../../../types/auth';
1
+ import { Auth } from '../../types/auth';
2
2
  export declare function getAuthHeader(auth: Auth): string;
@@ -1,4 +1,4 @@
1
- import { Auth } from '../../types/auth';
1
+ import { Auth } from '../types/auth';
2
2
  interface SocketManager {
3
3
  socket?: WebSocket;
4
4
  terminate: () => void;
@@ -1,4 +1,4 @@
1
- import { Agent, AgentManagerOptions, AgentsManagerAPI, CreateStreamOptions } from '../../types/index';
1
+ import { Agent, AgentManagerOptions, AgentsManagerAPI, CreateStreamOptions } from '../types/index';
2
2
  export declare function getAgentStreamArgs(agent: Agent): CreateStreamOptions;
3
3
  /**
4
4
  * Creates a new Agent Manager instance for interacting with an agent, chat, and related connections.
@@ -1,10 +1,10 @@
1
- import { CreateStreamOptions, ManagerCallbacks, PayloadType, StreamingManagerOptions } from '../../types/index';
1
+ import { CreateStreamOptions, ManagerCallbacks, PayloadType, StreamingManagerOptions } from '../types/index';
2
2
  export declare function createStreamingManager<T extends CreateStreamOptions>(agent: T, { debug, callbacks, auth, baseURL }: StreamingManagerOptions): Promise<{
3
3
  /**
4
4
  * Method to send request to server to get clip or talk depend on you payload
5
5
  * @param payload
6
6
  */
7
- speak(payload: PayloadType<T>): Promise<import('../../types/index').SendStreamPayloadResponse>;
7
+ speak(payload: PayloadType<T>): Promise<import('../types/index').SendStreamPayloadResponse>;
8
8
  /**
9
9
  * Method to close RTC connection
10
10
  */
@@ -23,9 +23,5 @@ export declare function createStreamingManager<T extends CreateStreamOptions>(ag
23
23
  * @param callback
24
24
  */
25
25
  onCallback<T_1 extends keyof ManagerCallbacks>(eventName: T_1, callback: ManagerCallbacks[T_1]): void;
26
- /**
27
- * existing callback is internal method to pass calbacks added after create in new connection
28
- */
29
- getCallbacks(): ManagerCallbacks;
30
26
  }>;
31
27
  export type StreamingManager<T extends CreateStreamOptions> = Awaited<ReturnType<typeof createStreamingManager<T>>>;
@@ -1,2 +1,7 @@
1
- export declare const didApiUrl = "https://api-dev.d-id.com";
2
- export declare const didSocketApiUrl = "wss://notifications.d-id.com";
1
+ export declare const nodeEnv: string;
2
+ export declare const didApiUrl: string;
3
+ export declare const didSocketApiUrl: string;
4
+ export declare const mixpanelKey: string;
5
+ export declare const clientKey: string;
6
+ export declare const agentId: string;
7
+ export declare const externalId = "temp";
@@ -1,4 +1,4 @@
1
- import { SupportedStreamScipt } from '../../StreamScript';
1
+ import { SupportedStreamScipt } from '../../../types/StreamScript';
2
2
  import { Auth } from '../../auth';
3
3
  import { SendStreamPayloadResponse, StreamingState } from '../../stream';
4
4
  import { Agent } from './agent';
@@ -3,4 +3,4 @@ export * from './tts';
3
3
  export * from './stream';
4
4
  export * from './auth';
5
5
  export * from './entities';
6
- export * from '../src';
6
+ export * from '..';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d-id/client-sdk",
3
3
  "private": false,
4
- "version": "1.0.18-beta.5",
4
+ "version": "1.0.18-beta.7",
5
5
  "type": "module",
6
6
  "description": "d-id client sdk",
7
7
  "repository": {
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "main": "./dist/index.umd.cjs",
22
22
  "module": "./dist/index.js",
23
- "types": "./dist/types/index.d.ts",
23
+ "types": "./dist/src/types/index.d.ts",
24
24
  "scripts": {
25
25
  "dev": "vite",
26
26
  "build": "node ./infra/build.js -m production",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes