fcr-core 3.4.1 → 3.4.2

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 (35) hide show
  1. package/lib/chat-connection/index.js +1 -1
  2. package/lib/engine/index.d.ts +1 -0
  3. package/lib/engine/index.js +6 -3
  4. package/lib/imports.d.ts +1 -1
  5. package/lib/media-control/desktop.js +7 -1
  6. package/lib/media-control/mobile.js +1 -1
  7. package/lib/media-control/type.d.ts +10 -0
  8. package/lib/monitor-control/index.js +1 -34
  9. package/lib/peer-session/index.js +5 -1
  10. package/lib/plugins/chatroom.js +4 -1
  11. package/lib/room-control/chatroom-control/index.js +120 -58
  12. package/lib/room-control/group-control/index.js +1 -1
  13. package/lib/room-control/index.js +237 -192
  14. package/lib/room-control/interpreter-control/index.js +1 -1
  15. package/lib/room-control/interpreter-control/room.js +14 -0
  16. package/lib/room-control/mainroom-control/index.js +1 -1
  17. package/lib/room-control/privilege-control/helper.d.ts +4 -1
  18. package/lib/room-control/privilege-control/helper.js +70 -2
  19. package/lib/room-control/privilege-control/index.js +8 -34
  20. package/lib/room-control/stream-control/index.js +36 -37
  21. package/lib/room-control/type.d.ts +0 -4
  22. package/lib/room-control/type.js +1 -6
  23. package/lib/room-control/user-control/index.js +1 -1
  24. package/lib/room-control/waitingroom-control/index.js +1 -1
  25. package/lib/room-control/whiteboard-control/board-subwindow.d.ts +6 -0
  26. package/lib/room-control/whiteboard-control/board-subwindow.js +26 -0
  27. package/lib/room-control/whiteboard-control-v2/index.d.ts +1 -3
  28. package/lib/room-control/whiteboard-control-v2/index.js +6 -7
  29. package/lib/room-control/whiteboard-control-v2/main-window.d.ts +2 -2
  30. package/lib/room-control/whiteboard-control-v2/main-window.js +5 -4
  31. package/lib/service/api.d.ts +2 -0
  32. package/lib/service/api.js +4 -2
  33. package/lib/utilities/error.d.ts +1 -0
  34. package/lib/utilities/error.js +1 -0
  35. package/package.json +6 -6
@@ -24,11 +24,9 @@ Object.defineProperty(exports, "__esModule", {
24
24
  value: true
25
25
  });
26
26
  exports.FcrPrivilegeControlImpl = void 0;
27
- require("core-js/modules/esnext.async-iterator.find.js");
28
27
  require("core-js/modules/esnext.async-iterator.for-each.js");
29
28
  require("core-js/modules/esnext.async-iterator.map.js");
30
29
  require("core-js/modules/esnext.iterator.constructor.js");
31
- require("core-js/modules/esnext.iterator.find.js");
32
30
  require("core-js/modules/esnext.iterator.for-each.js");
33
31
  require("core-js/modules/esnext.iterator.map.js");
34
32
  require("core-js/modules/web.dom-collections.iterator.js");
@@ -87,14 +85,7 @@ class FcrPrivilegeControlImpl {
87
85
  } */
88
86
 
89
87
  getLocalUserPermissionInfo(action) {
90
- const permissionStringArray = this._scene.getUserPropertiesByKeyPath("permission.list", this._scene.localUser.getLocalUserId());
91
- const permissionString = permissionStringArray.find(permission => permission.startsWith(action));
92
- if (!permissionString) {
93
- return {
94
- enable: false
95
- };
96
- }
97
- return this._convertPermissionInfo(_helper.FcrPermission.fromString(permissionString), _type2.FcrOperatePermissionType.GET);
88
+ return (0, _helper.getLocalUserPermissionInfo)(this._scene, action);
98
89
  }
99
90
 
100
91
  // @trace
@@ -250,31 +241,14 @@ class FcrPrivilegeControlImpl {
250
241
  });
251
242
  });
252
243
  }
