fcr-core 3.6.0 → 3.6.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 (38) hide show
  1. package/lib/engine/index.js +1 -1
  2. package/lib/room-control/ability-control/index.js +1 -1
  3. package/lib/room-control/index.js +12 -8
  4. package/lib/room-control/interpreter-control/index.js +13 -3
  5. package/lib/room-control/mainroom-control/index.js +17 -2
  6. package/lib/room-control/privilege-control/index.js +32 -4
  7. package/lib/room-control/privilege-control/type.d.ts +13 -3
  8. package/lib/room-control/privilege-control/type.js +3 -0
  9. package/lib/room-control/sharing-control/index.d.ts +44 -0
  10. package/lib/room-control/sharing-control/index.js +217 -0
  11. package/lib/room-control/sharing-control/type.d.ts +31 -0
  12. package/lib/room-control/sharing-control/type.js +17 -0
  13. package/lib/room-control/stream-control/index.js +80 -11
  14. package/lib/room-control/stream-control/type.d.ts +3 -2
  15. package/lib/room-control/type.d.ts +5 -5
  16. package/lib/room-control/whiteboard-control/board-window.d.ts +4 -3
  17. package/lib/room-control/whiteboard-control/board-window.js +4 -1
  18. package/lib/room-control/whiteboard-control/types.d.ts +39 -72
  19. package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +33 -0
  20. package/lib/room-control/whiteboard-control-v2/annotation-control/index.js +187 -0
  21. package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +32 -0
  22. package/lib/room-control/whiteboard-control-v2/annotation-control/type.js +5 -0
  23. package/lib/room-control/whiteboard-control-v2/index.d.ts +2 -1
  24. package/lib/room-control/whiteboard-control-v2/index.js +19 -1
  25. package/lib/room-control/whiteboard-control-v2/main-window.d.ts +7 -4
  26. package/lib/room-control/whiteboard-control-v2/main-window.js +20 -3
  27. package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +38 -0
  28. package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +261 -0
  29. package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +42 -0
  30. package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.js +5 -0
  31. package/lib/schema.d.ts +21 -0
  32. package/lib/schema.js +9 -1
  33. package/lib/service/api.d.ts +64 -3
  34. package/lib/service/api.js +88 -3
  35. package/lib/type.d.ts +7 -0
  36. package/lib/utilities/package-info.d.ts +2 -0
  37. package/lib/utilities/package-info.js +6 -2
  38. package/package.json +7 -7
