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,7 +1,4 @@
1
- import "core-js/modules/es.symbol.description.js";
2
- import "core-js/modules/es.error.cause.js";
3
1
  import "core-js/modules/esnext.function.metadata.js";
4
- import "core-js/modules/esnext.iterator.filter.js";
5
2
  import "core-js/modules/esnext.map.delete-all.js";
6
3
  import "core-js/modules/esnext.map.emplace.js";
7
4
  import "core-js/modules/esnext.map.every.js";
@@ -17,19 +14,12 @@ import "core-js/modules/esnext.map.reduce.js";
17
14
  import "core-js/modules/esnext.map.some.js";
18
15
  import "core-js/modules/esnext.map.update.js";
19
16
  import "core-js/modules/esnext.symbol.metadata.js";
20
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
21
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
22
- var _FcrUserControlImpl;
23
- let _initProto, _getUserDecs, _fetchUserListDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs, _ref;
24
- 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; }
25
- 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) { _defineProperty(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; }
17
+ let _initProto, _getUserDecs, _fetchUserListDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs;
26
18
  import "core-js/modules/es.array.push.js";
27
- import "core-js/modules/es.object.from-entries.js";
28
19
  import "core-js/modules/esnext.iterator.constructor.js";
29
20
  import "core-js/modules/esnext.iterator.find.js";
30
21
  import "core-js/modules/esnext.iterator.for-each.js";
31
22
  import "core-js/modules/esnext.iterator.map.js";
32
- import "core-js/modules/web.dom-collections.iterator.js";
33
23
  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)]; } }; }
34
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
35
25
  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); }
@@ -51,157 +41,165 @@ import { ErrorModuleCode } from '../../imports';
51
41
  /**
52
42
  * @internal
53
43
  */
