@avaturn-live/web-sdk 0.1.2 → 0.1.3

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/main.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare class AvaturnHead implements IAvaturnHead {
5
5
  inited: boolean;
6
6
  mediaStream: MediaStream;
7
7
  session_id: string;
8
+ protected shadow: ShadowRoot | null;
8
9
  protected frameHandle: ReturnType<typeof requestAnimationFrame>;
9
10
  protected rootElement?: HTMLElement;
10
11
  protected abortController: AbortController;
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var ea = Object.defineProperty;
2
2
  var ta = (t, e, n) => e in t ? ea(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var Y = (t, e, n) => ta(t, typeof e != "symbol" ? e + "" : e, n);
3
+ var W = (t, e, n) => ta(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  function Gr(t, e) {
5
5
  if (t == null) return {};
6
6
  var n, r, i = function(a, c) {
@@ -5143,8 +5143,8 @@ var Rl = function(t) {
5143
5143
  this._remoteParticipantsAudioLevel = o.participantsAudioLevel, this._preloadCache.remoteParticipantsAudioLevelObserver = null, this.emitDailyJSEvent(o);
5144
5144
  break;
5145
5145
  case Nc:
5146
- var W = o.session_id;
5147
- this._rmpPlayerState[W] = o.playerState, this.emitDailyJSEvent(o);
5146
+ var Y = o.session_id;
5147
+ this._rmpPlayerState[Y] = o.playerState, this.emitDailyJSEvent(o);
5148
5148
  break;
5149
5149
  case Ic:
5150
5150
  delete this._rmpPlayerState[o.session_id], this.emitDailyJSEvent(o);
@@ -5301,10 +5301,10 @@ var Rl = function(t) {
5301
5301
  if (!((u = o.error) !== null && u !== void 0 && u.type && !["connection-error", "end-of-life", "no-room"].includes(o.error.type))) {
5302
5302
  var C = (d = this.properties) !== null && d !== void 0 && d.url ? new URL(this.properties.url) : void 0, x = "production";
5303
5303
  C && C.host.includes(".staging.daily") && (x = "staging");
5304
- var H, G, be, Te, we, _n = new za({ dsn: "https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844", transport: Ha, integrations: [new Ui.GlobalHandlers({ onunhandledrejection: !1 }), new Ui.HttpContext()], environment: x }), W = new br(_n, void 0, re.version());
5305
- if (this.session_id && W.setExtra("sessionId", this.session_id), this.properties) {
5304
+ var H, G, be, Te, we, _n = new za({ dsn: "https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844", transport: Ha, integrations: [new Ui.GlobalHandlers({ onunhandledrejection: !1 }), new Ui.HttpContext()], environment: x }), Y = new br(_n, void 0, re.version());
5305
+ if (this.session_id && Y.setExtra("sessionId", this.session_id), this.properties) {
5306
5306
  var ge = P({}, this.properties);
5307
- ge.userName = ge.userName ? "[Filtered]" : void 0, ge.userData = ge.userData ? "[Filtered]" : void 0, ge.token = ge.token ? "[Filtered]" : void 0, W.setExtra("properties", ge);
5307
+ ge.userName = ge.userName ? "[Filtered]" : void 0, ge.userData = ge.userData ? "[Filtered]" : void 0, ge.token = ge.token ? "[Filtered]" : void 0, Y.setExtra("properties", ge);
5308
5308
  }
5309
5309
  if (C) {
5310
5310
  var je = C.searchParams.get("domain");
@@ -5312,11 +5312,11 @@ var Rl = function(t) {
5312
5312
  var xt = C.host.match(/(.*?)\./);
5313
5313
  je = xt && xt[1] || "";
5314
5314
  }
5315
- je && W.setTag("domain", je);
5315
+ je && Y.setTag("domain", je);
5316
5316
  }
5317
- o.error && (W.setTag("fatalErrorType", o.error.type), W.setExtra("errorDetails", o.error.details), !((H = o.error.details) === null || H === void 0) && H.uri && W.setTag("serverAddress", o.error.details.uri), !((G = o.error.details) === null || G === void 0) && G.workerGroup && W.setTag("workerGroup", o.error.details.workerGroup), !((be = o.error.details) === null || be === void 0) && be.geoGroup && W.setTag("geoGroup", o.error.details.geoGroup), !((Te = o.error.details) === null || Te === void 0) && Te.on && W.setTag("connectionAttempt", o.error.details.on), (we = o.error.details) !== null && we !== void 0 && we.bundleUrl && (W.setTag("bundleUrl", o.error.details.bundleUrl), W.setTag("bundleError", o.error.details.sourceError.type))), W.setTags({ callMode: this._callObjectMode ? N() ? "reactNative" : (g = this.properties) !== null && g !== void 0 && (m = g.dailyConfig) !== null && m !== void 0 && (w = m.callMode) !== null && w !== void 0 && w.includes("prebuilt") ? this.properties.dailyConfig.callMode : "custom" : "prebuilt-frame", version: re.version() });
5317
+ o.error && (Y.setTag("fatalErrorType", o.error.type), Y.setExtra("errorDetails", o.error.details), !((H = o.error.details) === null || H === void 0) && H.uri && Y.setTag("serverAddress", o.error.details.uri), !((G = o.error.details) === null || G === void 0) && G.workerGroup && Y.setTag("workerGroup", o.error.details.workerGroup), !((be = o.error.details) === null || be === void 0) && be.geoGroup && Y.setTag("geoGroup", o.error.details.geoGroup), !((Te = o.error.details) === null || Te === void 0) && Te.on && Y.setTag("connectionAttempt", o.error.details.on), (we = o.error.details) !== null && we !== void 0 && we.bundleUrl && (Y.setTag("bundleUrl", o.error.details.bundleUrl), Y.setTag("bundleError", o.error.details.sourceError.type))), Y.setTags({ callMode: this._callObjectMode ? N() ? "reactNative" : (g = this.properties) !== null && g !== void 0 && (m = g.dailyConfig) !== null && m !== void 0 && (w = m.callMode) !== null && w !== void 0 && w.includes("prebuilt") ? this.properties.dailyConfig.callMode : "custom" : "prebuilt-frame", version: re.version() });
5318
5318
  var bn = ((E = o.error) === null || E === void 0 ? void 0 : E.msg) || o.errorMsg;
5319
- W.run(function(Zo) {
5319
+ Y.run(function(Zo) {
5320
5320
  Zo.captureException(new Error(bn));
5321
5321
  });
5322
5322
  }
@@ -7371,17 +7371,18 @@ class ud {
7371
7371
  * @param param2 Configuration options if the first parameter is a DOM element.
7372
7372
  */
7373
7373
  constructor(e, n) {
7374
- Y(this, "inited", !1);
7375
- Y(this, "mediaStream");
7376
- Y(this, "session_id", "");
7377
- Y(this, "frameHandle", 0);
7378
- Y(this, "rootElement");
7379
- Y(this, "abortController");
7380
- Y(this, "timeout", 0);
7381
- Y(this, "keepAlive", !1);
7382
- Y(this, "fetcher");
7383
- Y(this, "call");
7384
- Y(this, "handlers", {});
7374
+ W(this, "inited", !1);
7375
+ W(this, "mediaStream");
7376
+ W(this, "session_id", "");
7377
+ W(this, "shadow", null);
7378
+ W(this, "frameHandle", 0);
7379
+ W(this, "rootElement");
7380
+ W(this, "abortController");
7381
+ W(this, "timeout", 0);
7382
+ W(this, "keepAlive", !1);
7383
+ W(this, "fetcher");
7384
+ W(this, "call");
7385
+ W(this, "handlers", {});
7385
7386
  if (typeof window > "u")
7386
7387
  throw new Error("Unfortunately, SDK only works on the client side.");
7387
7388
  const [{ apiHost: r = Qo, sessionToken: i, preloadBundle: s, preconnect: a, keepAlive: c }, l] = this.parseConfig(e, n);
@@ -7416,7 +7417,8 @@ class ud {
7416
7417
  drawUI(e) {
7417
7418
  if (!this.rootElement || this.inited)
7418
7419
  return;
7419
- const n = this.rootElement.attachShadow({ mode: "closed" }), r = new CSSStyleSheet();
7420
+ this.shadow || (this.shadow = this.rootElement.attachShadow({ mode: "closed" }));
7421
+ const n = this.shadow, r = new CSSStyleSheet();
7420
7422
  r.replaceSync(`
7421
7423
  :host {
7422
7424
  display: inline-block;
@@ -7499,16 +7501,15 @@ class ud {
7499
7501
  this.handlers[e] && (this.handlers[e] = this.handlers[e].filter((r) => r !== n));
7500
7502
  }
7501
7503
  async dispose() {
7502
- var e;
7503
- this.inited = !1, this.mediaStream = new MediaStream(), this.inited = !1, this.timeout && clearTimeout(this.timeout), this.frameHandle && cancelAnimationFrame(this.frameHandle), await ((e = this.call) == null ? void 0 : e.destroy()), this.abortController.abort();
7504
+ this.inited = !1, this.mediaStream = new MediaStream(), this.timeout && clearTimeout(this.timeout), this.frameHandle && cancelAnimationFrame(this.frameHandle), await this.call.leave(), this.abortController.abort(), this.abortController = new AbortController(), this.fetcher.defaults.signal = this.abortController.signal;
7504
7505
  }
7505
7506
  }
7506
7507
  class hd extends ud {
7507
7508
  constructor(n) {
7508
7509
  super(n);
7509
- Y(this, "assistantSessionToken", "");
7510
- Y(this, "assistantFetcher");
7511
- Y(this, "sessionToken", "");
7510
+ W(this, "assistantSessionToken", "");
7511
+ W(this, "assistantFetcher");
7512
+ W(this, "sessionToken", "");
7512
7513
  this.assistantSessionToken = n.assistantSessionToken, this.sessionToken = n.sessionToken, this.assistantFetcher = $.create({
7513
7514
  baseURL: `${n.apiHost || Qo}/`,
7514
7515
  headers: {
@@ -7555,7 +7556,7 @@ class hd extends ud {
7555
7556
  }
7556
7557
  async dispose() {
7557
7558
  var n;
7558
- this.inited = !1, this.mediaStream = new MediaStream(), this.timeout && clearTimeout(this.timeout), await ((n = this.call) == null ? void 0 : n.destroy()), await this.assistantFetcher.delete("/assistants/sessions"), this.abortController.abort();
7559
+ this.inited = !1, this.mediaStream = new MediaStream(), this.timeout && clearTimeout(this.timeout), await ((n = this.call) == null ? void 0 : n.leave()), await this.assistantFetcher.delete("/assistants/sessions"), this.abortController.abort(), this.abortController = new AbortController(), this.fetcher.defaults.signal = this.abortController.signal;
7559
7560
  }
7560
7561
  }
7561
7562
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@avaturn-live/web-sdk",
3
3
  "private": false,
4
- "version": "0.1.2",
4
+ "version": "0.1.3",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",