@@ -0,0 +1,261 @@
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 _mainWindow = require("../main-window");
36
+ var _user = require("../../../utilities/user");
37
+ var _observable = require("agora-foundation/lib/utilities/observable");
38
+ var _decorator = require("agora-foundation/lib/decorator");
39
+ var _ = require("../../../");
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 _FcrWhiteboardControlImpl;
45
+ let _initProto, _setBackgroundColorDecs, _ref;
46
+ 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)]; } }; }
47
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
48
+ 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); }
49
+ 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; }
50
+ 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; }
51
+ _ref = (_setBackgroundColorDecs = [_decorator.bound, _logger.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger");
52
+ class FcrWhiteboardControlImpl {
53
+ constructor(_scene, _api, _engine, _sharedCache) {
54
+ (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
55
+ prefix: 'FcrWhiteboardControlImpl'
56
+ })));
57
+ (0, _defineProperty2.default)(this, "_observable", new _observable.AgoraObservable());
58
+ (0, _defineProperty2.default)(this, "_connectState", _.FcrConnectionState.DISCONNECTED);
59
+ (0, _defineProperty2.default)(this, "_joined", false);
60
+ (0, _defineProperty2.default)(this, "_FORGE_WHITEBOARD_APP_ID", 'MainWhiteboard');
61
+ this._scene = _scene;
62
+ this._api = _api;
63
+ this._engine = _engine;
64
+ this._sharedCache = _sharedCache;
65
+ this._roomCache = _sharedCache.getRoomCache(this._scene.sceneId);
66
+ this._addLogObserver();
67
+ _scene.addObserver(this._notifyObservers());
68
+ }
69
+ async open() {
70
+ var _this$_scene$getUser;
71
+ // 此宽高为设计稿中的白板尺寸,如无特殊需求,不建议修改
72
+ const width = 1920;
73
+ const height = 1220;
74
+ const roomId = this._scene.sceneId;
75
+ const userId = this._scene.localUser.getLocalUserId();
76
+ const nickName = (_this$_scene$getUser = this._scene.getUser(userId)) === null || _this$_scene$getUser === void 0 ? void 0 : _this$_scene$getUser.userName;
77
+ const {
78
+ data
79
+ } = await this._getToken(roomId, userId);
80
+ const {
81
+ boardAppId: appIdentifier,
82
+ boardId,
83
+ boardRegion: region,
84
+ boardToken: roomToken
85
+ } = data || {};
86
+
87
+ // @ts-ignore
88
+ const rtmClient = this._engine._rtmClient._client;
89
+ const rtmProvider = new _forgeRtm.RTMProvider_2_2(rtmClient);
90
+ const wbRoom = new _forgeRoom.Room(boardId, rtmProvider);
91
+ wbRoom.applicationManager.registerApplication(_forgeWhiteboard.WhiteboardApplication);
92
+ try {
93
+ this._updateConnnectionState(_.FcrConnectionState.CONNECTING);
94
+ const retriesMax = 10;
95
+ await (0, _asyncRetry.retryAttempt)(async () => {
96
+ await wbRoom.joinRoom({
97
+ userId,
98
+ nickName,
99
+ roomToken,
100
+ sdkConfig: {
101
+ // @ts-ignore
102
+ region,
103
+ appIdentifier
104
+ }
105
+ });
106
+ this._boardRoom = wbRoom;
107
+ this.logger.info({
108
+ appIdentifier,
109
+ boardId,
110
+ region,
111
+ roomToken
112
+ });
113
+ const whiteboard = await wbRoom.applicationManager.launchApplication(_forgeWhiteboard.WhiteboardApplication, {
114
+ width,
115
+ height,
116
+ defaultToolbarStyle: {
117
+ tool: 'laser'
118
+ }
119
+ }, this._FORGE_WHITEBOARD_APP_ID);
120
+ whiteboard.enableCameraByMouse = false;
121
+ whiteboard.enableCameraByTouch = false;
122
+ whiteboard.setViewModeToMain();
123
+ // wbRoom.applicationManager.on('terminal', () => {
124
+ // this._updateConnnectionState(FcrConnectionState.DISCONNECTED);
125
+ // });
126
+ this._boardView = new _mainWindow.FcrBoardMainWindowImpl(whiteboard, this._scene, this._sharedCache, wbRoom);
127
+ this._updateConnnectionState(_.FcrConnectionState.CONNECTED);
128
+ }, [], {
129
+ retriesMax
130
+ }).fail(async _ref2 => {
131
+ let {
132
+ error,
133
+ timeFn,
134
+ currentRetry
135
+ } = _ref2;
136
+ this.logger.info("failed to join board room, error: ".concat(error.message, ", current retry: ").concat(currentRetry));
137
+ this._joined && (await timeFn());
138
+ this.logger.info("continue attemptting? ".concat(this._joined));
139
+ return this._joined;
140
+ }).abort(() => {
141
+ this._updateConnnectionState(_.FcrConnectionState.DISCONNECTED);
142
+ }).exec();
143
+ } catch (e) {
144
+ this._updateConnnectionState(_.FcrConnectionState.DISCONNECTED);
145
+ }
146
+ return this._boardView;
147
+ }
148
+ async close() {
149
+ var _this$_boardRoom, _this$_boardRoom2;
150
+ this._joined = false;
151
+ (_this$_boardRoom = this._boardRoom) === null || _this$_boardRoom === void 0 || _this$_boardRoom.applicationManager.terminateApplication(this._FORGE_WHITEBOARD_APP_ID);
152
+ await ((_this$_boardRoom2 = this._boardRoom) === null || _this$_boardRoom2 === void 0 ? void 0 : _this$_boardRoom2.leaveRoom());
153
+ this._boardRoom = undefined;
154
+ this._boardView = undefined;
155
+ }
156
+ async active() {
157
+ return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.ON), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'active failed');
158
+ }
159
+ async inactive() {
160
+ return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.OFF), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'inactive failed');
161
+ }
162
+ getConnectionState() {
163
+ return this._connectState;
164
+ }
165
+ getMainWindow() {
166
+ return this._boardView;
167
+ }
168
+ getBoardActiveInfo() {
169
+ const {
170
+ state,
171
+ ownerUserUuid: ownerUserId
172
+ } = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard') || {
173
+ isActive: false,
174
+ ownerUserUuid: null
175
+ };
176
+ const isActive = state === _enums.FcrSharePermissionState.ON;
177
+ if (isActive) {
178
+ return {
179
+ isActive: true,
180
+ ownerUserId
181
+ };
182
+ } else {
183
+ return {
184
+ isActive: false,
185
+ ownerUserId: null
186
+ };
187
+ }
188
+ }
189
+ async setBackgroundColor(backgroundColor) {
190
+ var _this$_boardView;
191
+ await this._api.setBackgroundColor({
192
+ roomId: this._scene.sceneId,
193
+ backgroundColor
194
+ });
195
+ (_this$_boardView = this._boardView) === null || _this$_boardView === void 0 || _this$_boardView.setBackgroundColor(backgroundColor);
196
+ }
197
+ getBackgroundColor() {
198
+ return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
199
+ }
200
+ getActivity() {
201
+ return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
202
+ }
203
+ getOwnerId() {
204
+ return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.ownerUserUuid');
205
+ }
206
+ addObserver(observer) {
207
+ this._observable.addObserver(observer);
208
+ }
209
+ removeObserver(observer) {
210
+ this._observable.removeObserver(observer);
211
+ }
212
+ _notifyObservers() {
213
+ return {
214
+ onScenePropertiesUpdated: (sceneId, event) => {
215
+ var _event$cause;
216
+ const operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
217
+ const getByKeyPath = value => this._scene.getScenePropertiesByKeyPath(value);
218
+ if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 10) {
219
+ var _ref3, _ref4, _event$cause$data$wid2;
220
+ const {
221
+ state,
222
+ ownerUserUuid
223
+ } = (_ref3 = getByKeyPath('widgets.netlessBoard')) !== null && _ref3 !== void 0 ? _ref3 : {
224
+ state: 0
225
+ };
226
+ const {
227
+ backgroundColor: bgColor
228
+ } = (_ref4 = getByKeyPath('widgets.netlessBoard.extra')) !== null && _ref4 !== void 0 ? _ref4 : {
229
+ backgroundColor: '#ffffff'
230
+ };
231
+ if (state === 1) {
232
+ this._observable.notifyObservers('onActive', ownerUserUuid, operatorUser);
233
+ }
234
+ if (state === 0) {
235
+ var _event$cause$data$wid;
236
+ this._observable.notifyObservers('onInactive', (_event$cause$data$wid = event.cause.data.widgetCause) === null || _event$cause$data$wid === void 0 || (_event$cause$data$wid = _event$cause$data$wid.data) === null || _event$cause$data$wid === void 0 ? void 0 : _event$cause$data$wid.reason, operatorUser);
237
+ }
238
+ if (((_event$cause$data$wid2 = event.cause.data.widgetCause) === null || _event$cause$data$wid2 === void 0 ? void 0 : _event$cause$data$wid2.cmd) === 100101) {
239
+ this._observable.notifyObservers('onBackgroundColorUpdated', bgColor, operatorUser);
240
+ }
241
+ }
242
+ }
243
+ };
244
+ }
245
+ _updateConnnectionState(state) {
246
+ this._connectState = state;
247
+ this._observable.notifyObservers('onConnectionStateUpdated', state);
248
+ }
249
+ async _getToken(roomId, userId) {
250
+ return await (0, _error.handleRequestError)(() => this._api.getWhiteboardToken({
251
+ roomId,
252
+ userId
253
+ }), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'get whiteboard token failed');
254
+ }
255
+ _addLogObserver() {
256
+ this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onActive', 'onInactive', 'onBackgroundColorUpdated', 'onConnectionStateUpdated']));
257
+ }
258
+ }
259
+ exports.FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
260
+ _FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
261
+ [_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"], [_setBackgroundColorDecs, 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;
@@ -0,0 +1,42 @@
1
+ import { FcrConnectionState } from '../../..';
2
+ import { FcrUserInfo } from '../../../type';
3
+ import { FcrBaseWhiteboardControl, FcrBoardInactiveReason } from '../../whiteboard-control/types';
4
+ export interface FcrWhiteboardControl extends FcrBaseWhiteboardControl {
5
+ active(): Promise<void>;
6
+ inactive(): Promise<void>;
7
+ getActivity(): boolean;
8
+ getOwnerId(): string;
9
+ getBackgroundColor(): string | undefined;
10
+ setBackgroundColor(color: string): Promise<void>;
11
+ addObserver(observer: FcrWhiteboardObserver): void;
12
+ removeObserver(observer: FcrWhiteboardObserver): void;
13
+ }
14
+ export type FcrWhiteboardObserver = {
15
+ /**
16
+ * Callback to receive the connection state change.
17
+ * @param state
18
+ */
19
+ onConnectionStateUpdated?(state: FcrConnectionState): void;
20
+ /**
21
+ * Callback to receive the background color of the whiteboard change.
22
+ * @param info
23
+ */
24
+ onBackgroundColorUpdated?(color: string, operatorUser?: FcrUserInfo): void;
25
+ /**
26
+ * Callback to receive the whiteboard active event.
27
+ * @param info
28
+ */
29
+ onActive?(ownerId: string, operatorUser: FcrUserInfo): void;
30
+ /**
31
+ * Callback to receive the whiteboard inactive event.
32
+ * @param reason
33
+ * @param operatorUser
34
+ */
35
+ onInactive?(reason: FcrBoardInactiveReason, operatorUser?: FcrUserInfo): void;
36
+ };
37
+ export type FcrBoardConfig = {
38
+ roomId: string;
39
+ userId: string;
40
+ userName: string;
41
+ boardRatio: number;
42
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/lib/schema.d.ts CHANGED
@@ -893,7 +893,28 @@ export declare const fcrScreenStreamCreateConfigSchema: z.ZodObject<{
893
893
  audioSourceId?: string | undefined;
894
894
  audioDeviceName?: string | undefined;
895
895
  }>;
896
+ export declare const fcrScreenStreamCreateConfigSize: z.ZodObject<{
897
+ width: z.ZodNumber;
898
+ height: z.ZodNumber;
899
+ }, "strip", z.ZodTypeAny, {
900
+ width: number;
901
+ height: number;
902
+ }, {
903
+ width: number;
904
+ height: number;
905
+ }>;
896
906
  export type FcrScreenStreamCreateConfigSchema = z.infer<typeof fcrScreenStreamCreateConfigSchema>;
907
+ export declare const fcrSizeSchema: z.ZodOptional<z.ZodObject<{
908
+ width: z.ZodNumber;
909
+ height: z.ZodNumber;
910
+ }, "strip", z.ZodTypeAny, {
911
+ width: number;
912
+ height: number;
913
+ }, {
914
+ width: number;
915
+ height: number;
916
+ }>>;
917
+ export type fcrSizeSchema = z.infer<typeof fcrSizeSchema>;
897
918
  export declare const fcrGroupCreateConfigArraySchema: z.ZodArray<z.ZodObject<{
898
919
  groupName: z.ZodString;
899
920
  userList: z.ZodArray<z.ZodString, "many">;
package/lib/schema.js CHANGED
@@ -42,7 +42,7 @@ Object.defineProperty(exports, "fcrRenderViewSchema", {
42
42
  return _imports.fcrRenderViewSchema;
43
43
  }
44
44
  });
45
- exports.messageSchema = exports.fcrVideoStreamTypeSchema = exports.fcrVideoSourceTypeSchema = exports.fcrUserRolesSchema = exports.fcrUserRoleSchema = exports.fcrUserKickedOutTypeSchema = exports.fcrUpdateStreamPrivilegeScopeSchema = exports.fcrUpdateStreamCustomSchema = exports.fcrStreamPrivilegeVideoSourceTypeSchema = exports.fcrStreamPrivilegeOperation = exports.fcrStreamPrivilegeAudioSourceTypeSchema = exports.fcrStreamJoinConfig = exports.fcrStreamBindConfigSchema = exports.fcrStreamBindConfigArrySchema = exports.fcrSessionBaseSchema = exports.fcrSecuritySendChatPayloadSchema = exports.fcrSecurityPrivateChatConfigSchema = exports.fcrSecurityActionSchema = exports.fcrScreenStreamCreateConfigSchema = exports.fcrRoomSessionParamsSchema = exports.fcrRoomJoinOptionsWithTicketSchema = exports.fcrRoomJoinOptionsSchema = void 0;
45
+ exports.messageSchema = exports.fcrVideoStreamTypeSchema = exports.fcrVideoSourceTypeSchema = exports.fcrUserRolesSchema = exports.fcrUserRoleSchema = exports.fcrUserKickedOutTypeSchema = exports.fcrUpdateStreamPrivilegeScopeSchema = exports.fcrUpdateStreamCustomSchema = exports.fcrStreamPrivilegeVideoSourceTypeSchema = exports.fcrStreamPrivilegeOperation = exports.fcrStreamPrivilegeAudioSourceTypeSchema = exports.fcrStreamJoinConfig = exports.fcrStreamBindConfigSchema = exports.fcrStreamBindConfigArrySchema = exports.fcrSizeSchema = exports.fcrSessionBaseSchema = exports.fcrSecuritySendChatPayloadSchema = exports.fcrSecurityPrivateChatConfigSchema = exports.fcrSecurityActionSchema = exports.fcrScreenStreamCreateConfigSize = exports.fcrScreenStreamCreateConfigSchema = exports.fcrRoomSessionParamsSchema = exports.fcrRoomJoinOptionsWithTicketSchema = exports.fcrRoomJoinOptionsSchema = void 0;
46
46
  Object.defineProperty(exports, "numberSchema", {
47
47
  enumerable: true,
48
48
  get: function () {
@@ -260,6 +260,14 @@ const fcrScreenStreamCreateConfigSchema = exports.fcrScreenStreamCreateConfigSch
260
260
  videoSourceId: _imports.stringSchema.optional(),
261
261
  audioSourceId: _imports.stringSchema.optional()
262
262
  });
263
+ const fcrScreenStreamCreateConfigSize = exports.fcrScreenStreamCreateConfigSize = _imports.z.object({
264
+ width: _imports.numberSchema,
265
+ height: _imports.numberSchema
266
+ });
267
+ const fcrSizeSchema = exports.fcrSizeSchema = _imports.z.object({
268
+ width: _imports.numberSchema,
269
+ height: _imports.numberSchema
270
+ }).optional();
263
271
  const fcrGroupCreateConfigArraySchema = exports.fcrGroupCreateConfigArraySchema = _imports.z.array(fcrGroupCreateConfigSchema);
264
272
  const fcrGroupUpdateOptionsArraySchema = exports.fcrGroupUpdateOptionsArraySchema = _imports.z.array(fcrGroupUpdateOptionsSchema);
265
273
  const fcrLocalStreamCreateArrayConfigSchema = exports.fcrLocalStreamCreateArrayConfigSchema = _imports.z.array(fcrMediaStreamCreateConfigSchema);
@@ -1,10 +1,11 @@
1
1
  import { AgoraRestfulClient, AgoraRteEntryRoomResponse } from '../imports';
2
- import { FcrCloudRecordingConfig, FcrGroupCreateConfig, FcrGroupUpdateOptions, FcrLiveStreamingLayoutType, FcrLiveStreamingConfig, FcrSharePermissionProps, FcrAllowWatermarkPayloadBody } from '../type';
2
+ import { FcrCloudRecordingConfig, FcrGroupCreateConfig, FcrGroupUpdateOptions, FcrLiveStreamingLayoutType, FcrLiveStreamingConfig, FcrSharePermissionProps, FcrAllowWatermarkPayloadBody, FcrAnnotationProps } from '../type';
3
3
  import { AgoraRteRegion } from '../imports';
4
4
  import { FcrCheckInParams, FcrChatRoomTokenResData } from './type';
5
5
  import { FcrBoardRegion, FcrSharePermissionState } from '../room-control/whiteboard-control/enums';
6
6
  import { FcrPrivilegeUserRole, FcrSecuritySendChatPayload } from '../room-control/privilege-control/type';
7
7
  import { FcrUserKickedOutType } from '../room-control/user-control/type';
8
+ import { AgoraRteAudioSourceType, AgoraRteMediaPublishState, AgoraRteVideoSourceType } from 'agora-rte-sdk/lib/type';
8
9
  export declare class FcrCoreServiceApi {
9
10
  private _client;
10
11
  protected logger: import("agora-foundation/lib/logger").Logger;
@@ -248,9 +249,21 @@ export declare class FcrCoreServiceApi {
248
249
  };
249
250
  }>;
250
251
  /**
251
- * @description 开 / 关白板
252
+ * @description 获取批注token
252
253
  */
253
- toggleWhiteboardActivityState(roomId: string, state: FcrSharePermissionState): Promise<any>;
254
+ getAnnotationToken({ roomId, userId }: {
255
+ roomId: string;
256
+ userId: string;
257
+ }): Promise<{
258
+ data: {
259
+ boardUserUuid: string;
260
+ boardUserToken: string;
261
+ };
262
+ }>;
263
+ /**
264
+ * @description 开启/关闭屏幕共享标注权限
265
+ */
266
+ toggleAnnotationActivityState(roomId: string, state: FcrSharePermissionState): Promise<any>;
254
267
  /**
255
268
  * @description 启用/禁用屏幕共享&白板
256
269
  */
@@ -285,6 +298,23 @@ export declare class FcrCoreServiceApi {
285
298
  code: number;
286
299
  ts: number;
287
300
  }>;
301
+ /**
302
+ * @description 开 / 关白板
303
+ */
304
+ toggleWhiteboardActivityState(roomId: string, state: FcrSharePermissionState): Promise<any>;
305
+ /**
306
+ * @description 启用/禁用屏幕共享&白板
307
+ */
308
+ toggleAnnotation(params: {
309
+ roomId: string;
310
+ enable: boolean;
311
+ targetRoles: string[];
312
+ payload: FcrAnnotationProps;
313
+ }): Promise<{
314
+ msg: string;
315
+ code: number;
316
+ ts: number;
317
+ }>;
288
318
  /**
289
319
  * @description 修改白板背景
290
320
  */
@@ -307,6 +337,12 @@ export declare class FcrCoreServiceApi {
307
337
  audioSourceUuid?: string;
308
338
  videoSourceState?: number;
309
339
  audioSourceState?: number;
340
+ annotation?: {
341
+ size: {
342
+ width: number;
343
+ height: number;
344
+ };
345
+ };
310
346
  };
311
347
  }): Promise<{
312
348
  data: {
@@ -347,4 +383,29 @@ export declare class FcrCoreServiceApi {
347
383
  closeInterpreter(params: {
348
384
  roomId: string;
349
385
  }): Promise<any>;
386
+ upsertStreamBatch(roomUuid: string, streams: {
387
+ streamName?: string;
388
+ userUuid?: string;
389
+ streamUuid?: string;
390
+ videoState?: AgoraRteMediaPublishState;
391
+ audioState?: AgoraRteMediaPublishState;
392
+ videoSourceType?: AgoraRteVideoSourceType;
393
+ audioSourceType?: AgoraRteAudioSourceType;
394
+ videoSourceUuid?: string;
395
+ audioSourceUuid?: string;
396
+ }[]): Promise<any>;
397
+ updateStreamBatchByCondition({ roomUuid, videoState, audioState, includeRoles, excludeRoles, condition, }: {
398
+ roomUuid: string;
399
+ videoState?: number;
400
+ audioState?: number;
401
+ includeRoles?: string[];
402
+ excludeRoles?: string[];
403
+ condition?: {
404
+ videoSourceType?: number;
405
+ audioSourceType?: number;
406
+ };
407
+ }): Promise<any>;
408
+ deleteStreamBatch(roomUuid: string, streams: {
409
+ streamUuid: string;
410
+ }[]): Promise<any>;
350
411
  }
@@ -848,11 +848,25 @@ class FcrCoreServiceApi {
848
848
  }
849
849
 
850
850
  /**
851
- * @description 开 / 关白板
851
+ * @description 获取批注token
852
852
  */
853
- async toggleWhiteboardActivityState(roomId, state) {
853
+ async getAnnotationToken(_ref21) {
854
+ let {
855
+ roomId,
856
+ userId
857
+ } = _ref21;
854
858
  return this._client.fetch({
855
- path: "/v1/rooms/".concat(roomId, "/widgets/netlessBoard/states/").concat(state),
859
+ path: "/v1/rooms/".concat(roomId, "/users/").concat(userId, "/widgets/annotation/token"),
860
+ method: 'GET'
861
+ });
862
+ }
863
+
864
+ /**
865
+ * @description 开启/关闭屏幕共享标注权限
866
+ */
867
+ async toggleAnnotationActivityState(roomId, state) {
868
+ return this._client.fetch({
869
+ path: "/v1/rooms/".concat(roomId, "/widgets/annotation/states/").concat(state),
856
870
  method: 'PUT'
857
871
  });
858
872
  }
@@ -894,6 +908,36 @@ class FcrCoreServiceApi {
894
908
  });
895
909
  }
896
910
 
911
+ /**
912
+ * @description 开 / 关白板
913
+ */
914
+ async toggleWhiteboardActivityState(roomId, state) {
915
+ return this._client.fetch({
916
+ path: "/v1/rooms/".concat(roomId, "/widgets/netlessBoard/states/").concat(state),
917
+ method: 'PUT'
918
+ });
919
+ }
920
+
921
+ /**
922
+ * @description 启用/禁用屏幕共享&白板
923
+ */
924
+ async toggleAnnotation(params) {
925
+ const {
926
+ roomId,
927
+ enable,
928
+ payload,
929
+ targetRoles
930
+ } = params;
931
+ return this._client.fetch({
932
+ path: "/v1/rooms/".concat(roomId, "/security/annotation/", 1),
933
+ method: 'PUT',
934
+ data: {
935
+ targetRoles,
936
+ payload: _objectSpread({}, payload)
937
+ }
938
+ });
939
+ }
940
+
897
941
  /**
898
942
  * @description 修改白板背景
899
943
  */
@@ -960,5 +1004,46 @@ class FcrCoreServiceApi {
960
1004
  });
961
1005
  return res;
962
1006
  }