54
- _ref = (_getUserDecs = [bound, validateParams(stringSchema)], _fetchUserListDecs = [bound, trace(['params'])], _updateUserNameDecs = [bound, trace(['userId', 'userName']), validateParams(stringSchema, stringSchema)], _updateUserPropertiesDecs = [bound, trace(['properties', 'cause', 'userId']), validateParams(stringKeyUnknownValueSchema, stringKeyUnknownValueSchema, stringSchema)], _updateIncrementUserPropertiesDecs = [bound, trace(['increments', 'cause', 'userId']), validateParams(stringKeyNumberValueSchema, stringKeyUnknownValueSchema, stringSchema)], _deleteUserPropertiesDecs = [bound, trace(['keyPath', 'cause', 'userId']), validateParams(stringArraySchema, stringKeyUnknownValueSchema, stringSchema)], _getUserPropertiesByUserIdDecs = [bound, trace(['userId']), validateParams(stringSchema)], _getUserPropertiesByKeyPathDecs = [bound, trace(['keyPath', 'userId']), validateParams(stringSchema, stringSchema)], _updateRemoteUserRoleDecs = [bound, trace(['userId', 'userRole']), validateParams(stringSchema, fcrUserRoleSchema)], _claimHostDecs = [bound, trace(['hostKey']), validateParams(stringSchema)], _kickOutDecs = [bound, trace(['userId', 'type']), validateParams(stringSchema, fcrUserKickedOutTypeSchema)], _kickOutByUserIdsDecs = [trace(['userIds', 'type']), validateParams(stringArraySchema, fcrUserKickedOutTypeSchema)], _kickOutByUserRolesDecs = [trace(['userRoles', 'type']), validateParams(fcrUserRolesSchema, fcrUserKickedOutTypeSchema)], _mergeAudioStreamDecs = [trace(['userId']), validateParams(stringSchema)], "logger");
55
44
  export class FcrUserControlImpl {
56
- constructor(_scene, _api, _sharedCache) {
57
- //@internal
58
- _defineProperty(this, _ref, (_initProto(this), createLogger({
59
- prefix: 'FcrUserControlImpl'
60
- })));
61
- //@internal
62
- _defineProperty(this, "_observable", new AgoraObservable());
63
- //@internal
64
- _defineProperty(this, "_enableUserCount", true);
65
- //@internal
66
- _defineProperty(this, "_sceneObserver", {
67
- onRemoteUsersJoined: (roomId, events) => {
68
- events.forEach(event => {
69
- const userProperties = this._scene.getUserPropertiesByUserId(event.userInfo.userId);
70
- this._roomCache.setUserPlatform(event.userInfo.userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.platform);
71
- this._roomCache.setUserAvatar(event.userInfo.userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.avatar);
72
- });
73
- const fcrUserEvents = events.map(e => {
74
- return {
75
- userInfo: e.userInfo && convertRteUserToFcrUser(e.userInfo, this._roomCache)
76
- // operatorUser: e.operatorUser && convertRteUserToFcrUser(e.operatorUser, this._roomCache),
77
- };
78
- });
79
- fcrUserEvents.forEach(event => {
80
- const user = event.userInfo;
81
- const exists = user.userId in this._roomCache.userMapByUserId;
82
- if (exists) {
83
- this.logger.warn("[FcrUserControl] user joined when the user already exists, userId: ".concat(user.userId));
84
- } else {
85
- this._roomCache.setUserMapByUserId(user.userId, user);
86
- this._roomCache.addUserToList(user);
87
- }
88
- });
89
- this._observable.notifyObservers('onRemoteUsersJoined', roomId, fcrUserEvents);
90
- },
91
- onRemoteUsersLeft: (roomId, events) => {
92
- const fcrUserEvents = events.map(e => {
93
- var _e$cause;
94
- return {
95
- userInfo: e.userInfo && convertRteUserToFcrUser(e.userInfo, this._roomCache),
96
- userProperties: e.userProperties,
97
- operatorUser: e.operatorUser && convertRteUserToFcrUser(e.operatorUser, this._roomCache),
98
- reason: ((_e$cause = e.cause) === null || _e$cause === void 0 ? void 0 : _e$cause.cmd) === 5 ? FcrUserLeftReason.kickOut : FcrUserLeftReason.LeaveRoom
99
- };
100
- });
101
- fcrUserEvents.forEach(event => {
102
- const user = event.userInfo;
103
- const exists = this._roomCache.userMapByUserId.has(user.userId);
104
- if (!exists) {
105
- this.logger.warn("[FcrUserControl] user left when the user does not exist, userId: ".concat(user.userId));
106
- } else {
107
- this._roomCache.deleteUserMapByUserId(user.userId);
108
- const index = this._roomCache.userList.findIndex(u => user.userId === u.userId);
109
- if (index !== -1) {
110
- this._roomCache.deleteUserList(index);
111
- }
112
- }
113
- });
114
- events.forEach(event => {
115
- this._roomCache.deleteUserPlatform(event.userInfo.userId);
116
- this._roomCache.deleteUserAvatar(event.userInfo.userId);
117
- });
118
- this._observable.notifyObservers('onRemoteUsersLeft', roomId, fcrUserEvents);
119
- },
120
- onUserUpdated: (sceneId, event) => {
121
- const fcrUserUpdatedEvent = {
122
- modifiedUser: event.modifiedUser && convertRteUserToFcrUser(event.modifiedUser, this._roomCache),
123
- operatorUser: event.operatorUser && convertRteUserToFcrUser(event.operatorUser, this._roomCache),
124
- reason: event.reason
45
+ static {
46
+ [_initProto] = _applyDecs(this, [[bound, 2, "getLocalUser"], [bound, 2, "getUsers"], [bound, 2, "getUserList"], [bound, 2, "getUserListByRole"], [bound, 2, "getUserCountByRole"], [_getUserDecs, 2, "getUser"], [[bound, trace], 2, "getAllUserCount"], [bound, 2, "getWaterMarkContent"], [_fetchUserListDecs, 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[bound, trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[bound, trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [trace, 2, "release"]], []).e;
47
+ }
48
+ //@internal
49
+ [(_getUserDecs = [bound, validateParams(stringSchema)], _fetchUserListDecs = [bound, trace(['params'])], _updateUserNameDecs = [bound, trace(['userId', 'userName']), validateParams(stringSchema, stringSchema)], _updateUserPropertiesDecs = [bound, trace(['properties', 'cause', 'userId']), validateParams(stringKeyUnknownValueSchema, stringKeyUnknownValueSchema, stringSchema)], _updateIncrementUserPropertiesDecs = [bound, trace(['increments', 'cause', 'userId']), validateParams(stringKeyNumberValueSchema, stringKeyUnknownValueSchema, stringSchema)], _deleteUserPropertiesDecs = [bound, trace(['keyPath', 'cause', 'userId']), validateParams(stringArraySchema, stringKeyUnknownValueSchema, stringSchema)], _getUserPropertiesByUserIdDecs = [bound, trace(['userId']), validateParams(stringSchema)], _getUserPropertiesByKeyPathDecs = [bound, trace(['keyPath', 'userId']), validateParams(stringSchema, stringSchema)], _updateRemoteUserRoleDecs = [bound, trace(['userId', 'userRole']), validateParams(stringSchema, fcrUserRoleSchema)], _claimHostDecs = [bound, trace(['hostKey']), validateParams(stringSchema)], _kickOutDecs = [bound, trace(['userId', 'type']), validateParams(stringSchema, fcrUserKickedOutTypeSchema)], _kickOutByUserIdsDecs = [trace(['userIds', 'type']), validateParams(stringArraySchema, fcrUserKickedOutTypeSchema)], _kickOutByUserRolesDecs = [trace(['userRoles', 'type']), validateParams(fcrUserRolesSchema, fcrUserKickedOutTypeSchema)], _mergeAudioStreamDecs = [trace(['userId']), validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
50
+ prefix: 'FcrUserControlImpl'
51
+ }));
52
+ //@internal
53
+ _observable = new AgoraObservable();
54
+ //@internal
55
+
56
+ //@internal
57
+
58
+ //@internal
59
+ _enableUserCount = true;
60
+
61
+ //@internal
62
+ _sceneObserver = {
63
+ onRemoteUsersJoined: (roomId, events) => {
64
+ events.forEach(event => {
65
+ const userProperties = this._scene.getUserPropertiesByUserId(event.userInfo.userId);
66
+ this._roomCache.setUserPlatform(event.userInfo.userId, userProperties?.platform);
67
+ this._roomCache.setUserAvatar(event.userInfo.userId, userProperties?.avatar);
68
+ });
69
+ const fcrUserEvents = events.map(e => {
70
+ return {
71
+ userInfo: e.userInfo && convertRteUserToFcrUser(e.userInfo, this._roomCache)
72
+ // operatorUser: e.operatorUser && convertRteUserToFcrUser(e.operatorUser, this._roomCache),
125
73
  };
126
- const user = fcrUserUpdatedEvent.modifiedUser;
74
+ });
75
+ fcrUserEvents.forEach(event => {
76
+ const user = event.userInfo;
77
+ const exists = user.userId in this._roomCache.userMapByUserId;
78
+ if (exists) {
79
+ this.logger.warn(`[FcrUserControl] user joined when the user already exists, userId: ${user.userId}`);
80
+ } else {
81
+ this._roomCache.setUserMapByUserId(user.userId, user);
82
+ this._roomCache.addUserToList(user);
83
+ }
84
+ });
85
+ this._observable.notifyObservers('onRemoteUsersJoined', roomId, fcrUserEvents);
86
+ },
87
+ onRemoteUsersLeft: (roomId, events) => {
88
+ const fcrUserEvents = events.map(e => {
89
+ return {
90
+ userInfo: e.userInfo && convertRteUserToFcrUser(e.userInfo, this._roomCache),
91
+ userProperties: e.userProperties,
92
+ operatorUser: e.operatorUser && convertRteUserToFcrUser(e.operatorUser, this._roomCache),
93
+ reason: e.cause?.cmd === 5 ? FcrUserLeftReason.kickOut : FcrUserLeftReason.LeaveRoom
94
+ };
95
+ });
96
+ fcrUserEvents.forEach(event => {
97
+ const user = event.userInfo;
127
98
  const exists = this._roomCache.userMapByUserId.has(user.userId);
128
99
  if (!exists) {
129
- this.logger.warn("[FcrUserControl] user updated when the user does not exist, userId: ".concat(user.userId));
100
+ this.logger.warn(`[FcrUserControl] user left when the user does not exist, userId: ${user.userId}`);
130
101
  } else {
131
- this._roomCache.setUserMapByUserId(user.userId, user);
102
+ this._roomCache.deleteUserMapByUserId(user.userId);
132
103
  const index = this._roomCache.userList.findIndex(u => user.userId === u.userId);
133
104
  if (index !== -1) {
134
105
  this._roomCache.deleteUserList(index);
135
- this._roomCache.insertUserToList(index, user);
136
106
  }
137
107
  }
138
- this._observable.notifyObservers('onUserInfoUpdated', sceneId, fcrUserUpdatedEvent);
139
- },
140
- onAllUserCountUpdated: (sceneId, count) => {
141
- if (!this._enableUserCount) {
142
- return;
108
+ });
109
+ events.forEach(event => {
110
+ this._roomCache.deleteUserPlatform(event.userInfo.userId);
111
+ this._roomCache.deleteUserAvatar(event.userInfo.userId);
112
+ });
113
+ this._observable.notifyObservers('onRemoteUsersLeft', roomId, fcrUserEvents);
114
+ },
115
+ onUserUpdated: (sceneId, event) => {
116
+ const fcrUserUpdatedEvent = {
117
+ modifiedUser: event.modifiedUser && convertRteUserToFcrUser(event.modifiedUser, this._roomCache),
118
+ operatorUser: event.operatorUser && convertRteUserToFcrUser(event.operatorUser, this._roomCache),
119
+ reason: event.reason
120
+ };
121
+ const user = fcrUserUpdatedEvent.modifiedUser;
122
+ const exists = this._roomCache.userMapByUserId.has(user.userId);
123
+ if (!exists) {
124
+ this.logger.warn(`[FcrUserControl] user updated when the user does not exist, userId: ${user.userId}`);
125
+ } else {
126
+ this._roomCache.setUserMapByUserId(user.userId, user);
127
+ const index = this._roomCache.userList.findIndex(u => user.userId === u.userId);
128
+ if (index !== -1) {
129
+ this._roomCache.deleteUserList(index);
130
+ this._roomCache.insertUserToList(index, user);
143
131
  }
144
- this._observable.notifyObservers('onAllUserCountUpdated', sceneId, count);
145
- },
146
- onUserPropertiesUpdated: (roomId, event) => {
147
- var _event$cause, _event$cause2;
148
- if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 5 && event.modifiedUser.userId === this._localUserId) {
149
- const changedProperties = event.changedProperties;
150
- const dirtyStateMap = {
151
- '0': FcrUserKickedOutType.Once,
152
- '1': FcrUserKickedOutType.Forever,
153
- '2': 2
154
- };
155
- const key = get(changedProperties, 'dirty.state');
156
- const type = dirtyStateMap[key];
157
- this._observable.notifyObservers('onLocalUserKickedOut', roomId, {
158
- type
159
- });
160
- }
161
- if (((_event$cause2 = event.cause) === null || _event$cause2 === void 0 ? void 0 : _event$cause2.cmd) === 8) {
162
- const changedProperties = {};
163
- for (const key in event.changedProperties) {
164
- if (key.startsWith('flexProps')) {
165
- changedProperties[key] = event.changedProperties[key];
166
- }
167
- }
168
- if (Object.keys(changedProperties).length > 0) {
169
- const structure = convertToStructure(changedProperties);
170
- this._observable.notifyObservers('onUserPropertiesUpdated', roomId, _objectSpread(_objectSpread({}, event), {}, {
171
- changedProperties: structure['flexProps']
172
- }));
132
+ }
133
+ this._observable.notifyObservers('onUserInfoUpdated', sceneId, fcrUserUpdatedEvent);
134
+ },
135
+ onAllUserCountUpdated: (sceneId, count) => {
136
+ if (!this._enableUserCount) {
137
+ return;
138
+ }
139
+ this._observable.notifyObservers('onAllUserCountUpdated', sceneId, count);
140
+ },
141
+ onUserPropertiesUpdated: (roomId, event) => {
142
+ if (event.cause?.cmd === 5 && event.modifiedUser.userId === this._localUserId) {
143
+ const {
144
+ changedProperties
145
+ } = event;
146
+ const dirtyStateMap = {
147
+ '0': FcrUserKickedOutType.Once,
148
+ '1': FcrUserKickedOutType.Forever,
149
+ '2': 2
150
+ };
151
+ const key = get(changedProperties, 'dirty.state');
152
+ const type = dirtyStateMap[key];
153
+ this._observable.notifyObservers('onLocalUserKickedOut', roomId, {
154
+ type
155
+ });
156
+ }
157
+ if (event.cause?.cmd === 8) {
158
+ const changedProperties = {};
159
+ for (const key in event.changedProperties) {
160
+ if (key.startsWith('flexProps')) {
161
+ changedProperties[key] = event.changedProperties[key];
173
162
  }
174
163
  }
175
- },
176
- onUserPropertiesDeleted: (roomId, event) => {
177
- var _event$cause3;
178
- if (((_event$cause3 = event.cause) === null || _event$cause3 === void 0 ? void 0 : _event$cause3.cmd) === 8) {
179
- const changedKeyPaths = [];
180
- for (const keyPath of event.changedKeyPaths) {
181
- if (keyPath.startsWith('flexProps')) {
182
- changedKeyPaths.push(keyPath);
183
- }
184
- }
185
- if (changedKeyPaths.length > 0) {
186
- this._observable.notifyObservers('onUserPropertiesDeleted', roomId, _objectSpread(_objectSpread({}, event), {}, {
187
- changedKeyPaths
188
- }));
164
+ if (Object.keys(changedProperties).length > 0) {
165
+ const structure = convertToStructure(changedProperties);
166
+ this._observable.notifyObservers('onUserPropertiesUpdated', roomId, {
167
+ ...event,
168
+ changedProperties: structure['flexProps']
169
+ });
170
+ }
171
+ }
172
+ },
173
+ onUserPropertiesDeleted: (roomId, event) => {
174
+ if (event.cause?.cmd === 8) {
175
+ const changedKeyPaths = [];
176
+ for (const keyPath of event.changedKeyPaths) {
177
+ if (keyPath.startsWith('flexProps')) {
178
+ changedKeyPaths.push(keyPath);
189
179
  }
190
180
  }
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;
181
+ if (changedKeyPaths.length > 0) {
182
+ this._observable.notifyObservers('onUserPropertiesDeleted', roomId, {
183
+ ...event,
184
+ changedKeyPaths
185
+ });
201
186
  }
202
- this._observable.notifyObservers('onUserCountUpdatedByRole', roomId, userRole, count);
203
187
  }
204
- });
188
+ },
189
+ onRemoteUsersSynced: (roomId, events) => {
190
+ this._observable.notifyObservers('onRemoteUsersSynced', roomId, events);
191
+ },
192
+ onRemoteUsersDesynced: (roomId, events) => {
193
+ this._observable.notifyObservers('onRemoteUsersDesynced', roomId, events);
194
+ },
195
+ onUserCountUpdatedByRole: (roomId, userRole, count) => {
196
+ if (!this._enableUserCount) {
197
+ return;
198
+ }
199
+ this._observable.notifyObservers('onUserCountUpdatedByRole', roomId, userRole, count);
200
+ }
201
+ };
202
+ constructor(_scene, _api, _sharedCache) {
205
203
  this._scene = _scene;
206
204
  this._api = _api;
207
205
  this._sharedCache = _sharedCache;
@@ -209,8 +207,8 @@ export class FcrUserControlImpl {
209
207
  const users = this._scene.getUsers();
210
208
  Object.keys(users).forEach(userId => {
211
209
  const userProperties = this._scene.getUserPropertiesByUserId(userId);
212
- this._roomCache.setUserAvatar(userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.avatar);
213
- this._roomCache.setUserPlatform(userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.platform);
210
+ this._roomCache.setUserAvatar(userId, userProperties?.avatar);
211
+ this._roomCache.setUserPlatform(userId, userProperties?.platform);
214
212
  });
215
213
  Object.keys(users).forEach(userId => {
216
214
  this._roomCache.setUserMapByUserId(userId, convertRteUserToFcrUser(users[userId], this._roomCache));
@@ -238,7 +236,7 @@ export class FcrUserControlImpl {
238
236
  }
239
237
  getUserListByRole(role) {
240
238
  const userList = this._scene.getUserListByRole(FcrUserRoleToStringMap[role]);
241
- return userList === null || userList === void 0 ? void 0 : userList.map(user => convertRteUserToFcrUser(user, this._roomCache));
239
+ return userList?.map(user => convertRteUserToFcrUser(user, this._roomCache));
242
240
  }
243
241
  getUserCountByRole(role) {
244
242
  if (!this._enableUserCount) {
@@ -256,8 +254,9 @@ export class FcrUserControlImpl {
256
254
  return this._scene.getUserCount();
257
255
  }
258
256
  getWaterMarkContent() {
259
- const _this$getLocalUser = this.getLocalUser(),
260
- userId = _this$getLocalUser.userId;
257
+ const {
258
+ userId
259
+ } = this.getLocalUser();
261
260
  return get(this._scene.getUserPropertiesByUserId(userId), 'security.watermark.content');
262
261
  }
263
262
  async fetchUserList(params) {
@@ -298,14 +297,12 @@ export class FcrUserControlImpl {
298
297
  const userProperties = this._scene.getUserProperties();
299
298
  const res = {};
300
299
  for (const userId in userProperties) {
301
- var _userProperties$userI;
302
- res[userId] = (_userProperties$userI = userProperties[userId]) === null || _userProperties$userI === void 0 ? void 0 : _userProperties$userI['flexProps'];
300
+ res[userId] = userProperties[userId]?.['flexProps'];
303
301
  }
304
302
  return res;
305
303
  }
306
304
  getUserPropertiesByUserId(userId) {
307
- var _this$_scene$getUserP;
308
- return (_this$_scene$getUserP = this._scene.getUserPropertiesByUserId(userId)) === null || _this$_scene$getUserP === void 0 ? void 0 : _this$_scene$getUserP['flexProps'];
305
+ return this._scene.getUserPropertiesByUserId(userId)?.['flexProps'];
309
306
  }
310
307
  getUserPropertiesByKeyPath(keyPath, userId) {
311
308
  return this._scene.getUserPropertiesByKeyPath('flexProps.' + keyPath, userId);
@@ -329,8 +326,9 @@ export class FcrUserControlImpl {
329
326
  }
330
327
  }
331
328
  async claimHost(hostKey) {
332
- const _this$getLocalUser2 = this.getLocalUser(),
333
- userId = _this$getLocalUser2.userId;
329
+ const {
330
+ userId
331
+ } = this.getLocalUser();
334
332
  return await handleRequestError(() => this._api.claimHost({
335
333
  roomId: this._scene.sceneId,
336
334
  hostKey,
@@ -370,9 +368,4 @@ export class FcrUserControlImpl {
370
368
  _addLogObserver() {
371
369
  this.addObserver(generateLogObserver(this.logger, [['onRemoteUsersJoined', ['roomId', 'events']], ['onRemoteUsersLeft', ['roomId', 'events']], ['onUserInfoUpdated', ['roomId', 'event']], ['onAllUserCountUpdated', ['roomId', 'count']], ['onLocalUserKickedOut', ['roomId', 'event']], ['onUserPropertiesUpdated', ['roomId', 'event']], ['onUserPropertiesDeleted', ['roomId', 'event']]]));
372
370
  }
373
- }
374
- _FcrUserControlImpl = FcrUserControlImpl;
375
- var _applyDecs$e = _applyDecs(_FcrUserControlImpl, [[bound, 2, "getLocalUser"], [bound, 2, "getUsers"], [bound, 2, "getUserList"], [bound, 2, "getUserListByRole"], [bound, 2, "getUserCountByRole"], [_getUserDecs, 2, "getUser"], [[bound, trace], 2, "getAllUserCount"], [bound, 2, "getWaterMarkContent"], [_fetchUserListDecs, 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[bound, trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[bound, trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [trace, 2, "release"]], []).e;
376
- var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
377
- _initProto = _applyDecs$e2[0];
378
- _applyDecs$e;
371
+ }
@@ -1,5 +1,3 @@
1
- import "core-js/modules/es.symbol.description.js";
2
- import "core-js/modules/es.error.cause.js";
3
1
  import "core-js/modules/es.array.push.js";
4
2
  import "core-js/modules/esnext.function.metadata.js";
5
3
  import "core-js/modules/esnext.map.delete-all.js";
@@ -17,11 +15,7 @@ import "core-js/modules/esnext.map.reduce.js";
17
15
  import "core-js/modules/esnext.map.some.js";
18
16
  import "core-js/modules/esnext.map.update.js";
19
17
  import "core-js/modules/esnext.symbol.metadata.js";
20
- import "core-js/modules/web.dom-collections.iterator.js";
21
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
22
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
23
- var _FcrWaitingRoomControlImpl;
24
- let _initProto, _moveToMainRoomByUserIdsDecs, _moveToMainRoomByUserRolesDecs, _ref;
18
+ let _initProto, _moveToMainRoomByUserIdsDecs, _moveToMainRoomByUserRolesDecs;
25
19
  import "core-js/modules/esnext.iterator.constructor.js";
26
20
  import "core-js/modules/esnext.iterator.map.js";
27
21
  function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
@@ -41,14 +35,16 @@ import { FcrRoomType } from '../type';
41
35
  /**
42
36
  * @internal
43
37
  */
44
- _ref = (_moveToMainRoomByUserIdsDecs = [trace(['userIds']), validateParams(stringArraySchema)], _moveToMainRoomByUserRolesDecs = [trace(['userRoles']), validateParams(fcrUserRolesSchema)], "logger");
45
38
  export class FcrWaitingRoomControlImpl extends FcrBaseRoomControlImpl {
39
+ static {
40
+ [_initProto] = _applyDecs(this, [[_moveToMainRoomByUserIdsDecs, 2, "moveToMainRoomByUserIds"], [_moveToMainRoomByUserRolesDecs, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
41
+ }
42
+ //@internal
43
+ [(_moveToMainRoomByUserIdsDecs = [trace(['userIds']), validateParams(stringArraySchema)], _moveToMainRoomByUserRolesDecs = [trace(['userRoles']), validateParams(fcrUserRolesSchema)], "logger")] = (_initProto(this), createLogger({
44
+ prefix: 'FcrWaitingRoomControlImpl'
45
+ }));
46
46
  constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
47
47
  super(engine, scene, api, config, FcrRoomType.Waitingroom, chatConnection, sharedCache, chatRoomControl);
48
- //@internal
49
- _defineProperty(this, _ref, (_initProto(this), createLogger({
50
- prefix: 'FcrWaitingRoomControlImpl'
51
- })));
52
48
  this._addLogObserver();
53
49
  }
54
50
  addObserver(observer) {
@@ -69,9 +65,4 @@ export class FcrWaitingRoomControlImpl extends FcrBaseRoomControlImpl {
69
65
  // 'onNetworkStatsUpdated',
70
66
  ['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
71
67
  }
72
- }
73
- _FcrWaitingRoomControlImpl = FcrWaitingRoomControlImpl;
74
- var _applyDecs$e = _applyDecs(_FcrWaitingRoomControlImpl, [[_moveToMainRoomByUserIdsDecs, 2, "moveToMainRoomByUserIds"], [_moveToMainRoomByUserRolesDecs, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
75
- var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
76
- _initProto = _applyDecs$e2[0];
77
- _applyDecs$e;
68
+ }
@@ -3,13 +3,11 @@ import "core-js/modules/esnext.iterator.some.js";
3
3
  import { FcrPermissionAction } from '../privilege-control/type';
4
4
  export const hasBoardWritePermission = permissions => {
5
5
  return permissions.some(permission => {
6
- var _permission$info;
7
- return ((_permission$info = permission.info) === null || _permission$info === void 0 ? void 0 : _permission$info.action) === FcrPermissionAction.BoardWrite;
6
+ return permission.info?.action === FcrPermissionAction.BoardWrite;
8
7
  });
9
8
  };
10
9
  export const hasAnnotationWritePermission = permissions => {
11
10
  return permissions.some(permission => {
12
- var _permission$info2;
13
- return ((_permission$info2 = permission.info) === null || _permission$info2 === void 0 ? void 0 : _permission$info2.action) === FcrPermissionAction.AnnotationWrite;
11
+ return permission.info?.action === FcrPermissionAction.AnnotationWrite;
14
12
  });
15
13
  };
@@ -10,8 +10,7 @@ export class FcrBoardSubWindowImpl {
10
10
  return new Promise((resolve, reject) => {
11
11
  window.addEventListener('message', event => {
12
12
  if (event.data.type === '@netless/_result_save_pdf_') {
13
- var _event$data$result;
14
- event.data.progress === 100 && resolve((_event$data$result = event.data.result) === null || _event$data$result === void 0 ? void 0 : _event$data$result.pdf);
13
+ event.data.progress === 100 && resolve(event.data.result?.pdf);
15
14
  }
16
15
  });
17
16
  });