fcr-core 3.7.8 → 3.8.0-alpha

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 (108) hide show
  1. package/lib/chat-connection/index.d.ts +1 -1
  2. package/lib/engine/index.js +6 -5
  3. package/lib/imports.d.ts +7 -2
  4. package/lib/imports.js +25 -4
  5. package/lib/index.d.ts +2 -2
  6. package/lib/index.js +12 -0
  7. package/lib/media-control/desktop.js +4 -4
  8. package/lib/media-control/mobile.js +20 -20
  9. package/lib/media-control/type.d.ts +8 -0
  10. package/lib/plugins/chatroom.js +19 -3
  11. package/lib/room-control/ability-control/type.d.ts +4 -1
  12. package/lib/room-control/ability-control/type.js +3 -0
  13. package/lib/room-control/helpers/constants.d.ts +4 -0
  14. package/lib/room-control/helpers/constants.js +5 -1
  15. package/lib/room-control/index.js +16 -5
  16. package/lib/room-control/interpreter-control/index.js +2 -4
  17. package/lib/room-control/mainroom-control/index.js +66 -1
  18. package/lib/room-control/privilege-control/index.js +43 -3
  19. package/lib/room-control/privilege-control/type.d.ts +57 -10
  20. package/lib/room-control/privilege-control/type.js +17 -0
  21. package/lib/room-control/room-control-factory.js +1 -1
  22. package/lib/room-control/room-session/index.js +23 -13
  23. package/lib/room-control/room-session/type.d.ts +2 -2
  24. package/lib/room-control/sharing-control/index.d.ts +5 -5
  25. package/lib/room-control/sharing-control/index.js +43 -13
  26. package/lib/room-control/sharing-control/type.d.ts +9 -5
  27. package/lib/room-control/sharing-control/type.js +6 -1
  28. package/lib/room-control/stream-control/index.d.ts +8 -1
  29. package/lib/room-control/stream-control/index.js +139 -36
  30. package/lib/room-control/stream-control/type.d.ts +6 -0
  31. package/lib/room-control/stt-control/de-compress-gzip.d.ts +1 -0
  32. package/lib/room-control/stt-control/de-compress-gzip.js +49 -0
  33. package/lib/room-control/stt-control/index.d.ts +1 -0
  34. package/lib/room-control/stt-control/index.js +353 -0
  35. package/lib/room-control/stt-control/type.d.ts +142 -0
  36. package/lib/room-control/stt-control/type.js +16 -0
  37. package/lib/room-control/type.d.ts +15 -0
  38. package/lib/room-control/type.js +13 -1
  39. package/lib/room-control/whiteboard-control/enum.d.ts +15 -0
  40. package/lib/room-control/whiteboard-control/{types.js → enum.js} +12 -1
  41. package/lib/room-control/whiteboard-control/type.d.ts +38 -0
  42. package/lib/room-control/whiteboard-control/type.js +15 -0
  43. package/lib/room-control/whiteboard-control/utils.d.ts +3 -0
  44. package/lib/room-control/whiteboard-control/utils.js +23 -0
  45. package/lib/room-control/whiteboard-control-v1/board-subwindow.d.ts +6 -0
  46. package/lib/room-control/whiteboard-control-v1/board-subwindow.js +26 -0
  47. package/lib/room-control/whiteboard-control-v1/board-window.d.ts +58 -0
  48. package/lib/room-control/whiteboard-control-v1/board-window.js +571 -0
  49. package/lib/room-control/{whiteboard-control/enums.d.ts → whiteboard-control-v1/enum.d.ts} +3 -17
  50. package/lib/room-control/{whiteboard-control/enums.js → whiteboard-control-v1/enum.js} +3 -20
  51. package/lib/room-control/whiteboard-control-v1/factory.d.ts +9 -0
  52. package/lib/room-control/whiteboard-control-v1/factory.js +22 -0
  53. package/lib/room-control/whiteboard-control-v1/index.d.ts +1 -0
  54. package/lib/room-control/whiteboard-control-v1/index.js +440 -0
  55. package/lib/room-control/whiteboard-control-v1/mount-manager.d.ts +4 -0
  56. package/lib/room-control/whiteboard-control-v1/mount-manager.js +15 -0
  57. package/lib/room-control/whiteboard-control-v1/type.d.ts +300 -0
  58. package/lib/room-control/whiteboard-control-v1/type.js +13 -0
  59. package/lib/room-control/whiteboard-control-v1/utils.d.ts +53 -0
  60. package/lib/room-control/whiteboard-control-v1/utils.js +290 -0
  61. package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +17 -31
  62. package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +39 -233
  63. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +10 -0
  64. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +48 -0
  65. package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +11 -19
  66. package/lib/room-control/whiteboard-control-v2/annotation-control/type.js +1 -3
  67. package/lib/room-control/whiteboard-control-v2/base/index.d.ts +42 -0
  68. package/lib/room-control/whiteboard-control-v2/base/index.js +317 -0
  69. package/lib/room-control/whiteboard-control-v2/{main-window.d.ts → base/main-window.d.ts} +6 -4
  70. package/lib/room-control/whiteboard-control-v2/{main-window.js → base/main-window.js} +31 -18
  71. package/lib/room-control/whiteboard-control-v2/constant.d.ts +6 -0
  72. package/lib/room-control/whiteboard-control-v2/constant.js +15 -0
  73. package/lib/room-control/whiteboard-control-v2/enum.d.ts +26 -0
  74. package/lib/room-control/whiteboard-control-v2/enum.js +34 -0
  75. package/lib/room-control/{whiteboard-control/types.d.ts → whiteboard-control-v2/type.d.ts} +51 -165
  76. package/lib/room-control/whiteboard-control-v2/type.js +5 -0
  77. package/lib/room-control/whiteboard-control-v2/utils.d.ts +5 -4
  78. package/lib/room-control/whiteboard-control-v2/utils.js +22 -21
  79. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +34 -33
  80. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +124 -191
  81. package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +11 -0
  82. package/lib/room-control/whiteboard-control-v2/{annotation-control/index.js → whiteboard-control/factory.js} +35 -44
  83. package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +18 -30
  84. package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.js +1 -9
  85. package/lib/room-router/index.js +4 -0
  86. package/lib/schema.d.ts +23 -9
  87. package/lib/schema.js +10 -4
  88. package/lib/service/api.d.ts +75 -19
  89. package/lib/service/api.js +193 -24
  90. package/lib/type.d.ts +15 -2
  91. package/lib/type.js +13 -0
  92. package/lib/utilities/error-helpers.d.ts +2 -1
  93. package/lib/utilities/error-helpers.js +1 -0
  94. package/lib/utilities/error.d.ts +1 -0
  95. package/lib/utilities/error.js +1 -0
  96. package/lib/utilities/logger.d.ts +2 -2
  97. package/lib/utilities/shared-storage.d.ts +3 -1
  98. package/lib/utilities/shared-storage.js +9 -1
  99. package/package.json +11 -5
  100. package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +0 -19
  101. package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.d.ts +0 -36
  102. package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +0 -262
  103. package/lib/room-control/whiteboard-control-v2/index.d.ts +0 -38
  104. package/lib/room-control/whiteboard-control-v2/index.js +0 -286
  105. package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +0 -17
  106. package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +0 -32
  107. package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.d.ts +0 -36
  108. package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +0 -252
