@acrobits/ipc-sdk 0.8.1-alpha.16 → 0.8.1-alpha.17
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/docs/interfaces/UriContactItem.html +3 -3
- package/docs/types/HostType.html +1 -1
- package/docs/types/IpcProtocolVersion.html +1 -1
- package/lib/ipc-sdk.js +168 -191
- package/lib/ipc-sdk.js.map +1 -1
- package/lib/ipc-sdk.umd.cjs +3 -3
- package/lib/ipc-sdk.umd.cjs.map +1 -1
- package/package.json +2 -2
package/lib/ipc-sdk.js
CHANGED
|
@@ -56,7 +56,7 @@ function D(n, t, e) {
|
|
|
56
56
|
(i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
|
|
57
57
|
return n.concat(i || Array.prototype.slice.call(t));
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function S(n) {
|
|
60
60
|
return typeof n == "function";
|
|
61
61
|
}
|
|
62
62
|
function X(n) {
|
|
@@ -108,19 +108,19 @@ var R = function() {
|
|
|
108
108
|
}
|
|
109
109
|
else
|
|
110
110
|
o.remove(this);
|
|
111
|
-
var
|
|
112
|
-
if (
|
|
111
|
+
var h = this.initialTeardown;
|
|
112
|
+
if (S(h))
|
|
113
113
|
try {
|
|
114
|
-
|
|
114
|
+
h();
|
|
115
115
|
} catch (y) {
|
|
116
116
|
i = y instanceof N ? y.errors : [y];
|
|
117
117
|
}
|
|
118
|
-
var
|
|
119
|
-
if (
|
|
118
|
+
var l = this._finalizers;
|
|
119
|
+
if (l) {
|
|
120
120
|
this._finalizers = null;
|
|
121
121
|
try {
|
|
122
|
-
for (var
|
|
123
|
-
var k =
|
|
122
|
+
for (var b = G(l), v = b.next(); !v.done; v = b.next()) {
|
|
123
|
+
var k = v.value;
|
|
124
124
|
try {
|
|
125
125
|
se(k);
|
|
126
126
|
} catch (y) {
|
|
@@ -131,7 +131,7 @@ var R = function() {
|
|
|
131
131
|
r = { error: y };
|
|
132
132
|
} finally {
|
|
133
133
|
try {
|
|
134
|
-
|
|
134
|
+
v && !v.done && (s = b.return) && s.call(b);
|
|
135
135
|
} finally {
|
|
136
136
|
if (r)
|
|
137
137
|
throw r.error;
|
|
@@ -172,10 +172,10 @@ var R = function() {
|
|
|
172
172
|
}(), n;
|
|
173
173
|
}(), be = R.EMPTY;
|
|
174
174
|
function me(n) {
|
|
175
|
-
return n instanceof R || n && "closed" in n &&
|
|
175
|
+
return n instanceof R || n && "closed" in n && S(n.remove) && S(n.add) && S(n.unsubscribe);
|
|
176
176
|
}
|
|
177
177
|
function se(n) {
|
|
178
|
-
|
|
178
|
+
S(n) ? n() : n.unsubscribe();
|
|
179
179
|
}
|
|
180
180
|
var we = {
|
|
181
181
|
onUnhandledError: null,
|
|
@@ -183,20 +183,20 @@ var we = {
|
|
|
183
183
|
Promise: void 0,
|
|
184
184
|
useDeprecatedSynchronousErrorHandling: !1,
|
|
185
185
|
useDeprecatedNextContext: !1
|
|
186
|
-
},
|
|
186
|
+
}, Se = {
|
|
187
187
|
setTimeout: function(n, t) {
|
|
188
188
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
189
189
|
e[r - 2] = arguments[r];
|
|
190
190
|
return setTimeout.apply(void 0, D([n, t], $(e)));
|
|
191
191
|
},
|
|
192
192
|
clearTimeout: function(n) {
|
|
193
|
-
var t =
|
|
193
|
+
var t = Se.delegate;
|
|
194
194
|
return ((t == null ? void 0 : t.clearTimeout) || clearTimeout)(n);
|
|
195
195
|
},
|
|
196
196
|
delegate: void 0
|
|
197
197
|
};
|
|
198
198
|
function Ae(n) {
|
|
199
|
-
|
|
199
|
+
Se.setTimeout(function() {
|
|
200
200
|
throw n;
|
|
201
201
|
});
|
|
202
202
|
}
|
|
@@ -275,7 +275,7 @@ var Le = function() {
|
|
|
275
275
|
M(t, n);
|
|
276
276
|
function t(e, r, s) {
|
|
277
277
|
var i = n.call(this) || this, o;
|
|
278
|
-
if (
|
|
278
|
+
if (S(e) || !e)
|
|
279
279
|
o = {
|
|
280
280
|
next: e ?? void 0,
|
|
281
281
|
error: r ?? void 0,
|
|
@@ -309,11 +309,11 @@ var $e = {
|
|
|
309
309
|
}, De = function() {
|
|
310
310
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
311
311
|
}();
|
|
312
|
-
function
|
|
312
|
+
function Ee(n) {
|
|
313
313
|
return n;
|
|
314
314
|
}
|
|
315
315
|
function Fe(n) {
|
|
316
|
-
return n.length === 0 ?
|
|
316
|
+
return n.length === 0 ? Ee : n.length === 1 ? n[0] : function(e) {
|
|
317
317
|
return n.reduce(function(r, s) {
|
|
318
318
|
return s(r);
|
|
319
319
|
}, e);
|
|
@@ -384,13 +384,13 @@ function oe(n) {
|
|
|
384
384
|
return (t = n ?? we.Promise) !== null && t !== void 0 ? t : Promise;
|
|
385
385
|
}
|
|
386
386
|
function He(n) {
|
|
387
|
-
return n &&
|
|
387
|
+
return n && S(n.next) && S(n.error) && S(n.complete);
|
|
388
388
|
}
|
|
389
389
|
function ke(n) {
|
|
390
390
|
return n && n instanceof Z || He(n) && me(n);
|
|
391
391
|
}
|
|
392
392
|
function Ne(n) {
|
|
393
|
-
return
|
|
393
|
+
return S(n == null ? void 0 : n.lift);
|
|
394
394
|
}
|
|
395
395
|
function Ce(n) {
|
|
396
396
|
return function(t) {
|
|
@@ -415,14 +415,14 @@ var Ve = function(n) {
|
|
|
415
415
|
return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(u) {
|
|
416
416
|
try {
|
|
417
417
|
r(u);
|
|
418
|
-
} catch (
|
|
419
|
-
e.error(
|
|
418
|
+
} catch (h) {
|
|
419
|
+
e.error(h);
|
|
420
420
|
}
|
|
421
421
|
} : n.prototype._next, c._error = i ? function(u) {
|
|
422
422
|
try {
|
|
423
423
|
i(u);
|
|
424
|
-
} catch (
|
|
425
|
-
e.error(
|
|
424
|
+
} catch (h) {
|
|
425
|
+
e.error(h);
|
|
426
426
|
} finally {
|
|
427
427
|
this.unsubscribe();
|
|
428
428
|
}
|
|
@@ -646,7 +646,7 @@ var Ve = function(n) {
|
|
|
646
646
|
}, t;
|
|
647
647
|
}(ce), Ye = new Be(Ge), ze = Ye;
|
|
648
648
|
function We(n) {
|
|
649
|
-
return n &&
|
|
649
|
+
return n && S(n.schedule);
|
|
650
650
|
}
|
|
651
651
|
var Ke = X(function(n) {
|
|
652
652
|
return function() {
|
|
@@ -692,7 +692,7 @@ function Xe(n, t, e) {
|
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
function Ze(n, t, e) {
|
|
695
|
-
var r =
|
|
695
|
+
var r = S(n) || t || e ? { next: n, error: t, complete: e } : n;
|
|
696
696
|
return r ? Ce(function(s, i) {
|
|
697
697
|
var o;
|
|
698
698
|
(o = r.subscribe) === null || o === void 0 || o.call(r);
|
|
@@ -710,10 +710,10 @@ function Ze(n, t, e) {
|
|
|
710
710
|
var c, u;
|
|
711
711
|
a && ((c = r.unsubscribe) === null || c === void 0 || c.call(r)), (u = r.finalize) === null || u === void 0 || u.call(r);
|
|
712
712
|
}));
|
|
713
|
-
}) :
|
|
713
|
+
}) : Ee;
|
|
714
714
|
}
|
|
715
715
|
var et = Object.defineProperty, tt = (n, t, e) => t in n ? et(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, C = (n, t, e) => (tt(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
716
|
-
class
|
|
716
|
+
class d extends Error {
|
|
717
717
|
constructor(t) {
|
|
718
718
|
super(`Incorrect context (${t}). Cannot perform the requested operation.`), C(this, "context"), this.context = t;
|
|
719
719
|
}
|
|
@@ -746,11 +746,11 @@ class le extends Error {
|
|
|
746
746
|
e && (r += ` Minimum version supported is ${e}.`), super(r), this.version = t;
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
|
-
function
|
|
749
|
+
function E(n) {
|
|
750
750
|
return typeof n == "function";
|
|
751
751
|
}
|
|
752
752
|
function st(n) {
|
|
753
|
-
return
|
|
753
|
+
return E(n == null ? void 0 : n.lift);
|
|
754
754
|
}
|
|
755
755
|
function P(n) {
|
|
756
756
|
return function(t) {
|
|
@@ -869,19 +869,19 @@ var te = function() {
|
|
|
869
869
|
}
|
|
870
870
|
else
|
|
871
871
|
o.remove(this);
|
|
872
|
-
var
|
|
873
|
-
if (
|
|
872
|
+
var h = this.initialTeardown;
|
|
873
|
+
if (E(h))
|
|
874
874
|
try {
|
|
875
|
-
|
|
875
|
+
h();
|
|
876
876
|
} catch (y) {
|
|
877
877
|
i = y instanceof j ? y.errors : [y];
|
|
878
878
|
}
|
|
879
|
-
var
|
|
880
|
-
if (
|
|
879
|
+
var l = this._finalizers;
|
|
880
|
+
if (l) {
|
|
881
881
|
this._finalizers = null;
|
|
882
882
|
try {
|
|
883
|
-
for (var
|
|
884
|
-
var k =
|
|
883
|
+
for (var b = he(l), v = b.next(); !v.done; v = b.next()) {
|
|
884
|
+
var k = v.value;
|
|
885
885
|
try {
|
|
886
886
|
pe(k);
|
|
887
887
|
} catch (y) {
|
|
@@ -892,7 +892,7 @@ var te = function() {
|
|
|
892
892
|
r = { error: y };
|
|
893
893
|
} finally {
|
|
894
894
|
try {
|
|
895
|
-
|
|
895
|
+
v && !v.done && (s = b.return) && s.call(b);
|
|
896
896
|
} finally {
|
|
897
897
|
if (r)
|
|
898
898
|
throw r.error;
|
|
@@ -934,10 +934,10 @@ var te = function() {
|
|
|
934
934
|
}();
|
|
935
935
|
te.EMPTY;
|
|
936
936
|
function Ie(n) {
|
|
937
|
-
return n instanceof te || n && "closed" in n &&
|
|
937
|
+
return n instanceof te || n && "closed" in n && E(n.remove) && E(n.add) && E(n.unsubscribe);
|
|
938
938
|
}
|
|
939
939
|
function pe(n) {
|
|
940
|
-
|
|
940
|
+
E(n) ? n() : n.unsubscribe();
|
|
941
941
|
}
|
|
942
942
|
var Te = {
|
|
943
943
|
onUnhandledError: null,
|
|
@@ -1036,7 +1036,7 @@ var lt = function() {
|
|
|
1036
1036
|
ee(t, n);
|
|
1037
1037
|
function t(e, r, s) {
|
|
1038
1038
|
var i = n.call(this) || this, o;
|
|
1039
|
-
if (
|
|
1039
|
+
if (E(e) || !e)
|
|
1040
1040
|
o = {
|
|
1041
1041
|
next: e ?? void 0,
|
|
1042
1042
|
error: r ?? void 0,
|
|
@@ -1145,7 +1145,7 @@ function ge(n) {
|
|
|
1145
1145
|
return (t = n ?? Te.Promise) !== null && t !== void 0 ? t : Promise;
|
|
1146
1146
|
}
|
|
1147
1147
|
function vt(n) {
|
|
1148
|
-
return n &&
|
|
1148
|
+
return n && E(n.next) && E(n.error) && E(n.complete);
|
|
1149
1149
|
}
|
|
1150
1150
|
function yt(n) {
|
|
1151
1151
|
return n && n instanceof re || vt(n) && Ie(n);
|
|
@@ -1160,14 +1160,14 @@ var bt = function(n) {
|
|
|
1160
1160
|
return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(u) {
|
|
1161
1161
|
try {
|
|
1162
1162
|
r(u);
|
|
1163
|
-
} catch (
|
|
1164
|
-
e.error(
|
|
1163
|
+
} catch (h) {
|
|
1164
|
+
e.error(h);
|
|
1165
1165
|
}
|
|
1166
1166
|
} : n.prototype._next, c._error = i ? function(u) {
|
|
1167
1167
|
try {
|
|
1168
1168
|
i(u);
|
|
1169
|
-
} catch (
|
|
1170
|
-
e.error(
|
|
1169
|
+
} catch (h) {
|
|
1170
|
+
e.error(h);
|
|
1171
1171
|
} finally {
|
|
1172
1172
|
this.unsubscribe();
|
|
1173
1173
|
}
|
|
@@ -1189,7 +1189,7 @@ var bt = function(n) {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
}, t;
|
|
1191
1191
|
}(re);
|
|
1192
|
-
function
|
|
1192
|
+
function p(n, t) {
|
|
1193
1193
|
return P(function(e, r) {
|
|
1194
1194
|
var s = 0;
|
|
1195
1195
|
e.subscribe(_(r, function(i) {
|
|
@@ -1228,7 +1228,7 @@ function wt(n, t) {
|
|
|
1228
1228
|
});
|
|
1229
1229
|
}
|
|
1230
1230
|
function f(n, t, e) {
|
|
1231
|
-
var r =
|
|
1231
|
+
var r = E(n) || t || e ? { next: n, error: t, complete: e } : n;
|
|
1232
1232
|
return r ? P(function(s, i) {
|
|
1233
1233
|
var o;
|
|
1234
1234
|
(o = r.subscribe) === null || o === void 0 || o.call(r);
|
|
@@ -1248,17 +1248,17 @@ function f(n, t, e) {
|
|
|
1248
1248
|
}));
|
|
1249
1249
|
}) : Re;
|
|
1250
1250
|
}
|
|
1251
|
-
const
|
|
1252
|
-
function
|
|
1251
|
+
const St = /^(\d+)\.(\d+)$/;
|
|
1252
|
+
function Et(n) {
|
|
1253
1253
|
if (typeof n == "string") {
|
|
1254
|
-
const t = n.match(
|
|
1254
|
+
const t = n.match(St);
|
|
1255
1255
|
if (t)
|
|
1256
1256
|
return `${t[1]}.${t[2]}`;
|
|
1257
1257
|
}
|
|
1258
1258
|
throw new nt(n);
|
|
1259
1259
|
}
|
|
1260
1260
|
function ve(n) {
|
|
1261
|
-
const t =
|
|
1261
|
+
const t = Et(n), [e, r] = t.split("."), [s, i] = [parseInt(e), parseInt(r)];
|
|
1262
1262
|
return [s, i];
|
|
1263
1263
|
}
|
|
1264
1264
|
function ne(n, t) {
|
|
@@ -1321,7 +1321,7 @@ class xt {
|
|
|
1321
1321
|
*/
|
|
1322
1322
|
determineContext() {
|
|
1323
1323
|
return Xe(1e3).pipe(
|
|
1324
|
-
|
|
1324
|
+
p(() => (this.isEmbedded() ? this.currentContext = "user" : this.currentContext = "guest", this.currentContext)),
|
|
1325
1325
|
m(1)
|
|
1326
1326
|
);
|
|
1327
1327
|
}
|
|
@@ -1333,14 +1333,14 @@ class xt {
|
|
|
1333
1333
|
*/
|
|
1334
1334
|
openBridge() {
|
|
1335
1335
|
if (!this.isEmbedded())
|
|
1336
|
-
throw new
|
|
1336
|
+
throw new d(this.currentContext);
|
|
1337
1337
|
const t = "HELLO", e = this.createMessage(t);
|
|
1338
1338
|
e.protocolVersions = this.supportedVersions, this.logCreated(t, e);
|
|
1339
1339
|
const r = this.incomingMessages$.pipe(
|
|
1340
1340
|
g((s) => s.type === t && s.replyTo === e.id),
|
|
1341
|
-
|
|
1341
|
+
p((s) => s),
|
|
1342
1342
|
f(this.logReceived()),
|
|
1343
|
-
|
|
1343
|
+
p((s) => {
|
|
1344
1344
|
if (this.supportedVersions.some((i) => Ct(i, s.protocolVersion)))
|
|
1345
1345
|
throw new le(s.protocolVersion, this.supportedVersions[0]);
|
|
1346
1346
|
return s;
|
|
@@ -1363,12 +1363,12 @@ class xt {
|
|
|
1363
1363
|
*/
|
|
1364
1364
|
requestSSOToken() {
|
|
1365
1365
|
if (!this.isEmbedded())
|
|
1366
|
-
throw new
|
|
1366
|
+
throw new d(this.currentContext);
|
|
1367
1367
|
const t = "TOKEN", e = this.createMessage(t);
|
|
1368
1368
|
this.logCreated(t, e);
|
|
1369
1369
|
const r = this.incomingMessages$.pipe(
|
|
1370
1370
|
g((s) => s.type === t && s.replyTo === e.id),
|
|
1371
|
-
|
|
1371
|
+
p((s) => s),
|
|
1372
1372
|
f(this.logReceived()),
|
|
1373
1373
|
m(1)
|
|
1374
1374
|
);
|
|
@@ -1389,7 +1389,7 @@ class xt {
|
|
|
1389
1389
|
*/
|
|
1390
1390
|
sendJoiningRoomMessage(t) {
|
|
1391
1391
|
if (!this.isEmbedded())
|
|
1392
|
-
throw new
|
|
1392
|
+
throw new d(this.currentContext);
|
|
1393
1393
|
const {
|
|
1394
1394
|
roomName: e,
|
|
1395
1395
|
roomInvite: r,
|
|
@@ -1399,8 +1399,8 @@ class xt {
|
|
|
1399
1399
|
region: a,
|
|
1400
1400
|
joinMicMuted: c,
|
|
1401
1401
|
joinWithoutCamera: u
|
|
1402
|
-
} = t,
|
|
1403
|
-
|
|
1402
|
+
} = t, h = "JOINING ROOM", l = this.createMessage(h, !1);
|
|
1403
|
+
l.roomName = e, l.jwtToken = i, l.serverUrl = o, l.region = a, l.roomInvite = r, l.joinMicMuted = c ?? !1, l.joinWithoutCamera = u ?? !1, l.displayName = s, this.logCreated(h, l), this.port2.postMessage(l), this.logSent(h, l);
|
|
1404
1404
|
}
|
|
1405
1405
|
/**
|
|
1406
1406
|
* Sends a {@link LeavingRoomMessage} lifecycle message to the Host app.
|
|
@@ -1415,7 +1415,7 @@ class xt {
|
|
|
1415
1415
|
*/
|
|
1416
1416
|
sendLeavingRoomMessage(t) {
|
|
1417
1417
|
if (!this.isEmbedded())
|
|
1418
|
-
throw new
|
|
1418
|
+
throw new d(this.currentContext);
|
|
1419
1419
|
const e = "LEAVING ROOM", r = this.createMessage(e, !1);
|
|
1420
1420
|
r.roomName = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
|
|
1421
1421
|
}
|
|
@@ -1447,13 +1447,13 @@ class xt {
|
|
|
1447
1447
|
*/
|
|
1448
1448
|
onJoinRoomMessage() {
|
|
1449
1449
|
if (!this.isEmbedded())
|
|
1450
|
-
throw new
|
|
1450
|
+
throw new d(this.currentContext);
|
|
1451
1451
|
const t = "JOIN ROOM";
|
|
1452
1452
|
return this.incomingMessages$.pipe(
|
|
1453
1453
|
g((e) => e.type === t && e.target === "client"),
|
|
1454
|
-
|
|
1454
|
+
p((e) => e),
|
|
1455
1455
|
f(this.logReceived()),
|
|
1456
|
-
|
|
1456
|
+
p((e) => e)
|
|
1457
1457
|
);
|
|
1458
1458
|
}
|
|
1459
1459
|
/**
|
|
@@ -1483,13 +1483,13 @@ class xt {
|
|
|
1483
1483
|
*/
|
|
1484
1484
|
onLeaveRoomMessage() {
|
|
1485
1485
|
if (!this.isEmbedded())
|
|
1486
|
-
throw new
|
|
1486
|
+
throw new d(this.currentContext);
|
|
1487
1487
|
const t = "LEAVE ROOM";
|
|
1488
1488
|
return this.incomingMessages$.pipe(
|
|
1489
1489
|
g((e) => e.type === t && e.target === "client"),
|
|
1490
|
-
|
|
1490
|
+
p((e) => e),
|
|
1491
1491
|
f(this.logReceived()),
|
|
1492
|
-
|
|
1492
|
+
p((e) => e)
|
|
1493
1493
|
);
|
|
1494
1494
|
}
|
|
1495
1495
|
/**
|
|
@@ -1520,13 +1520,13 @@ class xt {
|
|
|
1520
1520
|
*/
|
|
1521
1521
|
onConfigMessage() {
|
|
1522
1522
|
if (!this.isEmbedded())
|
|
1523
|
-
throw new
|
|
1523
|
+
throw new d(this.currentContext);
|
|
1524
1524
|
const t = "CONFIG";
|
|
1525
1525
|
return this.incomingMessages$.pipe(
|
|
1526
1526
|
g((e) => e.type === t && e.target === "client"),
|
|
1527
|
-
|
|
1527
|
+
p((e) => e),
|
|
1528
1528
|
f(this.logReceived()),
|
|
1529
|
-
|
|
1529
|
+
p((e) => ({
|
|
1530
1530
|
preferredCameraType: e.preferredCameraType,
|
|
1531
1531
|
preferredMicType: e.preferredMicType,
|
|
1532
1532
|
preferredOutputType: e.preferredOutputType,
|
|
@@ -1542,28 +1542,28 @@ class xt {
|
|
|
1542
1542
|
}
|
|
1543
1543
|
sendScreenshareSourceMessage(t) {
|
|
1544
1544
|
if (!this.isEmbedded())
|
|
1545
|
-
throw new
|
|
1545
|
+
throw new d(this.currentContext);
|
|
1546
1546
|
const e = "SCREENSHARE SOURCE", r = this.createMessage(e);
|
|
1547
1547
|
r.sourceTypes = t, this.logCreated(e, r);
|
|
1548
1548
|
const s = this.incomingMessages$.pipe(
|
|
1549
1549
|
g((i) => i.type === e && i.replyTo === r.id),
|
|
1550
|
-
|
|
1550
|
+
p((i) => i),
|
|
1551
1551
|
f(this.logReceived()),
|
|
1552
|
-
|
|
1552
|
+
p((i) => i),
|
|
1553
1553
|
m(1)
|
|
1554
1554
|
);
|
|
1555
1555
|
return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), s;
|
|
1556
1556
|
}
|
|
1557
1557
|
layoutChange(t, e, r) {
|
|
1558
1558
|
if (!this.isEmbedded())
|
|
1559
|
-
throw new
|
|
1559
|
+
throw new d(this.currentContext);
|
|
1560
1560
|
const s = "LAYOUT CHANGE";
|
|
1561
1561
|
let i, o;
|
|
1562
1562
|
if (e && r ? (i = this.createMessage(s, !1, r), i.result = e) : (i = this.createMessage(s), o = this.incomingMessages$.pipe(
|
|
1563
1563
|
g((a) => a.type === s && a.replyTo === i.id),
|
|
1564
|
-
|
|
1564
|
+
p((a) => a),
|
|
1565
1565
|
f(this.logReceived()),
|
|
1566
|
-
|
|
1566
|
+
p((a) => a),
|
|
1567
1567
|
m(1)
|
|
1568
1568
|
), this.logService.debug(`Created ${s} Reply handler`)), i.layout = t, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i), o)
|
|
1569
1569
|
return o;
|
|
@@ -1601,24 +1601,24 @@ class xt {
|
|
|
1601
1601
|
*/
|
|
1602
1602
|
onLayoutChangeMessage() {
|
|
1603
1603
|
if (!this.isEmbedded())
|
|
1604
|
-
throw new
|
|
1604
|
+
throw new d(this.currentContext);
|
|
1605
1605
|
const t = "LAYOUT CHANGE";
|
|
1606
1606
|
return this.incomingMessages$.pipe(
|
|
1607
1607
|
g((e) => e.type === t && e.target === "client" && e.replyTo === null),
|
|
1608
|
-
|
|
1608
|
+
p((e) => e),
|
|
1609
1609
|
f(this.logReceived()),
|
|
1610
|
-
|
|
1610
|
+
p((e) => e)
|
|
1611
1611
|
);
|
|
1612
1612
|
}
|
|
1613
1613
|
requestOAuthToken(t) {
|
|
1614
1614
|
if (!this.isEmbedded())
|
|
1615
|
-
throw new
|
|
1615
|
+
throw new d(this.currentContext);
|
|
1616
1616
|
Array.isArray(t) || (t = [t]);
|
|
1617
1617
|
const e = "OAUTH TOKEN", r = this.createMessage(e);
|
|
1618
1618
|
r.providerTypes = t, this.logCreated(e, r);
|
|
1619
1619
|
const s = this.incomingMessages$.pipe(
|
|
1620
1620
|
g((i) => i.type === e && i.replyTo === r.id),
|
|
1621
|
-
|
|
1621
|
+
p((i) => i),
|
|
1622
1622
|
f(this.logReceived()),
|
|
1623
1623
|
m(1)
|
|
1624
1624
|
);
|
|
@@ -1626,13 +1626,13 @@ class xt {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
openUrl(t, e) {
|
|
1628
1628
|
if (!this.isEmbedded())
|
|
1629
|
-
throw new
|
|
1629
|
+
throw new d(this.currentContext);
|
|
1630
1630
|
const r = "OPEN URL", s = this.createMessage(r, !1);
|
|
1631
1631
|
s.url = t, s.data = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
1632
1632
|
}
|
|
1633
1633
|
selectContacts(t, e, r, s) {
|
|
1634
1634
|
if (!this.isEmbedded())
|
|
1635
|
-
throw new
|
|
1635
|
+
throw new d(this.currentContext);
|
|
1636
1636
|
if (e === "group" && s === void 0)
|
|
1637
1637
|
throw new I(
|
|
1638
1638
|
"currentContacts",
|
|
@@ -1651,7 +1651,7 @@ class xt {
|
|
|
1651
1651
|
g((c) => c.type === i && c.replyTo === o.id),
|
|
1652
1652
|
f(this.logReceived()),
|
|
1653
1653
|
// validate if `streamId` is the same as we sent
|
|
1654
|
-
|
|
1654
|
+
p((c) => {
|
|
1655
1655
|
const u = c;
|
|
1656
1656
|
if (u.streamId !== t)
|
|
1657
1657
|
throw new rt(u.streamId, t);
|
|
@@ -1671,7 +1671,7 @@ class xt {
|
|
|
1671
1671
|
*/
|
|
1672
1672
|
matchContacts(t) {
|
|
1673
1673
|
if (!this.isEmbedded())
|
|
1674
|
-
throw new
|
|
1674
|
+
throw new d(this.currentContext);
|
|
1675
1675
|
if (!t.length)
|
|
1676
1676
|
throw new I("contacts", t, "At least one contact is required");
|
|
1677
1677
|
const e = "MATCH CONTACTS", r = this.createMessage(e);
|
|
@@ -1679,7 +1679,7 @@ class xt {
|
|
|
1679
1679
|
const s = this.incomingMessages$.pipe(
|
|
1680
1680
|
g((i) => i.type === e && i.replyTo === r.id),
|
|
1681
1681
|
f(this.logReceived()),
|
|
1682
|
-
|
|
1682
|
+
p((i) => i),
|
|
1683
1683
|
m(1)
|
|
1684
1684
|
);
|
|
1685
1685
|
return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), s;
|
|
@@ -1712,11 +1712,11 @@ class xt {
|
|
|
1712
1712
|
*/
|
|
1713
1713
|
onPushMessageMessage() {
|
|
1714
1714
|
if (!this.isEmbedded())
|
|
1715
|
-
throw new
|
|
1715
|
+
throw new d(this.currentContext);
|
|
1716
1716
|
const t = "PUSH MESSAGE";
|
|
1717
1717
|
return this.incomingMessages$.pipe(
|
|
1718
1718
|
g((e) => e.type === t && e.target === "client"),
|
|
1719
|
-
|
|
1719
|
+
p((e) => e),
|
|
1720
1720
|
f(this.logReceived())
|
|
1721
1721
|
);
|
|
1722
1722
|
}
|
|
@@ -1731,13 +1731,13 @@ class xt {
|
|
|
1731
1731
|
*/
|
|
1732
1732
|
requestPushToken() {
|
|
1733
1733
|
if (!this.isEmbedded())
|
|
1734
|
-
throw new
|
|
1734
|
+
throw new d(this.currentContext);
|
|
1735
1735
|
const t = "PUSH TOKEN", e = this.createMessage(t);
|
|
1736
1736
|
this.logCreated(t, e);
|
|
1737
1737
|
const r = this.incomingMessages$.pipe(
|
|
1738
1738
|
g((s) => s.type === t && s.replyTo === e.id),
|
|
1739
1739
|
f(this.logReceived()),
|
|
1740
|
-
|
|
1740
|
+
p((s) => s),
|
|
1741
1741
|
m(1)
|
|
1742
1742
|
);
|
|
1743
1743
|
return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(e), this.logSent(t, e), r;
|
|
@@ -1771,13 +1771,13 @@ class xt {
|
|
|
1771
1771
|
*/
|
|
1772
1772
|
onPushTokenMessage() {
|
|
1773
1773
|
if (!this.isEmbedded())
|
|
1774
|
-
throw new
|
|
1774
|
+
throw new d(this.currentContext);
|
|
1775
1775
|
const t = "PUSH TOKEN";
|
|
1776
1776
|
return this.incomingMessages$.pipe(
|
|
1777
1777
|
g(
|
|
1778
1778
|
(e) => e.type === t && e.target === "client" && e.replyTo === null && e.expectReply === !1
|
|
1779
1779
|
),
|
|
1780
|
-
|
|
1780
|
+
p((e) => {
|
|
1781
1781
|
if (e.pushToken && e.selector && e.appId)
|
|
1782
1782
|
return e;
|
|
1783
1783
|
throw new Error("PushTokenMessage is missing required PushTokenPayload fields");
|
|
@@ -1795,11 +1795,11 @@ class xt {
|
|
|
1795
1795
|
*/
|
|
1796
1796
|
onBadgeQueryMessage() {
|
|
1797
1797
|
if (!this.isEmbedded())
|
|
1798
|
-
throw new
|
|
1798
|
+
throw new d(this.currentContext);
|
|
1799
1799
|
const t = "BADGE QUERY";
|
|
1800
1800
|
return this.incomingMessages$.pipe(
|
|
1801
1801
|
g((e) => e.type === t && e.target === "client"),
|
|
1802
|
-
|
|
1802
|
+
p((e) => e),
|
|
1803
1803
|
f(this.logReceived())
|
|
1804
1804
|
);
|
|
1805
1805
|
}
|
|
@@ -1817,7 +1817,7 @@ class xt {
|
|
|
1817
1817
|
*/
|
|
1818
1818
|
sendBadgeUpdateMessage(t, e, r) {
|
|
1819
1819
|
if (!this.isEmbedded())
|
|
1820
|
-
throw new
|
|
1820
|
+
throw new d(this.currentContext);
|
|
1821
1821
|
const s = "BADGE UPDATE", i = this.createMessage(s, !1, r);
|
|
1822
1822
|
i.count = t, i.activity = e ?? !1, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i);
|
|
1823
1823
|
}
|
|
@@ -1836,7 +1836,7 @@ class xt {
|
|
|
1836
1836
|
*/
|
|
1837
1837
|
sendLifecycleMessage(t, e) {
|
|
1838
1838
|
if (!this.isEmbedded())
|
|
1839
|
-
throw new
|
|
1839
|
+
throw new d(this.currentContext);
|
|
1840
1840
|
const r = "LIFECYCLE", s = this.createMessage(r, !1);
|
|
1841
1841
|
s.eventName = t, s.payload = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
1842
1842
|
}
|
|
@@ -1853,11 +1853,11 @@ class xt {
|
|
|
1853
1853
|
*/
|
|
1854
1854
|
onLifecycleMessage() {
|
|
1855
1855
|
if (!this.isEmbedded())
|
|
1856
|
-
throw new
|
|
1856
|
+
throw new d(this.currentContext);
|
|
1857
1857
|
const t = "LIFECYCLE";
|
|
1858
1858
|
return this.incomingMessages$.pipe(
|
|
1859
1859
|
g((e) => e.type === t && e.target === "client"),
|
|
1860
|
-
|
|
1860
|
+
p((e) => e),
|
|
1861
1861
|
f(this.logReceived())
|
|
1862
1862
|
);
|
|
1863
1863
|
}
|
|
@@ -1875,7 +1875,7 @@ class xt {
|
|
|
1875
1875
|
*/
|
|
1876
1876
|
sendLogMessage(t, e) {
|
|
1877
1877
|
if (!this.isEmbedded())
|
|
1878
|
-
throw new
|
|
1878
|
+
throw new d(this.currentContext);
|
|
1879
1879
|
const r = "LOG", s = this.createMessage(r, !1);
|
|
1880
1880
|
s.level = t, s.message = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
1881
1881
|
}
|
|
@@ -1893,11 +1893,11 @@ class xt {
|
|
|
1893
1893
|
*/
|
|
1894
1894
|
onRequestLogsMessage() {
|
|
1895
1895
|
if (!this.isEmbedded())
|
|
1896
|
-
throw new
|
|
1896
|
+
throw new d(this.currentContext);
|
|
1897
1897
|
const t = "REQUEST LOGS";
|
|
1898
1898
|
return this.incomingMessages$.pipe(
|
|
1899
1899
|
g((e) => e.type === t && e.target === "client"),
|
|
1900
|
-
|
|
1900
|
+
p((e) => e),
|
|
1901
1901
|
f(this.logReceived())
|
|
1902
1902
|
);
|
|
1903
1903
|
}
|
|
@@ -1916,7 +1916,7 @@ class xt {
|
|
|
1916
1916
|
*/
|
|
1917
1917
|
sendViewTransitionMessage(t, e) {
|
|
1918
1918
|
if (!this.isEmbedded())
|
|
1919
|
-
throw new
|
|
1919
|
+
throw new d(this.currentContext);
|
|
1920
1920
|
const r = "VIEW TRANSITION", s = this.createMessage(r, !1);
|
|
1921
1921
|
s.transitionType = t, s.targetView = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
1922
1922
|
}
|
|
@@ -1963,7 +1963,7 @@ class xt {
|
|
|
1963
1963
|
*/
|
|
1964
1964
|
sendFileRequestMessage(t, e, r, s, i) {
|
|
1965
1965
|
if (!this.isEmbedded())
|
|
1966
|
-
throw new
|
|
1966
|
+
throw new d(this.currentContext);
|
|
1967
1967
|
const o = "FILE REQUEST", a = this.createMessage(o);
|
|
1968
1968
|
if (a.fileId = t, a.fileHash = e.toLowerCase(), a.intent = r, a.maxChunkSizeInBytes = i, r === "attachment") {
|
|
1969
1969
|
if (!s)
|
|
@@ -1978,12 +1978,12 @@ class xt {
|
|
|
1978
1978
|
let c = 0;
|
|
1979
1979
|
const u = this.incomingMessages$.pipe(
|
|
1980
1980
|
g(
|
|
1981
|
-
(
|
|
1981
|
+
(h) => h.type === o && h.replyTo === a.id
|
|
1982
1982
|
),
|
|
1983
1983
|
f(this.logReceived()),
|
|
1984
1984
|
f(() => c++),
|
|
1985
|
-
|
|
1986
|
-
wt((
|
|
1985
|
+
p((h) => (h.result === "success" && (h.chunkHash = h.chunkHash.toLowerCase(), h.fileHash = h.fileHash.toLowerCase()), h)),
|
|
1986
|
+
wt((h) => h.result === "success" && c < h.totalChunks, !0)
|
|
1987
1987
|
);
|
|
1988
1988
|
return this.port2.postMessage(a), this.logSent(o, a), u;
|
|
1989
1989
|
}
|
|
@@ -2008,7 +2008,7 @@ class xt {
|
|
|
2008
2008
|
*/
|
|
2009
2009
|
sendFileRequestMessageReply(t, e) {
|
|
2010
2010
|
if (!this.isEmbedded())
|
|
2011
|
-
throw new
|
|
2011
|
+
throw new d(this.currentContext);
|
|
2012
2012
|
const r = "FILE REQUEST", s = Object.assign(
|
|
2013
2013
|
e,
|
|
2014
2014
|
this.createMessage(r, !1, t.id)
|
|
@@ -2029,13 +2029,13 @@ class xt {
|
|
|
2029
2029
|
*/
|
|
2030
2030
|
onFileRequestMessage() {
|
|
2031
2031
|
if (!this.isEmbedded())
|
|
2032
|
-
throw new
|
|
2032
|
+
throw new d(this.currentContext);
|
|
2033
2033
|
const t = "FILE REQUEST";
|
|
2034
2034
|
return this.incomingMessages$.pipe(
|
|
2035
2035
|
g(
|
|
2036
2036
|
(e) => e.type === t && e.target === "client" && e.replyTo === null
|
|
2037
2037
|
),
|
|
2038
|
-
|
|
2038
|
+
p((e) => (e.fileHash = e.fileHash.toLowerCase(), e)),
|
|
2039
2039
|
f(this.logReceived())
|
|
2040
2040
|
);
|
|
2041
2041
|
}
|
|
@@ -2063,7 +2063,7 @@ class xt {
|
|
|
2063
2063
|
*/
|
|
2064
2064
|
sendFileSelectionMessage(t = "attachment", e, r, s, i, o) {
|
|
2065
2065
|
if (!this.isEmbedded())
|
|
2066
|
-
throw new
|
|
2066
|
+
throw new d(this.currentContext);
|
|
2067
2067
|
const a = "FILE SELECTION", c = this.createMessage(a);
|
|
2068
2068
|
if (c.intent = t, c.maxCount = s, c.maxFileSizeInBytes = i, c.mimeTypes = o, t === "attachment") {
|
|
2069
2069
|
if (!e)
|
|
@@ -2083,44 +2083,17 @@ class xt {
|
|
|
2083
2083
|
this.logCreated(a, c);
|
|
2084
2084
|
const u = this.incomingMessages$.pipe(
|
|
2085
2085
|
g(
|
|
2086
|
-
(
|
|
2086
|
+
(h) => h.type === a && h.replyTo === c.id
|
|
2087
2087
|
),
|
|
2088
|
-
|
|
2089
|
-
var
|
|
2090
|
-
return
|
|
2088
|
+
p((h) => {
|
|
2089
|
+
var l;
|
|
2090
|
+
return h.files = (l = h.files) == null ? void 0 : l.map((b) => (b.original.fileHash = b.original.fileHash.toLowerCase(), b.preview && (b.preview.fileHash = b.preview.fileHash.toLowerCase()), b)), h;
|
|
2091
2091
|
}),
|
|
2092
2092
|
f(this.logReceived()),
|
|
2093
2093
|
m(1)
|
|
2094
2094
|
);
|
|
2095
2095
|
return this.port2.postMessage(c), this.logSent(a, c), u;
|
|
2096
2096
|
}
|
|
2097
|
-
/**
|
|
2098
|
-
* Sends a {@link FileDownloadMessage} to the Host app, to request the download of a file.
|
|
2099
|
-
*
|
|
2100
|
-
* @remarks
|
|
2101
|
-
* The file at the specified `url` is encrypted using the provided `key` and the Host app needs
|
|
2102
|
-
* to decrypt it.
|
|
2103
|
-
*
|
|
2104
|
-
* @param url - The URL to download the file from
|
|
2105
|
-
* @param key - The decryption key for the file stream
|
|
2106
|
-
* @param fileName - The name of the file to download
|
|
2107
|
-
* @param mimeType - The MIME type of the file to download
|
|
2108
|
-
* @returns An observable which emits a {@link FileDownloadMessageReply} instance containing the
|
|
2109
|
-
* file ID and the file size in bytes. Emits once.
|
|
2110
|
-
*/
|
|
2111
|
-
sendFileDownloadMessage(t, e, r, s) {
|
|
2112
|
-
if (!this.isEmbedded())
|
|
2113
|
-
throw new h(this.currentContext);
|
|
2114
|
-
const i = "FILE DOWNLOAD", o = this.createMessage(i);
|
|
2115
|
-
o.url = t, o.key = e, o.fileName = r, o.mimeType = s, this.logCreated(i, o);
|
|
2116
|
-
const a = this.incomingMessages$.pipe(
|
|
2117
|
-
g((c) => c.type === i && c.replyTo === o.id),
|
|
2118
|
-
f(this.logReceived()),
|
|
2119
|
-
d((c) => c),
|
|
2120
|
-
m(1)
|
|
2121
|
-
);
|
|
2122
|
-
return this.port2.postMessage(o), this.logSent(i, o), a;
|
|
2123
|
-
}
|
|
2124
2097
|
/**
|
|
2125
2098
|
* Sends a {@link FileDownloadProgressQueryMessage} to the Host app, to query the progress of a
|
|
2126
2099
|
* file download that was initiated by a {@link FileDownloadMessage}.
|
|
@@ -2141,7 +2114,7 @@ class xt {
|
|
|
2141
2114
|
*/
|
|
2142
2115
|
sendFileDownloadProgressQueryMessage(t, e, r) {
|
|
2143
2116
|
if (!this.isEmbedded())
|
|
2144
|
-
throw new
|
|
2117
|
+
throw new d(this.currentContext);
|
|
2145
2118
|
const s = "FILE DOWNLOAD PROGRESS QUERY", i = this.createMessage(
|
|
2146
2119
|
s,
|
|
2147
2120
|
!0
|
|
@@ -2152,27 +2125,27 @@ class xt {
|
|
|
2152
2125
|
(a) => a.type === "FILE DOWNLOAD PROGRESS UPDATE" && a.replyTo === i.id
|
|
2153
2126
|
),
|
|
2154
2127
|
f((a) => this.logReceived(a)),
|
|
2155
|
-
|
|
2128
|
+
p((a) => (a.fileHash && (a.fileHash = a.fileHash.toLowerCase()), a)),
|
|
2156
2129
|
m(1)
|
|
2157
2130
|
);
|
|
2158
2131
|
return this.port2.postMessage(i), this.logSent(s, i), o;
|
|
2159
2132
|
}
|
|
2160
2133
|
/**
|
|
2161
2134
|
* Setup listener for {@link FileDownloadProgressQueryMessage}, which can be sent by a `Host` app
|
|
2162
|
-
* to update the progress of a file download which was initiated by a {@link
|
|
2135
|
+
* to update the progress of a file download which was initiated by a {@link FileDownloadMessage}.
|
|
2163
2136
|
*
|
|
2164
2137
|
* @returns An observable which emits a {@link FileDownloadProgressUpdateMessage} instance
|
|
2165
2138
|
* containing the progress of the file download. Emits once.
|
|
2166
2139
|
*/
|
|
2167
2140
|
onFileDownloadProgressUpdateMessage() {
|
|
2168
2141
|
if (!this.isEmbedded())
|
|
2169
|
-
throw new
|
|
2142
|
+
throw new d(this.currentContext);
|
|
2170
2143
|
const t = "FILE DOWNLOAD PROGRESS UPDATE";
|
|
2171
2144
|
return this.incomingMessages$.pipe(
|
|
2172
2145
|
g(
|
|
2173
2146
|
(e) => e.type === t && e.target === "client" && e.replyTo === null
|
|
2174
2147
|
),
|
|
2175
|
-
|
|
2148
|
+
p((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
|
|
2176
2149
|
f(this.logReceived())
|
|
2177
2150
|
);
|
|
2178
2151
|
}
|
|
@@ -2192,7 +2165,7 @@ class xt {
|
|
|
2192
2165
|
*/
|
|
2193
2166
|
sendFileUploadProgressQueryMessage(t, e, r) {
|
|
2194
2167
|
if (!this.isEmbedded())
|
|
2195
|
-
throw new
|
|
2168
|
+
throw new d(this.currentContext);
|
|
2196
2169
|
const s = "FILE UPLOAD PROGRESS QUERY", i = this.createMessage(
|
|
2197
2170
|
s,
|
|
2198
2171
|
!0
|
|
@@ -2203,7 +2176,7 @@ class xt {
|
|
|
2203
2176
|
(a) => a.type === "FILE UPLOAD PROGRESS UPDATE" && a.replyTo === i.id
|
|
2204
2177
|
),
|
|
2205
2178
|
f(this.logReceived()),
|
|
2206
|
-
|
|
2179
|
+
p((a) => (a.fileHash && (a.fileHash = a.fileHash.toLowerCase()), a)),
|
|
2207
2180
|
m(1)
|
|
2208
2181
|
);
|
|
2209
2182
|
return this.port2.postMessage(i), this.logSent(s, i), o;
|
|
@@ -2221,62 +2194,66 @@ class xt {
|
|
|
2221
2194
|
*/
|
|
2222
2195
|
onFileUploadProgressUpdateMessage() {
|
|
2223
2196
|
if (!this.isEmbedded())
|
|
2224
|
-
throw new
|
|
2197
|
+
throw new d(this.currentContext);
|
|
2225
2198
|
const t = "FILE UPLOAD PROGRESS UPDATE";
|
|
2226
2199
|
return this.incomingMessages$.pipe(
|
|
2227
2200
|
g(
|
|
2228
2201
|
(e) => e.type === t && e.target === "client" && e.replyTo === null
|
|
2229
2202
|
),
|
|
2230
|
-
|
|
2203
|
+
p((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
|
|
2231
2204
|
f(this.logReceived())
|
|
2232
2205
|
);
|
|
2233
2206
|
}
|
|
2234
2207
|
/**
|
|
2235
|
-
* Sends a {@link
|
|
2236
|
-
* have in it's storage.
|
|
2208
|
+
* Sends a {@link FileDownloadMessage} to the Host app, to download a file.
|
|
2237
2209
|
*
|
|
2238
2210
|
* @remarks
|
|
2239
2211
|
* The `fileHash` parameter is the SHA256 hash of the decrypted file, which is used as an
|
|
2240
2212
|
* identifier for the target file in the `Host` app as well as to verify the integrity of the
|
|
2241
2213
|
* file.
|
|
2242
2214
|
*
|
|
2243
|
-
*
|
|
2244
|
-
* @
|
|
2245
|
-
*
|
|
2246
|
-
* @param
|
|
2247
|
-
* @param
|
|
2215
|
+
* If the `host` already has the file in it's storage, it can reply with a
|
|
2216
|
+
* {@link FileDownloadSkippedResult} to notify the client that the download was skipped.
|
|
2217
|
+
*
|
|
2218
|
+
* @param url - URL from where the host should download the file if it isn't in storage.
|
|
2219
|
+
* @param key - Key used to encrypt the original attachment.
|
|
2220
|
+
* @param fileHash - The SHA256 hash of the file to download.
|
|
2221
|
+
* @param mimeType - The MIME type of the file to download.
|
|
2222
|
+
* @param fileName - _Optional_. The name of the file to download.
|
|
2223
|
+
* @param streamId - _Optional_. ID of the message stream from which the file is downloaded from.
|
|
2248
2224
|
* @param correlationId - _Optional_. Correlation ID of the message this file was attached to.
|
|
2249
|
-
* @param key - _Optional_. Key used to encrypt the original attachment.
|
|
2250
2225
|
* @param sender - _Optional_. The {@link ContactItem} of the sender of the file.
|
|
2226
|
+
* @param intent - _Optional_. The intent of the file download. Can be either `download` or
|
|
2227
|
+
* `open`. Defaults to `download`.
|
|
2251
2228
|
*
|
|
2252
|
-
* @returns An observable which emits a {@link
|
|
2229
|
+
* @returns An observable which emits a {@link FileDownloadMessageReply} instance containing the
|
|
2253
2230
|
* result of the request. Emits once.
|
|
2254
2231
|
*/
|
|
2255
|
-
|
|
2232
|
+
sendFileDownloadMessage(t, e, r, s, i, o, a, c, u) {
|
|
2256
2233
|
if (!this.isEmbedded())
|
|
2257
|
-
throw new
|
|
2258
|
-
const
|
|
2259
|
-
l.
|
|
2260
|
-
const
|
|
2261
|
-
g((v) => v.type ===
|
|
2234
|
+
throw new d(this.currentContext);
|
|
2235
|
+
const h = "FILE DOWNLOAD", l = this.createMessage(h, !0);
|
|
2236
|
+
l.url = t, l.key = e, l.fileHash = r.toLowerCase(), l.mimeType = s, l.fileName = i, l.streamId = o, l.correlationId = a, l.sender = c, l.intent = u ?? "download", this.logCreated(h, l);
|
|
2237
|
+
const b = this.incomingMessages$.pipe(
|
|
2238
|
+
g((v) => v.type === h && v.replyTo === l.id),
|
|
2262
2239
|
f(this.logReceived()),
|
|
2263
|
-
|
|
2240
|
+
p((v) => v),
|
|
2264
2241
|
m(1)
|
|
2265
2242
|
);
|
|
2266
|
-
return this.port2.postMessage(l), this.logSent(
|
|
2243
|
+
return this.port2.postMessage(l), this.logSent(h, l), b;
|
|
2267
2244
|
}
|
|
2268
2245
|
/**
|
|
2269
|
-
* Sends a {@link
|
|
2270
|
-
* that was initiated by a {@link
|
|
2246
|
+
* Sends a {@link CancelFileDownloadMessage} to the Host app, to cancel downloading of a file
|
|
2247
|
+
* that was initiated by a {@link FileDownloadMessage} previously.
|
|
2271
2248
|
*
|
|
2272
2249
|
* @param correlationId - UUIDv4 string to identify the message this file was attached to.
|
|
2273
|
-
* @param fileHash - SHA256 hash of the file to cancel
|
|
2250
|
+
* @param fileHash - SHA256 hash of the file to cancel downloading.
|
|
2274
2251
|
* @param url - URL of the file to cancel download.
|
|
2275
2252
|
*/
|
|
2276
|
-
|
|
2253
|
+
sendCancelFileDownloadMessage(t, e, r) {
|
|
2277
2254
|
if (!this.isEmbedded())
|
|
2278
|
-
throw new
|
|
2279
|
-
const s = "CANCEL FILE
|
|
2255
|
+
throw new d(this.currentContext);
|
|
2256
|
+
const s = "CANCEL FILE DOWNLOAD", i = this.createMessage(s, !1);
|
|
2280
2257
|
i.correlationId = t, i.fileHash = e.toLowerCase(), i.url = r, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i);
|
|
2281
2258
|
}
|
|
2282
2259
|
/**
|
|
@@ -2296,13 +2273,13 @@ class xt {
|
|
|
2296
2273
|
*/
|
|
2297
2274
|
sendFileRemoveMessage(t, e) {
|
|
2298
2275
|
if (!this.isEmbedded())
|
|
2299
|
-
throw new
|
|
2276
|
+
throw new d(this.currentContext);
|
|
2300
2277
|
const r = "FILE REMOVE", s = this.createMessage(r, !0);
|
|
2301
2278
|
s.hash = t.toLowerCase(), s.streamId = e, this.logCreated(r, s);
|
|
2302
2279
|
const i = this.incomingMessages$.pipe(
|
|
2303
2280
|
g((o) => o.type === r && o.replyTo === s.id),
|
|
2304
2281
|
f(this.logReceived()),
|
|
2305
|
-
|
|
2282
|
+
p((o) => o),
|
|
2306
2283
|
m(1)
|
|
2307
2284
|
);
|
|
2308
2285
|
return this.port2.postMessage(s), this.logSent(r, s), i;
|
|
@@ -2322,7 +2299,7 @@ class xt {
|
|
|
2322
2299
|
*/
|
|
2323
2300
|
sendAppResetMessage() {
|
|
2324
2301
|
if (!this.isEmbedded())
|
|
2325
|
-
throw new
|
|
2302
|
+
throw new d(this.currentContext);
|
|
2326
2303
|
const t = "APP RESET", e = this.createMessage(t, !1);
|
|
2327
2304
|
this.logCreated(t, e), this.port2.postMessage(e), this.logSent(t, e);
|
|
2328
2305
|
}
|
|
@@ -2346,7 +2323,7 @@ class xt {
|
|
|
2346
2323
|
*/
|
|
2347
2324
|
sendMessageSentMessage(t, e) {
|
|
2348
2325
|
if (!this.isEmbedded())
|
|
2349
|
-
throw new
|
|
2326
|
+
throw new d(this.currentContext);
|
|
2350
2327
|
const r = "MESSAGE SENT", s = this.createMessage(r, !1);
|
|
2351
2328
|
s.streamId = t, s.correlationId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
2352
2329
|
}
|
|
@@ -2370,16 +2347,16 @@ class xt {
|
|
|
2370
2347
|
*/
|
|
2371
2348
|
sendSendMessageMessage(t, e, r, s = "TEXT", i, o, a, c = !0, u) {
|
|
2372
2349
|
if (!this.isEmbedded())
|
|
2373
|
-
throw new
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2376
|
-
const
|
|
2377
|
-
g((
|
|
2350
|
+
throw new d(this.currentContext);
|
|
2351
|
+
const h = "SEND MESSAGE", l = this.createMessage(h, !0);
|
|
2352
|
+
l.streamId = t, l.correlationId = e, l.body = r, l.messageType = s, l.mentions = i ?? [], l.attachments = (o == null ? void 0 : o.map((v) => v.toLowerCase())) ?? [], l.relatedMessageId = a, l.setCursors = c, l.threadId = u, this.logCreated(h, l);
|
|
2353
|
+
const b = this.incomingMessages$.pipe(
|
|
2354
|
+
g((v) => v.type === h && v.replyTo === l.id),
|
|
2378
2355
|
f(this.logReceived()),
|
|
2379
|
-
|
|
2356
|
+
p((v) => v),
|
|
2380
2357
|
m(1)
|
|
2381
2358
|
);
|
|
2382
|
-
return this.port2.postMessage(
|
|
2359
|
+
return this.port2.postMessage(l), this.logSent(h, l), b;
|
|
2383
2360
|
}
|
|
2384
2361
|
/**
|
|
2385
2362
|
* Sends a {@link CancelSendMessageMessage} to the Host app, to cancel a message that was being
|
|
@@ -2392,7 +2369,7 @@ class xt {
|
|
|
2392
2369
|
*/
|
|
2393
2370
|
sendCancelSendMessageMessage(t, e) {
|
|
2394
2371
|
if (!this.isEmbedded())
|
|
2395
|
-
throw new
|
|
2372
|
+
throw new d(this.currentContext);
|
|
2396
2373
|
const r = "CANCEL SEND MESSAGE", s = this.createMessage(r, !1);
|
|
2397
2374
|
s.streamId = t, s.correlationId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
2398
2375
|
}
|
|
@@ -2405,7 +2382,7 @@ class xt {
|
|
|
2405
2382
|
*/
|
|
2406
2383
|
sendMessageDeletedMessage(t, e) {
|
|
2407
2384
|
if (!this.isEmbedded())
|
|
2408
|
-
throw new
|
|
2385
|
+
throw new d(this.currentContext);
|
|
2409
2386
|
const r = "MESSAGE DELETED", s = this.createMessage(r, !1);
|
|
2410
2387
|
s.correlationId = t, s.streamId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
2411
2388
|
}
|
|
@@ -2424,7 +2401,7 @@ class xt {
|
|
|
2424
2401
|
*/
|
|
2425
2402
|
sendSendMessageStatusQueryMessage(t, e) {
|
|
2426
2403
|
if (!this.isEmbedded())
|
|
2427
|
-
throw new
|
|
2404
|
+
throw new d(this.currentContext);
|
|
2428
2405
|
const r = "SEND MESSAGE STATUS QUERY", s = this.createMessage(r, !0);
|
|
2429
2406
|
s.correlationId = t, s.streamId = e, this.logCreated(r, s);
|
|
2430
2407
|
const i = this.incomingMessages$.pipe(
|
|
@@ -2432,7 +2409,7 @@ class xt {
|
|
|
2432
2409
|
(o) => o.type === "SEND MESSAGE STATUS UPDATE" && o.replyTo === s.id
|
|
2433
2410
|
),
|
|
2434
2411
|
f(this.logReceived()),
|
|
2435
|
-
|
|
2412
|
+
p((o) => o),
|
|
2436
2413
|
m(1)
|
|
2437
2414
|
);
|
|
2438
2415
|
return this.port2.postMessage(s), this.logSent(r, s), i;
|
|
@@ -2446,11 +2423,11 @@ class xt {
|
|
|
2446
2423
|
*/
|
|
2447
2424
|
onSendMessageStatusUpdateMessage() {
|
|
2448
2425
|
if (!this.isEmbedded())
|
|
2449
|
-
throw new
|
|
2426
|
+
throw new d(this.currentContext);
|
|
2450
2427
|
const t = "SEND MESSAGE STATUS UPDATE";
|
|
2451
2428
|
return this.incomingMessages$.pipe(
|
|
2452
2429
|
g((e) => e.type === t && e.target === "client" && e.replyTo === null),
|
|
2453
|
-
|
|
2430
|
+
p((e) => e),
|
|
2454
2431
|
f(this.logReceived())
|
|
2455
2432
|
);
|
|
2456
2433
|
}
|
|
@@ -2462,7 +2439,7 @@ class xt {
|
|
|
2462
2439
|
*/
|
|
2463
2440
|
sendSipCallMessage(t) {
|
|
2464
2441
|
if (!this.isEmbedded())
|
|
2465
|
-
throw new
|
|
2442
|
+
throw new d(this.currentContext);
|
|
2466
2443
|
const e = "SIP CALL", r = this.createMessage(e, !1);
|
|
2467
2444
|
r.contact = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
|
|
2468
2445
|
}
|