fcr-core 3.10.5 → 3.10.6

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.
Files changed (127) hide show
  1. package/lib/engine/index.js +108 -102
  2. package/lib/imports.js +0 -1
  3. package/lib/index.d.ts +1 -1
  4. package/lib/media-control/desktop.js +13 -22
  5. package/lib/media-control/mobile.js +13 -22
  6. package/lib/monitor-control/index.js +7 -17
  7. package/lib/peer-session/index.js +121 -120
  8. package/lib/plugins/chat/chatroom.js +96 -119
  9. package/lib/plugins/chat/connector.js +48 -69
  10. package/lib/remote-control/index.js +216 -194
  11. package/lib/room-control/ability-control/index.js +10 -20
  12. package/lib/room-control/application-control/index.js +75 -82
  13. package/lib/room-control/group-control/index.js +30 -31
  14. package/lib/room-control/helpers/board-init-info-helper.js +10 -16
  15. package/lib/room-control/helpers/validation-helper.js +1 -1
  16. package/lib/room-control/index.js +51 -70
  17. package/lib/room-control/infinity-room-control/index.js +19 -27
  18. package/lib/room-control/interpreter-control/index.js +65 -77
  19. package/lib/room-control/interpreter-control/room.js +4 -6
  20. package/lib/room-control/join-before-host-waitingroom-control/index.js +4 -6
  21. package/lib/room-control/mainroom-control/index.js +25 -37
  22. package/lib/room-control/privilege-control/helper.js +13 -28
  23. package/lib/room-control/privilege-control/index.js +28 -36
  24. package/lib/room-control/room-connector-control/index.js +47 -52
  25. package/lib/room-control/room-control-factory.js +12 -10
  26. package/lib/room-control/room-session/index.js +74 -77
  27. package/lib/room-control/shared-cache.js +56 -63
  28. package/lib/room-control/sharing-control/index.js +57 -65
  29. package/lib/room-control/stream-control/index.js +238 -203
  30. package/lib/room-control/stream-control/type.d.ts +11 -1
  31. package/lib/room-control/stt-control/de-compress-gzip.js +0 -10
  32. package/lib/room-control/stt-control/index.js +86 -93
  33. package/lib/room-control/user-control/index.js +155 -162
  34. package/lib/room-control/waitingroom-control/index.js +9 -18
  35. package/lib/room-control/whiteboard-control/utils.js +2 -4
  36. package/lib/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
  37. package/lib/room-control/whiteboard-control-v1/board-window.js +103 -120
  38. package/lib/room-control/whiteboard-control-v1/factory.js +4 -7
  39. package/lib/room-control/whiteboard-control-v1/index.js +67 -80
  40. package/lib/room-control/whiteboard-control-v1/mount-manager.js +2 -4
  41. package/lib/room-control/whiteboard-control-v1/utils.js +14 -17
  42. package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +10 -14
  43. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +8 -17
  44. package/lib/room-control/whiteboard-control-v2/base/index.js +53 -61
  45. package/lib/room-control/whiteboard-control-v2/base/main-window.js +30 -39
  46. package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
  47. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +33 -45
  48. package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +11 -27
  49. package/lib/room-control/widget-control/index.js +33 -43
  50. package/lib/room-router/index.js +58 -66
  51. package/lib/service/api.js +548 -446
  52. package/lib/struct.js +2 -5
  53. package/lib/type.d.ts +1 -1
  54. package/lib/utilities/abortable-retry.js +0 -3
  55. package/lib/utilities/collection.js +11 -15
  56. package/lib/utilities/error-helpers.js +27 -34
  57. package/lib/utilities/error.js +3 -4
  58. package/lib/utilities/join-helper.js +31 -37
  59. package/lib/utilities/logger.js +5 -8
  60. package/lib/utilities/parameters.js +10 -21
  61. package/lib/utilities/retry-helpers.js +0 -1
  62. package/lib/utilities/stream.js +11 -16
  63. package/lib/utilities/user.js +3 -4
  64. package/lib/utilities/validate-params.js +1 -1
  65. package/lib/utilities/video-encoder-config.js +5 -10
  66. package/lib-es/engine/index.js +108 -102
  67. package/lib-es/media-control/desktop.js +13 -22
  68. package/lib-es/media-control/mobile.js +13 -22
  69. package/lib-es/monitor-control/index.js +7 -16
  70. package/lib-es/peer-session/index.js +121 -120
  71. package/lib-es/plugins/chat/chatroom.js +95 -118
  72. package/lib-es/plugins/chat/connector.js +47 -67
  73. package/lib-es/remote-control/index.js +216 -194
  74. package/lib-es/room-control/ability-control/index.js +10 -19
  75. package/lib-es/room-control/application-control/index.js +75 -81
  76. package/lib-es/room-control/group-control/index.js +30 -31
  77. package/lib-es/room-control/helpers/board-init-info-helper.js +10 -15
  78. package/lib-es/room-control/helpers/validation-helper.js +1 -1
  79. package/lib-es/room-control/index.js +51 -69
  80. package/lib-es/room-control/infinity-room-control/index.js +19 -26
  81. package/lib-es/room-control/interpreter-control/index.js +65 -77
  82. package/lib-es/room-control/interpreter-control/room.js +4 -5
  83. package/lib-es/room-control/join-before-host-waitingroom-control/index.js +4 -5
  84. package/lib-es/room-control/mainroom-control/index.js +25 -37
  85. package/lib-es/room-control/privilege-control/helper.js +13 -27
  86. package/lib-es/room-control/privilege-control/index.js +28 -36
  87. package/lib-es/room-control/room-connector-control/index.js +47 -52
  88. package/lib-es/room-control/room-control-factory.js +12 -10
  89. package/lib-es/room-control/room-session/index.js +74 -77
  90. package/lib-es/room-control/shared-cache.js +56 -62
  91. package/lib-es/room-control/sharing-control/index.js +57 -64
  92. package/lib-es/room-control/stream-control/index.js +240 -205
  93. package/lib-es/room-control/stt-control/de-compress-gzip.js +0 -10
  94. package/lib-es/room-control/stt-control/index.js +86 -93
  95. package/lib-es/room-control/user-control/index.js +155 -162
  96. package/lib-es/room-control/waitingroom-control/index.js +9 -18
  97. package/lib-es/room-control/whiteboard-control/utils.js +2 -4
  98. package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
  99. package/lib-es/room-control/whiteboard-control-v1/board-window.js +103 -120
  100. package/lib-es/room-control/whiteboard-control-v1/factory.js +4 -6
  101. package/lib-es/room-control/whiteboard-control-v1/index.js +67 -80
  102. package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +2 -3
  103. package/lib-es/room-control/whiteboard-control-v1/utils.js +14 -17
  104. package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +10 -13
  105. package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +8 -16
  106. package/lib-es/room-control/whiteboard-control-v2/base/index.js +53 -60
  107. package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +30 -39
  108. package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
  109. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +33 -45
  110. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +11 -26
  111. package/lib-es/room-control/widget-control/index.js +33 -42
  112. package/lib-es/room-router/index.js +58 -66
  113. package/lib-es/service/api.js +548 -445
  114. package/lib-es/struct.js +2 -4
  115. package/lib-es/utilities/abortable-retry.js +0 -3
  116. package/lib-es/utilities/collection.js +11 -14
  117. package/lib-es/utilities/error-helpers.js +26 -33
  118. package/lib-es/utilities/error.js +3 -4
  119. package/lib-es/utilities/join-helper.js +29 -36
  120. package/lib-es/utilities/logger.js +5 -7
  121. package/lib-es/utilities/parameters.js +10 -21
  122. package/lib-es/utilities/retry-helpers.js +0 -1
  123. package/lib-es/utilities/stream.js +11 -15
  124. package/lib-es/utilities/user.js +3 -4
  125. package/lib-es/utilities/validate-params.js +1 -1
  126. package/lib-es/utilities/video-encoder-config.js +5 -10
  127. package/package.json +4 -4
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.description.js");
4
- require("core-js/modules/es.error.cause.js");
5
3
  require("core-js/modules/esnext.function.metadata.js");
