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,18 +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 _FcrBaseRoomControlImpl;
23
- let _initProto, _joinDecs, _updateRoomPropertiesDecs, _updateIncrementRoomPropertiesDecs, _deleteRoomPropertiesDecs, _startCloudRecordingDecs, _startLiveStreamingDecs, _updateLiveStreamingLayoutDecs, _sendRoomMessageDecs, _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, _joinDecs, _updateRoomPropertiesDecs, _updateIncrementRoomPropertiesDecs, _deleteRoomPropertiesDecs, _startCloudRecordingDecs, _startLiveStreamingDecs, _updateLiveStreamingLayoutDecs, _sendRoomMessageDecs;
26
18
  import "core-js/modules/es.array.includes.js";
27
19
  import "core-js/modules/es.array.push.js";
28
20
  import "core-js/modules/es.json.stringify.js";
29
21
  import "core-js/modules/esnext.iterator.constructor.js";
30
22
  import "core-js/modules/esnext.iterator.for-each.js";
31
- import "core-js/modules/web.dom-collections.iterator.js";
32
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)]; } }; }
33
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
34
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); }
@@ -78,17 +69,19 @@ import { FcrApplicationControlImpl } from './application-control';
78
69
  *
79
70
  * @internal
80
71
  */
81
- _ref = (_joinDecs = trace(['options']), _updateRoomPropertiesDecs = trace(['properties', 'cause']), _updateIncrementRoomPropertiesDecs = trace(['increments', 'cause']), _deleteRoomPropertiesDecs = trace(['properties', 'cause']), _startCloudRecordingDecs = trace(['config']), _startLiveStreamingDecs = trace(['data']), _updateLiveStreamingLayoutDecs = trace(['layoutType']), _sendRoomMessageDecs = trace(['payload', 'guaranteedDelivery']), "logger");
82
72
  export class FcrBaseRoomControlImpl {
73
+ static {
74
+ [_initProto] = _applyDecs(this, [[trace, 2, "getSyncTimestamp"], [trace, 2, "getRoomInfo"], [trace, 2, "getRoomSchedule"], [trace, 2, "getLocalExDataSyncTypeList"], [_joinDecs, 2, "join"], [trace, 2, "leave"], [trace, 2, "release"], [trace, 2, "start"], [trace, 2, "end"], [trace, 2, "close"], [trace, 2, "getRoomState"], [trace, 2, "getRoomProperties"], [trace, 2, "getRoomPropertiesByKeyPath"], [_updateRoomPropertiesDecs, 2, "updateRoomProperties"], [_updateIncrementRoomPropertiesDecs, 2, "updateIncrementRoomProperties"], [_deleteRoomPropertiesDecs, 2, "deleteRoomProperties"], [_startCloudRecordingDecs, 2, "startCloudRecording"], [trace, 2, "pauseCloudRecording"], [trace, 2, "resumeCloudRecording"], [trace, 2, "stopCloudRecording"], [trace, 2, "getLiveStreamingState"], [trace, 2, "getLiveStreamingConfig"], [_startLiveStreamingDecs, 2, "startLiveStreaming"], [_updateLiveStreamingLayoutDecs, 2, "updateLiveStreamingLayout"], [trace, 2, "stopLiveStreaming"], [trace, 2, "getCloudRecordingState"], [_sendRoomMessageDecs, 2, "sendRoomMessage"]], []).e;
75
+ }
76
+ //@internal
77
+ [(_joinDecs = trace(['options']), _updateRoomPropertiesDecs = trace(['properties', 'cause']), _updateIncrementRoomPropertiesDecs = trace(['increments', 'cause']), _deleteRoomPropertiesDecs = trace(['properties', 'cause']), _startCloudRecordingDecs = trace(['config']), _startLiveStreamingDecs = trace(['data']), _updateLiveStreamingLayoutDecs = trace(['layoutType']), _sendRoomMessageDecs = trace(['payload', 'guaranteedDelivery']), "logger")] = (_initProto(this), createLogger({
78
+ prefix: 'FcrBaseRoomControlImpl'
79
+ }));
80
+ _observable = new AgoraObservable();
81
+ _joinRoomSuccess = false;
82
+ _joining = false;
83
+ _joinState = ROOM_CONTROL_CONSTANTS.JOIN_STATE.CANCELED;
83
84
  constructor(_engine, _scene, _api, _config, _roomType, _chatConnection, _sharedCache, _chatRoomControl) {
84
- //@internal
85
- _defineProperty(this, _ref, (_initProto(this), createLogger({
86
- prefix: 'FcrBaseRoomControlImpl'
87
- })));
88
- _defineProperty(this, "_observable", new AgoraObservable());
89
- _defineProperty(this, "_joinRoomSuccess", false);
90
- _defineProperty(this, "_joining", false);
91
- _defineProperty(this, "_joinState", ROOM_CONTROL_CONSTANTS.JOIN_STATE.CANCELED);
92
85
  this._engine = _engine;
93
86
  this._scene = _scene;
94
87
  this._api = _api;
@@ -98,8 +91,9 @@ export class FcrBaseRoomControlImpl {
98
91
  this._sharedCache = _sharedCache;
99
92
  this._chatRoomControl = _chatRoomControl;
100
93
  // 初始化 FcrJoinHelper
101
- const _this$_engine$getConf = this._engine.getConfig(),
102
- userId = _this$_engine$getConf.userId;
94
+ const {
95
+ userId
96
+ } = this._engine.getConfig();
103
97
  this._joinHelper = new FcrJoinHelper(userId, this._scene, this._api);
104
98
  this._engineObserver = {
105
99
  onConnectionStateUpdated: state => {
@@ -111,9 +105,8 @@ export class FcrBaseRoomControlImpl {
111
105
  };
112
106
  this._sceneObserver = {
113
107
  onJoinSceneSuccess: (sceneId, localUser) => {
114
- var _this$_chatRoomContro;
115
108
  this._joinRoomSuccess = true;
116
- (_this$_chatRoomContro = this._chatRoomControl) === null || _this$_chatRoomContro === void 0 || _this$_chatRoomContro.join();
109
+ this._chatRoomControl?.join();
117
110
  this._userControl = new FcrUserControlImpl(this._scene, this._api, this._sharedCache);
118
111
  this._streamControl = new FcrStreamControlImpl(this._engine, this._scene, this._api, this._sharedCache);
119
112
  this._roomSessionControl = new FcrRoomSessionControlImpl(this, this._api, localUser.getLocalUserId());
@@ -147,33 +140,31 @@ export class FcrBaseRoomControlImpl {
147
140
  this._observable.notifyObservers('onRoomMessageReceived', sceneId, message);
148
141
  const payload = message.payload;
149
142
  if (message.cmd === ROOM_MESSAGE_COMMANDS.ROOM_ROUTE_SWITCH) {
150
- var _this$_userControl;
151
- const localUserRole = (_this$_userControl = this._userControl) === null || _this$_userControl === void 0 ? void 0 : _this$_userControl.getLocalUser().userRole;
143
+ const localUserRole = this._userControl?.getLocalUser().userRole;
152
144
  if (localUserRole && payload.targetRoles.includes(FcrUserRoleToStringMap[localUserRole])) {
153
- var _this$_userControl2;
154
145
  this._observable.notifyObservers('onRoomRouteSwitched', {
155
146
  targetRouting: {
156
147
  roomId: payload.toRoom.roomUuid,
157
148
  roomType: payload.toRoom.roomType,
158
149
  isJoined: false
159
150
  },
160
- operatorUser: (_this$_userControl2 = this._userControl) === null || _this$_userControl2 === void 0 ? void 0 : _this$_userControl2.getUser(message.senderId)
151
+ operatorUser: this._userControl?.getUser(message.senderId)
161
152
  });
162
153
  this.leave();
163
154
  }
164
155
  }
165
156
  },
166
157
  onScenePropertiesUpdated: async (sceneId, event) => {
167
- var _event$cause, _event$cause2, _event$cause3, _event$cause4;
168
- if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === ROOM_MESSAGE_COMMANDS.CLOUD_RECORDING) {
169
- const _ref2 = this._scene.getSceneProperties().record,
170
- state = _ref2.state,
171
- ready = _ref2.ready,
172
- onhold = _ref2.onhold;
158
+ if (event.cause?.cmd === ROOM_MESSAGE_COMMANDS.CLOUD_RECORDING) {
159
+ const {
160
+ state,
161
+ ready,
162
+ onhold
163
+ } = this._scene.getSceneProperties().record;
173
164
  const recordState = this._formatRecordingState(state, ready, onhold);
174
165
  this._observable.notifyObservers('onCloudRecordingStateUpdated', sceneId, recordState);
175
166
  }
176
- if (((_event$cause2 = event.cause) === null || _event$cause2 === void 0 ? void 0 : _event$cause2.cmd) === ROOM_MESSAGE_COMMANDS.ROOM_STATE_UPDATE) {
167
+ if (event.cause?.cmd === ROOM_MESSAGE_COMMANDS.ROOM_STATE_UPDATE) {
177
168
  const schedule = event.changedProperties.schedule;
178
169
  if (schedule.state === ROOM_STATE_VALUES.ENDED) {
179
170
  this._joinState = ROOM_CONTROL_CONSTANTS.JOIN_STATE.CANCELED;
@@ -181,7 +172,7 @@ export class FcrBaseRoomControlImpl {
181
172
  }
182
173
  this._observable.notifyObservers('onRoomStateUpdated', sceneId, schedule.state);
183
174
  }
184
- if (((_event$cause3 = event.cause) === null || _event$cause3 === void 0 ? void 0 : _event$cause3.cmd) === ROOM_MESSAGE_COMMANDS.ROOM_PROPERTIES_UPDATE) {
175
+ if (event.cause?.cmd === ROOM_MESSAGE_COMMANDS.ROOM_PROPERTIES_UPDATE) {
185
176
  const changedProperties = {};
186
177
  for (const key in event.changedProperties) {
187
178
  if (key.startsWith('flexProps')) {
@@ -190,17 +181,17 @@ export class FcrBaseRoomControlImpl {
190
181
  }
191
182
  if (Object.keys(changedProperties).length > 0) {
192
183
  const structure = convertToStructure(changedProperties);
193
- this._observable.notifyObservers('onRoomPropertiesUpdated', sceneId, _objectSpread(_objectSpread({}, event), {}, {
184
+ this._observable.notifyObservers('onRoomPropertiesUpdated', sceneId, {
185
+ ...event,
194
186
  changedProperties: structure['flexProps']
195
- }));
187
+ });
196
188
  }
197
189
  }
198
- if (((_event$cause4 = event.cause) === null || _event$cause4 === void 0 ? void 0 : _event$cause4.cmd) === ROOM_MESSAGE_COMMANDS.LIVE_STREAMING_UPDATE) {
199
- var _event$cause5;
190
+ if (event.cause?.cmd === ROOM_MESSAGE_COMMANDS.LIVE_STREAMING_UPDATE) {
200
191
  let liveStreamingState = FcrLiveStreamingState.STOPPED;
201
192
  let state = this._scene.getScenePropertiesByKeyPath('live.state');
202
193
  let pageUrl = this._scene.getScenePropertiesByKeyPath('live.pageUrl');
203
- const reason = (_event$cause5 = event.cause) === null || _event$cause5 === void 0 || (_event$cause5 = _event$cause5.data) === null || _event$cause5 === void 0 ? void 0 : _event$cause5.reason;
194
+ const reason = event.cause?.data?.reason;
204
195
  if (state === LIVE_STREAMING_STATE_VALUES.STARTED) {
205
196
  liveStreamingState = FcrLiveStreamingState.STARTED;
206
197
  }
@@ -211,8 +202,7 @@ export class FcrBaseRoomControlImpl {
211
202
  }
212
203
  },
213
204
  onScenePropertiesDeleted: (sceneId, event) => {
214
- var _event$cause6;
215
- if (((_event$cause6 = event.cause) === null || _event$cause6 === void 0 ? void 0 : _event$cause6.cmd) === ROOM_MESSAGE_COMMANDS.ROOM_PROPERTIES_UPDATE) {
205
+ if (event.cause?.cmd === ROOM_MESSAGE_COMMANDS.ROOM_PROPERTIES_UPDATE) {
216
206
  this._observable.notifyObservers('onRoomPropertiesDeleted', sceneId, event);
217
207
  }
218
208
  },
@@ -235,8 +225,7 @@ export class FcrBaseRoomControlImpl {
235
225
  }
236
226
  },
237
227
  onUserPropertiesUpdated: (_, event) => {
238
- var _event$cause7;
239
- if (((_event$cause7 = event.cause) === null || _event$cause7 === void 0 ? void 0 : _event$cause7.cmd) === ROOM_MESSAGE_COMMANDS.USER_KICK_OUT && event.modifiedUser.userId === this._scene.localUser.getLocalUserId()) {
228
+ if (event.cause?.cmd === ROOM_MESSAGE_COMMANDS.USER_KICK_OUT && event.modifiedUser.userId === this._scene.localUser.getLocalUserId()) {
240
229
  this._joinState = ROOM_CONTROL_CONSTANTS.JOIN_STATE.CANCELED;
241
230
  this._cleanup();
242
231
  }
@@ -347,7 +336,6 @@ export class FcrBaseRoomControlImpl {
347
336
  * @returns 房间信息,如果未加入房间则返回 undefined
348
337
  */
349
338
  getRoomInfo() {
350
- var _passwordInfo$payload;
351
339
  const sceneInfo = this._scene.getSceneInfo();
352
340
  // 检查是否已加入房间,避免在退出房间时访问已清除的 localUser
353
341
  if (!sceneInfo || !this._joinRoomSuccess) {
@@ -356,19 +344,18 @@ export class FcrBaseRoomControlImpl {
356
344
  const passwordInfo = this._scene.getScenePropertiesByKeyPath('security.password');
357
345
  let shareLink;
358
346
  try {
359
- var _userProperties$info;
360
347
  const userProperties = this._scene.getUserPropertiesByUserId(this._scene.localUser.getLocalUserId());
361
- shareLink = userProperties === null || userProperties === void 0 || (_userProperties$info = userProperties.info) === null || _userProperties$info === void 0 ? void 0 : _userProperties$info.shareLink;
348
+ shareLink = userProperties?.info?.shareLink;
362
349
  } catch (e) {
363
350
  // localUser 可能在退出房间过程中被清除,
364
- this.logger.warn("getroomInfo error :".concat(JSON.stringify(e)));
351
+ this.logger.warn(`getroomInfo error :${JSON.stringify(e)}`);
365
352
  }
366
353
  const label = this._scene.getScenePropertiesByKeyPath('label');
367
354
  return {
368
355
  roomId: sceneInfo.sceneId,
369
356
  roomName: sceneInfo.sceneName,
370
357
  roomType: this._roomType,
371
- password: passwordInfo === null || passwordInfo === void 0 || (_passwordInfo$payload = passwordInfo.payload) === null || _passwordInfo$payload === void 0 ? void 0 : _passwordInfo$payload.text,
358
+ password: passwordInfo?.payload?.text,
372
359
  inviteLink: shareLink,
373
360
  label
374
361
  };
@@ -381,12 +368,11 @@ export class FcrBaseRoomControlImpl {
381
368
  * @throws {FcrError} 如果未加入房间
382
369
  */
383
370
  getRoomSchedule() {
384
- var _schedule$duration, _schedule$startTime;
385
371
  validateRoomJoined(this._joinRoomSuccess, 'get schedule info');
386
372
  const schedule = this._scene.getScenePropertiesByKeyPath('schedule');
387
373
  return {
388
- duration: (_schedule$duration = schedule.duration) !== null && _schedule$duration !== void 0 ? _schedule$duration : 0,
389
- startTime: Math.floor(((_schedule$startTime = schedule.startTime) !== null && _schedule$startTime !== void 0 ? _schedule$startTime : 0) / 1000)
374
+ duration: schedule.duration ?? 0,
375
+ startTime: Math.floor((schedule.startTime ?? 0) / 1000)
390
376
  };
391
377
  }
392
378
 
@@ -398,7 +384,7 @@ export class FcrBaseRoomControlImpl {
398
384
  getLocalExDataSyncTypeList() {
399
385
  const localExDataSyncTypeList = this._scene.getLocalExDataSyncTypeList();
400
386
  const result = [];
401
- localExDataSyncTypeList === null || localExDataSyncTypeList === void 0 || localExDataSyncTypeList.forEach(syncTypeInfo => {
387
+ localExDataSyncTypeList?.forEach(syncTypeInfo => {
402
388
  const convertedType = this._convertAgoraRteExDataSyncTypeInfoToFcrExDataSyncType(syncTypeInfo);
403
389
  if (convertedType) {
404
390
  result.push(convertedType);
@@ -462,9 +448,7 @@ export class FcrBaseRoomControlImpl {
462
448
  */
463
449
  async _executeJoinProcess(options) {
464
450
  const handleJoinAborted = this._createJoinAbortedHandler();
465
- const _await$to = await to(this._joinHelper.join(options, handleJoinAborted)),
466
- _await$to2 = _slicedToArray(_await$to, 1),
467
- error = _await$to2[0];
451
+ const [error] = await to(this._joinHelper.join(options, handleJoinAborted));
468
452
  if (error) {
469
453
  throw error;
470
454
  }
@@ -493,7 +477,7 @@ export class FcrBaseRoomControlImpl {
493
477
  async _handleRobotUserSetup(options) {
494
478
  if (options.userRole === FcrUserRole.ROBOT) {
495
479
  const res = handleRequestError(() => this._api.setCloudRecordingReady(this._scene.sceneId), ErrorModuleCode.FCR_ROOM, 'set cloud recording ready failed');
496
- this.logger.info("set cloud recording ready, response: ".concat(jsonstring(res)));
480
+ this.logger.info(`set cloud recording ready, response: ${jsonstring(res)}`);
497
481
  }
498
482
  }
499
483
 
@@ -502,7 +486,7 @@ export class FcrBaseRoomControlImpl {
502
486
  * @private
503
487
  */
504
488
  _handleJoinFailure(error) {
505
- this.logger.error("failed to join room: ".concat(error.message));
489
+ this.logger.error(`failed to join room: ${error.message}`);
506
490
  this._observable.notifyObservers('onJoinRoomFailure', this._scene.sceneId, error);
507
491
  }
508
492
 
@@ -633,10 +617,11 @@ export class FcrBaseRoomControlImpl {
633
617
  return FcrReturnCode.SUCCESS;
634
618
  }
635
619
  getCloudRecordingState() {
636
- const _ref3 = this._scene.getScenePropertiesByKeyPath('record'),
637
- state = _ref3.state,
638
- ready = _ref3.ready,
639
- onhold = _ref3.onhold;
620
+ const {
621
+ state,
622
+ ready,
623
+ onhold
624
+ } = this._scene.getScenePropertiesByKeyPath('record');
640
625
  return this._formatRecordingState(state, ready, onhold);
641
626
  }
642
627
  async sendRoomMessage(payload, guaranteedDelivery) {
@@ -661,8 +646,7 @@ export class FcrBaseRoomControlImpl {
661
646
  this._engine.removeObserver(this._engineObserver);
662
647
  this._sharedCache.getRoomCache(this._scene.sceneId).clear();
663
648
  try {
664
- var _this$_chatRoomContro2, _this$sharingControl, _this$sharingControl2;
665
- return await Promise.all([(_this$_chatRoomContro2 = this._chatRoomControl) === null || _this$_chatRoomContro2 === void 0 ? void 0 : _this$_chatRoomContro2.leave(), (_this$sharingControl = this.sharingControl) === null || _this$sharingControl === void 0 ? void 0 : _this$sharingControl.getBoardControl().close(), (_this$sharingControl2 = this.sharingControl) === null || _this$sharingControl2 === void 0 ? void 0 : _this$sharingControl2.getAnnotationControl().close(), this._scene.leave()]);
649
+ return await Promise.all([this._chatRoomControl?.leave(), this.sharingControl?.getBoardControl().close(), this.sharingControl?.getAnnotationControl().close(), this._scene.leave()]);
666
650
  } finally {
667
651
  this._joinRoomSuccess = false;
668
652
  }
@@ -684,8 +668,9 @@ export class FcrBaseRoomControlImpl {
684
668
  }
685
669
  async _liveStreamingAction(action, errorMessage) {
686
670
  try {
687
- const _await$action = await action(),
688
- code = _await$action.code;
671
+ const {
672
+ code
673
+ } = await action();
689
674
  if (code !== RESPONSE_CODES.SUCCESS) {
690
675
  throw liveStreamingErrorHelper.createNetworkError(errorMessage);
691
676
  }
@@ -707,7 +692,4 @@ export class FcrBaseRoomControlImpl {
707
692
  /**
708
693
  * @internal
709
694
  */
710
- _FcrBaseRoomControlImpl = FcrBaseRoomControlImpl;
711
- var _applyDecs$e = _slicedToArray(_applyDecs(_FcrBaseRoomControlImpl, [[trace, 2, "getSyncTimestamp"], [trace, 2, "getRoomInfo"], [trace, 2, "getRoomSchedule"], [trace, 2, "getLocalExDataSyncTypeList"], [_joinDecs, 2, "join"], [trace, 2, "leave"], [trace, 2, "release"], [trace, 2, "start"], [trace, 2, "end"], [trace, 2, "close"], [trace, 2, "getRoomState"], [trace, 2, "getRoomProperties"], [trace, 2, "getRoomPropertiesByKeyPath"], [_updateRoomPropertiesDecs, 2, "updateRoomProperties"], [_updateIncrementRoomPropertiesDecs, 2, "updateIncrementRoomProperties"], [_deleteRoomPropertiesDecs, 2, "deleteRoomProperties"], [_startCloudRecordingDecs, 2, "startCloudRecording"], [trace, 2, "pauseCloudRecording"], [trace, 2, "resumeCloudRecording"], [trace, 2, "stopCloudRecording"], [trace, 2, "getLiveStreamingState"], [trace, 2, "getLiveStreamingConfig"], [_startLiveStreamingDecs, 2, "startLiveStreaming"], [_updateLiveStreamingLayoutDecs, 2, "updateLiveStreamingLayout"], [trace, 2, "stopLiveStreaming"], [trace, 2, "getCloudRecordingState"], [_sendRoomMessageDecs, 2, "sendRoomMessage"]], []).e, 1);
712
- _initProto = _applyDecs$e[0];
713
695
  export class FcrSubRoomControlImpl extends FcrBaseRoomControlImpl {}
@@ -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,10 +15,6 @@ 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 _FcrInfinityRoomControlImpl;
24
18
  let _initProto;
25
19
  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)]; } }; }
26
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -36,26 +30,31 @@ import { FcrRoomType } from '../type';
36
30
  import { addBoardInitInfoObserver } from '../helpers/board-init-info-helper';
37
31
  import { clearAnnotationBoardOptions, clearWhiteboardOptions } from '../../utilities/shared-storage';
38
32
  import { hasAnnotationWritePermission, hasBoardWritePermission } from '../whiteboard-control/utils';
39
- const sharedScheduler = AgoraScheduler.shared,
40
- Duration = AgoraScheduler.Duration;
33
+ const {
34
+ shared: sharedScheduler,
35
+ Duration
36
+ } = AgoraScheduler;
41
37
  /**
42
38
  * @internal
43
39
  */
44
40
  export class FcrInfinityRoomControlImpl extends FcrBaseRoomControlImpl {
41
+ static {
42
+ [_initProto] = _applyDecs(this, [[trace, 2, "getAnnouncement"], [trace, 2, "join"], [trace, 2, "leave"], [bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
43
+ }
44
+ //@internal
45
+ logger = (_initProto(this), createLogger({
46
+ prefix: 'FcrInfinityRoomControlImpl'
47
+ }));
48
+ _privilegeObserver = {
49
+ onLocalUserPermissionInfoDeleted: this._onLocalUserPermissionInfoDeleted
50
+ };
45
51
  constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl, monitorControl) {
46
52
  super(engine, scene, api, config, FcrRoomType.Infinityroom, chatConnection, sharedCache, chatRoomControl);
47
- //@internal
48
- _defineProperty(this, "logger", (_initProto(this), createLogger({
49
- prefix: 'FcrInfinityRoomControlImpl'
50
- })));
51
- _defineProperty(this, "_privilegeObserver", {
52
- onLocalUserPermissionInfoDeleted: this._onLocalUserPermissionInfoDeleted
53
- });
54
53
  this._monitorControl = monitorControl;
55
54
  this._interpreterControl = new FcrInterpreterControlImpl(api, scene, config, engine, chatConnection, sharedCache);
56
55
  this._addLogObserver();
57
56
  addBoardInitInfoObserver(this._scene, this._api, this.logger);
58
- this.logger.info("initialized, room id: ".concat(this._scene.sceneId));
57
+ this.logger.info(`initialized, room id: ${this._scene.sceneId}`);
59
58
  }
60
59
  getAnnouncement() {
61
60
  const announcement = this._scene.getScenePropertiesByKeyPath('info.announcement');
@@ -86,8 +85,7 @@ export class FcrInfinityRoomControlImpl extends FcrBaseRoomControlImpl {
86
85
  privilegeControl.removeObserver(this._privilegeObserver);
87
86
  return await super.leave();
88
87
  } finally {
89
- var _this$_logUploadTask;
90
- (_this$_logUploadTask = this._logUploadTask) === null || _this$_logUploadTask === void 0 || _this$_logUploadTask.stop();
88
+ this._logUploadTask?.stop();
91
89
  this._uploadLog();
92
90
  }
93
91
  }
@@ -109,12 +107,12 @@ export class FcrInfinityRoomControlImpl extends FcrBaseRoomControlImpl {
109
107
  }
110
108
  _onLocalUserPermissionInfoDeleted(roomId, event) {
111
109
  if (hasBoardWritePermission(event.permissionInfo)) {
112
- this.logger.info("remove board write permission");
110
+ this.logger.info(`remove board write permission`);
113
111
 
114
112
  // this.getSharingControl().getBoardControl().getMainWindow()?.setWritable(false);
115
113
  }
116
114
  if (hasAnnotationWritePermission(event.permissionInfo)) {
117
- this.logger.info("remove annotation write permission");
115
+ this.logger.info(`remove annotation write permission`);
118
116
 
119
117
  // this.getSharingControl().getAnnotationControl().getMainWindow()?.setWritable(false);
120
118
  }
@@ -122,9 +120,4 @@ export class FcrInfinityRoomControlImpl extends FcrBaseRoomControlImpl {
122
120
  _addLogObserver() {
123
121
  this.addObserver(generateLogObserver(this.logger, [['onCloudRecordingStateUpdated', ['roomId', 'state']], ['onJoinRoomFailure', ['roomId', 'error']], ['onJoinRoomSuccess', ['roomId']], ['onLiveStreamingStateUpdated', ['roomId', 'state', 'url', 'reason']], ['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
124
122
  }
125
- }
126
- _FcrInfinityRoomControlImpl = FcrInfinityRoomControlImpl;
127
- var _applyDecs$e = _applyDecs(_FcrInfinityRoomControlImpl, [[trace, 2, "getAnnouncement"], [trace, 2, "join"], [trace, 2, "leave"], [bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
128
- var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
129
- _initProto = _applyDecs$e2[0];
130
- _applyDecs$e;
123
+ }
@@ -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 _FcrInterpreterControlImpl;
24
- let _initProto, _createRoomControlDecs, _setInterpreterUsersDecs, _ref;
18
+ let _initProto, _createRoomControlDecs, _setInterpreterUsersDecs;
25
19
  import "core-js/modules/es.array.includes.js";
26
20
  import "core-js/modules/esnext.iterator.constructor.js";
27
21
  import "core-js/modules/esnext.iterator.map.js";
@@ -44,44 +38,45 @@ import { ErrorModuleCode } from '../../imports';
44
38
  /**
45
39
  * @internal
46
40
  */
47
- _ref = (_createRoomControlDecs = [trace(['roomId']), validateParams(stringSchema)], _setInterpreterUsersDecs = [trace(['params']), validateParams(fcrInterpreterUsersParamsArraySchema)], "logger");
48
41
  export class FcrInterpreterControlImpl {
49
- constructor(_api, _scene, _config, _engine, _chatConnection, _sharedCache) {
50
- //@internal
51
- _defineProperty(this, _ref, (_initProto(this), createLogger({
52
- prefix: 'FcrInterpreterControlImpl'
53
- })));
54
- _defineProperty(this, "_observable", new AgoraObservable());
55
- _defineProperty(this, "_interpreterUserList", null);
56
- _defineProperty(this, "_sceneObserver", {
57
- onScenePropertiesUpdated: (_, event) => {
58
- var _event$cause;
59
- if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 800) {
60
- const actionType = get(event.cause.data, 'actionType');
61
- let operatorUser;
62
- if (event.operatorUser) {
63
- operatorUser = convertRteUserToFcrUser(event.operatorUser, this._roomCache);
64
- }
65
- const isStateUpdated = [FcrInterpreterActionType.OPEN, FcrInterpreterActionType.CLOSE].includes(actionType);
66
- const isUpdated = [
67
- // FcrInterpreterActionType.OPEN,
68
- FcrInterpreterActionType.UPDATE].includes(actionType);
69
- if (isStateUpdated || isUpdated) {
70
- this._setInterpreterUserList();
71
- }
72
- if (isStateUpdated) {
73
- this._observable.notifyObservers('onInterpreterStateUpdated', this._roomId, this.getState(), operatorUser);
74
- }
75
- if (isUpdated) {
76
- this._observable.notifyObservers('onInterpreterUsersUpdated', this._roomId, this.getInterpreterUserList(), operatorUser);
77
- this._observable.notifyObservers('onInterpreterRoomListUpdated', this._roomId, this.getInterpreterRoomList(), operatorUser);
78
- }
42
+ static {
43
+ [_initProto] = _applyDecs(this, [[_createRoomControlDecs, 2, "createRoomControl"], [_setInterpreterUsersDecs, 2, "setInterpreterUsers"], [trace, 2, "close"], [trace, 2, "getState"], [trace, 2, "getInterpreterRoomList"], [trace, 2, "getInterpreterLanguageList"], [trace, 2, "release"]], []).e;
44
+ }
45
+ //@internal
46
+ [(_createRoomControlDecs = [trace(['roomId']), validateParams(stringSchema)], _setInterpreterUsersDecs = [trace(['params']), validateParams(fcrInterpreterUsersParamsArraySchema)], "logger")] = (_initProto(this), createLogger({
47
+ prefix: 'FcrInterpreterControlImpl'
48
+ }));
49
+ _observable = new AgoraObservable();
50
+ _interpreterUserList = null;
51
+ _sceneObserver = {
52
+ onScenePropertiesUpdated: (_, event) => {
53
+ if (event.cause?.cmd === 800) {
54
+ const actionType = get(event.cause.data, 'actionType');
55
+ let operatorUser;
56
+ if (event.operatorUser) {
57
+ operatorUser = convertRteUserToFcrUser(event.operatorUser, this._roomCache);
58
+ }
59
+ const isStateUpdated = [FcrInterpreterActionType.OPEN, FcrInterpreterActionType.CLOSE].includes(actionType);
60
+ const isUpdated = [
61
+ // FcrInterpreterActionType.OPEN,
62
+ FcrInterpreterActionType.UPDATE].includes(actionType);
63
+ if (isStateUpdated || isUpdated) {
64
+ this._setInterpreterUserList();
65
+ }
66
+ if (isStateUpdated) {
67
+ this._observable.notifyObservers('onInterpreterStateUpdated', this._roomId, this.getState(), operatorUser);
68
+ }
69
+ if (isUpdated) {
70
+ this._observable.notifyObservers('onInterpreterUsersUpdated', this._roomId, this.getInterpreterUserList(), operatorUser);
71
+ this._observable.notifyObservers('onInterpreterRoomListUpdated', this._roomId, this.getInterpreterRoomList(), operatorUser);
79
72
  }
80
- },
81
- onJoinSceneSuccess: () => {
82
- this._setInterpreterUserList();
83
73
  }
84
- });
74
+ },
75
+ onJoinSceneSuccess: () => {
76
+ this._setInterpreterUserList();
77
+ }
78
+ };
79
+ constructor(_api, _scene, _config, _engine, _chatConnection, _sharedCache) {
85
80
  this._api = _api;
86
81
  this._scene = _scene;
87
82
  this._config = _config;
@@ -102,10 +97,11 @@ export class FcrInterpreterControlImpl {
102
97
  await handleRequestError(() => this._api.openInterpreter({
103
98
  roomId: this._roomId,
104
99
  data: {
105
- interpreters: params.map(_ref2 => {
106
- let userUuid = _ref2.userId,
107
- sourceLanguage = _ref2.sourceLanguage,
108
- targetLanguage = _ref2.targetLanguage;
100
+ interpreters: params.map(({
101
+ userId: userUuid,
102
+ sourceLanguage,
103
+ targetLanguage
104
+ }) => {
109
105
  return {
110
106
  userUuid,
111
107
  languagePair: [sourceLanguage, targetLanguage]
@@ -129,34 +125,31 @@ export class FcrInterpreterControlImpl {
129
125
  }
130
126
  getInterpreterRoomList() {
131
127
  const rooms = this._scene.getScenePropertiesByKeyPath('interpreter.rooms') || [];
132
- return rooms.length > 0 ? rooms.map(_ref3 => {
133
- let roomUuid = _ref3.roomUuid,
134
- language = _ref3.language;
135
- return {
136
- roomId: roomUuid,
137
- language
138
- };
139
- }) : null;
128
+ return rooms.length > 0 ? rooms.map(({
129
+ roomUuid,
130
+ language
131
+ }) => ({
132
+ roomId: roomUuid,
133
+ language
134
+ })) : null;
140
135
  }
141
136
  _setInterpreterUserList() {
142
137
  const interpreter = this._scene.getScenePropertiesByKeyPath('interpreter');
143
- const _ref4 = interpreter || {
144
- translates: []
145
- },
146
- translates = _ref4.translates;
147
- const results = translates.map(_ref5 => {
148
- let userId = _ref5.userUuid,
149
- userName = _ref5.userName,
150
- _ref5$languagePair = _slicedToArray(_ref5.languagePair, 2),
151
- sourceLanguage = _ref5$languagePair[0],
152
- targetLanguage = _ref5$languagePair[1];
153
- return {
154
- userId,
155
- userName,
156
- sourceLanguage,
157
- targetLanguage
158
- };
159
- });
138
+ const {
139
+ translates
140
+ } = interpreter || {
141
+ translates: []
142
+ };
143
+ const results = translates.map(({
144
+ userUuid: userId,
145
+ userName,
146
+ languagePair: [sourceLanguage, targetLanguage]
147
+ }) => ({
148
+ userId,
149
+ userName,
150
+ sourceLanguage,
151
+ targetLanguage
152
+ }));
160
153
  this._interpreterUserList = results.length > 0 ? results : null;
161
154
  }
162
155
  getInterpreterUserList() {
@@ -182,9 +175,4 @@ export class FcrInterpreterControlImpl {
182
175
  _addLogObserver() {
183
176
  this.addObserver(generateLogObserver(this.logger, [['onInterpreterStateUpdated', ['roomId', 'state', 'operatorUser']], ['onInterpreterUsersUpdated', ['roomId', 'users', 'operatorUser']], ['onInterpreterRoomListUpdated', ['roomId', 'rooms', 'operatorUser']]]));
184
177
  }
185
- }
186
- _FcrInterpreterControlImpl = FcrInterpreterControlImpl;
187
- var _applyDecs$e = _applyDecs(_FcrInterpreterControlImpl, [[_createRoomControlDecs, 2, "createRoomControl"], [_setInterpreterUsersDecs, 2, "setInterpreterUsers"], [trace, 2, "close"], [trace, 2, "getState"], [trace, 2, "getInterpreterRoomList"], [trace, 2, "getInterpreterLanguageList"], [trace, 2, "release"]], []).e;
188
- var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
189
- _initProto = _applyDecs$e2[0];
190
- _applyDecs$e;
178
+ }
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import { FcrBaseRoomControlImpl } from '..';
3
2
  import { createLogger, generateLogObserver } from '../../utilities/logger';
4
3
  import { FcrRoomType } from '../type';
@@ -6,12 +5,12 @@ import { FcrRoomType } from '../type';
6
5
  * @internal
7
6
  */
8
7
  export class FcrInterpreterRoomControlImpl extends FcrBaseRoomControlImpl {
8
+ //@internal
9
+ logger = createLogger({
10
+ prefix: 'FcrInterpreterRoomControlImpl'
11
+ });
9
12
  constructor(_engine, _scene, _api, _config, _sharedCache, _chatConnection, chatRoomControl) {
10
13
  super(_engine, _scene, _api, _config, FcrRoomType.Interpreterroom, _chatConnection, _sharedCache, chatRoomControl);
11
- //@internal
12
- _defineProperty(this, "logger", createLogger({
13
- prefix: 'FcrInterpreterRoomControlImpl'
14
- }));
15
14
  this._engine = _engine;
16
15
  this._scene = _scene;
17
16
  this._api = _api;
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import { FcrBaseRoomControlImpl } from '..';
3
2
  import { createLogger, generateLogObserver } from '../../utilities/logger';
4
3
  import { FcrRoomType } from '../type';
@@ -7,12 +6,12 @@ import { FcrRoomType } from '../type';
7
6
  * @internal
8
7
  */
9
8
  export class FcrJoinBeforeHostWaitingRoomControlImpl extends FcrBaseRoomControlImpl {
9
+ //@internal
10
+ logger = createLogger({
11
+ prefix: 'FcrJoinBeforeHostWaitingRoomControlImpl'
12
+ });
10
13
  constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
11
14
  super(engine, scene, api, config, FcrRoomType.JoinBeforeHostWaitingRoom, chatConnection, sharedCache, chatRoomControl);
12
- //@internal
13
- _defineProperty(this, "logger", createLogger({
14
- prefix: 'FcrJoinBeforeHostWaitingRoomControlImpl'
15
- }));
16
15
  this._addLogObserver();
17
16
  }
18
17
  addObserver(observer) {