1007
+ async upsertStreamBatch(roomUuid, streams) {
1008
+ return await this._client.fetch({
1009
+ path: "/v1/rooms/".concat(roomUuid, "/streams"),
1010
+ method: 'PUT',
1011
+ data: {
1012
+ streams
1013
+ }
1014
+ });
1015
+ }
1016
+ async updateStreamBatchByCondition(_ref22) {
1017
+ let {
1018
+ roomUuid,
1019
+ videoState,
1020
+ audioState,
1021
+ includeRoles,
1022
+ excludeRoles,
1023
+ condition
1024
+ } = _ref22;
1025
+ return await this._client.fetch({
1026
+ path: "/v1/rooms/".concat(roomUuid, "/conditions/streams"),
1027
+ method: 'PUT',
1028
+ data: {
1029
+ includeRoles,
1030
+ excludeRoles,
1031
+ stream: {
1032
+ videoState,
1033
+ audioState
1034
+ },
1035
+ condition
1036
+ }
1037
+ });
1038
+ }
1039
+ async deleteStreamBatch(roomUuid, streams) {
1040
+ return await this._client.fetch({
1041
+ path: "/v1/rooms/".concat(roomUuid, "/streams"),
1042
+ method: 'DELETE',
1043
+ data: {
1044
+ streams
1045
+ }
1046
+ });
1047
+ }
963
1048
  }