6
- require("core-js/modules/esnext.iterator.filter.js");
7
4
  require("core-js/modules/esnext.map.delete-all.js");
8
5
  require("core-js/modules/esnext.map.emplace.js");
9
6
  require("core-js/modules/esnext.map.every.js");
@@ -25,14 +22,10 @@ Object.defineProperty(exports, "__esModule", {
25
22
  });
26
23
  exports.FcrUserControlImpl = void 0;
27
24
  require("core-js/modules/es.array.push.js");
28
- require("core-js/modules/es.object.from-entries.js");
29
25
  require("core-js/modules/esnext.iterator.constructor.js");
30
26
  require("core-js/modules/esnext.iterator.find.js");
31
27
  require("core-js/modules/esnext.iterator.for-each.js");
32
28
  require("core-js/modules/esnext.iterator.map.js");
33
- require("core-js/modules/web.dom-collections.iterator.js");
34
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
35
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
36
29
  var _imports = require("../../imports");
37
30
  var _type = require("../../type");
38
31
  var _user = require("../../utilities/user");
@@ -42,10 +35,7 @@ var _logger = require("../../utilities/logger");
42
35
  var _error = require("../../utilities/error");
43
36
  var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
44
37
  var _schema = require("../../schema");
45
- var _FcrUserControlImpl;
46
- let _initProto, _getUserDecs, _fetchUserListDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs, _ref;
47
- 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; }
48
- 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
+ let _initProto, _getUserDecs, _fetchUserListDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs;
49
39
  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)]; } }; }
50
40
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
51
41
  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); }
@@ -54,157 +44,165 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
54
44
  /**
55
45
  * @internal
56
46
  */