@@ -1,286 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol.description.js");
4
- require("core-js/modules/es.error.cause.js");
5
- require("core-js/modules/es.array.push.js");
6
- require("core-js/modules/esnext.function.metadata.js");
7
- require("core-js/modules/esnext.map.delete-all.js");
8
- require("core-js/modules/esnext.map.emplace.js");
9
- require("core-js/modules/esnext.map.every.js");
10
- require("core-js/modules/esnext.map.filter.js");
11
- require("core-js/modules/esnext.map.find.js");
12
- require("core-js/modules/esnext.map.find-key.js");
13
- require("core-js/modules/esnext.map.includes.js");
14
- require("core-js/modules/esnext.map.key-of.js");
15
- require("core-js/modules/esnext.map.map-keys.js");
16
- require("core-js/modules/esnext.map.map-values.js");
17
- require("core-js/modules/esnext.map.merge.js");
18
- require("core-js/modules/esnext.map.reduce.js");
19
- require("core-js/modules/esnext.map.some.js");
20
- require("core-js/modules/esnext.map.update.js");
21
- require("core-js/modules/esnext.symbol.metadata.js");
22
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23
- Object.defineProperty(exports, "__esModule", {
24
- value: true
25
- });
26
- exports.FcrWhiteboardControlImpl = void 0;
27
- require("core-js/modules/es.regexp.exec.js");
28
- require("core-js/modules/web.dom-collections.iterator.js");
29
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
30
- var _enums = require("../whiteboard-control/enums");
31
- var _forgeRoom = require("@netless/forge-room");
32
- var _forgeWhiteboard = require("@netless/forge-whiteboard");
33
- var _forgeRtm = require("@netless/forge-rtm");
34
- var _asyncRetry = require("agora-foundation/lib/utilities/async-retry");
35
- var _imports = require("../../imports");
36
- var _mainWindow = require("./main-window");
37
- var _user = require("../../utilities/user");
38
- var _observable = require("agora-foundation/lib/utilities/observable");
39
- var _type = require("../../type");
40
- var _logger = require("../../utilities/logger");
41
- var _error = require("../../utilities/error");
42
- var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
43
- var _schema = require("../../schema");
44
- var _type2 = require("./whiteboard-control/type");
45
- var _packageInfo = require("../../utilities/package-info");
46
- var _FcrWhiteboardControlImpl;
47
- let _initProto, _setBackgroundColorDecs, _ref;
48
- 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)]; } }; }
49
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
50
- 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
- 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; }
52
- 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; }
53
- _ref = (_setBackgroundColorDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger");
54
- class FcrWhiteboardControlImpl {
55
- constructor(_scene, _api, _engine, _sharedCache) {
56
- (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
57
- prefix: 'FcrWhiteboardControlImpl'
58
- })));
59
- (0, _defineProperty2.default)(this, "_observable", new _observable.AgoraObservable());
60
- (0, _defineProperty2.default)(this, "_connectState", _type.FcrConnectionState.DISCONNECTED);
61
- (0, _defineProperty2.default)(this, "_needRetry", true);
62
- (0, _defineProperty2.default)(this, "_FORGE_WHITEBOARD_APP_ID", 'MainWhiteboard');
63
- this._scene = _scene;
64
- this._api = _api;
65
- this._engine = _engine;
66
- this._sharedCache = _sharedCache;
67
- this._roomCache = _sharedCache.getRoomCache(this._scene.sceneId);
68
- this._addLogObserver();
69
- _scene.addObserver(this._notifyObservers());
70
- this.logger.info("Whitebaord Version: forge-whiteboard@".concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-whiteboard'), ", forge-room@").concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-room'), ", forge-rtm@").concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-rtm')));
71
- }
72
- async open() {
73
- var _this$_scene$getUser;
74
- // 此宽高为设计稿中的白板尺寸,如无特殊需求,不建议修改
75
- const width = 1920;
76
- const height = 1220;
77
- const roomId = this._scene.sceneId;
78
- const userId = this._scene.localUser.getLocalUserId();
79
- const nickName = (_this$_scene$getUser = this._scene.getUser(userId)) === null || _this$_scene$getUser === void 0 ? void 0 : _this$_scene$getUser.userName;
80
- const {
81
- data
82
- } = await this._getToken(roomId, userId);
83
- const {
84
- boardAppId: appIdentifier,
85
- boardId,
86
- boardRegion: region,
87
- boardToken: roomToken
88
- } = data || {};
89
-
90
- // @ts-ignore
91
- const rtmClient = this._engine._rtmClient._client;
92
- const rtmProvider = new _forgeRtm.RTMProvider_2_2(rtmClient);
93
- const wbRoom = new _forgeRoom.Room(boardId, rtmProvider);
94
-
95
- // rtmProvider.addListener('connectionStatusChange', (state: ConnectionStatus) => {
96
- // switch (state) {
97
- // case 'CONNECTED':
98
- // this._updateConnnectionState(FcrConnectionState.CONNECTED);
99
- // break;
100
- // case 'RECONNECTING':
101
- // this._updateConnnectionState(FcrConnectionState.RECONNECTING);
102
- // break;
103
- // case 'CONNECTING':
104
- // this._updateConnnectionState(FcrConnectionState.CONNECTING);
105
- // break;
106
- // case 'DISCONNECTED':
107
- // this._updateConnnectionState(FcrConnectionState.DISCONNECTED);
108
- // break;
109
- // }
110
- // });
111
- // 由于白板用的也是 rtm 的链接状态,主应用也通过监听 rtm 状态的变化来显示加载动画,所以白板不再需要监听 rtm 状态的变化,三端、产品和测试已同步
112
- // 白板的 rtm 状态和加入房间更新的状态用的是同一个枚举,在弱网环境下有冲突会导致问题,去掉之后即不再有此问题
113
-
114
- wbRoom.applicationManager.registerApplication(_forgeWhiteboard.WhiteboardApplication);
115
- try {
116
- this._updateConnnectionState(_type.FcrConnectionState.CONNECTING);
117
- this.logger.info('[whiteboard]: join board room, state: CONNECTING');
118
- const retriesMax = 10;
119
- await (0, _asyncRetry.retryAttempt)(async () => {
120
- await wbRoom.joinRoom({
121
- userId,
122
- nickName,
123
- roomToken,
124
- sdkConfig: {
125
- // @ts-ignore
126
- region,
127
- appIdentifier
128
- }
129
- });
130
- this._boardRoom = wbRoom;
131
- this.logger.info({
132
- appIdentifier,
133
- boardId,
134
- region,
135
- roomToken
136
- });
137
- const whiteboard = await wbRoom.applicationManager.launchApplication(_forgeWhiteboard.WhiteboardApplication, {
138
- width,
139
- height,
140
- defaultToolbarStyle: {
141
- tool: 'laser'
142
- }
143
- }, this._FORGE_WHITEBOARD_APP_ID);
144
- whiteboard.enableCameraByMouse = false;
145
- whiteboard.enableCameraByTouch = false;
146
- whiteboard.setViewModeToMain();
147
- // wbRoom.applicationManager.on('terminal', () => {
148
- // this._updateConnnectionState(FcrConnectionState.DISCONNECTED);
149
- // });
150
- this._boardView = new _mainWindow.FcrBoardMainWindowImpl(whiteboard, wbRoom);
151
- this._needRetry = false;
152
- this.logger.info('[whiteboard]: join board room success, state: CONNECTED');
153
- this._updateConnnectionState(_type.FcrConnectionState.CONNECTED);
154
- }, [], {
155
- retriesMax
156
- }).fail(async _ref2 => {
157
- let {
158
- error,
159
- timeFn,
160
- currentRetry
161
- } = _ref2;
162
- this.logger.info("[whiteboard]: failed to join board room, error: ".concat(error.message, ", current retry: ").concat(currentRetry));
163
- this._needRetry && (await timeFn());
164
- this.logger.info("[whiteboard]: continue attemptting? need retry: ".concat(this._needRetry));
165
- return this._needRetry;
166
- }).abort(() => {
167
- this.logger.info('[whiteboard]: join board room aborted, state: DISCONNECTED');
168
- this._updateConnnectionState(_type.FcrConnectionState.DISCONNECTED);
169
- }).exec();
170
- } catch (e) {
171
- this.logger.info('[whiteboard]: join board room failed, state: DISCONNECTED');
172
- this._updateConnnectionState(_type.FcrConnectionState.DISCONNECTED);
173
- }
174
- return this._boardView;
175
- }
176
- async close() {
177
- var _this$_boardRoom, _this$_boardRoom2;
178
- this._needRetry = false;
179
- (_this$_boardRoom = this._boardRoom) === null || _this$_boardRoom === void 0 || _this$_boardRoom.applicationManager.terminateApplication(this._FORGE_WHITEBOARD_APP_ID);
180
- await ((_this$_boardRoom2 = this._boardRoom) === null || _this$_boardRoom2 === void 0 ? void 0 : _this$_boardRoom2.leaveRoom());
181
- this._boardRoom = undefined;
182
- this._boardView = undefined;
183
- }
184
- async active() {
185
- return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.ON), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'active failed');
186
- }
187
- async inactive() {
188
- return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.OFF), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'inactive failed');
189
- }
190
- getConnectionState() {
191
- return this._connectState;
192
- }
193
- getMainWindow() {
194
- return this._boardView;
195
- }
196
- getBoardActiveInfo() {
197
- const {
198
- state,
199
- ownerUserUuid: ownerUserId
200
- } = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard');
201
- if (state === _type2.FcrBoardPropertiesState.ACTIVE) {
202
- return {
203
- isActive: true,
204
- ownerUserId
205
- };
206
- } else {
207
- return {
208
- isActive: false,
209
- ownerUserId: null
210
- };
211
- }
212
- }
213
- async setBackgroundColor(backgroundColor) {
214
- var _this$_boardView;
215
- await this._api.setBackgroundColor({
216
- roomId: this._scene.sceneId,
217
- backgroundColor
218
- });
219
- (_this$_boardView = this._boardView) === null || _this$_boardView === void 0 || _this$_boardView.setBackgroundColor(backgroundColor);
220
- }
221
- getBackgroundColor() {
222
- return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
223
- }
224
- getActivity() {
225
- return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
226
- }
227
- getOwnerId() {
228
- return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.ownerUserUuid');
229
- }
230
- addObserver(observer) {
231
- this._observable.addObserver(observer);
232
- }
233
- removeObserver(observer) {
234
- this._observable.removeObserver(observer);
235
- }
236
- _notifyObservers() {
237
- return {
238
- onScenePropertiesUpdated: (_, event) => {
239
- var _event$cause;
240
- const operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
241
- const getByKeyPath = value => this._scene.getScenePropertiesByKeyPath(value);
242
- if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 10) {
243
- var _ref3, _ref4, _event$cause$data;
244
- const {
245
- state,
246
- ownerUserUuid
247
- } = (_ref3 = getByKeyPath('widgets.netlessBoard')) !== null && _ref3 !== void 0 ? _ref3 : {
248
- state: 0
249
- };
250
- const {
251
- backgroundColor: bgColor
252
- } = (_ref4 = getByKeyPath('widgets.netlessBoard.extra')) !== null && _ref4 !== void 0 ? _ref4 : {
253
- backgroundColor: '#ffffff'
254
- };
255
- const widgetCauseReason = getByKeyPath('event.cause.data.widgetCause.data.reason');
256
- const widgetCauseCmd = (_event$cause$data = event.cause.data) === null || _event$cause$data === void 0 || (_event$cause$data = _event$cause$data.widgetCause) === null || _event$cause$data === void 0 ? void 0 : _event$cause$data.cmd;
257
- if (state === 1) {
258
- this._observable.notifyObservers('onActive', ownerUserUuid, operatorUser);
259
- }
260
- if (state === 0) {
261
- this._observable.notifyObservers('onInactive', widgetCauseReason, operatorUser);
262
- }
263
- if (widgetCauseCmd && widgetCauseCmd === 100101) {
264
- this._observable.notifyObservers('onBackgroundColorUpdated', bgColor, operatorUser);
265
- }
266
- }
267
- }
268
- };
269
- }
270
- _updateConnnectionState(state) {
271
- this._connectState = state;
272
- this._observable.notifyObservers('onConnectionStateUpdated', state);
273
- }
274
- async _getToken(roomId, userId) {
275
- return await (0, _error.handleRequestError)(() => this._api.getWhiteboardToken({
276
- roomId,
277
- userId
278
- }), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'get whiteboard token failed');
279
- }
280
- _addLogObserver() {
281
- this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onActive', 'onInactive', 'onBackgroundColorUpdated', 'onConnectionStateUpdated']));
282
- }
283
- }
284
- exports.FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
285
- _FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
286
- [_initProto] = _applyDecs(_FcrWhiteboardControlImpl, [[_imports.trace, 2, "open"], [_imports.trace, 2, "close"], [_imports.trace, 2, "active"], [_imports.trace, 2, "inactive"], [[_imports.bound, _imports.trace], 2, "getConnectionState"], [[_imports.bound, _imports.trace], 2, "getMainWindow"], [_imports.bound, 2, "getBoardActiveInfo"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [[_imports.bound, _imports.trace], 2, "getBackgroundColor"], [[_imports.bound, _imports.trace], 2, "getActivity"], [[_imports.bound, _imports.trace], 2, "getOwnerId"], [_imports.bound, 2, "_notifyObservers"], [_imports.bound, 2, "_updateConnnectionState"], [_imports.bound, 2, "_getToken"]], []).e;
@@ -1,17 +0,0 @@
1
- import { AgoraRteScene } from 'agora-rte-sdk';
2
- import { FcrCoreServiceApi } from '../../../service/api';
3
- import { FcrSharedCache } from '../../shared-cache';
4
- import { FcrPrivilegeControl } from '../../..';
5
- import { FcrBoardConfig, FcrPrivilegedWhiteboardControl, FcrWhiteboardControl, FcrWhiteboardControlFactory } from './type';
6
- import { AgoraRtmClient } from 'agora-rte-sdk/lib/core/rtm/client';
7
- export declare class FcrWhiteboardControlFactoryImpl implements FcrWhiteboardControlFactory {
8
- private _rtmClient;
9
- private _scene?;
10
- private _api?;
11
- private _sharedCache?;
12
- private _privilegeControl?;
13
- protected logger: import("agora-foundation/lib/logger").Logger;
14
- constructor(_rtmClient: AgoraRtmClient, _scene?: AgoraRteScene | undefined, _api?: FcrCoreServiceApi | undefined, _sharedCache?: FcrSharedCache | undefined, _privilegeControl?: FcrPrivilegeControl | undefined);
15
- createForSubProcess(config: FcrBoardConfig): FcrWhiteboardControl;
16
- createForMainProcess(): FcrPrivilegedWhiteboardControl;
17
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.FcrWhiteboardControlFactoryImpl = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _control = require("./control");
10
- var _logger = require("../../../utilities/logger");
11
- var _privilegeControl2 = require("./privilege-control");
12
- class FcrWhiteboardControlFactoryImpl {
13
- constructor(_rtmClient, _scene, _api, _sharedCache, _privilegeControl) {
14
- (0, _defineProperty2.default)(this, "logger", (0, _logger.createLogger)({
15
- prefix: 'FcrWhiteboardControlFactory'
16
- }));
17
- this._rtmClient = _rtmClient;
18
- this._scene = _scene;
19
- this._api = _api;
20
- this._sharedCache = _sharedCache;
21
- this._privilegeControl = _privilegeControl;
22
- }
23
- createForSubProcess(config) {
24
- this.logger.info('[whiteboard]: create for sub process');
25
- return new _control.FcrWhiteboardControlImpl(this._rtmClient, config);
26
- }
27
- createForMainProcess() {
28
- this.logger.info('[whiteboard]: create for main process');
29
- return new _privilegeControl2.FcrPrivilegedWhiteboardControlImpl(this._scene, this._api, this._rtmClient, this._sharedCache, this._privilegeControl);
30
- }
31
- }
32
- exports.FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
@@ -1,36 +0,0 @@
1
- import { FcrBoardActiveInfo, FcrBoardMainWindow } from '../../whiteboard-control/types';
2
- import { AgoraRteScene } from '../../../imports';
3
- import { FcrCoreServiceApi } from '../../../service/api';
4
- import { FcrSharedCache } from '../../shared-cache';
5
- import { FcrPrivilegedWhiteboardControl, FcrWhiteboardObserver } from './type';
6
- import { FcrWhiteboardControlImpl } from './control';
7
- import { FcrConnectionState, FcrPrivilegeControl } from '../../..';
8
- import { AgoraRtmClient } from 'agora-rte-sdk/lib/core/rtm/client';
9
- export declare class FcrPrivilegedWhiteboardControlImpl extends FcrWhiteboardControlImpl implements FcrPrivilegedWhiteboardControl {
10
- private _scene;
11
- private _api;
12
- private _privilegeControl;
13
- private _roomCache;
14
- private _notifyObservers;
15
- private _privilegeObserver;
16
- get roomId(): string;
17
- get userId(): string;
18
- constructor(_scene: AgoraRteScene, _api: FcrCoreServiceApi, rtmClient: AgoraRtmClient, sharedCache: FcrSharedCache, _privilegeControl: FcrPrivilegeControl);
19
- open(): Promise<FcrBoardMainWindow>;
20
- active(): Promise<void>;
21
- inactive(): Promise<void>;
22
- getBoardActiveInfo(): FcrBoardActiveInfo;
23
- setBackgroundColor(backgroundColor: string): Promise<void>;
24
- getBackgroundColor(): string | undefined;
25
- getActivity(): boolean;
26
- getOwnerId(): string;
27
- addObserver(observer: FcrWhiteboardObserver): void;
28
- removeObserver(observer: FcrWhiteboardObserver): void;
29
- release(): void;
30
- private _handleApplicationLaunch;
31
- private _handleApplicationTerminal;
32
- private _getToken;
33
- private _isBoardWritePermission;
34
- private _onScenePropertiesUpdated;
35
- protected updateConnnectionState(state: FcrConnectionState): void;
36
- }
@@ -1,252 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol.description.js");
4
- require("core-js/modules/es.error.cause.js");
5
- require("core-js/modules/es.array.push.js");
6
- require("core-js/modules/esnext.function.metadata.js");
7
- require("core-js/modules/esnext.map.delete-all.js");
8
- require("core-js/modules/esnext.map.emplace.js");
9
- require("core-js/modules/esnext.map.every.js");
10
- require("core-js/modules/esnext.map.filter.js");
11
- require("core-js/modules/esnext.map.find.js");
12
- require("core-js/modules/esnext.map.find-key.js");
13
- require("core-js/modules/esnext.map.includes.js");
14
- require("core-js/modules/esnext.map.key-of.js");
15
- require("core-js/modules/esnext.map.map-keys.js");
16
- require("core-js/modules/esnext.map.map-values.js");
17
- require("core-js/modules/esnext.map.merge.js");
18
- require("core-js/modules/esnext.map.reduce.js");
19
- require("core-js/modules/esnext.map.some.js");
20
- require("core-js/modules/esnext.map.update.js");
21
- require("core-js/modules/esnext.symbol.metadata.js");
22
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23
- Object.defineProperty(exports, "__esModule", {
24
- value: true
25
- });
26
- exports.FcrPrivilegedWhiteboardControlImpl = void 0;
27
- require("core-js/modules/esnext.iterator.constructor.js");
28
- require("core-js/modules/esnext.iterator.some.js");
29
- require("core-js/modules/web.dom-collections.iterator.js");
30
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
31
- var _enums = require("../../whiteboard-control/enums");
32
- var _imports = require("../../../imports");
33
- var _user = require("../../../utilities/user");
34
- var _error = require("../../../utilities/error");
35
- var _schema = require("../../../schema");
36
- var _type = require("./type");
37
- var _packageInfo = require("../../../utilities/package-info");
38
- var _control = require("./control");
39
- var _ = require("../../..");
40
- var _helper = require("../../privilege-control/helper");
41
- var _forgeWhiteboard = require("@netless/forge-whiteboard");
42
- var _validateParams = _interopRequireDefault(require("../../../utilities/validate-params"));
43
- var _FcrPrivilegedWhiteboardControlImpl;
44
- let _initProto, _setBackgroundColorDecs, _ref;
45
- 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)]; } }; }
46
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
47
- 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); }
48
- 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; }
49
- 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; }
50
- _ref = (_setBackgroundColorDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "_roomCache");
51
- class FcrPrivilegedWhiteboardControlImpl extends _control.FcrWhiteboardControlImpl {
52
- get roomId() {
53
- return this._scene.sceneId;
54
- }
55
- get userId() {
56
- return this._scene.localUser.getLocalUserId();
57
- }
58
- constructor(_scene, _api, rtmClient, sharedCache, _privilegeControl) {
59
- var _scene$getUser;
60
- const userId = _scene.localUser.getLocalUserId();
61
- const nickName = (_scene$getUser = _scene.getUser(userId)) === null || _scene$getUser === void 0 ? void 0 : _scene$getUser.userName;
62
- super(rtmClient, {
63
- userId,
64
- nickName
65
- });
66
- (0, _defineProperty2.default)(this, _ref, void _initProto(this));
67
- (0, _defineProperty2.default)(this, "_notifyObservers", {
68
- onScenePropertiesUpdated: this._onScenePropertiesUpdated
69
- });
70
- (0, _defineProperty2.default)(this, "_privilegeObserver", {
71
- onLocalUserPermissionInfoAdded: (roomId, event) => {
72
- if (this._isBoardWritePermission(event)) {
73
- this.logger.info("add board write permission");
74
- const whiteboard = this.whiteboard;
75
- if (whiteboard) {
76
- whiteboard.permissions.addPermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
77
- } else {
78
- this.logger.warn('whiteboard is not initialized yet, should add permission when application launched');
79
- }
80
- }
81
- },
82
- onLocalUserPermissionInfoDeleted: (roomId, event) => {
83
- if (this._isBoardWritePermission(event)) {
84
- this.logger.info("remove board write permission");
85
- const whiteboard = this.whiteboard;
86
- if (whiteboard) {
87
- whiteboard.permissions.removePermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
88
- } else {
89
- this.logger.warn('whiteboard is not initialized yet, should remove permission when application launched');
90
- }
91
- }
92
- }
93
- });
94
- this._scene = _scene;
95
- this._api = _api;
96
- this._privilegeControl = _privilegeControl;
97
- this._roomCache = sharedCache.getRoomCache(this._scene.sceneId);
98
- this._scene.addObserver(this._notifyObservers);
99
- this._privilegeControl.addObserver(this._privilegeObserver);
100
- this.logger.info('[whiteboard][privilege-whiteboard]: constructor');
101
- this.logger.info("[whiteboard][privilege-whiteboard]: Whitebaord Version: forge-whiteboard@".concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-whiteboard'), ", forge-room@").concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-room'), ", forge-rtm@").concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-rtm')));
102
- }
103
- async open() {
104
- this.logger.info('[whiteboard][privilege-whiteboard]: start open');
105
- const {
106
- data
107
- } = await this._getToken(this.roomId, this.userId);
108
- const config = {
109
- boardAppId: data.boardAppId,
110
- boardId: data.boardId,
111
- boardRegion: data.boardRegion,
112
- boardToken: data.boardToken
113
- };
114
- this.logger.info('[whiteboard][privilege-whiteboard]: open with config', config);
115
- const promise = super.openWithConfig(config);
116
- promise.then(boardView => {
117
- this.boardRoom.applicationManager.on('launch', this._handleApplicationLaunch);
118
- this.boardRoom.applicationManager.on('terminal', this._handleApplicationTerminal);
119
- return boardView;
120
- });
121
- return promise;
122
- }
123
- async active() {
124
- return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this.roomId, _enums.FcrSharePermissionState.ON), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, '[whiteboard][privilege-whiteboard]: active failed');
125
- }
126
- async inactive() {
127
- return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this.roomId, _enums.FcrSharePermissionState.OFF), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, '[whiteboard][privilege-whiteboard]: inactive failed');
128
- }
129
- getBoardActiveInfo() {
130
- const {
131
- state,
132
- ownerUserUuid: ownerUserId
133
- } = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard');
134
- if (state === _type.FcrBoardPropertiesState.ACTIVE) {
135
- return {
136
- isActive: true,
137
- ownerUserId
138
- };
139
- } else {
140
- return {
141
- isActive: false,
142
- ownerUserId: null
143
- };
144
- }
145
- }
146
- async setBackgroundColor(backgroundColor) {
147
- var _this$getMainWindow;
148
- await this._api.setBackgroundColor({
149
- roomId: this.roomId,
150
- backgroundColor
151
- });
152
- (_this$getMainWindow = this.getMainWindow()) === null || _this$getMainWindow === void 0 || _this$getMainWindow.setBackgroundColor(backgroundColor);
153
- }
154
- getBackgroundColor() {
155
- return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
156
- }
157
- getActivity() {
158
- const isActive = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
159
- this.logger.info("[whiteboard][privilege-whiteboard]: getActivity isActive: ".concat(isActive));
160
- return isActive;
161
- }
162
- getOwnerId() {
163
- return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.ownerUserUuid');
164
- }
165
- addObserver(observer) {
166
- this.observable.addObserver(observer);
167
- }
168
- removeObserver(observer) {
169
- this.observable.removeObserver(observer);
170
- }
171
- release() {
172
- this._scene.removeObserver(this._notifyObservers);
173
- this._privilegeControl.removeObserver(this._privilegeObserver);
174
- super.release();
175
- }
176
- async _handleApplicationLaunch(appId, app) {
177
- this.whiteboard = app;
178
- }
179
- async _handleApplicationTerminal(appId, app) {
180
- this.whiteboard = app;
181
- }
182
- async _getToken(roomId, userId) {
183
- return await (0, _error.handleRequestError)(() => this._api.getWhiteboardToken({
184
- roomId,
185
- userId
186
- }), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, '[whiteboard][privilege-whiteboard]: get whiteboard token failed');
187
- }
188
- _isBoardWritePermission(event) {
189
- return event.permissionInfo.some(perm => {
190
- var _perm$info;
191
- return ((_perm$info = perm.info) === null || _perm$info === void 0 ? void 0 : _perm$info.action) === _.FcrPermissionAction.BoardWrite;
192
- });
193
- }
194
- _onScenePropertiesUpdated(sceneId, event) {
195
- var _event$cause;
196
- const operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
197
- const getByKeyPath = value => this._scene.getScenePropertiesByKeyPath(value);
198
- if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 10) {
199
- var _ref2, _ref3;
200
- const {
201
- state,
202
- ownerUserUuid
203
- } = (_ref2 = getByKeyPath('widgets.netlessBoard')) !== null && _ref2 !== void 0 ? _ref2 : {
204
- state: 0
205
- };
206
- const {
207
- backgroundColor: bgColor
208
- } = (_ref3 = getByKeyPath('widgets.netlessBoard.extra')) !== null && _ref3 !== void 0 ? _ref3 : {
209
- backgroundColor: '#ffffff'
210
- };
211
- const widgetCauseReason = (0, _imports.get)(event.cause.data, 'widgetCause.data.reason');
212
- const widgetCauseCmd = (0, _imports.get)(event.cause.data, 'widgetCause.cmd');
213
- this.logger.info("[whiteboard][privilege-whiteboard]: onScenePropertiesUpdated ".concat(_type.FcrBoardPropertiesState[state]));
214
- if (state === _type.FcrBoardPropertiesState.ACTIVE) {
215
- this.observable.notifyObservers('onActive', ownerUserUuid, operatorUser);
216
- }
217
- if (state === _type.FcrBoardPropertiesState.INACTIVE) {
218
- this.observable.notifyObservers('onInactive', widgetCauseReason, operatorUser);
219
- }
220
- if (widgetCauseCmd && widgetCauseCmd === _type.FcrBoardPropertiesState.BACKGROUND_COLOR_UPDATED) {
221
- this.observable.notifyObservers('onBackgroundColorUpdated', bgColor, operatorUser);
222
- }
223
- }
224
- }
225
- updateConnnectionState(state) {
226
- super.updateConnnectionState(state);
227
- if (state === _.FcrConnectionState.CONNECTED) {
228
- const whiteboard = this.whiteboard;
229
- const mainWindow = this.getMainWindow();
230
- if (!whiteboard) {
231
- this.logger.error('whiteboard is expected to be initialized at this point');
232
- return;
233
- }
234
- if (!mainWindow) {
235
- this.logger.error('main window is expected to be initialized at this point');
236
- return;
237
- }
238
- const isEnabled = action => (0, _helper.getLocalUserPermissionInfo)(this._scene, action).enable;
239
- const hasOperationPrivilege = isEnabled(_.FcrPermissionAction.BoardWrite) || isEnabled(_.FcrPermissionAction.AnnotationWrite);
240
- if (hasOperationPrivilege) {
241
- this.logger.info('add whiteboard permission');
242
- whiteboard.permissions.addPermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
243
- } else {
244
- this.logger.info('remove whiteboard permission');
245
- whiteboard.permissions.removePermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
246
- }
247
- }
248
- }
249
- }
250
- exports.FcrPrivilegedWhiteboardControlImpl = FcrPrivilegedWhiteboardControlImpl;
251
- _FcrPrivilegedWhiteboardControlImpl = FcrPrivilegedWhiteboardControlImpl;
252
- [_initProto] = _applyDecs(_FcrPrivilegedWhiteboardControlImpl, [[_imports.bound, 2, "open"], [_imports.trace, 2, "active"], [_imports.trace, 2, "inactive"], [_imports.bound, 2, "getBoardActiveInfo"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [[_imports.bound, _imports.trace], 2, "getBackgroundColor"], [[_imports.bound, _imports.trace], 2, "getActivity"], [[_imports.bound, _imports.trace], 2, "getOwnerId"], [[_imports.bound, _imports.trace], 2, "_handleApplicationLaunch"], [[_imports.bound, _imports.trace], 2, "_handleApplicationTerminal"], [_imports.bound, 2, "_getToken"], [_imports.bound, 2, "_onScenePropertiesUpdated"], [_imports.bound, 2, "updateConnnectionState"]], [], 0, void 0, _control.FcrWhiteboardControlImpl).e;