964
1049
  exports.FcrCoreServiceApi = FcrCoreServiceApi;
package/lib/type.d.ts CHANGED
@@ -228,6 +228,13 @@ export type FcrSharePermissionProps = {
228
228
  start?: FcrSharePermissionState;
229
229
  write?: FcrSharePermissionState;
230
230
  };
231
+ annotation?: {
232
+ start?: FcrSharePermissionState;
233
+ write?: FcrSharePermissionState;
234
+ };
235
+ };
236
+ export type FcrAnnotationProps = {
237
+ write?: FcrSharePermissionState;
231
238
  };
232
239
  export type FcrVideoRenderConfig = FcrRenderConfigSchema;
233
240
  export type FcrAllowWatermarkPayloadBody = {
@@ -1 +1,3 @@
1
+ import packageInfo from '../../package.json';
1
2
  export declare const getVersion: () => string;
3
+ export declare const getDependenciesInfo: (packageName: keyof typeof packageInfo.dependencies) => string;
@@ -4,9 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.getVersion = void 0;
7
+ exports.getVersion = exports.getDependenciesInfo = void 0;
8
8
  var _package = _interopRequireDefault(require("../../package.json"));
9
9
  const getVersion = () => {
10
10
  return _package.default.version;
11
11
  };
12
- exports.getVersion = getVersion;
12
+ exports.getVersion = getVersion;
13
+ const getDependenciesInfo = packageName => {
14
+ return _package.default.dependencies[packageName];
15
+ };
16
+ exports.getDependenciesInfo = getDependenciesInfo;
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.6.0",
4
+ "version": "3.6.2",
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
@@ -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.6.0",
43
+ "agora-toolchain": "^3.6.2",
44
44
  "core-js": "^3.33.3",
45
45
  "decomment": "^0.9.5",
46
46
  "husky": "^9.0.11",
@@ -54,14 +54,14 @@
54
54
  "dependencies": {
55
55
  "@netless/app-slide": "^0.2.58",
56
56
  "@netless/app-talkative": "^0.1.1",
57
- "@netless/forge-room": "0.1.4",
58
- "@netless/forge-rtm": "0.1.7",
59
- "@netless/forge-whiteboard": "0.1.10",
57
+ "@netless/forge-room": "0.1.12",
58
+ "@netless/forge-rtm": "0.1.12",
59
+ "@netless/forge-whiteboard": "0.1.16",
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.6.0",
64
- "agora-rte-sdk": "^3.6.0",
63
+ "agora-foundation": "^3.6.2",
64
+ "agora-rte-sdk": "^3.6.2",
65
65
  "await-to-js": "^3.0.0",
66
66
  "dayjs": "^1.10.4",
67
67
  "easemob-websdk": "4.8.1",