57
- _ref = (_getUserDecs = [_imports.bound, (0, _validateParams.default)(_schema.stringSchema)], _fetchUserListDecs = [_imports.bound, (0, _imports.trace)(['params'])], _updateUserNameDecs = [_imports.bound, (0, _imports.trace)(['userId', 'userName']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringSchema)], _updateUserPropertiesDecs = [_imports.bound, (0, _imports.trace)(['properties', 'cause', 'userId']), (0, _validateParams.default)(_schema.stringKeyUnknownValueSchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _updateIncrementUserPropertiesDecs = [_imports.bound, (0, _imports.trace)(['increments', 'cause', 'userId']), (0, _validateParams.default)(_schema.stringKeyNumberValueSchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _deleteUserPropertiesDecs = [_imports.bound, (0, _imports.trace)(['keyPath', 'cause', 'userId']), (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _getUserPropertiesByUserIdDecs = [_imports.bound, (0, _imports.trace)(['userId']), (0, _validateParams.default)(_schema.stringSchema)], _getUserPropertiesByKeyPathDecs = [_imports.bound, (0, _imports.trace)(['keyPath', 'userId']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringSchema)], _updateRemoteUserRoleDecs = [_imports.bound, (0, _imports.trace)(['userId', 'userRole']), (0, _validateParams.default)(_schema.stringSchema, _schema.fcrUserRoleSchema)], _claimHostDecs = [_imports.bound, (0, _imports.trace)(['hostKey']), (0, _validateParams.default)(_schema.stringSchema)], _kickOutDecs = [_imports.bound, (0, _imports.trace)(['userId', 'type']), (0, _validateParams.default)(_schema.stringSchema, _schema.fcrUserKickedOutTypeSchema)], _kickOutByUserIdsDecs = [(0, _imports.trace)(['userIds', 'type']), (0, _validateParams.default)(_schema.stringArraySchema, _schema.fcrUserKickedOutTypeSchema)], _kickOutByUserRolesDecs = [(0, _imports.trace)(['userRoles', 'type']), (0, _validateParams.default)(_schema.fcrUserRolesSchema, _schema.fcrUserKickedOutTypeSchema)], _mergeAudioStreamDecs = [(0, _imports.trace)(['userId']), (0, _validateParams.default)(_schema.stringSchema)], "logger");
58
47
  class FcrUserControlImpl {
59
- constructor(_scene, _api, _sharedCache) {
60
- //@internal
61
- (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
62
- prefix: 'FcrUserControlImpl'
63
- })));
64
- //@internal
65
- (0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
66
- //@internal
67
- (0, _defineProperty2.default)(this, "_enableUserCount", true);
68
- //@internal
69
- (0, _defineProperty2.default)(this, "_sceneObserver", {
70
- onRemoteUsersJoined: (roomId, events) => {
71
- events.forEach(event => {
72
- const userProperties = this._scene.getUserPropertiesByUserId(event.userInfo.userId);
73
- this._roomCache.setUserPlatform(event.userInfo.userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.platform);
74
- this._roomCache.setUserAvatar(event.userInfo.userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.avatar);
75
- });
76
- const fcrUserEvents = events.map(e => {
77
- return {
78
- userInfo: e.userInfo && (0, _user.convertRteUserToFcrUser)(e.userInfo, this._roomCache)
79
- // operatorUser: e.operatorUser && convertRteUserToFcrUser(e.operatorUser, this._roomCache),
80
- };
81
- });
82
- fcrUserEvents.forEach(event => {
83
- const user = event.userInfo;
84
- const exists = user.userId in this._roomCache.userMapByUserId;
85
- if (exists) {
86
- this.logger.warn("[FcrUserControl] user joined when the user already exists, userId: ".concat(user.userId));
87
- } else {
88
- this._roomCache.setUserMapByUserId(user.userId, user);
89
- this._roomCache.addUserToList(user);
90
- }
91
- });
92
- this._observable.notifyObservers('onRemoteUsersJoined', roomId, fcrUserEvents);
93
- },
94
- onRemoteUsersLeft: (roomId, events) => {
95
- const fcrUserEvents = events.map(e => {
96
- var _e$cause;
97
- return {
98
- userInfo: e.userInfo && (0, _user.convertRteUserToFcrUser)(e.userInfo, this._roomCache),
99
- userProperties: e.userProperties,
100
- operatorUser: e.operatorUser && (0, _user.convertRteUserToFcrUser)(e.operatorUser, this._roomCache),
101
- reason: ((_e$cause = e.cause) === null || _e$cause === void 0 ? void 0 : _e$cause.cmd) === 5 ? _type2.FcrUserLeftReason.kickOut : _type2.FcrUserLeftReason.LeaveRoom
102
- };
103
- });
104
- fcrUserEvents.forEach(event => {
105
- const user = event.userInfo;
106
- const exists = this._roomCache.userMapByUserId.has(user.userId);
107
- if (!exists) {
108
- this.logger.warn("[FcrUserControl] user left when the user does not exist, userId: ".concat(user.userId));
109
- } else {
110
- this._roomCache.deleteUserMapByUserId(user.userId);
111
- const index = this._roomCache.userList.findIndex(u => user.userId === u.userId);
112
- if (index !== -1) {
113
- this._roomCache.deleteUserList(index);
114
- }
115
- }
116
- });
117
- events.forEach(event => {
118
- this._roomCache.deleteUserPlatform(event.userInfo.userId);
119
- this._roomCache.deleteUserAvatar(event.userInfo.userId);
120
- });
121
- this._observable.notifyObservers('onRemoteUsersLeft', roomId, fcrUserEvents);
122
- },
123
- onUserUpdated: (sceneId, event) => {
124
- const fcrUserUpdatedEvent = {
125
- modifiedUser: event.modifiedUser && (0, _user.convertRteUserToFcrUser)(event.modifiedUser, this._roomCache),
126
- operatorUser: event.operatorUser && (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache),
127
- reason: event.reason
48
+ static {
49
+ [_initProto] = _applyDecs(this, [[_imports.bound, 2, "getLocalUser"], [_imports.bound, 2, "getUsers"], [_imports.bound, 2, "getUserList"], [_imports.bound, 2, "getUserListByRole"], [_imports.bound, 2, "getUserCountByRole"], [_getUserDecs, 2, "getUser"], [[_imports.bound, _imports.trace], 2, "getAllUserCount"], [_imports.bound, 2, "getWaterMarkContent"], [_fetchUserListDecs, 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[_imports.bound, _imports.trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[_imports.bound, _imports.trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [_imports.trace, 2, "release"]], []).e;
50
+ }
51
+ //@internal
52
+ [(_getUserDecs = [_imports.bound, (0, _validateParams.default)(_schema.stringSchema)], _fetchUserListDecs = [_imports.bound, (0, _imports.trace)(['params'])], _updateUserNameDecs = [_imports.bound, (0, _imports.trace)(['userId', 'userName']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringSchema)], _updateUserPropertiesDecs = [_imports.bound, (0, _imports.trace)(['properties', 'cause', 'userId']), (0, _validateParams.default)(_schema.stringKeyUnknownValueSchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _updateIncrementUserPropertiesDecs = [_imports.bound, (0, _imports.trace)(['increments', 'cause', 'userId']), (0, _validateParams.default)(_schema.stringKeyNumberValueSchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _deleteUserPropertiesDecs = [_imports.bound, (0, _imports.trace)(['keyPath', 'cause', 'userId']), (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _getUserPropertiesByUserIdDecs = [_imports.bound, (0, _imports.trace)(['userId']), (0, _validateParams.default)(_schema.stringSchema)], _getUserPropertiesByKeyPathDecs = [_imports.bound, (0, _imports.trace)(['keyPath', 'userId']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringSchema)], _updateRemoteUserRoleDecs = [_imports.bound, (0, _imports.trace)(['userId', 'userRole']), (0, _validateParams.default)(_schema.stringSchema, _schema.fcrUserRoleSchema)], _claimHostDecs = [_imports.bound, (0, _imports.trace)(['hostKey']), (0, _validateParams.default)(_schema.stringSchema)], _kickOutDecs = [_imports.bound, (0, _imports.trace)(['userId', 'type']), (0, _validateParams.default)(_schema.stringSchema, _schema.fcrUserKickedOutTypeSchema)], _kickOutByUserIdsDecs = [(0, _imports.trace)(['userIds', 'type']), (0, _validateParams.default)(_schema.stringArraySchema, _schema.fcrUserKickedOutTypeSchema)], _kickOutByUserRolesDecs = [(0, _imports.trace)(['userRoles', 'type']), (0, _validateParams.default)(_schema.fcrUserRolesSchema, _schema.fcrUserKickedOutTypeSchema)], _mergeAudioStreamDecs = [(0, _imports.trace)(['userId']), (0, _validateParams.default)(_schema.stringSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
53
+ prefix: 'FcrUserControlImpl'
54
+ }));
55
+ //@internal
56
+ _observable = new _imports.AgoraObservable();
57
+ //@internal
58
+
59
+ //@internal
60
+
61
+ //@internal
62
+ _enableUserCount = true;
63
+
64
+ //@internal
65
+ _sceneObserver = {
66
+ onRemoteUsersJoined: (roomId, events) => {
67
+ events.forEach(event => {
68
+ const userProperties = this._scene.getUserPropertiesByUserId(event.userInfo.userId);
69
+ this._roomCache.setUserPlatform(event.userInfo.userId, userProperties?.platform);
70
+ this._roomCache.setUserAvatar(event.userInfo.userId, userProperties?.avatar);
71
+ });
72
+ const fcrUserEvents = events.map(e => {
73
+ return {
74
+ userInfo: e.userInfo && (0, _user.convertRteUserToFcrUser)(e.userInfo, this._roomCache)
75
+ // operatorUser: e.operatorUser && convertRteUserToFcrUser(e.operatorUser, this._roomCache),
128
76
  };
129
- const user = fcrUserUpdatedEvent.modifiedUser;
77
+ });
78
+ fcrUserEvents.forEach(event => {
79
+ const user = event.userInfo;
80
+ const exists = user.userId in this._roomCache.userMapByUserId;
81
+ if (exists) {
82
+ this.logger.warn(`[FcrUserControl] user joined when the user already exists, userId: ${user.userId}`);
83
+ } else {
84
+ this._roomCache.setUserMapByUserId(user.userId, user);
85
+ this._roomCache.addUserToList(user);
86
+ }
87
+ });
88
+ this._observable.notifyObservers('onRemoteUsersJoined', roomId, fcrUserEvents);
89
+ },
90
+ onRemoteUsersLeft: (roomId, events) => {
91
+ const fcrUserEvents = events.map(e => {
92
+ return {
93
+ userInfo: e.userInfo && (0, _user.convertRteUserToFcrUser)(e.userInfo, this._roomCache),
94
+ userProperties: e.userProperties,
95
+ operatorUser: e.operatorUser && (0, _user.convertRteUserToFcrUser)(e.operatorUser, this._roomCache),
96
+ reason: e.cause?.cmd === 5 ? _type2.FcrUserLeftReason.kickOut : _type2.FcrUserLeftReason.LeaveRoom
97
+ };
98
+ });
99
+ fcrUserEvents.forEach(event => {
100
+ const user = event.userInfo;
130
101
  const exists = this._roomCache.userMapByUserId.has(user.userId);
131
102
  if (!exists) {
132
- this.logger.warn("[FcrUserControl] user updated when the user does not exist, userId: ".concat(user.userId));
103
+ this.logger.warn(`[FcrUserControl] user left when the user does not exist, userId: ${user.userId}`);
133
104
  } else {
134
- this._roomCache.setUserMapByUserId(user.userId, user);
105
+ this._roomCache.deleteUserMapByUserId(user.userId);
135
106
  const index = this._roomCache.userList.findIndex(u => user.userId === u.userId);
136
107
  if (index !== -1) {
137
108
  this._roomCache.deleteUserList(index);
138
- this._roomCache.insertUserToList(index, user);
139
109
  }
140
110
  }
141
- this._observable.notifyObservers('onUserInfoUpdated', sceneId, fcrUserUpdatedEvent);
142
- },
143
- onAllUserCountUpdated: (sceneId, count) => {
144
- if (!this._enableUserCount) {
145
- return;
111
+ });
112
+ events.forEach(event => {
113
+ this._roomCache.deleteUserPlatform(event.userInfo.userId);
114
+ this._roomCache.deleteUserAvatar(event.userInfo.userId);
115
+ });
116
+ this._observable.notifyObservers('onRemoteUsersLeft', roomId, fcrUserEvents);
117
+ },
118
+ onUserUpdated: (sceneId, event) => {
119
+ const fcrUserUpdatedEvent = {
120
+ modifiedUser: event.modifiedUser && (0, _user.convertRteUserToFcrUser)(event.modifiedUser, this._roomCache),
121
+ operatorUser: event.operatorUser && (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache),
122
+ reason: event.reason
123
+ };
124
+ const user = fcrUserUpdatedEvent.modifiedUser;
125
+ const exists = this._roomCache.userMapByUserId.has(user.userId);
126
+ if (!exists) {
127
+ this.logger.warn(`[FcrUserControl] user updated when the user does not exist, userId: ${user.userId}`);
128
+ } else {
129
+ this._roomCache.setUserMapByUserId(user.userId, user);
130
+ const index = this._roomCache.userList.findIndex(u => user.userId === u.userId);
131
+ if (index !== -1) {
132
+ this._roomCache.deleteUserList(index);
133
+ this._roomCache.insertUserToList(index, user);
146
134
  }
147
- this._observable.notifyObservers('onAllUserCountUpdated', sceneId, count);
148
- },
149
- onUserPropertiesUpdated: (roomId, event) => {
150
- var _event$cause, _event$cause2;
151
- if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 5 && event.modifiedUser.userId === this._localUserId) {
152
- const changedProperties = event.changedProperties;
153
- const dirtyStateMap = {
154
- '0': _type2.FcrUserKickedOutType.Once,
155
- '1': _type2.FcrUserKickedOutType.Forever,
156
- '2': 2
157
- };
158
- const key = (0, _imports.get)(changedProperties, 'dirty.state');
159
- const type = dirtyStateMap[key];
160
- this._observable.notifyObservers('onLocalUserKickedOut', roomId, {
161
- type
162
- });
163
- }
164
- if (((_event$cause2 = event.cause) === null || _event$cause2 === void 0 ? void 0 : _event$cause2.cmd) === 8) {
165
- const changedProperties = {};
166
- for (const key in event.changedProperties) {
167
- if (key.startsWith('flexProps')) {
168
- changedProperties[key] = event.changedProperties[key];
169
- }
170
- }
171
- if (Object.keys(changedProperties).length > 0) {
172
- const structure = (0, _collection.convertToStructure)(changedProperties);
173
- this._observable.notifyObservers('onUserPropertiesUpdated', roomId, _objectSpread(_objectSpread({}, event), {}, {
174
- changedProperties: structure['flexProps']
175
- }));
135
+ }
136
+ this._observable.notifyObservers('onUserInfoUpdated', sceneId, fcrUserUpdatedEvent);
137
+ },
138
+ onAllUserCountUpdated: (sceneId, count) => {
139
+ if (!this._enableUserCount) {
140
+ return;
141
+ }
142
+ this._observable.notifyObservers('onAllUserCountUpdated', sceneId, count);
143
+ },
144
+ onUserPropertiesUpdated: (roomId, event) => {
145
+ if (event.cause?.cmd === 5 && event.modifiedUser.userId === this._localUserId) {
146
+ const {
147
+ changedProperties
148
+ } = event;
149
+ const dirtyStateMap = {
150
+ '0': _type2.FcrUserKickedOutType.Once,
151
+ '1': _type2.FcrUserKickedOutType.Forever,
152
+ '2': 2
153
+ };
154
+ const key = (0, _imports.get)(changedProperties, 'dirty.state');
155
+ const type = dirtyStateMap[key];
156
+ this._observable.notifyObservers('onLocalUserKickedOut', roomId, {
157
+ type
158
+ });
159
+ }
160
+ if (event.cause?.cmd === 8) {
161
+ const changedProperties = {};
162
+ for (const key in event.changedProperties) {
163
+ if (key.startsWith('flexProps')) {
164
+ changedProperties[key] = event.changedProperties[key];
176
165
  }
177
166
  }
178
- },
179
- onUserPropertiesDeleted: (roomId, event) => {
180
- var _event$cause3;
181
- if (((_event$cause3 = event.cause) === null || _event$cause3 === void 0 ? void 0 : _event$cause3.cmd) === 8) {
182
- const changedKeyPaths = [];
183
- for (const keyPath of event.changedKeyPaths) {
184
- if (keyPath.startsWith('flexProps')) {
185
- changedKeyPaths.push(keyPath);
186
- }
187
- }
188
- if (changedKeyPaths.length > 0) {
189
- this._observable.notifyObservers('onUserPropertiesDeleted', roomId, _objectSpread(_objectSpread({}, event), {}, {
190
- changedKeyPaths
191
- }));
167
+ if (Object.keys(changedProperties).length > 0) {
168
+ const structure = (0, _collection.convertToStructure)(changedProperties);
169
+ this._observable.notifyObservers('onUserPropertiesUpdated', roomId, {
170
+ ...event,
171
+ changedProperties: structure['flexProps']
172
+ });
173
+ }
174
+ }
175
+ },
176
+ onUserPropertiesDeleted: (roomId, event) => {
177
+ if (event.cause?.cmd === 8) {
178
+ const changedKeyPaths = [];
179
+ for (const keyPath of event.changedKeyPaths) {
180
+ if (keyPath.startsWith('flexProps')) {
181
+ changedKeyPaths.push(keyPath);
192
182
  }
193
183
  }
194
- },
195
- onRemoteUsersSynced: (roomId, events) => {
196
- this._observable.notifyObservers('onRemoteUsersSynced', roomId, events);
197
- },
198
- onRemoteUsersDesynced: (roomId, events) => {
199
- this._observable.notifyObservers('onRemoteUsersDesynced', roomId, events);
200
- },
201
- onUserCountUpdatedByRole: (roomId, userRole, count) => {
202
- if (!this._enableUserCount) {
203
- return;
184
+ if (changedKeyPaths.length > 0) {
185
+ this._observable.notifyObservers('onUserPropertiesDeleted', roomId, {
186
+ ...event,
187
+ changedKeyPaths
188
+ });
204
189
  }
205
- this._observable.notifyObservers('onUserCountUpdatedByRole', roomId, userRole, count);
206
190
  }
207
- });
191
+ },
192
+ onRemoteUsersSynced: (roomId, events) => {
193
+ this._observable.notifyObservers('onRemoteUsersSynced', roomId, events);
194
+ },
195
+ onRemoteUsersDesynced: (roomId, events) => {
196
+ this._observable.notifyObservers('onRemoteUsersDesynced', roomId, events);
197
+ },
198
+ onUserCountUpdatedByRole: (roomId, userRole, count) => {
199
+ if (!this._enableUserCount) {
200
+ return;
201
+ }
202
+ this._observable.notifyObservers('onUserCountUpdatedByRole', roomId, userRole, count);
203
+ }
204
+ };
205
+ constructor(_scene, _api, _sharedCache) {
208
206
  this._scene = _scene;
209
207
  this._api = _api;
210
208
  this._sharedCache = _sharedCache;
@@ -212,8 +210,8 @@ class FcrUserControlImpl {
212
210
  const users = this._scene.getUsers();
213
211
  Object.keys(users).forEach(userId => {
214
212
  const userProperties = this._scene.getUserPropertiesByUserId(userId);
215
- this._roomCache.setUserAvatar(userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.avatar);
216
- this._roomCache.setUserPlatform(userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.platform);
213
+ this._roomCache.setUserAvatar(userId, userProperties?.avatar);
214
+ this._roomCache.setUserPlatform(userId, userProperties?.platform);
217
215
  });
218
216
  Object.keys(users).forEach(userId => {
219
217
  this._roomCache.setUserMapByUserId(userId, (0, _user.convertRteUserToFcrUser)(users[userId], this._roomCache));
@@ -241,7 +239,7 @@ class FcrUserControlImpl {
241
239
  }
242
240
  getUserListByRole(role) {
243
241
  const userList = this._scene.getUserListByRole(_type.FcrUserRoleToStringMap[role]);
244
- return userList === null || userList === void 0 ? void 0 : userList.map(user => (0, _user.convertRteUserToFcrUser)(user, this._roomCache));
242
+ return userList?.map(user => (0, _user.convertRteUserToFcrUser)(user, this._roomCache));
245
243
  }
246
244
  getUserCountByRole(role) {
247
245
  if (!this._enableUserCount) {
@@ -259,8 +257,9 @@ class FcrUserControlImpl {
259
257
  return this._scene.getUserCount();
260
258
  }
261
259
  getWaterMarkContent() {
262
- const _this$getLocalUser = this.getLocalUser(),
263
- userId = _this$getLocalUser.userId;
260
+ const {
261
+ userId
262
+ } = this.getLocalUser();
264
263
  return (0, _imports.get)(this._scene.getUserPropertiesByUserId(userId), 'security.watermark.content');
265
264
  }
266
265
  async fetchUserList(params) {
@@ -301,14 +300,12 @@ class FcrUserControlImpl {
301
300
  const userProperties = this._scene.getUserProperties();
302
301
  const res = {};
303
302
  for (const userId in userProperties) {
304
- var _userProperties$userI;
305
- res[userId] = (_userProperties$userI = userProperties[userId]) === null || _userProperties$userI === void 0 ? void 0 : _userProperties$userI['flexProps'];
303
+ res[userId] = userProperties[userId]?.['flexProps'];
306
304
  }
307
305
  return res;
308
306
  }
309
307
  getUserPropertiesByUserId(userId) {
310
- var _this$_scene$getUserP;
311
- return (_this$_scene$getUserP = this._scene.getUserPropertiesByUserId(userId)) === null || _this$_scene$getUserP === void 0 ? void 0 : _this$_scene$getUserP['flexProps'];
308
+ return this._scene.getUserPropertiesByUserId(userId)?.['flexProps'];
312
309
  }
313
310
  getUserPropertiesByKeyPath(keyPath, userId) {
314
311
  return this._scene.getUserPropertiesByKeyPath('flexProps.' + keyPath, userId);
@@ -332,8 +329,9 @@ class FcrUserControlImpl {
332
329
  }
333
330
  }
334
331
  async claimHost(hostKey) {
335
- const _this$getLocalUser2 = this.getLocalUser(),
336
- userId = _this$getLocalUser2.userId;
332
+ const {
333
+ userId
334
+ } = this.getLocalUser();
337
335
  return await (0, _error.handleRequestError)(() => this._api.claimHost({
338
336
  roomId: this._scene.sceneId,
339
337
  hostKey,
@@ -374,9 +372,4 @@ class FcrUserControlImpl {
374
372
  this.addObserver((0, _logger.generateLogObserver)(this.logger, [['onRemoteUsersJoined', ['roomId', 'events']], ['onRemoteUsersLeft', ['roomId', 'events']], ['onUserInfoUpdated', ['roomId', 'event']], ['onAllUserCountUpdated', ['roomId', 'count']], ['onLocalUserKickedOut', ['roomId', 'event']], ['onUserPropertiesUpdated', ['roomId', 'event']], ['onUserPropertiesDeleted', ['roomId', 'event']]]));
375
373
  }
376
374
  }
377
- exports.FcrUserControlImpl = FcrUserControlImpl;
378
- _FcrUserControlImpl = FcrUserControlImpl;
379
- var _applyDecs$e = _applyDecs(_FcrUserControlImpl, [[_imports.bound, 2, "getLocalUser"], [_imports.bound, 2, "getUsers"], [_imports.bound, 2, "getUserList"], [_imports.bound, 2, "getUserListByRole"], [_imports.bound, 2, "getUserCountByRole"], [_getUserDecs, 2, "getUser"], [[_imports.bound, _imports.trace], 2, "getAllUserCount"], [_imports.bound, 2, "getWaterMarkContent"], [_fetchUserListDecs, 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[_imports.bound, _imports.trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[_imports.bound, _imports.trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [_imports.trace, 2, "release"]], []).e;
380
- var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
381
- _initProto = _applyDecs$e2[0];
382
- _applyDecs$e;
375
+ exports.FcrUserControlImpl = FcrUserControlImpl;
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.description.js");
4
- require("core-js/modules/es.error.cause.js");
5
3
  require("core-js/modules/es.array.push.js");
6
4
  require("core-js/modules/esnext.function.metadata.js");
7
5
  require("core-js/modules/esnext.map.delete-all.js");
@@ -19,7 +17,6 @@ require("core-js/modules/esnext.map.reduce.js");
19
17
  require("core-js/modules/esnext.map.some.js");
20
18
  require("core-js/modules/esnext.map.update.js");
21
19
  require("core-js/modules/esnext.symbol.metadata.js");
22
- require("core-js/modules/web.dom-collections.iterator.js");
23
20
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
24
21
  Object.defineProperty(exports, "__esModule", {
25
22
  value: true
@@ -27,8 +24,6 @@ Object.defineProperty(exports, "__esModule", {
27
24
  exports.FcrWaitingRoomControlImpl = void 0;
28
25
  require("core-js/modules/esnext.iterator.constructor.js");
29
26
  require("core-js/modules/esnext.iterator.map.js");
30
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
31
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
32
27
  var _ = require("..");
33
28
  var _imports = require("../../imports");
34
29
  var _schema = require("../../schema");
@@ -37,8 +32,7 @@ var _error = require("../../utilities/error");
37
32
  var _logger = require("../../utilities/logger");
38
33
  var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
39
34
  var _type2 = require("../type");
40
- var _FcrWaitingRoomControlImpl;
41
- let _initProto, _moveToMainRoomByUserIdsDecs, _moveToMainRoomByUserRolesDecs, _ref;
35
+ let _initProto, _moveToMainRoomByUserIdsDecs, _moveToMainRoomByUserRolesDecs;
42
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)]; } }; }
43
37
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
44
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); }
@@ -47,14 +41,16 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
47
41
  /**
48
42
  * @internal
49
43
  */
50
- _ref = (_moveToMainRoomByUserIdsDecs = [(0, _imports.trace)(['userIds']), (0, _validateParams.default)(_schema.stringArraySchema)], _moveToMainRoomByUserRolesDecs = [(0, _imports.trace)(['userRoles']), (0, _validateParams.default)(_schema.fcrUserRolesSchema)], "logger");
51
44
  class FcrWaitingRoomControlImpl extends _.FcrBaseRoomControlImpl {
45
+ static {
46
+ [_initProto] = _applyDecs(this, [[_moveToMainRoomByUserIdsDecs, 2, "moveToMainRoomByUserIds"], [_moveToMainRoomByUserRolesDecs, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
47
+ }
48
+ //@internal
49
+ [(_moveToMainRoomByUserIdsDecs = [(0, _imports.trace)(['userIds']), (0, _validateParams.default)(_schema.stringArraySchema)], _moveToMainRoomByUserRolesDecs = [(0, _imports.trace)(['userRoles']), (0, _validateParams.default)(_schema.fcrUserRolesSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
50
+ prefix: 'FcrWaitingRoomControlImpl'
51
+ }));
52
52
  constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
53
53
  super(engine, scene, api, config, _type2.FcrRoomType.Waitingroom, chatConnection, sharedCache, chatRoomControl);
54
- //@internal
55
- (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
56
- prefix: 'FcrWaitingRoomControlImpl'
57
- })));
58
54
  this._addLogObserver();
59
55
  }
60
56
  addObserver(observer) {
@@ -76,9 +72,4 @@ class FcrWaitingRoomControlImpl extends _.FcrBaseRoomControlImpl {
76
72
  ['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
77
73
  }
78
74
  }
79
- exports.FcrWaitingRoomControlImpl = FcrWaitingRoomControlImpl;
80
- _FcrWaitingRoomControlImpl = FcrWaitingRoomControlImpl;
81
- var _applyDecs$e = _applyDecs(_FcrWaitingRoomControlImpl, [[_moveToMainRoomByUserIdsDecs, 2, "moveToMainRoomByUserIds"], [_moveToMainRoomByUserRolesDecs, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
82
- var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
83
- _initProto = _applyDecs$e2[0];
84
- _applyDecs$e;
75
+ exports.FcrWaitingRoomControlImpl = FcrWaitingRoomControlImpl;
@@ -9,15 +9,13 @@ require("core-js/modules/esnext.iterator.some.js");
9
9
  var _type = require("../privilege-control/type");
10
10
  const hasBoardWritePermission = permissions => {
11
11
  return permissions.some(permission => {
12
- var _permission$info;
13
- return ((_permission$info = permission.info) === null || _permission$info === void 0 ? void 0 : _permission$info.action) === _type.FcrPermissionAction.BoardWrite;
12
+ return permission.info?.action === _type.FcrPermissionAction.BoardWrite;
14
13
  });
15
14
  };
16
15
  exports.hasBoardWritePermission = hasBoardWritePermission;
17
16
  const hasAnnotationWritePermission = permissions => {
18
17
  return permissions.some(permission => {
19
- var _permission$info2;
20
- return ((_permission$info2 = permission.info) === null || _permission$info2 === void 0 ? void 0 : _permission$info2.action) === _type.FcrPermissionAction.AnnotationWrite;
18
+ return permission.info?.action === _type.FcrPermissionAction.AnnotationWrite;
21
19
  });
22
20
  };
23
21
  exports.hasAnnotationWritePermission = hasAnnotationWritePermission;
@@ -16,8 +16,7 @@ class FcrBoardSubWindowImpl {
16
16
  return new Promise((resolve, reject) => {
17
17
  window.addEventListener('message', event => {
18
18
  if (event.data.type === '@netless/_result_save_pdf_') {
19
- var _event$data$result;
20
- event.data.progress === 100 && resolve((_event$data$result = event.data.result) === null || _event$data$result === void 0 ? void 0 : _event$data$result.pdf);
19
+ event.data.progress === 100 && resolve(event.data.result?.pdf);
21
20
  }
22
21
  });
23
22
  });