fcr-core 3.8.1 → 3.9.0-alpha
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/lib/chat-connector/type.d.ts +40 -0
- package/lib/{chat-connection → chat-connector}/type.js +1 -1
- package/lib/engine/index.d.ts +10 -11
- package/lib/engine/index.js +63 -72
- package/lib/engine/type.d.ts +96 -0
- package/lib/engine/type.js +5 -0
- package/lib/imports.d.ts +7 -4
- package/lib/imports.js +30 -4
- package/lib/index.d.ts +3 -2
- package/lib/index.js +21 -2
- package/lib/media-control/desktop.js +12 -12
- package/lib/media-control/mobile.js +4 -0
- package/lib/media-control/type.d.ts +32 -33
- package/lib/monitor-control/index.js +3 -3
- package/lib/peer-session/index.js +14 -14
- package/lib/peer-session/type.d.ts +1 -1
- package/lib/plugins/chat/chatroom.js +417 -0
- package/lib/{chat-connection → plugins/chat}/config.d.ts +1 -0
- package/lib/{room-control/chatroom-control → plugins/chat}/config.js +2 -1
- package/lib/plugins/chat/connector.d.ts +38 -0
- package/lib/{chat-connection/index.js → plugins/chat/connector.js} +181 -61
- package/lib/room-control/ability-control/index.js +5 -4
- package/lib/room-control/ability-control/type.d.ts +5 -1
- package/lib/room-control/ability-control/type.js +4 -0
- package/lib/room-control/chatroom-control/type.d.ts +44 -35
- package/lib/room-control/group-control/index.js +9 -9
- package/lib/room-control/index.js +37 -22
- package/lib/room-control/interpreter-control/index.js +7 -4
- package/lib/room-control/interpreter-control/room.js +3 -3
- package/lib/room-control/interpreter-control/types.d.ts +2 -2
- package/lib/room-control/join-before-host-waitingroom-control/index.js +3 -3
- package/lib/room-control/mainroom-control/index.js +15 -13
- package/lib/room-control/privilege-control/index.js +39 -24
- package/lib/room-control/privilege-control/type.d.ts +15 -15
- package/lib/room-control/room-connector-control/index.js +7 -5
- package/lib/room-control/room-connector-control/type.d.ts +1 -1
- package/lib/room-control/room-control-factory.d.ts +3 -3
- package/lib/room-control/room-control-factory.js +7 -7
- package/lib/room-control/room-session/index.js +17 -15
- package/lib/room-control/room-session/type.d.ts +3 -3
- package/lib/room-control/sharing-control/index.js +13 -7
- package/lib/room-control/stream-control/index.js +18 -16
- package/lib/room-control/stream-control/type.d.ts +5 -5
- package/lib/room-control/stt-control/index.js +38 -31
- package/lib/room-control/type.d.ts +19 -19
- package/lib/room-control/user-control/index.js +20 -22
- package/lib/room-control/user-control/type.d.ts +1 -1
- package/lib/room-control/waitingroom-control/index.js +11 -11
- package/lib/room-control/whiteboard-control-v1/board-window.d.ts +21 -20
- package/lib/room-control/whiteboard-control-v1/board-window.js +27 -8
- package/lib/room-control/whiteboard-control-v1/factory.js +1 -1
- package/lib/room-control/whiteboard-control-v1/index.js +26 -18
- package/lib/room-control/whiteboard-control-v1/type.d.ts +26 -25
- package/lib/room-control/whiteboard-control-v1/type.js +1 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +15 -6
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +39 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +4 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +6 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +7 -1
- package/lib/room-control/whiteboard-control-v2/base/index.d.ts +9 -8
- package/lib/room-control/whiteboard-control-v2/base/index.js +84 -42
- package/lib/room-control/whiteboard-control-v2/base/main-window.d.ts +16 -15
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +23 -4
- package/lib/room-control/whiteboard-control-v2/type.d.ts +17 -17
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +12 -6
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +64 -18
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +2 -2
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +1 -1
- package/lib/room-router/index.js +10 -7
- package/lib/room-router/type.d.ts +1 -1
- package/lib/schema.d.ts +24 -46
- package/lib/schema.js +1 -2
- package/lib/service/api.d.ts +5 -3
- package/lib/service/api.js +17 -12
- package/lib/type.d.ts +64 -45
- package/lib/type.js +76 -11
- package/lib/utilities/abortable-retry.d.ts +38 -0
- package/lib/utilities/abortable-retry.js +61 -0
- package/lib/utilities/dual-video-stream-config.d.ts +6 -0
- package/lib/utilities/dual-video-stream-config.js +25 -0
- package/lib/utilities/error-helpers.d.ts +10 -9
- package/lib/utilities/error-helpers.js +12 -11
- package/lib/utilities/error.d.ts +4 -40
- package/lib/utilities/error.js +20 -77
- package/lib/utilities/join-helper.js +2 -2
- package/lib/utilities/logger.d.ts +2 -2
- package/lib/utilities/logger.js +6 -25
- package/lib/utilities/package-info.d.ts +1 -2
- package/lib/utilities/package-info.js +4 -8
- package/lib/utilities/parameters.js +88 -15
- package/lib/utilities/validate-params.js +1 -1
- package/lib/utilities/video-encoder-config.d.ts +9 -0
- package/lib/utilities/video-encoder-config.js +109 -0
- package/lib-es/base-session.js +1 -0
- package/lib-es/chat-connector/type.js +6 -0
- package/lib-es/engine/index.js +412 -0
- package/lib-es/engine/type.js +1 -0
- package/lib-es/imports.js +59 -0
- package/lib-es/index.js +8 -0
- package/lib-es/media-control/desktop.js +172 -0
- package/lib-es/media-control/mobile.js +198 -0
- package/lib-es/media-control/type.js +6 -0
- package/lib-es/monitor-control/index.js +46 -0
- package/lib-es/monitor-control/type.js +1 -0
- package/lib-es/peer-session/index.js +279 -0
- package/lib-es/peer-session/type.js +1 -0
- package/lib-es/plugins/chat/chatroom.js +409 -0
- package/{lib/chat-connection → lib-es/plugins/chat}/config.js +5 -9
- package/lib-es/plugins/chat/connector.js +269 -0
- package/lib-es/plugins/electron-rtc-plugin.js +1 -0
- package/lib-es/plugins/rtm-plugin.js +1 -0
- package/lib-es/plugins/web-rtc-plugin.js +1 -0
- package/lib-es/room-control/ability-control/index.js +58 -0
- package/lib-es/room-control/ability-control/type.js +15 -0
- package/lib-es/room-control/chatroom-control/type.js +12 -0
- package/lib-es/room-control/group-control/index.js +256 -0
- package/lib-es/room-control/helpers/constants.js +92 -0
- package/lib-es/room-control/helpers/index.js +20 -0
- package/lib-es/room-control/helpers/validation-helper.js +46 -0
- package/lib-es/room-control/index.js +623 -0
- package/lib-es/room-control/interpreter-control/index.js +172 -0
- package/lib-es/room-control/interpreter-control/room.js +28 -0
- package/lib-es/room-control/interpreter-control/types.js +26 -0
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +29 -0
- package/lib-es/room-control/mainroom-control/index.js +248 -0
- package/lib-es/room-control/privilege-control/helper.js +97 -0
- package/lib-es/room-control/privilege-control/index.js +339 -0
- package/lib-es/room-control/privilege-control/type.js +159 -0
- package/lib-es/room-control/room-connector-control/index.js +182 -0
- package/lib-es/room-control/room-connector-control/type.js +28 -0
- package/lib-es/room-control/room-control-factory.js +77 -0
- package/lib-es/room-control/room-session/index.js +292 -0
- package/lib-es/room-control/room-session/type.js +1 -0
- package/lib-es/room-control/shared-cache.js +47 -0
- package/lib-es/room-control/sharing-control/index.js +307 -0
- package/lib-es/room-control/sharing-control/type.js +16 -0
- package/lib-es/room-control/stream-control/index.js +536 -0
- package/lib-es/room-control/stream-control/type.js +1 -0
- package/lib-es/room-control/stt-control/de-compress-gzip.js +33 -0
- package/lib-es/room-control/stt-control/index.js +350 -0
- package/lib-es/room-control/stt-control/type.js +10 -0
- package/lib-es/room-control/type.js +30 -0
- package/lib-es/room-control/user-control/index.js +344 -0
- package/lib-es/room-control/user-control/type.js +21 -0
- package/lib-es/room-control/waitingroom-control/index.js +68 -0
- package/lib-es/room-control/whiteboard-control/enum.js +18 -0
- package/lib-es/room-control/whiteboard-control/type.js +10 -0
- package/lib-es/room-control/whiteboard-control/utils.js +13 -0
- package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +18 -0
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +573 -0
- package/lib-es/room-control/whiteboard-control-v1/enum.js +157 -0
- package/lib-es/room-control/whiteboard-control-v1/factory.js +12 -0
- package/lib-es/room-control/whiteboard-control-v1/index.js +427 -0
- package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +6 -0
- package/lib-es/room-control/whiteboard-control-v1/type.js +8 -0
- package/lib-es/room-control/whiteboard-control-v1/utils.js +273 -0
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +76 -0
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +37 -0
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/type.js +1 -0
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +347 -0
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +269 -0
- package/lib-es/room-control/whiteboard-control-v2/constant.js +9 -0
- package/lib-es/room-control/whiteboard-control-v2/enum.js +28 -0
- package/lib-es/room-control/whiteboard-control-v2/type.js +1 -0
- package/lib-es/room-control/whiteboard-control-v2/utils.js +92 -0
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +204 -0
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +61 -0
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/type.js +1 -0
- package/lib-es/room-router/index.js +263 -0
- package/lib-es/room-router/type.js +5 -0
- package/lib-es/schema.js +231 -0
- package/lib-es/service/api.js +1211 -0
- package/lib-es/service/type.js +1 -0
- package/lib-es/type.js +222 -0
- package/lib-es/utilities/abortable-retry.js +54 -0
- package/lib-es/utilities/cmd.js +1 -0
- package/lib-es/utilities/collection.js +64 -0
- package/lib-es/utilities/dual-video-stream-config.js +19 -0
- package/lib-es/utilities/error-helpers.js +224 -0
- package/lib-es/utilities/error.js +43 -0
- package/lib-es/utilities/join-helper.js +219 -0
- package/lib-es/utilities/logger.js +7 -0
- package/lib-es/utilities/package-info.js +5 -0
- package/lib-es/utilities/parameters.js +106 -0
- package/lib-es/utilities/retry-helpers.js +66 -0
- package/lib-es/utilities/shared-storage.js +31 -0
- package/lib-es/utilities/stream.js +18 -0
- package/lib-es/utilities/user.js +30 -0
- package/lib-es/utilities/validate-params.js +8 -0
- package/lib-es/utilities/video-encoder-config.js +103 -0
- package/package.json +11 -10
- package/lib/chat-connection/index.d.ts +0 -24
- package/lib/chat-connection/type.d.ts +0 -17
- package/lib/plugins/chatroom.js +0 -454
- package/lib/room-control/chatroom-control/config.d.ts +0 -51
- package/lib/utilities/storage.d.ts +0 -8
- package/lib/utilities/storage.js +0 -33
- /package/lib/plugins/{chatroom.d.ts → chat/chatroom.d.ts} +0 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import "core-js/modules/esnext.function.metadata.js";
|
|
2
|
+
import "core-js/modules/esnext.map.delete-all.js";
|
|
3
|
+
import "core-js/modules/esnext.map.emplace.js";
|
|
4
|
+
import "core-js/modules/esnext.map.every.js";
|
|
5
|
+
import "core-js/modules/esnext.map.filter.js";
|
|
6
|
+
import "core-js/modules/esnext.map.find.js";
|
|
7
|
+
import "core-js/modules/esnext.map.find-key.js";
|
|
8
|
+
import "core-js/modules/esnext.map.includes.js";
|
|
9
|
+
import "core-js/modules/esnext.map.key-of.js";
|
|
10
|
+
import "core-js/modules/esnext.map.map-keys.js";
|
|
11
|
+
import "core-js/modules/esnext.map.map-values.js";
|
|
12
|
+
import "core-js/modules/esnext.map.merge.js";
|
|
13
|
+
import "core-js/modules/esnext.map.reduce.js";
|
|
14
|
+
import "core-js/modules/esnext.map.some.js";
|
|
15
|
+
import "core-js/modules/esnext.map.update.js";
|
|
16
|
+
import "core-js/modules/esnext.symbol.metadata.js";
|
|
17
|
+
let _initProto, _getUserDecs, _fetchUserListDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs;
|
|
18
|
+
import "core-js/modules/es.array.push.js";
|
|
19
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
20
|
+
import "core-js/modules/esnext.iterator.find.js";
|
|
21
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
|
22
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
23
|
+
import "core-js/modules/esnext.iterator.reduce.js";
|
|
24
|
+
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
26
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
|
+
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
28
|
+
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
29
|
+
import { get, trace } from '../../imports';
|
|
30
|
+
import { FcrUserRole, FcrUserRoleToStringMap } from '../../type';
|
|
31
|
+
import { AgoraObservable } from '../../imports';
|
|
32
|
+
import { convertRteUserToFcrUser } from '../../utilities/user';
|
|
33
|
+
import { FcrUserKickedOutType, FcrUserLeftReason } from './type';
|
|
34
|
+
import { bound } from '../../imports';
|
|
35
|
+
import { convertToStructure } from '../../utilities/collection';
|
|
36
|
+
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
37
|
+
import { handleRequestError } from '../../utilities/error';
|
|
38
|
+
import validateParams from '../../utilities/validate-params';
|
|
39
|
+
import { fcrUserKickedOutTypeSchema, fcrUserRolesSchema, stringKeyUnknownValueSchema, stringSchema, stringArraySchema, fcrUserRoleSchema, stringKeyNumberValueSchema } from '../../schema';
|
|
40
|
+
import { ErrorModuleCode } from '../../imports';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export class FcrUserControlImpl {
|
|
46
|
+
static {
|
|
47
|
+
[_initProto] = _applyDecs(this, [[bound, 2, "getLocalUser"], [bound, 2, "getUsers"], [bound, 2, "getUserList"], [_getUserDecs, 2, "getUser"], [[bound, trace], 2, "getAllUserCount"], [bound, 2, "getWaterMarkContent"], [_fetchUserListDecs, 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[bound, trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[bound, trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"]], []).e;
|
|
48
|
+
}
|
|
49
|
+
//@internal
|
|
50
|
+
[(_getUserDecs = [bound, validateParams(stringSchema)], _fetchUserListDecs = [bound, trace(['params'])], _updateUserNameDecs = [bound, trace(['userId', 'userName']), validateParams(stringSchema, stringSchema)], _updateUserPropertiesDecs = [bound, trace(['properties', 'cause', 'userId']), validateParams(stringKeyUnknownValueSchema, stringKeyUnknownValueSchema, stringSchema)], _updateIncrementUserPropertiesDecs = [bound, trace(['increments', 'cause', 'userId']), validateParams(stringKeyNumberValueSchema, stringKeyUnknownValueSchema, stringSchema)], _deleteUserPropertiesDecs = [bound, trace(['keyPath', 'cause', 'userId']), validateParams(stringArraySchema, stringKeyUnknownValueSchema, stringSchema)], _getUserPropertiesByUserIdDecs = [bound, trace(['userId']), validateParams(stringSchema)], _getUserPropertiesByKeyPathDecs = [bound, trace(['keyPath', 'userId']), validateParams(stringSchema, stringSchema)], _updateRemoteUserRoleDecs = [bound, trace(['userId', 'userRole']), validateParams(stringSchema, fcrUserRoleSchema)], _claimHostDecs = [bound, trace(['hostKey']), validateParams(stringSchema)], _kickOutDecs = [bound, trace(['userId', 'type']), validateParams(stringSchema, fcrUserKickedOutTypeSchema)], _kickOutByUserIdsDecs = [trace(['userIds', 'type']), validateParams(stringArraySchema, fcrUserKickedOutTypeSchema)], _kickOutByUserRolesDecs = [trace(['userRoles', 'type']), validateParams(fcrUserRolesSchema, fcrUserKickedOutTypeSchema)], _mergeAudioStreamDecs = [trace(['userId']), validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
|
|
51
|
+
prefix: 'FcrUserControlImpl'
|
|
52
|
+
}));
|
|
53
|
+
//@internal
|
|
54
|
+
_observable = new AgoraObservable();
|
|
55
|
+
//@internal
|
|
56
|
+
_userMapByUserId = {};
|
|
57
|
+
//@internal
|
|
58
|
+
_userList = [];
|
|
59
|
+
//@internal
|
|
60
|
+
|
|
61
|
+
//@internal
|
|
62
|
+
|
|
63
|
+
//@internal
|
|
64
|
+
_sceneObserver = {
|
|
65
|
+
onRemoteUsersJoined: (roomId, events) => {
|
|
66
|
+
events.forEach(event => {
|
|
67
|
+
const userProperties = this._scene.getUserPropertiesByUserId(event.userInfo.userId);
|
|
68
|
+
this._roomCache.setUserPlatform(event.userInfo.userId, userProperties?.platform);
|
|
69
|
+
this._roomCache.setUserAvatar(event.userInfo.userId, userProperties?.avatar);
|
|
70
|
+
});
|
|
71
|
+
const fcrUserEvents = events.map(e => {
|
|
72
|
+
return {
|
|
73
|
+
userInfo: e.userInfo && convertRteUserToFcrUser(e.userInfo, this._roomCache),
|
|
74
|
+
operatorUser: e.operatorUser && convertRteUserToFcrUser(e.operatorUser, this._roomCache)
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
fcrUserEvents.forEach(event => {
|
|
78
|
+
const user = event.userInfo;
|
|
79
|
+
const exists = user.userId in this._userMapByUserId;
|
|
80
|
+
if (exists) {
|
|
81
|
+
this.logger.warn(`[FcrUserControl] user joined when the user already exists, userId: ${user.userId}`);
|
|
82
|
+
} else {
|
|
83
|
+
this._userMapByUserId[user.userId] = user;
|
|
84
|
+
this._userList.push(user);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
this._observable.notifyObservers('onRemoteUsersJoined', roomId, fcrUserEvents);
|
|
88
|
+
},
|
|
89
|
+
onRemoteUsersLeft: (roomId, events) => {
|
|
90
|
+
const fcrUserEvents = events.map(e => {
|
|
91
|
+
return {
|
|
92
|
+
userInfo: e.userInfo && convertRteUserToFcrUser(e.userInfo, this._roomCache),
|
|
93
|
+
userProperties: e.userProperties,
|
|
94
|
+
operatorUser: e.operatorUser && convertRteUserToFcrUser(e.operatorUser, this._roomCache),
|
|
95
|
+
reason: e.cause?.cmd === 5 ? FcrUserLeftReason.kickOut : FcrUserLeftReason.LeaveRoom
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
fcrUserEvents.forEach(event => {
|
|
99
|
+
const user = event.userInfo;
|
|
100
|
+
const exists = user.userId in this._userMapByUserId;
|
|
101
|
+
if (!exists) {
|
|
102
|
+
this.logger.warn(`[FcrUserControl] user left when the user does not exist, userId: ${user.userId}`);
|
|
103
|
+
} else {
|
|
104
|
+
delete this._userMapByUserId[user.userId];
|
|
105
|
+
const index = this._userList.findIndex(u => user.userId === u.userId);
|
|
106
|
+
if (index !== -1) {
|
|
107
|
+
this._userList.splice(index, 1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
events.forEach(event => {
|
|
112
|
+
this._roomCache.deleteUserPlatform(event.userInfo.userId);
|
|
113
|
+
this._roomCache.deleteUserAvatar(event.userInfo.userId);
|
|
114
|
+
});
|
|
115
|
+
this._observable.notifyObservers('onRemoteUsersLeft', roomId, fcrUserEvents);
|
|
116
|
+
},
|
|
117
|
+
onUserUpdated: (sceneId, event) => {
|
|
118
|
+
const fcrUserUpdatedEvent = {
|
|
119
|
+
modifiedUser: event.modifiedUser && convertRteUserToFcrUser(event.modifiedUser, this._roomCache),
|
|
120
|
+
operatorUser: event.operatorUser && convertRteUserToFcrUser(event.operatorUser, this._roomCache),
|
|
121
|
+
reason: event.reason
|
|
122
|
+
};
|
|
123
|
+
const user = fcrUserUpdatedEvent.modifiedUser;
|
|
124
|
+
const exists = user.userId in this._userMapByUserId;
|
|
125
|
+
if (!exists) {
|
|
126
|
+
this.logger.warn(`[FcrUserControl] user updated when the user does not exist, userId: ${user.userId}`);
|
|
127
|
+
} else {
|
|
128
|
+
this._userMapByUserId[user.userId] = user;
|
|
129
|
+
const index = this._userList.findIndex(u => user.userId === u.userId);
|
|
130
|
+
if (index !== -1) {
|
|
131
|
+
this._userList.splice(index, 1, user);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
this._observable.notifyObservers('onUserInfoUpdated', sceneId, fcrUserUpdatedEvent);
|
|
135
|
+
},
|
|
136
|
+
onAllUserCountUpdated: (sceneId, count) => {
|
|
137
|
+
this._observable.notifyObservers('onAllUserCountUpdated', sceneId, count);
|
|
138
|
+
},
|
|
139
|
+
onUserPropertiesUpdated: (roomId, event) => {
|
|
140
|
+
if (event.cause?.cmd === 5 && event.modifiedUser.userId === this._localUserId) {
|
|
141
|
+
const {
|
|
142
|
+
changedProperties
|
|
143
|
+
} = event;
|
|
144
|
+
const dirtyStateMap = {
|
|
145
|
+
'0': FcrUserKickedOutType.Once,
|
|
146
|
+
'1': FcrUserKickedOutType.Forever,
|
|
147
|
+
'2': 2
|
|
148
|
+
};
|
|
149
|
+
const key = get(changedProperties, 'dirty.state');
|
|
150
|
+
const type = dirtyStateMap[key];
|
|
151
|
+
this._observable.notifyObservers('onLocalUserKickedOut', roomId, {
|
|
152
|
+
type
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (event.cause?.cmd === 8) {
|
|
156
|
+
const changedProperties = {};
|
|
157
|
+
for (const key in event.changedProperties) {
|
|
158
|
+
if (key.startsWith('flexProps')) {
|
|
159
|
+
changedProperties[key] = event.changedProperties[key];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (Object.keys(changedProperties).length > 0) {
|
|
163
|
+
const structure = convertToStructure(changedProperties);
|
|
164
|
+
this._observable.notifyObservers('onUserPropertiesUpdated', roomId, {
|
|
165
|
+
...event,
|
|
166
|
+
changedProperties: structure['flexProps']
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
onUserPropertiesDeleted: (roomId, event) => {
|
|
172
|
+
if (event.cause?.cmd === 8) {
|
|
173
|
+
const changedKeyPaths = [];
|
|
174
|
+
for (const keyPath of event.changedKeyPaths) {
|
|
175
|
+
if (keyPath.startsWith('flexProps')) {
|
|
176
|
+
changedKeyPaths.push(keyPath);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (changedKeyPaths.length > 0) {
|
|
180
|
+
this._observable.notifyObservers('onUserPropertiesDeleted', roomId, {
|
|
181
|
+
...event,
|
|
182
|
+
changedKeyPaths
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
constructor(_scene, _api, _sharedCache) {
|
|
189
|
+
this._scene = _scene;
|
|
190
|
+
this._api = _api;
|
|
191
|
+
this._sharedCache = _sharedCache;
|
|
192
|
+
this._roomCache = _sharedCache.getRoomCache(this._scene.sceneId);
|
|
193
|
+
const users = this._scene.getUsers();
|
|
194
|
+
Object.keys(users).forEach(userId => {
|
|
195
|
+
const userProperties = this._scene.getUserPropertiesByUserId(userId);
|
|
196
|
+
this._roomCache.setUserAvatar(userId, userProperties?.avatar);
|
|
197
|
+
this._roomCache.setUserPlatform(userId, userProperties?.platform);
|
|
198
|
+
});
|
|
199
|
+
this._userMapByUserId = Object.keys(users).reduce((prev, userId) => {
|
|
200
|
+
prev[userId] = convertRteUserToFcrUser(users[userId], this._roomCache);
|
|
201
|
+
return prev;
|
|
202
|
+
}, {});
|
|
203
|
+
this._userList = this._scene.getUserList().map(user => {
|
|
204
|
+
return convertRteUserToFcrUser(user, this._roomCache);
|
|
205
|
+
});
|
|
206
|
+
this._localUserId = this._scene.localUser.getLocalUserId();
|
|
207
|
+
this._addLogObserver();
|
|
208
|
+
this._scene.addObserver(this._sceneObserver);
|
|
209
|
+
}
|
|
210
|
+
// @trace
|
|
211
|
+
getLocalUser() {
|
|
212
|
+
const localUserId = this._scene.localUser.getLocalUserId();
|
|
213
|
+
const localUser = this._scene.getUser(localUserId);
|
|
214
|
+
return convertRteUserToFcrUser(localUser, this._roomCache);
|
|
215
|
+
}
|
|
216
|
+
// @trace
|
|
217
|
+
getUsers() {
|
|
218
|
+
return this._userMapByUserId;
|
|
219
|
+
}
|
|
220
|
+
// @trace
|
|
221
|
+
getUserList() {
|
|
222
|
+
return this._userList;
|
|
223
|
+
}
|
|
224
|
+
getUser(userId) {
|
|
225
|
+
const user = this._scene.getUser(userId);
|
|
226
|
+
if (user) {
|
|
227
|
+
return convertRteUserToFcrUser(user, this._roomCache);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
getAllUserCount() {
|
|
231
|
+
return this._scene.getUserCount();
|
|
232
|
+
}
|
|
233
|
+
getWaterMarkContent() {
|
|
234
|
+
const {
|
|
235
|
+
userId
|
|
236
|
+
} = this.getLocalUser();
|
|
237
|
+
return get(this._scene.getUserPropertiesByUserId(userId), 'security.watermark.content');
|
|
238
|
+
}
|
|
239
|
+
async fetchUserList(params) {
|
|
240
|
+
return await this._scene.fetchUserList(params);
|
|
241
|
+
}
|
|
242
|
+
async updateUserName(userId, userName) {
|
|
243
|
+
return handleRequestError(() => this._api.updateUserName({
|
|
244
|
+
roomId: this._scene.sceneId,
|
|
245
|
+
userId,
|
|
246
|
+
userName
|
|
247
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'update user name failed');
|
|
248
|
+
}
|
|
249
|
+
updateUserProperties(properties, cause, userId) {
|
|
250
|
+
return handleRequestError(() => this._api.updateUserProperties({
|
|
251
|
+
roomId: this._scene.sceneId,
|
|
252
|
+
userUuid: userId,
|
|
253
|
+
properties,
|
|
254
|
+
cause
|
|
255
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'update user properties failed');
|
|
256
|
+
}
|
|
257
|
+
updateIncrementUserProperties(increments, cause, userId) {
|
|
258
|
+
return handleRequestError(() => this._api.updateUserProperties({
|
|
259
|
+
roomId: this._scene.sceneId,
|
|
260
|
+
userUuid: userId,
|
|
261
|
+
increments,
|
|
262
|
+
cause
|
|
263
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'update increment user properties failed');
|
|
264
|
+
}
|
|
265
|
+
async deleteUserProperties(keyPath, cause, userId) {
|
|
266
|
+
return handleRequestError(() => this._api.deleteUserProperties({
|
|
267
|
+
roomId: this._scene.sceneId,
|
|
268
|
+
userUuid: userId,
|
|
269
|
+
properties: keyPath,
|
|
270
|
+
cause
|
|
271
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'delete user properties failed');
|
|
272
|
+
}
|
|
273
|
+
getUserProperties() {
|
|
274
|
+
const userProperties = this._scene.getUserProperties();
|
|
275
|
+
const res = {};
|
|
276
|
+
for (const userId in userProperties) {
|
|
277
|
+
res[userId] = userProperties[userId]?.['flexProps'];
|
|
278
|
+
}
|
|
279
|
+
return res;
|
|
280
|
+
}
|
|
281
|
+
getUserPropertiesByUserId(userId) {
|
|
282
|
+
return this._scene.getUserPropertiesByUserId(userId)?.['flexProps'];
|
|
283
|
+
}
|
|
284
|
+
getUserPropertiesByKeyPath(keyPath, userId) {
|
|
285
|
+
return this._scene.getUserPropertiesByKeyPath('flexProps.' + keyPath, userId);
|
|
286
|
+
}
|
|
287
|
+
async updateRemoteUserRole(userId, userRole) {
|
|
288
|
+
return handleRequestError(() => this._api.updateUserRole({
|
|
289
|
+
roomId: this._scene.sceneId,
|
|
290
|
+
userId,
|
|
291
|
+
localRole: userRole === FcrUserRole.HOST ? FcrUserRoleToStringMap[FcrUserRole.PARTICIPANT] : undefined,
|
|
292
|
+
remoteRole: FcrUserRoleToStringMap[userRole]
|
|
293
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'update remote user role failed');
|
|
294
|
+
}
|
|
295
|
+
async revokeHost() {
|
|
296
|
+
const userList = this.getUserList();
|
|
297
|
+
const originHostUser = userList.find(user => user.userRole === FcrUserRole.HOST);
|
|
298
|
+
if (originHostUser) {
|
|
299
|
+
return handleRequestError(() => this._api.revokeUserRole({
|
|
300
|
+
roomId: this._scene.sceneId,
|
|
301
|
+
remoteRole: FcrUserRoleToStringMap[FcrUserRole.PARTICIPANT]
|
|
302
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'revoke host failed');
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
async claimHost(hostKey) {
|
|
306
|
+
const {
|
|
307
|
+
userId
|
|
308
|
+
} = this.getLocalUser();
|
|
309
|
+
return await handleRequestError(() => this._api.claimHost({
|
|
310
|
+
roomId: this._scene.sceneId,
|
|
311
|
+
hostKey,
|
|
312
|
+
userId
|
|
313
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'claim host by ticket failed');
|
|
314
|
+
}
|
|
315
|
+
async kickOut(userId, type) {
|
|
316
|
+
return handleRequestError(() => this._api.kickOut(userId, type, {
|
|
317
|
+
roomId: this._scene.sceneId
|
|
318
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'kick out failed');
|
|
319
|
+
}
|
|
320
|
+
async kickOutByUserIds(userIds, type) {
|
|
321
|
+
return handleRequestError(() => this._api.kickOutByUserIds(userIds, type, {
|
|
322
|
+
roomId: this._scene.sceneId
|
|
323
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'kick out by user ids failed');
|
|
324
|
+
}
|
|
325
|
+
async kickOutByUserRoles(userRoles, type) {
|
|
326
|
+
return handleRequestError(() => this._api.kickOutByUserRoles(type, {
|
|
327
|
+
roomId: this._scene.sceneId
|
|
328
|
+
}, userRoles.map(role => FcrUserRoleToStringMap[role])), ErrorModuleCode.FCR_ROOM_USER, 'kick out by user roles failed');
|
|
329
|
+
}
|
|
330
|
+
mergeAudioStream(userId) {
|
|
331
|
+
return handleRequestError(() => this._api.mergeAudioStream(userId, {
|
|
332
|
+
roomId: this._scene.sceneId
|
|
333
|
+
}), ErrorModuleCode.FCR_ROOM_USER, 'merge audio stream failed');
|
|
334
|
+
}
|
|
335
|
+
addObserver(observer) {
|
|
336
|
+
this._observable.addObserver(observer);
|
|
337
|
+
}
|
|
338
|
+
removeObserver(observer) {
|
|
339
|
+
this._observable.removeObserver(observer);
|
|
340
|
+
}
|
|
341
|
+
_addLogObserver() {
|
|
342
|
+
this.addObserver(generateLogObserver(this.logger, [['onRemoteUsersJoined', ['roomId', 'events']], ['onRemoteUsersLeft', ['roomId', 'events']], ['onUserInfoUpdated', ['roomId', 'event']], ['onAllUserCountUpdated', ['roomId', 'count']], ['onLocalUserKickedOut', ['roomId', 'event']], ['onUserPropertiesUpdated', ['roomId', 'event']], ['onUserPropertiesDeleted', ['roomId', 'event']]]));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** user */
|
|
2
|
+
|
|
3
|
+
export let FcrUserLeftReason = /*#__PURE__*/function (FcrUserLeftReason) {
|
|
4
|
+
FcrUserLeftReason[FcrUserLeftReason["LeaveRoom"] = 1] = "LeaveRoom";
|
|
5
|
+
FcrUserLeftReason[FcrUserLeftReason["kickOut"] = 2] = "kickOut";
|
|
6
|
+
return FcrUserLeftReason;
|
|
7
|
+
}({});
|
|
8
|
+
export let FcrUserKickedOutType = /*#__PURE__*/function (FcrUserKickedOutType) {
|
|
9
|
+
FcrUserKickedOutType[FcrUserKickedOutType["Once"] = 1] = "Once";
|
|
10
|
+
FcrUserKickedOutType[FcrUserKickedOutType["Forever"] = 2] = "Forever";
|
|
11
|
+
return FcrUserKickedOutType;
|
|
12
|
+
}({});
|
|
13
|
+
export let FcrUserRole = /*#__PURE__*/function (FcrUserRole) {
|
|
14
|
+
FcrUserRole[FcrUserRole["HOST"] = 1] = "HOST";
|
|
15
|
+
FcrUserRole[FcrUserRole["COHOST"] = 2] = "COHOST";
|
|
16
|
+
FcrUserRole[FcrUserRole["PARTICIPANT"] = 3] = "PARTICIPANT";
|
|
17
|
+
FcrUserRole[FcrUserRole["AUDIENCE"] = 4] = "AUDIENCE";
|
|
18
|
+
FcrUserRole[FcrUserRole["OBSERVER"] = 5] = "OBSERVER";
|
|
19
|
+
FcrUserRole[FcrUserRole["ROBOT"] = 6] = "ROBOT";
|
|
20
|
+
return FcrUserRole;
|
|
21
|
+
}({});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import "core-js/modules/es.array.push.js";
|
|
2
|
+
import "core-js/modules/esnext.function.metadata.js";
|
|
3
|
+
import "core-js/modules/esnext.map.delete-all.js";
|
|
4
|
+
import "core-js/modules/esnext.map.emplace.js";
|
|
5
|
+
import "core-js/modules/esnext.map.every.js";
|
|
6
|
+
import "core-js/modules/esnext.map.filter.js";
|
|
7
|
+
import "core-js/modules/esnext.map.find.js";
|
|
8
|
+
import "core-js/modules/esnext.map.find-key.js";
|
|
9
|
+
import "core-js/modules/esnext.map.includes.js";
|
|
10
|
+
import "core-js/modules/esnext.map.key-of.js";
|
|
11
|
+
import "core-js/modules/esnext.map.map-keys.js";
|
|
12
|
+
import "core-js/modules/esnext.map.map-values.js";
|
|
13
|
+
import "core-js/modules/esnext.map.merge.js";
|
|
14
|
+
import "core-js/modules/esnext.map.reduce.js";
|
|
15
|
+
import "core-js/modules/esnext.map.some.js";
|
|
16
|
+
import "core-js/modules/esnext.map.update.js";
|
|
17
|
+
import "core-js/modules/esnext.symbol.metadata.js";
|
|
18
|
+
let _initProto, _moveToMainRoomByUserIdsDecs, _moveToMainRoomByUserRolesDecs;
|
|
19
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
20
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
21
|
+
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
25
|
+
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
26
|
+
import { FcrBaseRoomControlImpl } from '..';
|
|
27
|
+
import { ErrorModuleCode, trace } from '../../imports';
|
|
28
|
+
import { fcrUserRolesSchema, stringArraySchema } from '../../schema';
|
|
29
|
+
import { FcrUserRoleToStringMap } from '../../type';
|
|
30
|
+
import { handleRequestError } from '../../utilities/error';
|
|
31
|
+
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
32
|
+
import validateParams from '../../utilities/validate-params';
|
|
33
|
+
import { FcrRoomType } from '../type';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export class FcrWaitingRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
39
|
+
static {
|
|
40
|
+
[_initProto] = _applyDecs(this, [[_moveToMainRoomByUserIdsDecs, 2, "moveToMainRoomByUserIds"], [_moveToMainRoomByUserRolesDecs, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
|
|
41
|
+
}
|
|
42
|
+
//@internal
|
|
43
|
+
[(_moveToMainRoomByUserIdsDecs = [trace(['userIds']), validateParams(stringArraySchema)], _moveToMainRoomByUserRolesDecs = [trace(['userRoles']), validateParams(fcrUserRolesSchema)], "logger")] = (_initProto(this), createLogger({
|
|
44
|
+
prefix: 'FcrWaitingRoomControlImpl'
|
|
45
|
+
}));
|
|
46
|
+
constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
|
|
47
|
+
super(engine, scene, api, config, FcrRoomType.Waitingroom, chatConnection, sharedCache, chatRoomControl);
|
|
48
|
+
this._addLogObserver();
|
|
49
|
+
}
|
|
50
|
+
addObserver(observer) {
|
|
51
|
+
super.addObserver(observer);
|
|
52
|
+
}
|
|
53
|
+
removeObserver(observer) {
|
|
54
|
+
super.removeObserver(observer);
|
|
55
|
+
}
|
|
56
|
+
async moveToMainRoomByUserIds(userIds) {
|
|
57
|
+
return handleRequestError(() => this._api.moveToMainRoomByUserIds(userIds, this._scene.getScenePropertiesByKeyPath('info.mainRoomUuid')), ErrorModuleCode.FCR_ROOM, 'move to main room by user ids failed');
|
|
58
|
+
}
|
|
59
|
+
async moveToMainRoomByUserRoles(userRoles) {
|
|
60
|
+
return handleRequestError(() => this._api.moveToMainRoomByUserRoles(userRoles.map(role => FcrUserRoleToStringMap[role]), this._scene.getScenePropertiesByKeyPath('info.mainRoomUuid')), ErrorModuleCode.FCR_ROOM, 'move to main room by user roles failed');
|
|
61
|
+
}
|
|
62
|
+
_addLogObserver() {
|
|
63
|
+
this.addObserver(generateLogObserver(this.logger, [['onCloudRecordingStateUpdated', ['roomId', 'state']], ['onJoinRoomFailure', ['roomId', 'error']], ['onJoinRoomSuccess', ['roomId']], ['onLiveStreamingStateUpdated', ['roomId', 'state', 'url', 'reason']],
|
|
64
|
+
// 'onNetworkQualityUpdated',
|
|
65
|
+
// 'onNetworkStatsUpdated',
|
|
66
|
+
['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* common enums shared by whiteboard v1 and v2
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export let FcrBoardInactiveReason = /*#__PURE__*/function (FcrBoardInactiveReason) {
|
|
6
|
+
FcrBoardInactiveReason[FcrBoardInactiveReason["CLOSE"] = 1] = "CLOSE";
|
|
7
|
+
FcrBoardInactiveReason[FcrBoardInactiveReason["TIMEOUT"] = 2] = "TIMEOUT";
|
|
8
|
+
FcrBoardInactiveReason[FcrBoardInactiveReason["SEIZE"] = 3] = "SEIZE";
|
|
9
|
+
return FcrBoardInactiveReason;
|
|
10
|
+
}({});
|
|
11
|
+
export let FcrBoardRegion = /*#__PURE__*/function (FcrBoardRegion) {
|
|
12
|
+
FcrBoardRegion["CN"] = "cn-hz";
|
|
13
|
+
FcrBoardRegion["US"] = "us-sv";
|
|
14
|
+
FcrBoardRegion["IN"] = "in-mum";
|
|
15
|
+
FcrBoardRegion["SG"] = "sg";
|
|
16
|
+
FcrBoardRegion["GB"] = "gb-lon";
|
|
17
|
+
return FcrBoardRegion;
|
|
18
|
+
}({});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* common types shared by whiteboard v1 and v2
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export let FcrBoardPropertiesState = /*#__PURE__*/function (FcrBoardPropertiesState) {
|
|
6
|
+
FcrBoardPropertiesState[FcrBoardPropertiesState["ACTIVE"] = 1] = "ACTIVE";
|
|
7
|
+
FcrBoardPropertiesState[FcrBoardPropertiesState["INACTIVE"] = 0] = "INACTIVE";
|
|
8
|
+
FcrBoardPropertiesState[FcrBoardPropertiesState["BACKGROUND_COLOR_UPDATED"] = 100101] = "BACKGROUND_COLOR_UPDATED";
|
|
9
|
+
return FcrBoardPropertiesState;
|
|
10
|
+
}({});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.some.js";
|
|
3
|
+
import { FcrPermissionAction } from '../privilege-control/type';
|
|
4
|
+
export const hasBoardWritePermission = permissions => {
|
|
5
|
+
return permissions.some(permission => {
|
|
6
|
+
return permission.info?.action === FcrPermissionAction.BoardWrite;
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export const hasAnnotationWritePermission = permissions => {
|
|
10
|
+
return permissions.some(permission => {
|
|
11
|
+
return permission.info?.action === FcrPermissionAction.AnnotationWrite;
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class FcrBoardSubWindowImpl {
|
|
2
|
+
constructor(_appId) {
|
|
3
|
+
this._appId = _appId;
|
|
4
|
+
}
|
|
5
|
+
exportPdf() {
|
|
6
|
+
window.postMessage({
|
|
7
|
+
type: '@netless/_request_save_pdf_',
|
|
8
|
+
appId: this._appId /* windowManager.addApp 返回的值, 指定要保存哪个窗口的板书, */
|
|
9
|
+
});
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
window.addEventListener('message', event => {
|
|
12
|
+
if (event.data.type === '@netless/_result_save_pdf_') {
|
|
13
|
+
event.data.progress === 100 && resolve(event.data.result?.pdf);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|