cogito-client 1.0.71 → 1.0.73
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/index.d.ts +5 -0
- package/dist/index.js +69 -67
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,11 @@ export declare interface CogitoConfig {
|
|
|
222
222
|
[k: string]: unknown;
|
|
223
223
|
};
|
|
224
224
|
agents: CogitoAgent[];
|
|
225
|
+
voice?: {
|
|
226
|
+
inactivityTimeout?: number;
|
|
227
|
+
inactivityMessage?: string;
|
|
228
|
+
[k: string]: unknown;
|
|
229
|
+
};
|
|
225
230
|
webhooks?: {
|
|
226
231
|
events: ("message" | "call-completed" | "call-started" | "logs")[];
|
|
227
232
|
uri: string;
|
package/dist/index.js
CHANGED
|
@@ -1977,7 +1977,7 @@ const p = Ao(
|
|
|
1977
1977
|
}
|
|
1978
1978
|
}
|
|
1979
1979
|
);
|
|
1980
|
-
class
|
|
1980
|
+
class ge extends wn {
|
|
1981
1981
|
constructor(e) {
|
|
1982
1982
|
super(), this.seconds = Q.zero, this.nanos = 0, p.util.initPartial(e, this);
|
|
1983
1983
|
}
|
|
@@ -2011,31 +2011,31 @@ class pe extends wn {
|
|
|
2011
2011
|
return new Date(Number(this.seconds) * 1e3 + Math.ceil(this.nanos / 1e6));
|
|
2012
2012
|
}
|
|
2013
2013
|
static now() {
|
|
2014
|
-
return
|
|
2014
|
+
return ge.fromDate(/* @__PURE__ */ new Date());
|
|
2015
2015
|
}
|
|
2016
2016
|
static fromDate(e) {
|
|
2017
2017
|
const t = e.getTime();
|
|
2018
|
-
return new
|
|
2018
|
+
return new ge({
|
|
2019
2019
|
seconds: Q.parse(Math.floor(t / 1e3)),
|
|
2020
2020
|
nanos: t % 1e3 * 1e6
|
|
2021
2021
|
});
|
|
2022
2022
|
}
|
|
2023
2023
|
static fromBinary(e, t) {
|
|
2024
|
-
return new
|
|
2024
|
+
return new ge().fromBinary(e, t);
|
|
2025
2025
|
}
|
|
2026
2026
|
static fromJson(e, t) {
|
|
2027
|
-
return new
|
|
2027
|
+
return new ge().fromJson(e, t);
|
|
2028
2028
|
}
|
|
2029
2029
|
static fromJsonString(e, t) {
|
|
2030
|
-
return new
|
|
2030
|
+
return new ge().fromJsonString(e, t);
|
|
2031
2031
|
}
|
|
2032
2032
|
static equals(e, t) {
|
|
2033
|
-
return p.util.equals(
|
|
2033
|
+
return p.util.equals(ge, e, t);
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2036
|
+
ge.runtime = p;
|
|
2037
|
+
ge.typeName = "google.protobuf.Timestamp";
|
|
2038
|
+
ge.fields = p.util.newFieldList(() => [{
|
|
2039
2039
|
no: 1,
|
|
2040
2040
|
name: "seconds",
|
|
2041
2041
|
kind: "scalar",
|
|
@@ -2058,7 +2058,7 @@ const Ko = /* @__PURE__ */ p.makeMessageType("livekit.MetricsBatch", () => [{
|
|
|
2058
2058
|
no: 2,
|
|
2059
2059
|
name: "normalized_timestamp",
|
|
2060
2060
|
kind: "message",
|
|
2061
|
-
T:
|
|
2061
|
+
T: ge
|
|
2062
2062
|
}, {
|
|
2063
2063
|
no: 3,
|
|
2064
2064
|
name: "str_data",
|
|
@@ -2117,7 +2117,7 @@ const Ko = /* @__PURE__ */ p.makeMessageType("livekit.MetricsBatch", () => [{
|
|
|
2117
2117
|
no: 2,
|
|
2118
2118
|
name: "normalized_timestamp",
|
|
2119
2119
|
kind: "message",
|
|
2120
|
-
T:
|
|
2120
|
+
T: ge
|
|
2121
2121
|
}, {
|
|
2122
2122
|
no: 3,
|
|
2123
2123
|
name: "value",
|
|
@@ -2158,12 +2158,12 @@ const Ko = /* @__PURE__ */ p.makeMessageType("livekit.MetricsBatch", () => [{
|
|
|
2158
2158
|
no: 6,
|
|
2159
2159
|
name: "normalized_start_timestamp",
|
|
2160
2160
|
kind: "message",
|
|
2161
|
-
T:
|
|
2161
|
+
T: ge
|
|
2162
2162
|
}, {
|
|
2163
2163
|
no: 7,
|
|
2164
2164
|
name: "normalized_end_timestamp",
|
|
2165
2165
|
kind: "message",
|
|
2166
|
-
T:
|
|
2166
|
+
T: ge,
|
|
2167
2167
|
opt: !0
|
|
2168
2168
|
}, {
|
|
2169
2169
|
no: 8,
|
|
@@ -6896,7 +6896,7 @@ function Gc() {
|
|
|
6896
6896
|
Gc({
|
|
6897
6897
|
window: typeof window > "u" ? void 0 : window
|
|
6898
6898
|
});
|
|
6899
|
-
class
|
|
6899
|
+
class ve extends Promise {
|
|
6900
6900
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
6901
6901
|
constructor(e) {
|
|
6902
6902
|
super(e);
|
|
@@ -6916,7 +6916,7 @@ class ge extends Promise {
|
|
|
6916
6916
|
}
|
|
6917
6917
|
const Jc = /version\/(\d+(\.?_?\d+)+)/i;
|
|
6918
6918
|
let Bi;
|
|
6919
|
-
function
|
|
6919
|
+
function ye(n) {
|
|
6920
6920
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
|
|
6921
6921
|
if (typeof navigator > "u")
|
|
6922
6922
|
return;
|
|
@@ -7501,10 +7501,10 @@ class T extends je.EventEmitter {
|
|
|
7501
7501
|
});
|
|
7502
7502
|
}
|
|
7503
7503
|
addAppVisibilityListener() {
|
|
7504
|
-
|
|
7504
|
+
be() ? (this.isInBackground = document.visibilityState === "hidden", document.addEventListener("visibilitychange", this.appVisibilityChangedListener)) : this.isInBackground = !1;
|
|
7505
7505
|
}
|
|
7506
7506
|
removeAppVisibilityListener() {
|
|
7507
|
-
|
|
7507
|
+
be() && document.removeEventListener("visibilitychange", this.appVisibilityChangedListener);
|
|
7508
7508
|
}
|
|
7509
7509
|
}
|
|
7510
7510
|
function yt(n, e) {
|
|
@@ -7607,7 +7607,7 @@ function hd(n) {
|
|
|
7607
7607
|
return e.length > 1 ? [e[0], n.substr(e[0].length + 1)] : [n, ""];
|
|
7608
7608
|
}
|
|
7609
7609
|
function ce(n) {
|
|
7610
|
-
return new
|
|
7610
|
+
return new ve((e) => oe.setTimeout(e, n));
|
|
7611
7611
|
}
|
|
7612
7612
|
function bn() {
|
|
7613
7613
|
return "addTransceiver" in RTCPeerConnection.prototype;
|
|
@@ -7633,7 +7633,7 @@ function md() {
|
|
|
7633
7633
|
if (!("getCapabilities" in RTCRtpSender) || ht())
|
|
7634
7634
|
return !1;
|
|
7635
7635
|
if (ft()) {
|
|
7636
|
-
const t =
|
|
7636
|
+
const t = ye();
|
|
7637
7637
|
if (t?.version && Fe(t.version, "16") < 0 || t?.os === "iOS" && t?.osVersion && Fe(t.osVersion, "16") < 0)
|
|
7638
7638
|
return !1;
|
|
7639
7639
|
}
|
|
@@ -7659,40 +7659,40 @@ function pd() {
|
|
|
7659
7659
|
}
|
|
7660
7660
|
function ht() {
|
|
7661
7661
|
var n;
|
|
7662
|
-
return ((n =
|
|
7662
|
+
return ((n = ye()) === null || n === void 0 ? void 0 : n.name) === "Firefox";
|
|
7663
7663
|
}
|
|
7664
7664
|
function xs() {
|
|
7665
|
-
const n =
|
|
7665
|
+
const n = ye();
|
|
7666
7666
|
return !!n && n.name === "Chrome" && n.os !== "iOS";
|
|
7667
7667
|
}
|
|
7668
7668
|
function ft() {
|
|
7669
7669
|
var n;
|
|
7670
|
-
return ((n =
|
|
7670
|
+
return ((n = ye()) === null || n === void 0 ? void 0 : n.name) === "Safari";
|
|
7671
7671
|
}
|
|
7672
7672
|
function Yt() {
|
|
7673
|
-
const n =
|
|
7673
|
+
const n = ye();
|
|
7674
7674
|
return n?.name === "Safari" || n?.os === "iOS";
|
|
7675
7675
|
}
|
|
7676
7676
|
function gd() {
|
|
7677
|
-
const n =
|
|
7677
|
+
const n = ye();
|
|
7678
7678
|
return n?.name === "Safari" && n.version.startsWith("17.") || n?.os === "iOS" && !!n?.osVersion && Fe(n.osVersion, "17") >= 0;
|
|
7679
7679
|
}
|
|
7680
7680
|
function vd(n) {
|
|
7681
|
-
return n || (n =
|
|
7681
|
+
return n || (n = ye()), n?.name === "Safari" && Fe(n.version, "18.3") > 0 || n?.os === "iOS" && !!n?.osVersion && Fe(n.osVersion, "18.3") > 0;
|
|
7682
7682
|
}
|
|
7683
7683
|
function Aa() {
|
|
7684
7684
|
var n, e;
|
|
7685
|
-
return
|
|
7685
|
+
return be() ? (
|
|
7686
7686
|
// @ts-expect-error `userAgentData` is not yet part of typescript
|
|
7687
7687
|
(e = (n = navigator.userAgentData) === null || n === void 0 ? void 0 : n.mobile) !== null && e !== void 0 ? e : /Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent)
|
|
7688
7688
|
) : !1;
|
|
7689
7689
|
}
|
|
7690
7690
|
function bd() {
|
|
7691
|
-
const n =
|
|
7691
|
+
const n = ye(), e = "17.2";
|
|
7692
7692
|
if (n)
|
|
7693
7693
|
return n.name !== "Safari" && n.os !== "iOS" || n.os === "iOS" && n.osVersion && Fe(n.osVersion, e) >= 0 ? !0 : n.name === "Safari" && Fe(n.version, e) >= 0;
|
|
7694
7694
|
}
|
|
7695
|
-
function
|
|
7695
|
+
function be() {
|
|
7696
7696
|
return typeof document < "u";
|
|
7697
7697
|
}
|
|
7698
7698
|
function Ue() {
|
|
@@ -7716,7 +7716,7 @@ function La() {
|
|
|
7716
7716
|
return n.platform;
|
|
7717
7717
|
}
|
|
7718
7718
|
function As() {
|
|
7719
|
-
if (
|
|
7719
|
+
if (be())
|
|
7720
7720
|
return window.devicePixelRatio;
|
|
7721
7721
|
if (Ue()) {
|
|
7722
7722
|
let n = Na();
|
|
@@ -8557,7 +8557,7 @@ class Kd {
|
|
|
8557
8557
|
} = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
8558
8558
|
return r.close(a, c);
|
|
8559
8559
|
};
|
|
8560
|
-
this.opened = new
|
|
8560
|
+
this.opened = new ve((a, c) => {
|
|
8561
8561
|
const d = () => {
|
|
8562
8562
|
c(L.websocket("Encountered websocket error during connection establishment"));
|
|
8563
8563
|
};
|
|
@@ -8587,15 +8587,15 @@ class Kd {
|
|
|
8587
8587
|
extensions: r.extensions
|
|
8588
8588
|
}), r.removeEventListener("error", d);
|
|
8589
8589
|
}, r.addEventListener("error", d);
|
|
8590
|
-
}), this.closed = new
|
|
8590
|
+
}), this.closed = new ve((a, c) => {
|
|
8591
8591
|
const d = () => f(this, void 0, void 0, function* () {
|
|
8592
|
-
const l = new
|
|
8592
|
+
const l = new ve((h) => {
|
|
8593
8593
|
r.readyState !== WebSocket.CLOSED && r.addEventListener("close", (m) => {
|
|
8594
8594
|
h(m);
|
|
8595
8595
|
}, {
|
|
8596
8596
|
once: !0
|
|
8597
8597
|
});
|
|
8598
|
-
}), u = yield
|
|
8598
|
+
}), u = yield ve.race([ce(250), l]);
|
|
8599
8599
|
u ? a(u) : c(L.websocket("Encountered unspecified websocket error without a timely close event"));
|
|
8600
8600
|
});
|
|
8601
8601
|
r.onclose = (l) => {
|
|
@@ -10379,7 +10379,7 @@ class rl {
|
|
|
10379
10379
|
}
|
|
10380
10380
|
negotiate(e) {
|
|
10381
10381
|
return f(this, void 0, void 0, function* () {
|
|
10382
|
-
return new
|
|
10382
|
+
return new ve((t, i) => f(this, void 0, void 0, function* () {
|
|
10383
10383
|
const s = setTimeout(() => {
|
|
10384
10384
|
i(new Et("negotiation timed out"));
|
|
10385
10385
|
}, this.peerConnectionTimeout), r = () => {
|
|
@@ -10803,7 +10803,7 @@ class qa extends T {
|
|
|
10803
10803
|
var i;
|
|
10804
10804
|
if (e.kind === T.Kind.Audio)
|
|
10805
10805
|
throw new Error("cannot get dimensions for audio tracks");
|
|
10806
|
-
((i =
|
|
10806
|
+
((i = ye()) === null || i === void 0 ? void 0 : i.os) === "iOS" && (yield ce(10));
|
|
10807
10807
|
const s = Date.now();
|
|
10808
10808
|
for (; Date.now() - s < t; ) {
|
|
10809
10809
|
const r = e.dimensions;
|
|
@@ -10931,7 +10931,7 @@ class qa extends T {
|
|
|
10931
10931
|
return;
|
|
10932
10932
|
}
|
|
10933
10933
|
this._isUpstreamPaused = !0, this.emit(_.UpstreamPaused, this);
|
|
10934
|
-
const i =
|
|
10934
|
+
const i = ye();
|
|
10935
10935
|
if (i?.name === "Safari" && Fe(i.version, "12.0") < 0)
|
|
10936
10936
|
throw new qn("pauseUpstream is not supported on Safari < 12.");
|
|
10937
10937
|
((e = this.sender.transport) === null || e === void 0 ? void 0 : e.state) !== "closed" && (yield this.sender.replaceTrack(null));
|
|
@@ -11183,7 +11183,7 @@ class Ci extends qa {
|
|
|
11183
11183
|
}
|
|
11184
11184
|
/* @internal */
|
|
11185
11185
|
startMonitor() {
|
|
11186
|
-
|
|
11186
|
+
be() && (this.monitorInterval || (this.monitorInterval = setInterval(() => {
|
|
11187
11187
|
this.monitorSender();
|
|
11188
11188
|
}, $n)));
|
|
11189
11189
|
}
|
|
@@ -11272,7 +11272,7 @@ function Pn(n, e, t, i) {
|
|
|
11272
11272
|
const b = new Wa(c), g = [];
|
|
11273
11273
|
if (b.spatial > 3)
|
|
11274
11274
|
throw new Error("unsupported scalabilityMode: ".concat(c));
|
|
11275
|
-
const R =
|
|
11275
|
+
const R = ye();
|
|
11276
11276
|
if (Yt() || // Even tho RN runs M114, it does not produce SVC layers when a single encoding
|
|
11277
11277
|
// is provided. So we'll use the legacy SVC specification for now.
|
|
11278
11278
|
// TODO: when we upstream libwebrtc, this will need additional verification
|
|
@@ -11468,7 +11468,7 @@ class Ei extends qa {
|
|
|
11468
11468
|
/* @internal */
|
|
11469
11469
|
startMonitor(e) {
|
|
11470
11470
|
var t;
|
|
11471
|
-
if (this.signalClient = e, !
|
|
11471
|
+
if (this.signalClient = e, !be())
|
|
11472
11472
|
return;
|
|
11473
11473
|
const i = (t = this.sender) === null || t === void 0 ? void 0 : t.getParameters();
|
|
11474
11474
|
i && (this.encodings = i.encodings), !this.monitorInterval && (this.monitorInterval = setInterval(() => {
|
|
@@ -12547,7 +12547,7 @@ class Ol extends je.EventEmitter {
|
|
|
12547
12547
|
});
|
|
12548
12548
|
}
|
|
12549
12549
|
waitForBufferStatusLow(e) {
|
|
12550
|
-
return new
|
|
12550
|
+
return new ve((t, i) => f(this, void 0, void 0, function* () {
|
|
12551
12551
|
if (this.isBufferStatusLow(e))
|
|
12552
12552
|
t();
|
|
12553
12553
|
else {
|
|
@@ -12601,7 +12601,7 @@ class Ol extends je.EventEmitter {
|
|
|
12601
12601
|
/** @internal */
|
|
12602
12602
|
negotiate() {
|
|
12603
12603
|
return f(this, void 0, void 0, function* () {
|
|
12604
|
-
return new
|
|
12604
|
+
return new ve((e, t) => f(this, void 0, void 0, function* () {
|
|
12605
12605
|
if (!this.pcManager) {
|
|
12606
12606
|
t(new Et("PC manager is closed"));
|
|
12607
12607
|
return;
|
|
@@ -12700,10 +12700,10 @@ class Ol extends je.EventEmitter {
|
|
|
12700
12700
|
this.clearReconnectTimeout(), this.reconnectAttempts = 0;
|
|
12701
12701
|
}
|
|
12702
12702
|
registerOnLineListener() {
|
|
12703
|
-
|
|
12703
|
+
be() && (window.addEventListener("online", this.handleBrowserOnLine), window.addEventListener("offline", this.handleBrowserOffline));
|
|
12704
12704
|
}
|
|
12705
12705
|
deregisterOnLineListener() {
|
|
12706
|
-
|
|
12706
|
+
be() && (window.removeEventListener("online", this.handleBrowserOnLine), window.removeEventListener("offline", this.handleBrowserOffline));
|
|
12707
12707
|
}
|
|
12708
12708
|
getTrackIdForReceiver(e) {
|
|
12709
12709
|
var t;
|
|
@@ -13720,7 +13720,7 @@ class Bl {
|
|
|
13720
13720
|
}, this.onLeavePiP = () => {
|
|
13721
13721
|
var i;
|
|
13722
13722
|
this.isPiP = Bt(this.element), (i = this.handleVisibilityChanged) === null || i === void 0 || i.call(this);
|
|
13723
|
-
}, this.element = e, this.isIntersecting = t ?? Rn(e), this.isPiP =
|
|
13723
|
+
}, this.element = e, this.isIntersecting = t ?? Rn(e), this.isPiP = be() && Bt(e), this.visibilityChangedAt = 0;
|
|
13724
13724
|
}
|
|
13725
13725
|
width() {
|
|
13726
13726
|
return this.element.clientWidth;
|
|
@@ -14261,7 +14261,7 @@ class Gl extends za {
|
|
|
14261
14261
|
yield a.mute();
|
|
14262
14262
|
else if (qe(a) || Xe(a))
|
|
14263
14263
|
try {
|
|
14264
|
-
if (
|
|
14264
|
+
if (be())
|
|
14265
14265
|
try {
|
|
14266
14266
|
const c = yield navigator?.permissions.query({
|
|
14267
14267
|
// the permission query for camera and microphone currently not supported in Safari and Firefox
|
|
@@ -14359,7 +14359,7 @@ class Gl extends za {
|
|
|
14359
14359
|
attributes: o
|
|
14360
14360
|
} = t;
|
|
14361
14361
|
return (function* () {
|
|
14362
|
-
return new
|
|
14362
|
+
return new ve((a, c) => f(i, void 0, void 0, function* () {
|
|
14363
14363
|
var d, l;
|
|
14364
14364
|
try {
|
|
14365
14365
|
let u = !1;
|
|
@@ -14827,12 +14827,12 @@ class Gl extends za {
|
|
|
14827
14827
|
try {
|
|
14828
14828
|
for (var ae = !0, Se = Je(x), Qe; Qe = yield Se.next(), le = Qe.done, !le; ae = !0) {
|
|
14829
14829
|
Y = Qe.value, ae = !1;
|
|
14830
|
-
const
|
|
14831
|
-
yield $t.write(
|
|
14830
|
+
const pe = Y;
|
|
14831
|
+
yield $t.write(pe);
|
|
14832
14832
|
}
|
|
14833
|
-
} catch (
|
|
14833
|
+
} catch (pe) {
|
|
14834
14834
|
Ve = {
|
|
14835
|
-
error:
|
|
14835
|
+
error: pe
|
|
14836
14836
|
};
|
|
14837
14837
|
} finally {
|
|
14838
14838
|
try {
|
|
@@ -14954,7 +14954,7 @@ class Gl extends za {
|
|
|
14954
14954
|
var i = this;
|
|
14955
14955
|
let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
|
|
14956
14956
|
return (function* () {
|
|
14957
|
-
i.republishPromise && (yield i.republishPromise), i.republishPromise = new
|
|
14957
|
+
i.republishPromise && (yield i.republishPromise), i.republishPromise = new ve((r, o) => f(i, void 0, void 0, function* () {
|
|
14958
14958
|
try {
|
|
14959
14959
|
const a = [];
|
|
14960
14960
|
this.trackPublications.forEach((c) => {
|
|
@@ -15123,7 +15123,7 @@ class Gl extends za {
|
|
|
15123
15123
|
responseTimeout: r = 15e3
|
|
15124
15124
|
} = e;
|
|
15125
15125
|
const o = 7e3, a = o + 1e3;
|
|
15126
|
-
return new
|
|
15126
|
+
return new ve((c, d) => f(this, void 0, void 0, function* () {
|
|
15127
15127
|
var l, u, h, m;
|
|
15128
15128
|
if (Xn(s) > Va) {
|
|
15129
15129
|
d(Z.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));
|
|
@@ -15715,7 +15715,7 @@ class Dt extends je.EventEmitter {
|
|
|
15715
15715
|
} catch (m) {
|
|
15716
15716
|
throw yield this.engine.close(), this.recreateEngine(), m;
|
|
15717
15717
|
}
|
|
15718
|
-
|
|
15718
|
+
be() && this.options.disconnectOnPageLeave && (window.addEventListener("pagehide", this.onPageLeave), window.addEventListener("beforeunload", this.onPageLeave)), be() && window.addEventListener("freeze", this.onPageLeave), this.setAndEmitConnectionState(K.Connected), this.emit(E.Connected), _t.getInstance().resetFailedConnectionAttempts(a), this.registerConnectionReconcile(), this.regionUrlProvider && this.regionUrlProvider.notifyConnected();
|
|
15719
15719
|
}), this.disconnect = function() {
|
|
15720
15720
|
for (var a = arguments.length, c = new Array(a), d = 0; d < a; d++)
|
|
15721
15721
|
c[d] = arguments[d];
|
|
@@ -15743,7 +15743,7 @@ class Dt extends je.EventEmitter {
|
|
|
15743
15743
|
}, this.onPageLeave = () => f(this, void 0, void 0, function* () {
|
|
15744
15744
|
this.log.info("Page leave detected, disconnecting", this.logContext), yield this.disconnect();
|
|
15745
15745
|
}), this.startAudio = () => f(this, void 0, void 0, function* () {
|
|
15746
|
-
const a = [], c =
|
|
15746
|
+
const a = [], c = ye();
|
|
15747
15747
|
if (c && c.os === "iOS") {
|
|
15748
15748
|
const d = "livekit-dummy-audio-el";
|
|
15749
15749
|
let l = document.getElementById(d);
|
|
@@ -15911,7 +15911,7 @@ class Dt extends je.EventEmitter {
|
|
|
15911
15911
|
this.isVideoPlaybackBlocked || (this.isVideoPlaybackBlocked = !0, this.emit(E.VideoPlaybackStatusChanged, !1));
|
|
15912
15912
|
}, this.handleDeviceChange = () => f(this, void 0, void 0, function* () {
|
|
15913
15913
|
var a;
|
|
15914
|
-
((a =
|
|
15914
|
+
((a = ye()) === null || a === void 0 ? void 0 : a.os) !== "iOS" && (yield this.selectDefaultDevices()), this.emit(E.MediaDevicesChanged);
|
|
15915
15915
|
}), this.handleRoomUpdate = (a) => {
|
|
15916
15916
|
const c = this.roomInfo;
|
|
15917
15917
|
this.roomInfo = a, c && c.metadata !== a.metadata && this.emitWhenConnected(E.RoomMetadataChanged, a.metadata), c?.activeRecording !== a.activeRecording && this.emitWhenConnected(E.RecordingStatusChanged, a.activeRecording);
|
|
@@ -15956,7 +15956,7 @@ class Dt extends je.EventEmitter {
|
|
|
15956
15956
|
this.emit(E.ParticipantPermissionsChanged, a, this.localParticipant);
|
|
15957
15957
|
}, this.onLocalChatMessageSent = (a) => {
|
|
15958
15958
|
this.emit(E.ChatMessage, a, this.localParticipant);
|
|
15959
|
-
}, this.setMaxListeners(100), this.remoteParticipants = /* @__PURE__ */ new Map(), this.sidToIdentity = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, sl), e), this.log = ze((i = this.options.loggerName) !== null && i !== void 0 ? i : xe.Room), this.transcriptionReceivedTimes = /* @__PURE__ */ new Map(), this.options.audioCaptureDefaults = Object.assign(Object.assign({}, Fa), e?.audioCaptureDefaults), this.options.videoCaptureDefaults = Object.assign(Object.assign({}, ja), e?.videoCaptureDefaults), this.options.publishDefaults = Object.assign(Object.assign({}, nl), e?.publishDefaults), this.maybeCreateEngine(), this.incomingDataStreamManager = new Al(), this.outgoingDataStreamManager = new Ul(this.engine, this.log), this.disconnectLock = new fe(), this.localParticipant = new Gl("", "", this.engine, this.options, this.rpcHandlers, this.outgoingDataStreamManager), (this.options.e2ee || this.options.encryption) && this.setupE2EE(), this.engine.e2eeManager = this.e2eeManager, this.options.videoCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("videoinput", it(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", it(this.options.audioCaptureDefaults.deviceId)), !((s = this.options.audioOutput) === null || s === void 0) && s.deviceId && this.switchActiveDevice("audiooutput", it(this.options.audioOutput.deviceId)).catch((a) => this.log.warn("Could not set audio output: ".concat(a.message), this.logContext)),
|
|
15959
|
+
}, this.setMaxListeners(100), this.remoteParticipants = /* @__PURE__ */ new Map(), this.sidToIdentity = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, sl), e), this.log = ze((i = this.options.loggerName) !== null && i !== void 0 ? i : xe.Room), this.transcriptionReceivedTimes = /* @__PURE__ */ new Map(), this.options.audioCaptureDefaults = Object.assign(Object.assign({}, Fa), e?.audioCaptureDefaults), this.options.videoCaptureDefaults = Object.assign(Object.assign({}, ja), e?.videoCaptureDefaults), this.options.publishDefaults = Object.assign(Object.assign({}, nl), e?.publishDefaults), this.maybeCreateEngine(), this.incomingDataStreamManager = new Al(), this.outgoingDataStreamManager = new Ul(this.engine, this.log), this.disconnectLock = new fe(), this.localParticipant = new Gl("", "", this.engine, this.options, this.rpcHandlers, this.outgoingDataStreamManager), (this.options.e2ee || this.options.encryption) && this.setupE2EE(), this.engine.e2eeManager = this.e2eeManager, this.options.videoCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("videoinput", it(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", it(this.options.audioCaptureDefaults.deviceId)), !((s = this.options.audioOutput) === null || s === void 0) && s.deviceId && this.switchActiveDevice("audiooutput", it(this.options.audioOutput.deviceId)).catch((a) => this.log.warn("Could not set audio output: ".concat(a.message), this.logContext)), be()) {
|
|
15960
15960
|
const a = new AbortController();
|
|
15961
15961
|
(o = (r = navigator.mediaDevices) === null || r === void 0 ? void 0 : r.addEventListener) === null || o === void 0 || o.call(r, "devicechange", this.handleDeviceChange, {
|
|
15962
15962
|
signal: a.signal
|
|
@@ -16058,7 +16058,7 @@ class Dt extends je.EventEmitter {
|
|
|
16058
16058
|
* returns once a sid has been issued by the server.
|
|
16059
16059
|
*/
|
|
16060
16060
|
getSid() {
|
|
16061
|
-
return this.state === K.Disconnected ?
|
|
16061
|
+
return this.state === K.Disconnected ? ve.resolve("") : this.roomInfo && this.roomInfo.sid !== "" ? ve.resolve(this.roomInfo.sid) : new ve((e, t) => {
|
|
16062
16062
|
const i = (s) => {
|
|
16063
16063
|
s.sid !== "" && (this.engine.off(w.RoomUpdate, i), e(s.sid));
|
|
16064
16064
|
};
|
|
@@ -16437,7 +16437,7 @@ class Dt extends je.EventEmitter {
|
|
|
16437
16437
|
}), this.localParticipant.trackPublications.forEach((r) => {
|
|
16438
16438
|
var o, a, c;
|
|
16439
16439
|
r.track && this.localParticipant.unpublishTrack(r.track, e), e ? ((o = r.track) === null || o === void 0 || o.detach(), (a = r.track) === null || a === void 0 || a.stop()) : (c = r.track) === null || c === void 0 || c.stopMonitor();
|
|
16440
|
-
}), this.localParticipant.off(I.ParticipantMetadataChanged, this.onLocalParticipantMetadataChanged).off(I.ParticipantNameChanged, this.onLocalParticipantNameChanged).off(I.AttributesChanged, this.onLocalAttributesChanged).off(I.TrackMuted, this.onLocalTrackMuted).off(I.TrackUnmuted, this.onLocalTrackUnmuted).off(I.LocalTrackPublished, this.onLocalTrackPublished).off(I.LocalTrackUnpublished, this.onLocalTrackUnpublished).off(I.ConnectionQualityChanged, this.onLocalConnectionQualityChanged).off(I.MediaDevicesError, this.onMediaDevicesError).off(I.AudioStreamAcquired, this.startAudio).off(I.ChatMessage, this.onLocalChatMessageSent).off(I.ParticipantPermissionsChanged, this.onLocalParticipantPermissionsChanged), this.localParticipant.trackPublications.clear(), this.localParticipant.videoTrackPublications.clear(), this.localParticipant.audioTrackPublications.clear(), this.remoteParticipants.clear(), this.sidToIdentity.clear(), this.activeSpeakers = [], this.audioContext && typeof this.options.webAudioMix == "boolean" && (this.audioContext.close(), this.audioContext = void 0),
|
|
16440
|
+
}), this.localParticipant.off(I.ParticipantMetadataChanged, this.onLocalParticipantMetadataChanged).off(I.ParticipantNameChanged, this.onLocalParticipantNameChanged).off(I.AttributesChanged, this.onLocalAttributesChanged).off(I.TrackMuted, this.onLocalTrackMuted).off(I.TrackUnmuted, this.onLocalTrackUnmuted).off(I.LocalTrackPublished, this.onLocalTrackPublished).off(I.LocalTrackUnpublished, this.onLocalTrackUnpublished).off(I.ConnectionQualityChanged, this.onLocalConnectionQualityChanged).off(I.MediaDevicesError, this.onMediaDevicesError).off(I.AudioStreamAcquired, this.startAudio).off(I.ChatMessage, this.onLocalChatMessageSent).off(I.ParticipantPermissionsChanged, this.onLocalParticipantPermissionsChanged), this.localParticipant.trackPublications.clear(), this.localParticipant.videoTrackPublications.clear(), this.localParticipant.audioTrackPublications.clear(), this.remoteParticipants.clear(), this.sidToIdentity.clear(), this.activeSpeakers = [], this.audioContext && typeof this.options.webAudioMix == "boolean" && (this.audioContext.close(), this.audioContext = void 0), be() && (window.removeEventListener("beforeunload", this.onPageLeave), window.removeEventListener("pagehide", this.onPageLeave), window.removeEventListener("freeze", this.onPageLeave), (s = (i = navigator.mediaDevices) === null || i === void 0 ? void 0 : i.removeEventListener) === null || s === void 0 || s.call(i, "devicechange", this.handleDeviceChange));
|
|
16441
16441
|
} finally {
|
|
16442
16442
|
this.setAndEmitConnectionState(K.Disconnected), this.emit(E.Disconnected, t);
|
|
16443
16443
|
}
|
|
@@ -16481,7 +16481,7 @@ class Dt extends je.EventEmitter {
|
|
|
16481
16481
|
selectDefaultDevices() {
|
|
16482
16482
|
return f(this, void 0, void 0, function* () {
|
|
16483
16483
|
var e, t, i;
|
|
16484
|
-
const s = re.getInstance().previousDevices, r = yield re.getInstance().getDevices(void 0, !1), o =
|
|
16484
|
+
const s = re.getInstance().previousDevices, r = yield re.getInstance().getDevices(void 0, !1), o = ye();
|
|
16485
16485
|
if (o?.name === "Chrome" && o.os !== "iOS")
|
|
16486
16486
|
for (let c of r) {
|
|
16487
16487
|
const d = s.find((l) => l.deviceId === c.deviceId);
|
|
@@ -17395,18 +17395,20 @@ function Su({ mode: n, server: e, configuration: t, applicationId: i, tenantId:
|
|
|
17395
17395
|
if (de !== or) return;
|
|
17396
17396
|
const $t = new TextDecoder().decode(ae);
|
|
17397
17397
|
try {
|
|
17398
|
-
const
|
|
17399
|
-
if (console.log("Received from agent:",
|
|
17400
|
-
|
|
17401
|
-
else if (
|
|
17402
|
-
|
|
17398
|
+
const pe = JSON.parse($t);
|
|
17399
|
+
if (console.log("Received from agent:", pe), pe.type === "session_end")
|
|
17400
|
+
alert("Session ended"), y();
|
|
17401
|
+
else if (pe.type === "ready")
|
|
17402
|
+
pe.messages && pe.messages.length > 0 && a(pe.messages), d("connected"), O.current = !1, v.current === "voice" && k(!0);
|
|
17403
|
+
else if (pe.type === "message") {
|
|
17404
|
+
const At = pe;
|
|
17403
17405
|
a(function(Zt) {
|
|
17404
17406
|
const es = Zt.findIndex((Ya) => Ya.id === At.message.id);
|
|
17405
17407
|
return es >= 0 ? Zt[es] = At.message : Zt.push(At.message), [...Zt];
|
|
17406
17408
|
}), At.message.role === "assistant" ? g("") : At.message.role === "user" && m(""), u(!1);
|
|
17407
17409
|
}
|
|
17408
|
-
} catch (
|
|
17409
|
-
console.error("Failed to parse agent message:",
|
|
17410
|
+
} catch (pe) {
|
|
17411
|
+
console.error("Failed to parse agent message:", pe);
|
|
17410
17412
|
}
|
|
17411
17413
|
};
|
|
17412
17414
|
Te.on(E.DataReceived, Mt), Te.on(E.TrackSubscribed, (ae, Se, Qe) => {
|