244
+ }
245
+ });
246
+ (0, _helper.addLocalUserPermissionObserver)(this._scene, {
247
+ onLocalUserPermissionInfoAdded: (sceneId, event) => {
248
+ this._observable.notifyObservers('onLocalUserPermissionInfoAdded', sceneId, event);
253
249
  },
254
- onUserPropertiesUpdated: (sceneId, event) => {
255
- var _event$cause;
256
- if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 3200) {
257
- if (event.modifiedUser.userId === this._scene.localUser.getLocalUserId()) {
258
- var _data$addPermissions, _data$removePermissio;
259
- const data = event.cause.data;
260
- const addedPermissions = (_data$addPermissions = data.addPermissions) === null || _data$addPermissions === void 0 ? void 0 : _data$addPermissions.map(p => this._convertPermissionInfo(_helper.FcrPermission.fromString(p), _type2.FcrOperatePermissionType.ADD));
261
- const removedPermissions = (_data$removePermissio = data.removePermissions) === null || _data$removePermissio === void 0 ? void 0 : _data$removePermissio.map(p => this._convertPermissionInfo(_helper.FcrPermission.fromString(p), _type2.FcrOperatePermissionType.DELETE));
262
- if (removedPermissions && removedPermissions.length > 0) {
263
- this._observable.notifyObservers('onLocalUserPermissionInfoDeleted', sceneId, {
264
- permissionInfo: removedPermissions,
265
- operatorUser: (0, _user.checkFcrUserRole)((0, _user.convertRteUserToFcrUser)(event.operatorUser)),
266
- cause: event.cause
267
- });
268
- }
269
- if (addedPermissions && addedPermissions.length > 0) {
270
- this._observable.notifyObservers('onLocalUserPermissionInfoAdded', sceneId, {
271
- permissionInfo: addedPermissions,
272
- operatorUser: (0, _user.checkFcrUserRole)((0, _user.convertRteUserToFcrUser)(event.operatorUser)),
273
- cause: event.cause
274
- });
275
- }
276
- }
277
- }
250
+ onLocalUserPermissionInfoDeleted: (sceneId, event) => {
251
+ this._observable.notifyObservers('onLocalUserPermissionInfoDeleted', sceneId, event);
278
252
  }
279
253
  });
280
254
  }
@@ -224,28 +224,28 @@ class FcrStreamControlImpl {
224
224
  }
225
225
  }
226
226
  addLocalStreams(streams) {
227
- return this._scene.localUser.addLocalStreams(streams);
227
+ return (0, _error.handleRequestError)(() => this._scene.localUser.addLocalStreams(streams), _error.FcrErrorModuleCode.ROOM_STREAM, 'add local streams failed');
228
228
  }
229
229
  bindLocalStreams(streams) {
230
- return this._scene.localUser.bindLocalStreams(streams);
230
+ return (0, _error.handleRequestError)(() => this._scene.localUser.bindLocalStreams(streams), _error.FcrErrorModuleCode.ROOM_STREAM, 'bind local streams failed');
231
231
  }
232
232
  updatePublishPrivilegeOfStreams() {
233
233
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
234
234
  args[_key] = arguments[_key];
235
235
  }
236
236
  if (args.length === 1) {
237
- return this._scene.localUser.updatePublishPrivilegeOfStreams(args[0]);
237
+ return (0, _error.handleRequestError)(() => this._scene.localUser.updatePublishPrivilegeOfStreams(args[0]), _error.FcrErrorModuleCode.ROOM_STREAM, 'update publish privilege of streams failed');
238
238
  } else if (args.length === 2) {
239
239
  const [privilege, scope] = args;
240
240
  const targetRteRoles = scope.targetRoleType.map(role => _type.FcrUserRoleToStringMap[role]);
241
- return this._scene.localUser.updatePublishPrivilegeOfStreams(privilege, {
241
+ return (0, _error.handleRequestError)(() => this._scene.localUser.updatePublishPrivilegeOfStreams(privilege, {
242
242
  targetRoleType: targetRteRoles,
243
243
  targetRoleTypeIsInclude: scope.targetRoleTypeIsInclude
244
- });
244
+ }), _error.FcrErrorModuleCode.ROOM_STREAM, 'update publish privilege of streams failed');
245
245
  }
246
246
  }
247
247
  removeStreams(streams) {
248
- return this._scene.localUser.removeStreams(streams);
248
+ return (0, _error.handleRequestError)(() => this._scene.localUser.removeStreams(streams), _error.FcrErrorModuleCode.ROOM_STREAM, 'remove streams failed');
249
249
  }
