fcr-core 3.10.2 → 3.10.5
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/engine/index.js +102 -108
- package/lib/imports.js +1 -0
- package/lib/media-control/desktop.js +22 -13
- package/lib/media-control/mobile.js +27 -19
- package/lib/media-control/type.d.ts +3 -3
- package/lib/monitor-control/index.js +17 -7
- package/lib/peer-session/index.js +120 -121
- package/lib/plugins/chat/chatroom.js +119 -96
- package/lib/plugins/chat/connector.js +69 -48
- package/lib/remote-control/index.js +194 -216
- package/lib/room-control/ability-control/index.js +20 -10
- package/lib/room-control/application-control/index.js +82 -75
- package/lib/room-control/group-control/index.js +31 -30
- package/lib/room-control/helpers/board-init-info-helper.js +16 -10
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +70 -51
- package/lib/room-control/infinity-room-control/index.js +27 -19
- package/lib/room-control/interpreter-control/index.js +77 -65
- package/lib/room-control/interpreter-control/room.js +6 -4
- package/lib/room-control/join-before-host-waitingroom-control/index.js +6 -4
- package/lib/room-control/mainroom-control/index.js +37 -25
- package/lib/room-control/privilege-control/helper.js +28 -13
- package/lib/room-control/privilege-control/index.js +36 -28
- package/lib/room-control/room-connector-control/index.js +52 -49
- package/lib/room-control/room-connector-control/type.d.ts +1 -1
- package/lib/room-control/room-control-factory.js +10 -12
- package/lib/room-control/room-session/index.js +77 -74
- package/lib/room-control/shared-cache.js +63 -56
- package/lib/room-control/sharing-control/index.js +65 -57
- package/lib/room-control/stream-control/index.js +197 -193
- package/lib/room-control/stt-control/de-compress-gzip.js +10 -0
- package/lib/room-control/stt-control/index.js +93 -86
- package/lib/room-control/user-control/index.js +162 -155
- package/lib/room-control/waitingroom-control/index.js +18 -9
- package/lib/room-control/whiteboard-control/utils.js +4 -2
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
- package/lib/room-control/whiteboard-control-v1/board-window.js +120 -103
- package/lib/room-control/whiteboard-control-v1/factory.js +7 -4
- package/lib/room-control/whiteboard-control-v1/index.js +80 -67
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +4 -2
- package/lib/room-control/whiteboard-control-v1/utils.js +17 -14
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +14 -10
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +17 -8
- package/lib/room-control/whiteboard-control-v2/base/index.js +61 -53
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +39 -30
- package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +27 -11
- package/lib/room-control/widget-control/index.js +43 -33
- package/lib/room-router/index.js +66 -58
- package/lib/schema.d.ts +15 -15
- package/lib/service/api.js +446 -548
- package/lib/struct.js +5 -2
- package/lib/utilities/abortable-retry.js +3 -0
- package/lib/utilities/collection.js +15 -11
- package/lib/utilities/error-helpers.js +34 -27
- package/lib/utilities/error.js +4 -3
- package/lib/utilities/join-helper.js +37 -31
- package/lib/utilities/logger.js +8 -5
- package/lib/utilities/parameters.js +21 -10
- package/lib/utilities/retry-helpers.js +1 -0
- package/lib/utilities/stream.js +16 -11
- package/lib/utilities/user.js +4 -3
- package/lib/utilities/validate-params.js +1 -1
- package/lib/utilities/video-encoder-config.js +10 -5
- package/lib-es/engine/index.js +102 -108
- package/lib-es/media-control/desktop.js +22 -13
- package/lib-es/media-control/mobile.js +27 -19
- package/lib-es/monitor-control/index.js +16 -7
- package/lib-es/peer-session/index.js +120 -121
- package/lib-es/plugins/chat/chatroom.js +118 -95
- package/lib-es/plugins/chat/connector.js +67 -47
- package/lib-es/remote-control/index.js +194 -216
- package/lib-es/room-control/ability-control/index.js +19 -10
- package/lib-es/room-control/application-control/index.js +81 -75
- package/lib-es/room-control/group-control/index.js +31 -30
- package/lib-es/room-control/helpers/board-init-info-helper.js +15 -10
- package/lib-es/room-control/helpers/validation-helper.js +1 -1
- package/lib-es/room-control/index.js +69 -51
- package/lib-es/room-control/infinity-room-control/index.js +26 -19
- package/lib-es/room-control/interpreter-control/index.js +77 -65
- package/lib-es/room-control/interpreter-control/room.js +5 -4
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +5 -4
- package/lib-es/room-control/mainroom-control/index.js +37 -25
- package/lib-es/room-control/privilege-control/helper.js +27 -13
- package/lib-es/room-control/privilege-control/index.js +36 -28
- package/lib-es/room-control/room-connector-control/index.js +52 -49
- package/lib-es/room-control/room-control-factory.js +10 -12
- package/lib-es/room-control/room-session/index.js +77 -74
- package/lib-es/room-control/shared-cache.js +62 -56
- package/lib-es/room-control/sharing-control/index.js +64 -57
- package/lib-es/room-control/stream-control/index.js +197 -193
- package/lib-es/room-control/stt-control/de-compress-gzip.js +10 -0
- package/lib-es/room-control/stt-control/index.js +93 -86
- package/lib-es/room-control/user-control/index.js +162 -155
- package/lib-es/room-control/waitingroom-control/index.js +18 -9
- package/lib-es/room-control/whiteboard-control/utils.js +4 -2
- package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +120 -103
- package/lib-es/room-control/whiteboard-control-v1/factory.js +6 -4
- package/lib-es/room-control/whiteboard-control-v1/index.js +80 -67
- package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +3 -2
- package/lib-es/room-control/whiteboard-control-v1/utils.js +17 -14
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +13 -10
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +16 -8
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +60 -53
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +39 -30
- package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +26 -11
- package/lib-es/room-control/widget-control/index.js +42 -33
- package/lib-es/room-router/index.js +66 -58
- package/lib-es/service/api.js +445 -548
- package/lib-es/struct.js +4 -2
- package/lib-es/utilities/abortable-retry.js +3 -0
- package/lib-es/utilities/collection.js +14 -11
- package/lib-es/utilities/error-helpers.js +33 -26
- package/lib-es/utilities/error.js +4 -3
- package/lib-es/utilities/join-helper.js +36 -29
- package/lib-es/utilities/logger.js +7 -5
- package/lib-es/utilities/parameters.js +21 -10
- package/lib-es/utilities/retry-helpers.js +1 -0
- package/lib-es/utilities/stream.js +15 -11
- package/lib-es/utilities/user.js +4 -3
- package/lib-es/utilities/validate-params.js +1 -1
- package/lib-es/utilities/video-encoder-config.js +10 -5
- package/package.json +4 -4
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
|
3
5
|
require("core-js/modules/es.array.push.js");
|
|
4
6
|
require("core-js/modules/esnext.function.metadata.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
10
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
6
11
|
require("core-js/modules/esnext.map.emplace.js");
|
|
7
12
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -22,6 +27,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
22
27
|
value: true
|
|
23
28
|
});
|
|
24
29
|
exports.FcrWhiteboardControlImpl = exports.FcrStandaloneWhiteboardControlImpl = void 0;
|
|
30
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
31
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
32
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
33
|
var _imports = require("../../../imports");
|
|
26
34
|
var _schema = require("../../../schema");
|
|
27
35
|
var _type = require("../../../type");
|
|
@@ -35,33 +43,34 @@ var _type3 = require("../../whiteboard-control/type");
|
|
|
35
43
|
var _base = require("../base");
|
|
36
44
|
var _constant = require("../constant");
|
|
37
45
|
var _utils = require("../utils");
|
|
38
|
-
|
|
46
|
+
var _FcrWhiteboardControlImpl, _FcrStandaloneWhiteboardControlImpl;
|
|
47
|
+
let _initProto, _setBackgroundColorDecs, _ref, _initProto2;
|
|
48
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
49
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
39
50
|
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)]; } }; }
|
|
40
51
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
41
52
|
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); }
|
|
42
53
|
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; }
|
|
43
54
|
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; }
|
|
55
|
+
_ref = (_setBackgroundColorDecs = [(0, _imports.trace)(['backgroundColor']), (0, _validateParams.default)(_schema.stringSchema)], "logger");
|
|
44
56
|
class FcrWhiteboardControlImpl extends _base.FcrBaseWhiteboardControlImpl {
|
|
45
|
-
static {
|
|
46
|
-
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "open"], [_imports.trace, 2, "close"], [_imports.trace, 2, "release"], [_imports.trace, 2, "active"], [_imports.trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [_imports.trace, 2, "getBackgroundColor"], [_imports.trace, 2, "getActivity"], [_imports.trace, 2, "getOwnerId"], [_imports.bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, _base.FcrBaseWhiteboardControlImpl).e;
|
|
47
|
-
}
|
|
48
|
-
[(_setBackgroundColorDecs = [(0, _imports.trace)(['backgroundColor']), (0, _validateParams.default)(_schema.stringSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
49
|
-
prefix: 'FcrWhiteboardControlImpl'
|
|
50
|
-
}));
|
|
51
|
-
_backgroundColor = '#ffffff';
|
|
52
|
-
_isActive = false;
|
|
53
|
-
_ownerId = null;
|
|
54
|
-
_preloadLock = false;
|
|
55
|
-
_notifyObservers = {
|
|
56
|
-
onScenePropertiesUpdated: this._onScenePropertiesUpdated
|
|
57
|
-
};
|
|
58
57
|
constructor(rtmClient, config, sharedCache, boardRoomConfigFetcher, _scene, _api) {
|
|
59
58
|
super(rtmClient, config, boardRoomConfigFetcher, _api);
|
|
59
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
60
|
+
prefix: 'FcrWhiteboardControlImpl'
|
|
61
|
+
})));
|
|
62
|
+
(0, _defineProperty2.default)(this, "_backgroundColor", '#ffffff');
|
|
63
|
+
(0, _defineProperty2.default)(this, "_isActive", false);
|
|
64
|
+
(0, _defineProperty2.default)(this, "_ownerId", null);
|
|
65
|
+
(0, _defineProperty2.default)(this, "_preloadLock", false);
|
|
66
|
+
(0, _defineProperty2.default)(this, "_notifyObservers", {
|
|
67
|
+
onScenePropertiesUpdated: this._onScenePropertiesUpdated
|
|
68
|
+
});
|
|
60
69
|
this._scene = _scene;
|
|
61
70
|
this._api = _api;
|
|
62
71
|
this._roomCache = sharedCache.getRoomCache(config.roomId);
|
|
63
72
|
this._scene.addObserver(this._notifyObservers);
|
|
64
|
-
this.logger.info(
|
|
73
|
+
this.logger.info("Whitebaord Version: forge-whiteboard@".concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-whiteboard'), ", forge-room@").concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-room'), ", forge-room@").concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-rtm')));
|
|
65
74
|
this._isActive = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
|
|
66
75
|
const backgroundColor = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
67
76
|
if (backgroundColor) {
|
|
@@ -112,10 +121,9 @@ class FcrWhiteboardControlImpl extends _base.FcrBaseWhiteboardControlImpl {
|
|
|
112
121
|
return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this.config.roomId, _type2.FcrSharePermissionState.OFF), _imports.ErrorModuleCode.FCR_ROOM_WHITEBOARD, 'inactive failed');
|
|
113
122
|
}
|
|
114
123
|
getBoardActiveInfo() {
|
|
115
|
-
const
|
|
116
|
-
state,
|
|
117
|
-
ownerUserUuid
|
|
118
|
-
} = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard');
|
|
124
|
+
const _ref2 = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard'),
|
|
125
|
+
state = _ref2.state,
|
|
126
|
+
ownerUserId = _ref2.ownerUserUuid;
|
|
119
127
|
if (state === _type3.FcrBoardPropertiesState.ACTIVE) {
|
|
120
128
|
return {
|
|
121
129
|
isActive: true,
|
|
@@ -155,11 +163,12 @@ class FcrWhiteboardControlImpl extends _base.FcrBaseWhiteboardControlImpl {
|
|
|
155
163
|
const operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
|
|
156
164
|
const getByKeyPath = value => this._scene.getScenePropertiesByKeyPath(value);
|
|
157
165
|
if (event.cause && event.cause.cmd === 10) {
|
|
166
|
+
var _getByKeyPath;
|
|
158
167
|
const causeData = event.cause.data;
|
|
159
|
-
if (causeData
|
|
168
|
+
if (causeData !== null && causeData !== void 0 && causeData.widgetUuid && causeData.widgetUuid !== 'netlessBoard') {
|
|
160
169
|
return;
|
|
161
170
|
}
|
|
162
|
-
const state = getByKeyPath('widgets.netlessBoard.state')
|
|
171
|
+
const state = (_getByKeyPath = getByKeyPath('widgets.netlessBoard.state')) !== null && _getByKeyPath !== void 0 ? _getByKeyPath : _type3.FcrBoardPropertiesState.INACTIVE;
|
|
163
172
|
const backgroundColor = getByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
164
173
|
const widgetCauseReason = (0, _imports.get)(event.cause.data, 'widgetCause.data.reason');
|
|
165
174
|
const widgetCauseCmd = (0, _imports.get)(event.cause.data, 'widgetCause.cmd');
|
|
@@ -187,23 +196,22 @@ class FcrWhiteboardControlImpl extends _base.FcrBaseWhiteboardControlImpl {
|
|
|
187
196
|
}
|
|
188
197
|
}
|
|
189
198
|
getWhiteboardOption() {
|
|
190
|
-
return {
|
|
191
|
-
...super.getWhiteboardOption(),
|
|
199
|
+
return _objectSpread(_objectSpread({}, super.getWhiteboardOption()), {}, {
|
|
192
200
|
width: _utils.WHITEBOARD_WIDTH,
|
|
193
201
|
height: _utils.WHITEBOARD_HEIGHT
|
|
194
|
-
};
|
|
202
|
+
});
|
|
195
203
|
}
|
|
196
204
|
addLogObserver() {
|
|
197
205
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, [['onConnectionStateUpdated', ['state']], ['onActive', ['ownerId', 'operatorUser']], ['onInactive', ['reason', 'operatorUser']], ['onBackgroundColorUpdated', ['color', 'operatorUser']]]));
|
|
198
206
|
}
|
|
199
207
|
}
|
|
200
208
|
exports.FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
|
|
209
|
+
_FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
|
|
210
|
+
var _applyDecs$e = (0, _slicedToArray2.default)(_applyDecs(_FcrWhiteboardControlImpl, [[_imports.trace, 2, "open"], [_imports.trace, 2, "close"], [_imports.trace, 2, "release"], [_imports.trace, 2, "active"], [_imports.trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [_imports.trace, 2, "getBackgroundColor"], [_imports.trace, 2, "getActivity"], [_imports.trace, 2, "getOwnerId"], [_imports.bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, _base.FcrBaseWhiteboardControlImpl).e, 1);
|
|
211
|
+
_initProto = _applyDecs$e[0];
|
|
201
212
|
class FcrStandaloneWhiteboardControlImpl extends _base.FcrBaseWhiteboardControlImpl {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
constructor(...args) {
|
|
206
|
-
super(...args);
|
|
213
|
+
constructor() {
|
|
214
|
+
super(...arguments);
|
|
207
215
|
_initProto2(this);
|
|
208
216
|
}
|
|
209
217
|
async open() {
|
|
@@ -216,11 +224,15 @@ class FcrStandaloneWhiteboardControlImpl extends _base.FcrBaseWhiteboardControlI
|
|
|
216
224
|
return _constant.WHITEBOARD_APP_ID;
|
|
217
225
|
}
|
|
218
226
|
getWhiteboardOption() {
|
|
219
|
-
return {
|
|
220
|
-
...super.getWhiteboardOption(),
|
|
227
|
+
return _objectSpread(_objectSpread({}, super.getWhiteboardOption()), {}, {
|
|
221
228
|
width: _utils.WHITEBOARD_WIDTH,
|
|
222
229
|
height: _utils.WHITEBOARD_HEIGHT
|
|
223
|
-
};
|
|
230
|
+
});
|
|
224
231
|
}
|
|
225
232
|
}
|
|
226
|
-
exports.FcrStandaloneWhiteboardControlImpl = FcrStandaloneWhiteboardControlImpl;
|
|
233
|
+
exports.FcrStandaloneWhiteboardControlImpl = FcrStandaloneWhiteboardControlImpl;
|
|
234
|
+
_FcrStandaloneWhiteboardControlImpl = FcrStandaloneWhiteboardControlImpl;
|
|
235
|
+
var _applyDecs$e2 = _applyDecs(_FcrStandaloneWhiteboardControlImpl, [[_imports.trace, 2, "open"], [_imports.trace, 2, "release"]], [], 0, void 0, _base.FcrBaseWhiteboardControlImpl).e;
|
|
236
|
+
var _applyDecs$e3 = (0, _slicedToArray2.default)(_applyDecs$e2, 1);
|
|
237
|
+
_initProto2 = _applyDecs$e3[0];
|
|
238
|
+
_applyDecs$e2;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
|
3
5
|
require("core-js/modules/es.array.push.js");
|
|
4
6
|
require("core-js/modules/esnext.function.metadata.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
10
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
6
11
|
require("core-js/modules/esnext.map.emplace.js");
|
|
7
12
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -17,10 +22,14 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
22
|
require("core-js/modules/esnext.map.some.js");
|
|
18
23
|
require("core-js/modules/esnext.map.update.js");
|
|
19
24
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
25
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
26
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
27
|
Object.defineProperty(exports, "__esModule", {
|
|
21
28
|
value: true
|
|
22
29
|
});
|
|
23
30
|
exports.FcrWhiteboardControlFactoryImpl = void 0;
|
|
31
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
32
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
33
|
var _log = require("agora-foundation/lib/decorator/log");
|
|
25
34
|
var _errorCode = require("agora-foundation/lib/utilities/error/error-code");
|
|
26
35
|
var _error = require("../../../utilities/error");
|
|
@@ -28,24 +37,27 @@ var _logger = require("../../../utilities/logger");
|
|
|
28
37
|
var _sharedStorage = require("../../../utilities/shared-storage");
|
|
29
38
|
var _control = require("./control");
|
|
30
39
|
var _sceneProperties = require("../../../utilities/scene-properties");
|
|
31
|
-
|
|
40
|
+
var _FcrWhiteboardControlFactoryImpl;
|
|
41
|
+
let _initProto, _createForSubProcessDecs, _createForMainProcessDecs, _ref;
|
|
42
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
43
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
44
|
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)]; } }; }
|
|
33
45
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
34
46
|
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); }
|
|
35
47
|
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; }
|
|
36
48
|
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; }
|
|
49
|
+
_ref = (_createForSubProcessDecs = (0, _log.trace)(['rtmClient', 'boardConfig']), _createForMainProcessDecs = (0, _log.trace)(['rtmClient', 'boardConfig', 'scene', 'api', 'sharedCache']), "logger");
|
|
37
50
|
class FcrWhiteboardControlFactoryImpl {
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
constructor() {
|
|
52
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
53
|
+
prefix: 'FcrWhiteboardControlFactory'
|
|
54
|
+
})));
|
|
40
55
|
}
|
|
41
|
-
[(_createForSubProcessDecs = (0, _log.trace)(['rtmClient', 'boardConfig']), _createForMainProcessDecs = (0, _log.trace)(['rtmClient', 'boardConfig', 'scene', 'api', 'sharedCache']), "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
42
|
-
prefix: 'FcrWhiteboardControlFactory'
|
|
43
|
-
}));
|
|
44
56
|
createForSubProcess(rtmClient, boardConfig) {
|
|
45
57
|
return new _control.FcrStandaloneWhiteboardControlImpl(rtmClient, boardConfig, () => {
|
|
46
58
|
const forgeInitConfig = (0, _sharedStorage.getWhiteboardOptions)();
|
|
47
59
|
if (!forgeInitConfig) {
|
|
48
|
-
throw (0, _error.generateFcrCoreClientError)(_errorCode.ErrorModuleCode.FCR_ROOM_WHITEBOARD, _errorCode.DetailErrorCode.UNDEFINED_ERROR,
|
|
60
|
+
throw (0, _error.generateFcrCoreClientError)(_errorCode.ErrorModuleCode.FCR_ROOM_WHITEBOARD, _errorCode.DetailErrorCode.UNDEFINED_ERROR, "whiteboard init config is not exist");
|
|
49
61
|
}
|
|
50
62
|
return Promise.resolve(forgeInitConfig);
|
|
51
63
|
});
|
|
@@ -63,11 +75,15 @@ class FcrWhiteboardControlFactoryImpl {
|
|
|
63
75
|
};
|
|
64
76
|
return async () => {
|
|
65
77
|
const response = await getObjectInitConfig(roomId, userId);
|
|
66
|
-
return {
|
|
67
|
-
...response.data,
|
|
78
|
+
return _objectSpread(_objectSpread({}, response.data), {}, {
|
|
68
79
|
boardPerformance
|
|
69
|
-
};
|
|
80
|
+
});
|
|
70
81
|
};
|
|
71
82
|
}
|
|
72
83
|
}
|
|
73
|
-
exports.FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
|
|
84
|
+
exports.FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
|
|
85
|
+
_FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
|
|
86
|
+
var _applyDecs$e = _applyDecs(_FcrWhiteboardControlFactoryImpl, [[_createForSubProcessDecs, 2, "createForSubProcess"], [_createForMainProcessDecs, 2, "createForMainProcess"]], []).e;
|
|
87
|
+
var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
|
|
88
|
+
_initProto = _applyDecs$e2[0];
|
|
89
|
+
_applyDecs$e;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
|
3
5
|
require("core-js/modules/es.array.push.js");
|
|
4
6
|
require("core-js/modules/esnext.function.metadata.js");
|
|
5
7
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -17,15 +19,20 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
19
|
require("core-js/modules/esnext.map.some.js");
|
|
18
20
|
require("core-js/modules/esnext.map.update.js");
|
|
19
21
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
23
|
Object.defineProperty(exports, "__esModule", {
|
|
21
24
|
value: true
|
|
22
25
|
});
|
|
23
26
|
exports.FcrWidgetControlImpl = void 0;
|
|
27
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
28
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
29
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
30
|
var _imports = require("../../imports");
|
|
25
31
|
var _type = require("../../type");
|
|
26
32
|
var _error = require("../../utilities/error");
|
|
27
33
|
var _logger = require("../../utilities/logger");
|
|
28
|
-
|
|
34
|
+
var _FcrWidgetControlImpl;
|
|
35
|
+
let _initProto, _getActivityDecs, _activeDecs, _inactiveDecs, _ref;
|
|
29
36
|
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)]; } }; }
|
|
30
37
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
31
38
|
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); }
|
|
@@ -41,46 +48,44 @@ var WidgetState = /*#__PURE__*/function (WidgetState) {
|
|
|
41
48
|
/**
|
|
42
49
|
* @internal
|
|
43
50
|
*/
|
|
51
|
+
_ref = (_getActivityDecs = (0, _imports.trace)(['widgetId']), _activeDecs = (0, _imports.trace)(['widgetId']), _inactiveDecs = (0, _imports.trace)(['widgetId']), "logger");
|
|
44
52
|
class FcrWidgetControlImpl {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this._observable.notifyObservers('onWidgetInactive', sceneId, widgetId);
|
|
53
|
+
constructor(_scene, _api, _sharedCache) {
|
|
54
|
+
//@internal
|
|
55
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
56
|
+
prefix: 'FcrWidgetControlImpl'
|
|
57
|
+
})));
|
|
58
|
+
//@internal
|
|
59
|
+
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
60
|
+
//@internal
|
|
61
|
+
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
62
|
+
onScenePropertiesUpdated: (sceneId, event) => {
|
|
63
|
+
var _event$cause, _event$changedPropert;
|
|
64
|
+
if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) !== WIDGET_SCENE_PROPERTIES_CMD) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const changedWidgets = (_event$changedPropert = event.changedProperties) === null || _event$changedPropert === void 0 ? void 0 : _event$changedPropert.flexWidgets;
|
|
68
|
+
if (!changedWidgets || typeof changedWidgets !== 'object') {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
for (const widgetId of Object.keys(changedWidgets)) {
|
|
72
|
+
var _changedWidgets$widge;
|
|
73
|
+
const state = (_changedWidgets$widge = changedWidgets[widgetId]) === null || _changedWidgets$widge === void 0 ? void 0 : _changedWidgets$widge.state;
|
|
74
|
+
if (state === WidgetState.ACTIVE) {
|
|
75
|
+
this._observable.notifyObservers('onWidgetActive', sceneId, widgetId);
|
|
76
|
+
} else if (state === WidgetState.INACTIVE) {
|
|
77
|
+
this._observable.notifyObservers('onWidgetInactive', sceneId, widgetId);
|
|
78
|
+
}
|
|
72
79
|
}
|
|
73
80
|
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
constructor(_scene, _api, _sharedCache) {
|
|
81
|
+
});
|
|
77
82
|
this._scene = _scene;
|
|
78
83
|
this._api = _api;
|
|
79
84
|
this._scene.addObserver(this._sceneObserver);
|
|
80
85
|
this._addLogObserver();
|
|
81
86
|
}
|
|
82
87
|
getActivity(widgetId) {
|
|
83
|
-
const state = this._scene.getScenePropertiesByKeyPath(
|
|
88
|
+
const state = this._scene.getScenePropertiesByKeyPath("flexWidgets.".concat(widgetId, ".state"));
|
|
84
89
|
return state === WidgetState.ACTIVE;
|
|
85
90
|
}
|
|
86
91
|
active(widgetId) {
|
|
@@ -112,4 +117,9 @@ class FcrWidgetControlImpl {
|
|
|
112
117
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, [['onWidgetActive', ['roomId', 'widgetId']], ['onWidgetInactive', ['roomId', 'widgetId']]]));
|
|
113
118
|
}
|
|
114
119
|
}
|
|
115
|
-
exports.FcrWidgetControlImpl = FcrWidgetControlImpl;
|
|
120
|
+
exports.FcrWidgetControlImpl = FcrWidgetControlImpl;
|
|
121
|
+
_FcrWidgetControlImpl = FcrWidgetControlImpl;
|
|
122
|
+
var _applyDecs$e = _applyDecs(_FcrWidgetControlImpl, [[_getActivityDecs, 2, "getActivity"], [_activeDecs, 2, "active"], [_inactiveDecs, 2, "inactive"], [_imports.trace, 2, "release"]], []).e;
|
|
123
|
+
var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
|
|
124
|
+
_initProto = _applyDecs$e2[0];
|
|
125
|
+
_applyDecs$e;
|
package/lib/room-router/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
3
4
|
require("core-js/modules/es.array.push.js");
|
|
4
5
|
require("core-js/modules/esnext.function.metadata.js");
|
|
6
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
9
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
6
10
|
require("core-js/modules/esnext.map.emplace.js");
|
|
7
11
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -17,11 +21,16 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
21
|
require("core-js/modules/esnext.map.some.js");
|
|
18
22
|
require("core-js/modules/esnext.map.update.js");
|
|
19
23
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
24
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
20
25
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
21
26
|
Object.defineProperty(exports, "__esModule", {
|
|
22
27
|
value: true
|
|
23
28
|
});
|
|
24
29
|
exports.FcrRoomRouterImpl = void 0;
|
|
30
|
+
require("core-js/modules/es.error.cause.js");
|
|
31
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
32
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
33
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
34
|
var _imports = require("../imports");
|
|
26
35
|
var _roomControlFactory = require("../room-control/room-control-factory");
|
|
27
36
|
var _type = require("../room-control/type");
|
|
@@ -34,7 +43,10 @@ var _logger = require("../utilities/logger");
|
|
|
34
43
|
var _validateParams = _interopRequireDefault(require("../utilities/validate-params"));
|
|
35
44
|
var _type3 = require("./type");
|
|
36
45
|
var _convertRoomType = require("../utilities/convertRoomType");
|
|
37
|
-
|
|
46
|
+
var _FcrRoomRouterImpl;
|
|
47
|
+
let _initProto, _initDecs, _joinRoomDecs, _ref;
|
|
48
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
49
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
38
50
|
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)]; } }; }
|
|
39
51
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
40
52
|
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); }
|
|
@@ -43,34 +55,30 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
43
55
|
/**
|
|
44
56
|
* @internal
|
|
45
57
|
*/
|
|
46
|
-
|
|
58
|
+
_ref = (_initDecs = [(0, _imports.trace)(['roomId']), (0, _validateParams.default)(_schema.stringSchema)], _joinRoomDecs = [(0, _imports.trace)(['options']), (0, _validateParams.default)(_schema.fcrRoomJoinOptionsSchema)], "logger");
|
|
47
59
|
class FcrRoomRouterImpl {
|
|
48
|
-
static {
|
|
49
|
-
[_initProto] = _applyDecs(this, [[_initDecs, 2, "_init"], [_joinRoomDecs, 2, "joinRoom"], [_imports.trace, 2, "leaveRoom"]], []).e;
|
|
50
|
-
}
|
|
51
|
-
[(_initDecs = [(0, _imports.trace)(['roomId']), (0, _validateParams.default)(_schema.stringSchema)], _joinRoomDecs = [(0, _imports.trace)(['options']), (0, _validateParams.default)(_schema.fcrRoomJoinOptionsSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
52
|
-
prefix: 'FcrRoomRouterImpl'
|
|
53
|
-
}));
|
|
54
|
-
_abortController = null;
|
|
55
|
-
_observable = new _imports.AgoraObservable();
|
|
56
|
-
_roomControlObservable = {
|
|
57
|
-
onRoomRouteSwitched: async event => {
|
|
58
|
-
this._nextRoomRoute = event.targetRouting;
|
|
59
|
-
this._observable.notifyObservers('onRoomRouteSwitched', this._nextRoomRoute);
|
|
60
|
-
this.roomControl.removeObserver(this._roomControlObservable);
|
|
61
|
-
this._roomControl = null;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
_roomControl = null;
|
|
65
|
-
_nextRoomRoute = {
|
|
66
|
-
roomId: '',
|
|
67
|
-
roomType: _type.FcrRoomType.Mainroom,
|
|
68
|
-
isJoined: false
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// 接口中新增一个bypass字段,在第一次调用joinRoom的时候不传,在后续收到房间切换后的joinRoom时传true
|
|
72
|
-
_bypass = undefined;
|
|
73
60
|
constructor(_rteEngine, _apiService, _config, _chatConnection, _sharedCache, roomId, _monitorControl) {
|
|
61
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
62
|
+
prefix: 'FcrRoomRouterImpl'
|
|
63
|
+
})));
|
|
64
|
+
(0, _defineProperty2.default)(this, "_abortController", null);
|
|
65
|
+
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
66
|
+
(0, _defineProperty2.default)(this, "_roomControlObservable", {
|
|
67
|
+
onRoomRouteSwitched: async event => {
|
|
68
|
+
this._nextRoomRoute = event.targetRouting;
|
|
69
|
+
this._observable.notifyObservers('onRoomRouteSwitched', this._nextRoomRoute);
|
|
70
|
+
this.roomControl.removeObserver(this._roomControlObservable);
|
|
71
|
+
this._roomControl = null;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
(0, _defineProperty2.default)(this, "_roomControl", null);
|
|
75
|
+
(0, _defineProperty2.default)(this, "_nextRoomRoute", {
|
|
76
|
+
roomId: '',
|
|
77
|
+
roomType: _type.FcrRoomType.Mainroom,
|
|
78
|
+
isJoined: false
|
|
79
|
+
});
|
|
80
|
+
// 接口中新增一个bypass字段,在第一次调用joinRoom的时候不传,在后续收到房间切换后的joinRoom时传true
|
|
81
|
+
(0, _defineProperty2.default)(this, "_bypass", undefined);
|
|
74
82
|
this._rteEngine = _rteEngine;
|
|
75
83
|
this._apiService = _apiService;
|
|
76
84
|
this._config = _config;
|
|
@@ -98,7 +106,9 @@ class FcrRoomRouterImpl {
|
|
|
98
106
|
async joinRoom(options) {
|
|
99
107
|
this._abortController = new AbortController();
|
|
100
108
|
this._validateRoomJoinState();
|
|
101
|
-
const
|
|
109
|
+
const _await$to = await (0, _imports.to)(this._executeJoinRoomWithRetry(options)),
|
|
110
|
+
_await$to2 = (0, _slicedToArray2.default)(_await$to, 1),
|
|
111
|
+
error = _await$to2[0];
|
|
102
112
|
this._abortController = null;
|
|
103
113
|
if (error) {
|
|
104
114
|
this._handleJoinRoomError(error);
|
|
@@ -110,9 +120,10 @@ class FcrRoomRouterImpl {
|
|
|
110
120
|
return Promise.resolve(this._roomControl);
|
|
111
121
|
}
|
|
112
122
|
async leaveRoom() {
|
|
113
|
-
|
|
123
|
+
var _this$_abortControlle, _this$_roomControl;
|
|
124
|
+
(_this$_abortControlle = this._abortController) === null || _this$_abortControlle === void 0 || _this$_abortControlle.abort();
|
|
114
125
|
this._abortController = null;
|
|
115
|
-
this._roomControl
|
|
126
|
+
(_this$_roomControl = this._roomControl) === null || _this$_roomControl === void 0 || _this$_roomControl.leave();
|
|
116
127
|
this._roomControl = null;
|
|
117
128
|
return _type2.FcrReturnCode.SUCCESS;
|
|
118
129
|
}
|
|
@@ -135,11 +146,10 @@ class FcrRoomRouterImpl {
|
|
|
135
146
|
const abortController = this._abortController;
|
|
136
147
|
return (0, _imports.retryAttempt)(() => this._performSingleJoinAttempt(options), [], {
|
|
137
148
|
retriesMax: _type3.ROOM_ROUTER_CONSTANTS.MAX_JOIN_ATTEMPTS
|
|
138
|
-
}).fail(async
|
|
139
|
-
error,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}) => {
|
|
149
|
+
}).fail(async _ref2 => {
|
|
150
|
+
let error = _ref2.error,
|
|
151
|
+
waitBeforeRetry = _ref2.timeFn,
|
|
152
|
+
attemptCount = _ref2.currentRetry;
|
|
143
153
|
return (0, _joinHelper.handleJoinRetryFailure)(error, waitBeforeRetry, attemptCount, _retryHelpers.canRetryJoinError, () => {
|
|
144
154
|
this._throwIfAborted(abortController);
|
|
145
155
|
}, 'join room via router');
|
|
@@ -164,17 +174,15 @@ class FcrRoomRouterImpl {
|
|
|
164
174
|
* @private
|
|
165
175
|
*/
|
|
166
176
|
async _performCheckIn(options) {
|
|
167
|
-
const
|
|
168
|
-
userId
|
|
169
|
-
} = this._rteEngine.getConfig();
|
|
177
|
+
const _this$_rteEngine$getC = this._rteEngine.getConfig(),
|
|
178
|
+
userId = _this$_rteEngine$getC.userId;
|
|
170
179
|
const checkInParams = _joinHelper.FcrJoinHelper.buildCheckInParams(options, userId, this._nextRoomRoute.roomId, {
|
|
171
180
|
bypass: this._bypass,
|
|
172
181
|
avatar: options.avatar
|
|
173
182
|
});
|
|
174
|
-
const
|
|
175
|
-
data,
|
|
176
|
-
ts
|
|
177
|
-
} = await (0, _error.handleRequestError)(() => this._apiService.checkIn(checkInParams), _imports.ErrorModuleCode.FCR_ENGINE);
|
|
183
|
+
const _await$handleRequestE = await (0, _error.handleRequestError)(() => this._apiService.checkIn(checkInParams), _imports.ErrorModuleCode.FCR_ENGINE),
|
|
184
|
+
data = _await$handleRequestE.data,
|
|
185
|
+
ts = _await$handleRequestE.ts;
|
|
178
186
|
return {
|
|
179
187
|
data,
|
|
180
188
|
ts
|
|
@@ -186,22 +194,19 @@ class FcrRoomRouterImpl {
|
|
|
186
194
|
* @private
|
|
187
195
|
*/
|
|
188
196
|
async _joinRoomControl(options, roomResponse) {
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
ts
|
|
192
|
-
} = roomResponse;
|
|
197
|
+
const data = roomResponse.data,
|
|
198
|
+
ts = roomResponse.ts;
|
|
193
199
|
const abortController = this._abortController;
|
|
194
200
|
const roomControl = this._createRoomControl(data);
|
|
195
|
-
abortController
|
|
201
|
+
abortController === null || abortController === void 0 || abortController.signal.addEventListener('abort', () => {
|
|
196
202
|
roomControl.leave();
|
|
197
203
|
});
|
|
198
|
-
await roomControl.join({
|
|
199
|
-
...options,
|
|
204
|
+
await roomControl.join(_objectSpread(_objectSpread({}, options), {}, {
|
|
200
205
|
snapshot: data,
|
|
201
206
|
timestamp: ts,
|
|
202
207
|
createStreamConfigs: options.createStreamConfigs,
|
|
203
208
|
roomToken: options.roomToken || this._config.token
|
|
204
|
-
});
|
|
209
|
+
}));
|
|
205
210
|
return roomControl;
|
|
206
211
|
}
|
|
207
212
|
|
|
@@ -210,12 +215,10 @@ class FcrRoomRouterImpl {
|
|
|
210
215
|
* @private
|
|
211
216
|
*/
|
|
212
217
|
_updateRoomState(roomResponse, roomControl) {
|
|
213
|
-
const
|
|
214
|
-
data
|
|
215
|
-
} = roomResponse;
|
|
218
|
+
const data = roomResponse.data;
|
|
216
219
|
const fcrRoomType = (0, _convertRoomType.convertServerRoomTypeToFcrRoomType)(data.room.roomProperties.roomType);
|
|
217
220
|
if (fcrRoomType === null) {
|
|
218
|
-
const fcrError = (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_ROOM, _imports.DetailErrorCode.UNDEFINED_ERROR,
|
|
221
|
+
const fcrError = (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_ROOM, _imports.DetailErrorCode.UNDEFINED_ERROR, "update room state failed: Unknown room type: ".concat(data.room.roomProperties.roomType));
|
|
219
222
|
throw fcrError;
|
|
220
223
|
}
|
|
221
224
|
this._nextRoomRoute = {
|
|
@@ -234,8 +237,8 @@ class FcrRoomRouterImpl {
|
|
|
234
237
|
* @private
|
|
235
238
|
*/
|
|
236
239
|
_handleJoinRoomError(error) {
|
|
237
|
-
this.logger.error(
|
|
238
|
-
const fcrError = (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_ROOM, _imports.DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED,
|
|
240
|
+
this.logger.error("Failed to join the room: ".concat(error.message));
|
|
241
|
+
const fcrError = (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_ROOM, _imports.DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED, "join room failed: ".concat(error.message));
|
|
239
242
|
this._observable.notifyObservers('onErrorOccurred', fcrError);
|
|
240
243
|
}
|
|
241
244
|
|
|
@@ -261,7 +264,7 @@ class FcrRoomRouterImpl {
|
|
|
261
264
|
});
|
|
262
265
|
}
|
|
263
266
|
_throwIfAborted(abortController) {
|
|
264
|
-
if (abortController
|
|
267
|
+
if (abortController !== null && abortController !== void 0 && abortController.signal.aborted) {
|
|
265
268
|
throw new Error('Join room attempt aborted');
|
|
266
269
|
}
|
|
267
270
|
}
|
|
@@ -275,4 +278,9 @@ class FcrRoomRouterImpl {
|
|
|
275
278
|
this._observable.removeObserver(observer);
|
|
276
279
|
}
|
|
277
280
|
}
|
|
278
|
-
exports.FcrRoomRouterImpl = FcrRoomRouterImpl;
|
|
281
|
+
exports.FcrRoomRouterImpl = FcrRoomRouterImpl;
|
|
282
|
+
_FcrRoomRouterImpl = FcrRoomRouterImpl;
|
|
283
|
+
var _applyDecs$e = _applyDecs(_FcrRoomRouterImpl, [[_initDecs, 2, "_init"], [_joinRoomDecs, 2, "joinRoom"], [_imports.trace, 2, "leaveRoom"]], []).e;
|
|
284
|
+
var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
|
|
285
|
+
_initProto = _applyDecs$e2[0];
|
|
286
|
+
_applyDecs$e;
|