250
250
  setVideoEncoderConfig(streamId, config, streamType) {
251
251
  return this._scene.localUser.setVideoEncoderConfig(config, streamType, streamId);
@@ -273,39 +273,38 @@ class FcrStreamControlImpl {
273
273
  return this._scene.streamPlayer.takeSnapshot(streamId, filePath);
274
274
  }
275
275
  async addLocalScreenStream(config) {
276
- try {
277
- const res = await this._api.startShareScreen({
278
- roomId: this._scene.sceneId,
279
- userId: this._scene.getLocalUser().getLocalUserId(),
280
- config: _objectSpread({
281
- videoSourceUuid: 'default',
282
- videoSourceType: _.FcrVideoSourceType.SCREEN,
283
- audioSourceType: _.FcrAudioSourceType.LOOPBACK
284
- }, (0, _imports.convertStreamTypeToPublishState)(config.streamType))
285
- });
286
- const {
287
- data: {
288
- rtcToken: token,
289
- streamUuid: streamId
290
- }
291
- } = res;
292
- this._screenStreamId = streamId;
293
- this._scene.localUser.prepareToPublishScreenStream(streamId, token);
294
- return streamId;
295
- } catch (error) {
296
- if (error instanceof _imports.AgoraRestfulClientError) {
297
- var _error$serviceCode;
298
- this.logger.error("[FcrStreamControl] addLocalScreenStream failed, error: ".concat(error.message));
299
- throw (0, _error.generateFcrCoreServerError)((_error$serviceCode = error.serviceCode) !== null && _error$serviceCode !== void 0 ? _error$serviceCode : -1, error.message, error);
276
+ const res = await (0, _error.handleRequestError)(() => this._api.startShareScreen({
277
+ roomId: this._scene.sceneId,
278
+ userId: this._scene.getLocalUser().getLocalUserId(),
279
+ config: _objectSpread({
280
+ videoSourceUuid: 'default',
281
+ videoSourceType: _.FcrVideoSourceType.SCREEN,
282
+ audioSourceType: _.FcrAudioSourceType.LOOPBACK,
283
+ videoSourceState: _.FcrMediaSourceState.CLOSE,
284
+ audioSourceState: _.FcrMediaSourceState.CLOSE
285
+ }, (0, _imports.convertStreamTypeToPublishState)(config.streamType))
286
+ }), _error.FcrErrorModuleCode.ROOM_STREAM, 'add local screen stream failed');
287
+ const {
288
+ data: {
289
+ rtcToken: token,
290
+ streamUuid: streamId
300
291
  }
301
- throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.MEDIA_CONTROL_SCREEN, _error.FcrErrorCode.UNDEFINED_ERROR, 'addLocalScreenStream failed', error);
302
- }
292
+ } = res;
293
+ this._screenStreamId = streamId;
294
+ this._scene.localUser.prepareToPublishScreenStream(streamId, token);
295
+ return streamId;
303
296
  }
304
297
  async removeScreenStream() {
305
- const res = await (0, _error.handleRequestError)(() => this._api.stopShareScreen({
306
- roomId: this._scene.sceneId,
307
- userId: this._scene.getLocalUser().getLocalUserId()
308
- }), _error.FcrErrorModuleCode.ROOM_STREAM, 'remove screen stream failed');
298
+ const res = await (0, _error.handleRequestError)(async () => {
299
+ for (const stream of this._streamList) {
300
+ if (stream.videoSourceType === _.FcrVideoSourceType.SCREEN) {
301
+ await this._api.stopShareScreen({
302
+ roomId: this._scene.sceneId,
303
+ userId: stream.owner.userId
304
+ });
305
+ }
306
+ }
307
+ }, _error.FcrErrorModuleCode.ROOM_STREAM, 'remove screen stream failed');
309
308
  if (this._screenStreamId) {
310
309
  this._scene.localUser.removePreparePublishScreenStream(this._screenStreamId);
311
310
  }
@@ -354,4 +353,4 @@ class FcrStreamControlImpl {
354
353
  }
355
354
  exports.FcrStreamControlImpl = FcrStreamControlImpl;
356
355
  _FcrStreamControlImpl = FcrStreamControlImpl;
357
- [_initProto] = _applyDecs(_FcrStreamControlImpl, [[_imports.bound, 2, "getStreams"], [_imports.bound, 2, "getStreamList"], [_imports.bound, 2, "getStreamsByUserId"], [_imports.bound, 2, "getStreamByStreamId"], [[_imports.bound, _logger.trace], 2, "addLocalStreams"], [[_imports.bound, _logger.trace], 2, "bindLocalStreams"], [[_imports.bound, _logger.trace], 2, "updatePublishPrivilegeOfStreams"], [[_imports.bound, _logger.trace], 2, "removeStreams"], [[_imports.bound, _logger.trace], 2, "setVideoEncoderConfig"], [[_imports.bound, _logger.trace], 2, "startRenderRemoteVideoStream"], [[_imports.bound, _logger.trace], 2, "stopRenderRemoteVideoStream"], [[_imports.bound, _logger.trace], 2, "startPlayRemoteAudioStream"], [[_imports.bound, _logger.trace], 2, "stopPlayRemoteAudioStream"], [[_imports.bound, _logger.trace], 2, "takeSnapshot"], [[_imports.bound, _logger.trace], 2, "addLocalScreenStream"], [[_imports.bound, _logger.trace], 2, "removeScreenStream"], [[_imports.bound, _logger.trace], 2, "adjustRemoteAudioStreamVolume"], [[_imports.bound, _logger.trace], 2, "mergeAudioStream"], [[_imports.bound, _logger.trace], 2, "splitAudioStream"], [[_imports.bound, _logger.trace], 2, "addObserver"], [[_imports.bound, _logger.trace], 2, "removeObserver"]], []).e;
356
+ [_initProto] = _applyDecs(_FcrStreamControlImpl, [[_imports.bound, 2, "getStreams"], [_imports.bound, 2, "getStreamList"], [_imports.bound, 2, "getStreamsByUserId"], [_imports.bound, 2, "getStreamByStreamId"], [[_imports.bound, _logger.trace], 2, "addLocalStreams"], [[_imports.bound, _logger.trace], 2, "bindLocalStreams"], [[_imports.bound, _logger.trace], 2, "updatePublishPrivilegeOfStreams"], [[_imports.bound, _logger.trace], 2, "removeStreams"], [[_imports.bound, _logger.trace], 2, "setVideoEncoderConfig"], [[_imports.bound, _logger.trace], 2, "startRenderRemoteVideoStream"], [[_imports.bound, _logger.trace], 2, "stopRenderRemoteVideoStream"], [[_imports.bound, _logger.trace], 2, "startPlayRemoteAudioStream"], [[_imports.bound, _logger.trace], 2, "stopPlayRemoteAudioStream"], [[_imports.bound, _logger.trace], 2, "takeSnapshot"], [[_imports.bound, _logger.trace], 2, "addLocalScreenStream"], [[_imports.bound, _logger.trace], 2, "removeScreenStream"], [[_imports.bound, _logger.trace], 2, "adjustRemoteAudioStreamVolume"], [[_imports.bound, _logger.trace], 2, "mergeAudioStream"], [[_imports.bound, _logger.trace], 2, "splitAudioStream"]], []).e;
@@ -189,10 +189,6 @@ export type FcrRoomJoinOptions = {
189
189
  export type FcrRoomConfig = {
190
190
  roomId: string;
191
191
  };
192
- export declare enum FcrUserKickOutType {
193
- Once = 1,
194
- Forever = 2
195
- }
196
192
  export type FcrRoomObserver = {
197
193
  /**
198
194
  * Callback when join room success.
@@ -3,12 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FcrUserKickOutType = exports.FcrRoomType = exports.FcrLiveStreamingStateUpdatedReason = void 0;
7
- let FcrUserKickOutType = exports.FcrUserKickOutType = /*#__PURE__*/function (FcrUserKickOutType) {
8
- FcrUserKickOutType[FcrUserKickOutType["Once"] = 1] = "Once";
9
- FcrUserKickOutType[FcrUserKickOutType["Forever"] = 2] = "Forever";
10
- return FcrUserKickOutType;
11
- }({});
6
+ exports.FcrRoomType = exports.FcrLiveStreamingStateUpdatedReason = void 0;
12
7
  let FcrRoomType = exports.FcrRoomType = /*#__PURE__*/function (FcrRoomType) {
13
8
  FcrRoomType[FcrRoomType["Mainroom"] = 11] = "Mainroom";
14
9
  FcrRoomType[FcrRoomType["Waitingroom"] = 102] = "Waitingroom";
@@ -327,4 +327,4 @@ class FcrUserControlImpl {
327
327
  }
328
328
  exports.FcrUserControlImpl = FcrUserControlImpl;
329
329
  _FcrUserControlImpl = FcrUserControlImpl;
330
- [_initProto] = _applyDecs(_FcrUserControlImpl, [[_imports.bound, 2, "getLocalUser"], [_imports.bound, 2, "getUsers"], [_imports.bound, 2, "getUserList"], [_imports.bound, 2, "getUser"], [[_imports.bound, _logger.trace], 2, "getAllUserCount"], [_imports.bound, 2, "getWaterMarkContent"], [[_imports.bound, _logger.trace], 2, "fetchUserList"], [[_imports.bound, _logger.trace], 2, "updateUserName"], [[_imports.bound, _logger.trace], 2, "updateUserProperties"], [[_imports.bound, _logger.trace], 2, "updateIncrementUserProperties"], [[_imports.bound, _logger.trace], 2, "deleteUserProperties"], [[_imports.bound, _logger.trace], 2, "getUserProperties"], [[_imports.bound, _logger.trace], 2, "getUserPropertiesByUserId"], [[_imports.bound, _logger.trace], 2, "getUserPropertiesByKeyPath"], [[_imports.bound, _logger.trace], 2, "updateRemoteUserRole"], [[_imports.bound, _logger.trace], 2, "revokeHost"], [[_imports.bound, _logger.trace], 2, "kickOut"], [_logger.trace, 2, "kickOutByUserIds"], [_logger.trace, 2, "kickOutByUserRoles"], [_logger.trace, 2, "mergeAudioStream"], [[_imports.bound, _logger.trace], 2, "addObserver"], [[_imports.bound, _logger.trace], 2, "removeObserver"]], []).e;
330
+ [_initProto] = _applyDecs(_FcrUserControlImpl, [[_imports.bound, 2, "getLocalUser"], [_imports.bound, 2, "getUsers"], [_imports.bound, 2, "getUserList"], [_imports.bound, 2, "getUser"], [[_imports.bound, _logger.trace], 2, "getAllUserCount"], [_imports.bound, 2, "getWaterMarkContent"], [[_imports.bound, _logger.trace], 2, "fetchUserList"], [[_imports.bound, _logger.trace], 2, "updateUserName"], [[_imports.bound, _logger.trace], 2, "updateUserProperties"], [[_imports.bound, _logger.trace], 2, "updateIncrementUserProperties"], [[_imports.bound, _logger.trace], 2, "deleteUserProperties"], [[_imports.bound, _logger.trace], 2, "getUserProperties"], [[_imports.bound, _logger.trace], 2, "getUserPropertiesByUserId"], [[_imports.bound, _logger.trace], 2, "getUserPropertiesByKeyPath"], [[_imports.bound, _logger.trace], 2, "updateRemoteUserRole"], [[_imports.bound, _logger.trace], 2, "revokeHost"], [[_imports.bound, _logger.trace], 2, "kickOut"], [_logger.trace, 2, "kickOutByUserIds"], [_logger.trace, 2, "kickOutByUserRoles"], [_logger.trace, 2, "mergeAudioStream"]], []).e;
@@ -87,4 +87,4 @@ class FcrWaitingRoomControlImpl extends _.FcrBaseRoomControlImpl {
87
87
  }
88
88
  exports.FcrWaitingRoomControlImpl = FcrWaitingRoomControlImpl;
89
89
  _FcrWaitingRoomControlImpl = FcrWaitingRoomControlImpl;
90
- [_initProto] = _applyDecs(_FcrWaitingRoomControlImpl, [[_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"], [_logger.trace, 2, "moveToMainRoomByUserIds"], [_logger.trace, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
90
+ [_initProto] = _applyDecs(_FcrWaitingRoomControlImpl, [[_logger.trace, 2, "moveToMainRoomByUserIds"], [_logger.trace, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
@@ -0,0 +1,6 @@
1
+ import { FcrBoardSubWindow } from './types';
2
+ export declare class FcrBoardSubWindowImpl implements FcrBoardSubWindow {
3
+ private _appId;
4
+ constructor(_appId: string);
5
+ exportPdf(): Promise<ArrayBuffer>;
6
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FcrBoardSubWindowImpl = void 0;
7
+ class FcrBoardSubWindowImpl {
8
+ constructor(_appId) {
9
+ this._appId = _appId;
10
+ }
11
+ exportPdf() {
12
+ window.postMessage({
13
+ type: '@netless/_request_save_pdf_',
14
+ appId: this._appId /* windowManager.addApp 返回的值, 指定要保存哪个窗口的板书, */
15
+ });
16
+ return new Promise((resolve, reject) => {
17
+ window.addEventListener('message', event => {
18
+ if (event.data.type === '@netless/_result_save_pdf_') {
19
+ var _event$data$result;
20
+ event.data.progress === 100 && resolve((_event$data$result = event.data.result) === null || _event$data$result === void 0 ? void 0 : _event$data$result.pdf);
21
+ }
22
+ });
23
+ });
24
+ }
25
+ }
26
+ exports.FcrBoardSubWindowImpl = FcrBoardSubWindowImpl;
@@ -1,11 +1,9 @@
1
1
  import { FcrBoardActiveInfo, FcrBoardMainWindow, FcrWhiteboardControl, FcrWhiteboardObserver } from '../whiteboard-control/types';
2
2
  import { AgoraRteEngine, AgoraRteScene } from '../../imports';
3
3
  import { FcrCoreServiceApi } from '../../service/api';
4
- import { FcrPrivilegeControl } from '../privilege-control/type';
5
4
  import { FcrConnectionState } from '../..';
6
5
  export declare class FcrWhiteboardControlImpl implements FcrWhiteboardControl {
7
6
  private _scene;
8
- private _privilegeControl;
9
7
  private _api;
10
8
  private _engine;
11
9
  protected logger: import("agora-foundation/lib/logger").Logger;
@@ -15,7 +13,7 @@ export declare class FcrWhiteboardControlImpl implements FcrWhiteboardControl {
15
13
  private _connectState;
16
14
  private _joined;
17
15
  private _FORGE_WHITEBOARD_APP_ID;
18
- constructor(_scene: AgoraRteScene, _privilegeControl: FcrPrivilegeControl, _api: FcrCoreServiceApi, _engine: AgoraRteEngine);
16
+ constructor(_scene: AgoraRteScene, _api: FcrCoreServiceApi, _engine: AgoraRteEngine);
19
17
  open(): Promise<FcrBoardMainWindow>;
20
18
  close(): Promise<void>;
21
19
  active(): Promise<void>;
@@ -47,7 +47,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
47
47
  function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
48
48
  function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
49
49
  class FcrWhiteboardControlImpl {
50
- constructor(_scene, _privilegeControl, _api, _engine) {
50
+ constructor(_scene, _api, _engine) {
51
51
  (0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.createLogger)({
52
52
  prefix: 'FcrWhiteboardControlImpl'
53
53
  })));
@@ -56,7 +56,6 @@ class FcrWhiteboardControlImpl {
56
56
  (0, _defineProperty2.default)(this, "_joined", false);
57
57
  (0, _defineProperty2.default)(this, "_FORGE_WHITEBOARD_APP_ID", 'MainWhiteboard');
58
58
  this._scene = _scene;
59
- this._privilegeControl = _privilegeControl;
60
59
  this._api = _api;
61
60
  this._engine = _engine;
62
61
  this._addLogObserver();
@@ -116,10 +115,10 @@ class FcrWhiteboardControlImpl {
116
115
  whiteboard.enableCameraByMouse = false;
117
116
  whiteboard.enableCameraByTouch = false;
118
117
  whiteboard.setViewModeToMain();
119
- wbRoom.applicationManager.on('terminal', () => {
120
- this._updateConnnectionState(_2.FcrConnectionState.DISCONNECTED);
121
- });
122
- this._boardView = new _mainWindow.FcrBoardMainWindowImpl(whiteboard, this._privilegeControl);
118
+ // wbRoom.applicationManager.on('terminal', () => {
119
+ // this._updateConnnectionState(FcrConnectionState.DISCONNECTED);
120
+ // });
121
+ this._boardView = new _mainWindow.FcrBoardMainWindowImpl(whiteboard, this._scene);
123
122
  this._updateConnnectionState(_2.FcrConnectionState.CONNECTED);
124
123
  }, [], {
125
124
  retriesMax
@@ -246,4 +245,4 @@ class FcrWhiteboardControlImpl {
246
245
  }
247
246
  exports.FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
248
247
  _FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
249
- [_initProto] = _applyDecs(_FcrWhiteboardControlImpl, [[_logger.trace, 2, "open"], [_logger.trace, 2, "close"], [_logger.trace, 2, "active"], [_logger.trace, 2, "inactive"], [[_decorator.bound, _logger.trace], 2, "getConnectionState"], [[_decorator.bound, _logger.trace], 2, "getMainWindow"], [_decorator.bound, 2, "getBoardActiveInfo"], [[_decorator.bound, _logger.trace], 2, "setBackgroundColor"], [[_decorator.bound, _logger.trace], 2, "getBackgroundColor"], [[_decorator.bound, _logger.trace], 2, "getActivity"], [[_decorator.bound, _logger.trace], 2, "getOwnerId"], [_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"], [_decorator.bound, 2, "_notifyObservers"], [_decorator.bound, 2, "_updateConnnectionState"], [_decorator.bound, 2, "_getToken"]], []).e;
248
+ [_initProto] = _applyDecs(_FcrWhiteboardControlImpl, [[_logger.trace, 2, "open"], [_logger.trace, 2, "close"], [_logger.trace, 2, "active"], [_logger.trace, 2, "inactive"], [[_decorator.bound, _logger.trace], 2, "getConnectionState"], [[_decorator.bound, _logger.trace], 2, "getMainWindow"], [_decorator.bound, 2, "getBoardActiveInfo"], [[_decorator.bound, _logger.trace], 2, "setBackgroundColor"], [[_decorator.bound, _logger.trace], 2, "getBackgroundColor"], [[_decorator.bound, _logger.trace], 2, "getActivity"], [[_decorator.bound, _logger.trace], 2, "getOwnerId"], [_decorator.bound, 2, "_notifyObservers"], [_decorator.bound, 2, "_updateConnnectionState"], [_decorator.bound, 2, "_getToken"]], []).e;
@@ -1,14 +1,14 @@
1
1
  import { FcrBoardToolType } from '../whiteboard-control/enums';
2
2
  import { Color, FcrBoardMainWindow, FcrBoardPageInfo, FcrBoardWindowObserver } from '../whiteboard-control/types';
3
3
  import { Whiteboard } from '@netless/forge-whiteboard';
4
- import { FcrPrivilegeControl } from '../privilege-control/type';
4
+ import type { AgoraRteScene } from '../../imports';
5
5
  export declare class FcrBoardMainWindowImpl implements FcrBoardMainWindow {
6
6
  protected logger: import("agora-foundation/lib/logger").Logger;
7
7
  private _whiteboard;
8
8
  private _observable;
9
9
  private _boardView;
10
10
  private _currentPage;
11
- constructor(whiteboard: Whiteboard, privilegeControl: FcrPrivilegeControl);
11
+ constructor(whiteboard: Whiteboard, scene: AgoraRteScene);
12
12
  addPage(): Promise<void>;
13
13
  removePage(): Promise<void>;
14
14
  undo(): Promise<void>;
@@ -35,6 +35,7 @@ var _observable = require("agora-foundation/lib/utilities/observable");
35
35
  var _utils = require("./utils");
36
36
  var _type = require("../privilege-control/type");
37
37
  var _logger = require("../../utilities/logger");
38
+ var _helper = require("../privilege-control/helper");
38
39
  var _FcrBoardMainWindowImpl;
39
40
  let _initProto;
40
41
  function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
@@ -43,7 +44,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
43
44
  function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
44
45
  function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
45
46
  class FcrBoardMainWindowImpl {
46
- constructor(whiteboard, privilegeControl) {
47
+ constructor(whiteboard, scene) {
47
48
  (0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.getLogger)()));
48
49
  (0, _defineProperty2.default)(this, "_observable", new _observable.AgoraObservable());
49
50
  (0, _defineProperty2.default)(this, "_currentPage", 0);
@@ -57,9 +58,9 @@ class FcrBoardMainWindowImpl {
57
58
  whiteboard.view.style.width = "100%";
58
59
  this._whiteboard = whiteboard;
59
60
  this._addWindowManagerEventListeners();
60
- const hasOperationPrivilege = privilegeControl.getLocalUserPermissionInfo(_type.FcrPermissionAction.BoardWrite).enable;
61
+ const hasOperationPrivilege = (0, _helper.getLocalUserPermissionInfo)(scene, _type.FcrPermissionAction.BoardWrite).enable;
61
62
  whiteboard.permissions[hasOperationPrivilege ? 'addPermission' : 'removePermission'](_forgeWhiteboard.WhiteboardPermissionFlag.all);
62
- privilegeControl.addObserver({
63
+ (0, _helper.addLocalUserPermissionObserver)(scene, {
63
64
  onLocalUserPermissionInfoAdded: (roomId, event) => {
64
65
  if (this._isBoardWritePermission(event)) {
65
66
  whiteboard.permissions.addPermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
@@ -215,4 +216,4 @@ class FcrBoardMainWindowImpl {
215
216
  }
216
217
  exports.FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
217
218
  _FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
218
- [_initProto] = _applyDecs(_FcrBoardMainWindowImpl, [[[_decorator.bound, _logger.trace], 2, "addPage"], [[_decorator.bound, _logger.trace], 2, "removePage"], [[_decorator.bound, _logger.trace], 2, "undo"], [[_decorator.bound, _logger.trace], 2, "redo"], [[_decorator.bound, _logger.trace], 2, "clean"], [[_decorator.bound, _logger.trace], 2, "getSnapshotImage"], [[_decorator.bound, _logger.trace], 2, "setBackgroundColor"], [[_decorator.bound, _logger.trace], 2, "getPageInfo"], [[_decorator.bound, _logger.trace], 2, "prevPage"], [[_decorator.bound, _logger.trace], 2, "nextPage"], [[_decorator.bound, _logger.trace], 2, "setToolType"], [[_decorator.bound, _logger.trace], 2, "setStrokeWidth"], [[_decorator.bound, _logger.trace], 2, "setStrokeColor"], [[_decorator.bound, _logger.trace], 2, "setTextColor"], [[_decorator.bound, _logger.trace], 2, "setTextSize"], [[_decorator.bound, _logger.trace], 2, "insertImage"], [[_decorator.bound, _logger.trace], 2, "getContentView"], [[_decorator.bound, _logger.trace], 2, "setContainerSizeRatio"], [[_decorator.bound, _logger.trace], 2, "addObserver"], [[_decorator.bound, _logger.trace], 2, "removeObserver"]], []).e;
219
+ [_initProto] = _applyDecs(_FcrBoardMainWindowImpl, [[[_decorator.bound, _logger.trace], 2, "addPage"], [[_decorator.bound, _logger.trace], 2, "removePage"], [[_decorator.bound, _logger.trace], 2, "undo"], [[_decorator.bound, _logger.trace], 2, "redo"], [[_decorator.bound, _logger.trace], 2, "clean"], [[_decorator.bound, _logger.trace], 2, "getSnapshotImage"], [[_decorator.bound, _logger.trace], 2, "setBackgroundColor"], [[_decorator.bound, _logger.trace], 2, "getPageInfo"], [[_decorator.bound, _logger.trace], 2, "prevPage"], [[_decorator.bound, _logger.trace], 2, "nextPage"], [[_decorator.bound, _logger.trace], 2, "setToolType"], [[_decorator.bound, _logger.trace], 2, "setStrokeWidth"], [[_decorator.bound, _logger.trace], 2, "setStrokeColor"], [[_decorator.bound, _logger.trace], 2, "setTextColor"], [[_decorator.bound, _logger.trace], 2, "setTextSize"], [[_decorator.bound, _logger.trace], 2, "insertImage"], [[_decorator.bound, _logger.trace], 2, "getContentView"], [[_decorator.bound, _logger.trace], 2, "setContainerSizeRatio"]], []).e;
@@ -358,6 +358,8 @@ export declare class FcrCoreServiceApi {
358
358
  audioSourceType: number;
359
359
  videoSourceUuid?: string;
360
360
  audioSourceUuid?: string;
361
+ videoSourceState?: number;
362
+ audioSourceState?: number;
361
363
  };
362
364
  }): Promise<{
363
365
  data: {
@@ -350,7 +350,8 @@ class FcrCoreServiceApi {
350
350
  userProperties: params.userProperties,
351
351
  version: params.version
352
352
  },
353
- retryFallbackDomainsWhenFail: true
353
+ retryFallbackDomainsWhenFail: true,
354
+ maxRetryTimes: 10
354
355
  });
355
356
  return {
356
357
  data,
@@ -375,7 +376,8 @@ class FcrCoreServiceApi {
375
376
  version: params.version,
376
377
  ticket: params.ticket
377
378
  },
378
- retryFallbackDomainsWhenFail: true
379
+ retryFallbackDomainsWhenFail: true,
380
+ maxRetryTimes: 10
379
381
  });
380
382
  return {
381
383
  data,
@@ -38,6 +38,7 @@ export declare enum FcrErrorCode {
38
38
  LOCAL_HTTP_REQUEST_FAILED = 12,
39
39
  NOT_LOGGED_IN = 13,
40
40
  NOT_JOINED_ROOM = 14,
41
+ JOIN_CONFLICT = 15,
41
42
  EXPIRED = 15
42
43
  }
43
44
  export declare const generateFcrCoreClientError: (module: FcrErrorModuleCode, code: number, message: string, origin: Error) => FcrError;
@@ -58,6 +58,7 @@ let FcrErrorCode = exports.FcrErrorCode = /*#__PURE__*/function (FcrErrorCode) {
58
58
  FcrErrorCode[FcrErrorCode["LOCAL_HTTP_REQUEST_FAILED"] = 12] = "LOCAL_HTTP_REQUEST_FAILED";
59
59
  FcrErrorCode[FcrErrorCode["NOT_LOGGED_IN"] = 13] = "NOT_LOGGED_IN";
60
60
  FcrErrorCode[FcrErrorCode["NOT_JOINED_ROOM"] = 14] = "NOT_JOINED_ROOM";
61
+ FcrErrorCode[FcrErrorCode["JOIN_CONFLICT"] = 15] = "JOIN_CONFLICT";
61
62
  FcrErrorCode[FcrErrorCode["EXPIRED"] = 15] = "EXPIRED";
62
63
  return FcrErrorCode;
63
64
  }({}); // helpers
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fcr-core",
3
3
  "description": "Core APIs for building online scenes",
4
- "version": "3.4.1",
4
+ "version": "3.4.2",
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
@@ -26,7 +26,7 @@
26
26
  "build:split:i18n": "node ./build-doc/doc-localization.js",
27
27
  "build:en-docs": "typedoc --entryPoints ./build-doc/en-sdk.d.ts --readme ./build-doc/readme-en.md --hideGenerator --name 'Edu Store Typescript API Reference for Web' --tsconfig ./build-doc/en/tsconfig.json --out en-docs --excludeExternals --excludePrivate --excludeInternal --excludeProtected --disableSources --theme typedoc-theme",
28
28
  "build:cn-docs": "typedoc --entryPoints ./build-doc/cn-sdk.d.ts --readme ./build-doc/readme-cn.md --hideGenerator --name 'Edu Store Typescript API Reference for Web' --tsconfig ./build-doc/cn/tsconfig.json --out cn-docs --excludeExternals --excludePrivate --excludeInternal --excludeProtected --disableSources --theme typedoc-theme",
29
- "test-browser": "agora-tc-test-karma-browser",
29
+ "test-browser": "agora-tc-test-karma-browser --file universal/room-control.test.ts",
30
30
  "test-electron": "agora-tc-test-karma-electron"
31
31
  },
32
32
  "devDependencies": {
@@ -40,7 +40,7 @@
40
40
  "@types/lodash": "^4.14.168",
41
41
  "@types/sinon": "^17.0.2",
42
42
  "@types/uuid": "^8.3.0",
43
- "agora-toolchain": "^3.4.1",
43
+ "agora-toolchain": "^3.4.2",
44
44
  "core-js": "^3.33.3",
45
45
  "decomment": "^0.9.5",
46
46
  "husky": "^9.0.11",
@@ -55,13 +55,13 @@
55
55
  "@netless/app-slide": "^0.2.58",
56
56
  "@netless/app-talkative": "^0.1.1",
57
57
  "@netless/forge-room": "0.1.4",
58
- "@netless/forge-rtm": "^0.1.6",
58
+ "@netless/forge-rtm": "0.1.7",
59
59
  "@netless/forge-whiteboard": "0.1.10",
60
60
  "@netless/video-js-plugin": "^0.3.8",
61
61
  "@netless/white-snapshot": "^0.4.2",
62
62
  "@netless/window-manager": "^0.4.72",
63
- "agora-foundation": "^3.4.1",
64
- "agora-rte-sdk": "^3.4.1",
63
+ "agora-foundation": "^3.4.2",
64
+ "agora-rte-sdk": "^3.4.2",
65
65
  "await-to-js": "^3.0.0",
66
66
  "dayjs": "^1.10.4",
67
67
  "easemob-websdk": "4.8.1",