fcr-core 3.4.1 → 3.4.100

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.
@@ -55,7 +55,7 @@ var _agoraRteSdk = require("agora-rte-sdk");
55
55
  var _helper = require("agora-rte-sdk/lib/core/scene/helper");
56
56
  var _mobile = require("../media-control/mobile");
57
57
  var _chatroom = require("../plugins/chatroom");
58
- var _whiteboardControlV = require("../room-control/whiteboard-control-v2");
58
+ var _whiteboardControl = require("../room-control/whiteboard-control");
59
59
  var _privilegeControl = require("../room-control/privilege-control");
60
60
  var _logger = require("../utilities/logger");
61
61
  var _FcrCoreEngine;
@@ -160,7 +160,7 @@ class FcrCoreEngine {
160
160
  const scene = this._rteEngine.createScene({
161
161
  sceneId: roomId
162
162
  });
163
- return new _mainroomControl.FcrMainRoomControlImpl(this._rteEngine, scene, this._apiService, this._config, _type2.FcrRoomType.Mainroom, this._chatConnection, new _chatroom.FcrChatRoomControlImpl(scene, this._chatConnection), new _whiteboardControlV.FcrWhiteboardControlImpl(scene, new _privilegeControl.FcrPrivilegeControlImpl(this._rteEngine, scene, this._apiService), this._apiService, this._rteEngine));
163
+ return new _mainroomControl.FcrMainRoomControlImpl(this._rteEngine, scene, this._apiService, this._config, _type2.FcrRoomType.Mainroom, this._chatConnection, new _chatroom.FcrChatRoomControlImpl(scene, this._chatConnection), new _whiteboardControl.FcrWhiteboardControlImpl(scene, new _privilegeControl.FcrPrivilegeControlImpl(this._rteEngine, scene, this._apiService), this._apiService));
164
164
  }
165
165
 
166
166
  /**
package/lib/imports.d.ts CHANGED
@@ -39,6 +39,7 @@ export { getSharedDomainHolder } from 'agora-rte-sdk/lib/core/services/domain-ho
39
39
  export { AgoraRteScreenCaptureType, AgoraRteVideoOrientation, } from 'agora-rte-sdk/lib/core/media/type';
40
40
  export { registerPlugin } from 'agora-rte-sdk/lib/core/engine/plugin';
41
41
  export { AgoraRteUserUpdatedReason } from 'agora-rte-sdk/lib/core/scene/type';
42
+ export type { AgoraRteUploadEvent } from 'agora-rte-sdk/lib/core/monitor/type';
42
43
  export { FcrCoreEngine } from './engine';
43
44
  export type FcrImageData = ImageData;
44
45
  export type FcrWhiteboardView = HTMLElement;
@@ -43,6 +43,9 @@ class FcrMonitorControlImpl {
43
43
  this._config = _config;
44
44
  this._monitor = engine.getMonitor();
45
45
  }
46
+ async uploadEvent(event) {
47
+ return this._monitor.uploadEvent(event);
48
+ }
46
49
  addObserver(observer) {
47
50
  this._monitor.addObserver(observer);
48
51
  }
@@ -52,4 +55,4 @@ class FcrMonitorControlImpl {
52
55
  }
53
56
  exports.FcrMonitorControlImpl = FcrMonitorControlImpl;
54
57
  _FcrMonitorControlImpl = FcrMonitorControlImpl;
55
- [_initProto] = _applyDecs(_FcrMonitorControlImpl, [[_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"]], []).e;
58
+ [_initProto] = _applyDecs(_FcrMonitorControlImpl, [[_logger.trace, 2, "uploadEvent"], [_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"]], []).e;
@@ -1,8 +1,15 @@
1
- import { FcrPerformanceInfo } from '../type';
1
+ import { FcrMonitorUploadEvent, FcrPerformanceInfo } from '../type';
2
2
  export interface FcrMonitorObserver {
3
3
  onPerformanceInfoUpdated?: (status: FcrPerformanceInfo) => void;
4
4
  }
5
5
  export interface FcrMonitorControl {
6
+ /**
7
+ * Uploads an event to the Agora Real-Time Engagement Monitor.
8
+ * @param event The event to be uploaded.
9
+ * @param success Callback function to be called if the upload is successful.
10
+ * @param failure Callback function to be called if the upload fails, with an error parameter.
11
+ */
12
+ uploadEvent(event: FcrMonitorUploadEvent): Promise<void>;
6
13
  /**
7
14
  * Add an observer to the monitor.
8
15
  * @param observer
@@ -29,6 +29,8 @@ Object.defineProperty(exports, "__esModule", {
29
29
  });
30
30
  exports.FcrChatRoomControlImpl = void 0;
31
31
  require("core-js/modules/es.error.cause.js");
32
+ require("core-js/modules/esnext.async-iterator.map.js");
33
+ require("core-js/modules/esnext.iterator.map.js");
32
34
  require("core-js/modules/web.dom-collections.iterator.js");
33
35
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
34
36
  var _observable = require("agora-foundation/lib/utilities/observable");
@@ -51,6 +53,10 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
51
53
  * @internal
52
54
  */
53
55
  class FcrChatRoomControlImpl {
56
+ _setConnectionState(state) {
57
+ this._connectionState = state;
58
+ this._observable.notifyObservers('onConnectionStateUpdated', this._scene.sceneId, state);
59
+ }
54
60
  get conn() {
55
61
  if (!this._chatConnection.getConnectionInstance()) {
56
62
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'chat room connection not initialized, please get chat room token first', new Error('chat room connection not initialized, please get chat room token first'));
@@ -108,27 +114,24 @@ class FcrChatRoomControlImpl {
108
114
  };
109
115
  return message;
110
116
  }
111
- // TODO: 3.x
112
- // case 'IMAGE': {
113
- // const message: FcrChatRoomReceiveImageMessage = {
114
- // id: msg.id,
115
- // //@ts-ignore
116
- // from: msg.ext.sender,
117
- // type: FcrChatRoomMessageType.Image,
118
- // //@ts-ignore
119
- // timestamp: parseInt(msg.time),
120
- // //@ts-ignore
121
- // file: msg.url,
122
- // //@ts-ignore
123
- // isPrivate: msg.ext.isPrivate,
124
- // };
125
- // return message;
126
- // }
117
+ case 'img':
118
+ {
119
+ var _msg$ext, _msg$ext2;
120
+ const message = {
121
+ id: msg.id,
122
+ from: (_msg$ext = msg.ext) === null || _msg$ext === void 0 ? void 0 : _msg$ext.sender,
123
+ type: _type.FcrChatRoomMessageType.Image,
124
+ timestamp: msg.time,
125
+ url: msg.url || '',
126
+ isPrivate: (_msg$ext2 = msg.ext) === null || _msg$ext2 === void 0 ? void 0 : _msg$ext2.isPrivate
127
+ };
128
+ return message;
129
+ }
127
130
  }
128
131
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown remote message type', new Error('unknown remote message type'));
129
132
  });
130
- (0, _defineProperty2.default)(this, "_convertFcrChatRoomSendBaseMessageToAgoraChatMessage", msg => {
131
- var _message$to;
133
+ (0, _defineProperty2.default)(this, "_convertFcrChatRoomSendBaseMessageToAgoraChatMessage", (msg, progress) => {
134
+ var _message$to, _imageMessage$to;
132
135
  switch (msg.type) {
133
136
  case _type.FcrChatRoomMessageType.Text:
134
137
  const message = msg;
@@ -146,12 +149,36 @@ class FcrChatRoomControlImpl {
146
149
  },
147
150
  receiverList: message.to
148
151
  });
152
+ case _type.FcrChatRoomMessageType.Image:
153
+ const imageMessage = msg;
154
+ const isPrivateImage = !!((_imageMessage$to = imageMessage.to) !== null && _imageMessage$to !== void 0 && _imageMessage$to.length);
155
+ const localUser = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
156
+ return _easemobWebsdk.default.message.create({
157
+ to: this.chatRoomId,
158
+ type: 'img',
159
+ chatType: 'chatRoom',
160
+ url: imageMessage.file.filePath,
161
+ file: {
162
+ filename: imageMessage.file.fileName,
163
+ filetype: imageMessage.file.fileType,
164
+ data: imageMessage.file.data,
165
+ url: ''
166
+ },
167
+ ext: {
168
+ sender: (0, _user.convertRteUserToFcrUser)(localUser),
169
+ roomUuid: this._scene.sceneId,
170
+ isPrivate: isPrivateImage
171
+ },
172
+ receiverList: imageMessage.to,
173
+ onFileUploadProgress: e => {
174
+ progress === null || progress === void 0 || progress(Math.round(e.loaded / e.total * 100));
175
+ }
176
+ });
149
177
  }
150
178
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown local message type', new Error('unknown local message type'));
151
179
  });
152
180
  this._scene = _scene;
153
181
  this._chatConnection = _chatConnection;
154
- this._addLogObserver();
155
182
  this._chatConnection.addObserver(this._chatConnectionObserver);
156
183
  if (this._chatConnection.getConnectionInstance()) {
157
184
  this._addEventListener();
@@ -160,22 +187,74 @@ class FcrChatRoomControlImpl {
160
187
  async join() {
161
188
  await this._joinChatRoom(this._chatConnection.getConnectionState());
162
189
  }
190
+ _removeEventListener() {
191
+ this.conn.removeEventHandler("chatroom".concat(this._scene.sceneId));
192
+ }
193
+ _addEventListener() {
194
+ this._removeEventListener();
195
+ this.conn.addEventHandler("chatroom".concat(this._scene.sceneId), {
196
+ onTextMessage: msg => {
197
+ if (msg.to !== this.chatRoomId) {
198
+ return;
199
+ }
200
+ const message = this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msg);
201
+ this._observable.notifyObservers('onTextMessageReceived', this._scene.sceneId, message);
202
+ }
203
+ });
204
+ this.conn.onPictureMessage = msg => {
205
+ if (msg.to !== this.chatRoomId) {
206
+ return;
207
+ }
208
+ // 这里的数据结构和 onTextMessage 不一样,实际上contentsType是img ,type是chatroom,
209
+ // 但是因为在onPictureMessage的回调中,所以这里直接用type: 'img',后续可以考虑优化
210
+ const message = this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(_objectSpread(_objectSpread({}, msg), {}, {
211
+ type: 'img'
212
+ }));
213
+ this._observable.notifyObservers('onImageMessageReceived', this._scene.sceneId, message);
214
+ };
215
+
216
+ // TODO: 3.x
217
+ // this.conn.onCmdMessage = (msg) => {
218
+ // if (msg.to !== this.initConfig.chatRoomId) {
219
+ // return;
220
+ // }
221
+ // const message: FcrChatRoomReceiveCustomMessage =
222
+ // this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msg);
223
+ // this._observable.notifyObservers('onCustomMessageReceived', this._scene.sceneId, message);
224
+ // };
225
+
226
+ // TODO: 3.x
227
+ // this.conn.onChatroomEvent = (eventData: EasemobChat.ChatroomEvent) => {
228
+ // if (eventData.operation === 'updateAnnouncement') {
229
+ // this._observable.notifyObservers(
230
+ // 'onAnnouncementUpdated',
231
+ // this._scene.sceneId,
232
+ // // TODO: 应该用什么字段传递?
233
+ // (eventData.attributes as { [key: string]: string })?.announcement,
234
+ // );
235
+ // } else if (eventData.operation === 'deleteAnnouncement') {
236
+ // this._observable.notifyObservers('onAnnouncementDeleted', this._scene.sceneId);
237
+ // }
238
+ // };
239
+ }
163
240
  getConnectionState() {
164
241
  return this._connectionState;
165
242
  }
166
- async sendMessage(message) {
243
+ async sendMessage(message, progress) {
167
244
  var _message$to2;
168
- const msg = this._convertFcrChatRoomSendBaseMessageToAgoraChatMessage(message);
169
- await this.conn.send(msg);
245
+ const msg = this._convertFcrChatRoomSendBaseMessageToAgoraChatMessage(message, progress);
246
+ const sendMsgRes = await this.conn.send(msg);
170
247
  const localUserInfo = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
171
248
  const res = _objectSpread(_objectSpread({}, message.type === _type.FcrChatRoomMessageType.Text ? {
172
249
  content: message.content
173
- } : {
174
- file: message.file
250
+ } :
251
+ // @ts-ignore
252
+ {
253
+ url: sendMsgRes.message.url
175
254
  }), {}, {
176
255
  from: (0, _user.convertRteUserToFcrUser)(localUserInfo),
177
256
  id: msg.id,
178
- type: _type.FcrChatRoomMessageType.Text,
257
+ type: message.type,
179
258
  properties: message.properties,
180
259
  timestamp: Date.now(),
181
260
  isPrivate: !!((_message$to2 = message.to) !== null && _message$to2 !== void 0 && _message$to2.length)
@@ -206,107 +285,25 @@ class FcrChatRoomControlImpl {
206
285
  }
207
286
  });
208
287
  }
209
- _removeEventListener() {
210
- this.conn.removeEventHandler("chatroom".concat(this._scene.sceneId));
211
- }
212
- _addEventListener() {
213
- this._removeEventListener();
214
- this.conn.addEventHandler("chatroom".concat(this._scene.sceneId), {
215
- onTextMessage: msg => {
216
- if (msg.to !== this.chatRoomId) {
217
- return;
218
- }
219
- const message = this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msg);
220
- this._observable.notifyObservers('onTextMessageReceived', this._scene.sceneId, message);
288
+ async getHistoryMessageList(pageSize, startedMessageId) {
289
+ if (pageSize > 50) {
290
+ throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'pageSize should be less than 50', new Error('pageSize should be less than 50'));
291
+ }
292
+ const assembleRet = await this.conn.fetchHistoryMessages({
293
+ queue: this.chatRoomId,
294
+ count: pageSize,
295
+ start: startedMessageId,
296
+ isGroup: true,
297
+ fail(error) {
298
+ throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, error.message, new Error('get history message list failed'));
221
299
  }
222
300
  });
223
- // TODO: 3.x
224
- // this.conn.onPictureMessage = (msg) => {
225
- // if (msg.to !== this.initConfig.chatRoomId) {
226
- // return;
227
- // }
228
- // const message: FcrChatRoomReceiveImageMessage =
229
- // this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(
230
- // msg,
231
- // ) as FcrChatRoomReceiveImageMessage;
232
- // this._observable.notifyObservers('onImageMessageReceived', this._scene.sceneId, message);
233
- // };
234
-
235
- // TODO: 3.x
236
- // this.conn.onCmdMessage = (msg) => {
237
- // if (msg.to !== this.initConfig.chatRoomId) {
238
- // return;
239
- // }
240
- // const message: FcrChatRoomReceiveCustomMessage =
241
- // this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msg);
242
- // this._observable.notifyObservers('onCustomMessageReceived', this._scene.sceneId, message);
243
- // };
244
-
245
- // TODO: 3.x
246
- // this.conn.onChatroomEvent = (eventData: EasemobChat.ChatroomEvent) => {
247
- // if (eventData.operation === 'updateAnnouncement') {
248
- // this._observable.notifyObservers(
249
- // 'onAnnouncementUpdated',
250
- // this._scene.sceneId,
251
- // // TODO: 应该用什么字段传递?
252
- // (eventData.attributes as { [key: string]: string })?.announcement,
253
- // );
254
- // } else if (eventData.operation === 'deleteAnnouncement') {
255
- // this._observable.notifyObservers('onAnnouncementDeleted', this._scene.sceneId);
256
- // }
257
- // };
258
- }
259
- _setConnectionState(state) {
260
- this._connectionState = state;
261
- this._observable.notifyObservers('onConnectionStateUpdated', this._scene.sceneId, state);
262
- }
263
- _addLogObserver() {
264
- this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onConnectionStateUpdated', 'onErrorOccurred'
265
- // 'onTextMessageReceived'
266
- ]));
301
+ const ret = assembleRet.map(msgBody => {
302
+ return this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msgBody);
303
+ });
304
+ return ret;
267
305
  }
268
306
 
269
- // TODO: 3.x
270
- // /**
271
- // *
272
- // * @param pageSize max 50
273
- // * @param startedMessageId
274
- // * @returns
275
- // */
276
- // async getHistoryMessageList(
277
- // pageSize: number,
278
- // startedMessageId: string,
279
- // ): Promise<Array<FcrChatRoomReceiveBaseMessage>> {
280
- // if (pageSize > 50) {
281
- // throw generateFcrCoreClientError(
282
- // FcrErrorModuleCode.ROOM_CHATROOM,
283
- // FcrErrorCode.UNDEFINED_ERROR,
284
- // 'pageSize should be less than 50',
285
- // new Error('pageSize should be less than 50'),
286
- // );
287
- // }
288
-
289
- // const assembleRet = await this.conn.fetchHistoryMessages({
290
- // queue: this.initConfig.chatRoomId,
291
- // isGroup: true,
292
- // count: pageSize,
293
- // start: startedMessageId,
294
- // fail(error) {
295
- // throw generateFcrCoreClientError(
296
- // FcrErrorModuleCode.ROOM_CHATROOM,
297
- // FcrErrorCode.UNDEFINED_ERROR,
298
- // error.message,
299
- // new Error('get history message list failed'),
300
- // );
301
- // },
302
- // });
303
-
304
- // const ret: FcrChatRoomReceiveBaseMessage[] = assembleRet.map((msgBody) => {
305
- // return this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msgBody);
306
- // });
307
- // return ret;
308
- // }
309
-
310
307
  // TODO: 3.x
311
308
  // async getAnnouncement(): Promise<string> {
312
309
  // const announcement = await this.conn.fetchChatRoomAnnouncement({
@@ -9,8 +9,9 @@ export interface FcrChatRoomControl {
9
9
  /**
10
10
  * Sends a message to the chat room.
11
11
  * @param message
12
+ * @param onProgress
12
13
  */
13
- sendMessage(message: FcrChatRoomSendBaseMessage): Promise<FcrChatRoomReceiveBaseMessage>;
14
+ sendMessage(message: FcrChatRoomSendBaseMessage, progress?: (progress: number) => void): Promise<FcrChatRoomReceivedBaseMessage>;
14
15
  /**
15
16
  * Adds an observer to the chat room.
16
17
  * @param observer
@@ -21,6 +22,12 @@ export interface FcrChatRoomControl {
21
22
  * @param observer
22
23
  */
23
24
  removeObserver(observer: FcrChatRoomObserver): void;
25
+ /**
26
+ * Gets the history message list of the chat room.
27
+ * @param pageSize
28
+ * @param startedMessageId
29
+ */
30
+ getHistoryMessageList(pageSize: number, startedMessageId?: string): Promise<FcrChatRoomReceivedBaseMessage[]>;
24
31
  }
25
32
  export declare enum FcrChatRoomConnectionState {
26
33
  Disconnected = 0,
@@ -40,7 +47,7 @@ export type FcrChatRoomSendBaseMessage = {
40
47
  export type FcrChatRoomSendTextMessage = FcrChatRoomSendBaseMessage & {
41
48
  content: string;
42
49
  };
43
- export type FcrChatRoomReceiveBaseMessage = {
50
+ export type FcrChatRoomReceivedBaseMessage = {
44
51
  id: string;
45
52
  from: FcrUserInfo;
46
53
  type: FcrChatRoomMessageType;
@@ -48,22 +55,22 @@ export type FcrChatRoomReceiveBaseMessage = {
48
55
  timestamp: number;
49
56
  isPrivate: boolean;
50
57
  };
51
- export type FcrChatRoomReceiveTextMessage = FcrChatRoomReceiveBaseMessage & {
58
+ export type FcrChatRoomReceivedTextMessage = FcrChatRoomReceivedBaseMessage & {
52
59
  content: string;
53
60
  };
54
61
  export type FcrChatRoomFile = {
55
- filename: string;
56
- filetype: string;
57
- url: string;
58
- data: any;
62
+ fileName: string;
63
+ fileType: string;
64
+ filePath?: string;
65
+ data?: any;
59
66
  };
60
- export type FcrChatRoomReceiveImageMessage = FcrChatRoomReceiveBaseMessage & {
61
- file: FcrChatRoomFile;
67
+ export type FcrChatRoomReceivedImageMessage = FcrChatRoomReceivedBaseMessage & {
68
+ url: string;
62
69
  };
63
70
  export type FcrChatRoomSendImageMessage = FcrChatRoomSendBaseMessage & {
64
71
  file: FcrChatRoomFile;
65
72
  };
66
- export type FcrChatRoomReceiveCustomMessage = FcrChatRoomReceiveBaseMessage & {};
73
+ export type FcrChatRoomReceiveCustomMessage = FcrChatRoomReceivedBaseMessage & {};
67
74
  export type FcrChatRoomObserver = {
68
75
  /**
69
76
  * Callback to receive the connection state change of the chat room.
@@ -78,7 +85,7 @@ export type FcrChatRoomObserver = {
78
85
  * @param message
79
86
  * @returns
80
87
  */
81
- onTextMessageReceived?: (roomId: string, message: FcrChatRoomReceiveTextMessage) => void;
88
+ onTextMessageReceived?: (roomId: string, message: FcrChatRoomReceivedTextMessage) => void;
82
89
  /**
83
90
  * Callback when an error occurs.
84
91
  * @param roomId
@@ -86,6 +93,13 @@ export type FcrChatRoomObserver = {
86
93
  * @returns
87
94
  */
88
95
  onErrorOccurred?: (roomId: string, error: FcrError) => void;
96
+ /**
97
+ * Callback to receive the image message sent to the chat room.
98
+ * @param roomId The ID of the chat room.
99
+ * @param message The image message received in the chat room.
100
+ * @returns void
101
+ */
102
+ onImageMessageReceived?: (roomId: string, message: FcrChatRoomReceivedImageMessage) => void;
89
103
  };
90
104
  export type FcrChatRoomControlInitConfig = {
91
105
  appkey: string;
@@ -79,54 +79,42 @@ class FcrBaseRoomControlImpl {
79
79
  this._addSceneObserver();
80
80
  this._addRteEngineObserver();
81
81
  }
82
- // @trace
83
82
  getUserControl() {
84
83
  if (!this._userControl) {
85
84
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'user control not initialized, please join room first', new Error('user control not initialized, please join room first'));
86
85
  }
87
86
  return this._userControl;
88
87
  }
89
- // @trace
90
88
  getBoardControl() {
91
89
  if (!this._whiteboardControl) {
92
90
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'whiteboard control not initialized, please join room first', new Error('whiteboard control not initialized, please join room first'));
93
91
  }
94
92
  return this._whiteboardControl;
95
93
  }
96
-
97
- // @trace
98
94
  getStreamControl() {
99
95
  if (!this._streamControl) {
100
96
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'stream control not initialized, please join room first', new Error('stream control not initialized, please join room first'));
101
97
  }
102
98
  return this._streamControl;
103
99
  }
104
-
105
- // @trace
106
100
  getRoomSessionControl() {
107
101
  if (!this._roomSessionControl) {
108
102
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'room session control not initialized, please join room first', new Error('room session control not initialized, please join room first'));
109
103
  }
110
104
  return this._roomSessionControl;
111
105
  }
112
-
113
- // @trace
114
106
  getChatRoomControl() {
115
107
  if (!this._chatRoomControl) {
116
108
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'chat room control not initialized, please join room first', new Error('chat room control not initialized, please join room first'));
117
109
  }
118
110
  return this._chatRoomControl;
119
111
  }
120
-
121
- // @trace
122
112
  getPrivilegeControl() {
123
113
  if (!this._privilegeControl) {
124
114
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'privilege control not initialized, please join room first', new Error('privilege control not initialized, please join room first'));
125
115
  }
126
116
  return this._privilegeControl;
127
117
  }
128
-
129
- // @trace
130
118
  getRoomConnectorControl() {
131
119
  if (!this._roomConnectorControl) {
132
120
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'room connector control not initialized, please join room first', new Error('room connector control not initialized, please join room first'));
@@ -503,6 +491,6 @@ class FcrBaseRoomControlImpl {
503
491
  */
504
492
  exports.FcrBaseRoomControlImpl = FcrBaseRoomControlImpl;
505
493
  _FcrBaseRoomControlImpl = FcrBaseRoomControlImpl;
506
- [_initProto] = _applyDecs(_FcrBaseRoomControlImpl, [[_logger.trace, 2, "getSyncTimestamp"], [_logger.trace, 2, "getRoomInfo"], [_logger.trace, 2, "getRoomSchedule"], [_logger.trace, 2, "join"], [_logger.trace, 2, "leave"], [_logger.trace, 2, "start"], [_logger.trace, 2, "end"], [_logger.trace, 2, "close"], [_logger.trace, 2, "getRoomState"], [_logger.trace, 2, "getRoomProperties"], [_logger.trace, 2, "getRoomPropertiesByKeyPath"], [_logger.trace, 2, "updateRoomProperties"], [_logger.trace, 2, "updateIncrementRoomProperties"], [_logger.trace, 2, "deleteRoomProperties"], [_logger.trace, 2, "startCloudRecording"], [_logger.trace, 2, "pauseCloudRecording"], [_logger.trace, 2, "resumeCloudRecording"], [_logger.trace, 2, "stopCloudRecording"], [_logger.trace, 2, "getLiveStreamingState"], [_logger.trace, 2, "getLiveStreamingConfig"], [_logger.trace, 2, "startLiveStreaming"], [_logger.trace, 2, "updateLiveStreamingLayout"], [_logger.trace, 2, "stopLiveStreaming"], [_logger.trace, 2, "getCloudRecordingState"], [_logger.trace, 2, "sendRoomMessage"], [_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"]], []).e;
494
+ [_initProto] = _applyDecs(_FcrBaseRoomControlImpl, [[_logger.trace, 2, "getUserControl"], [_logger.trace, 2, "getBoardControl"], [_logger.trace, 2, "getStreamControl"], [_logger.trace, 2, "getRoomSessionControl"], [_logger.trace, 2, "getChatRoomControl"], [_logger.trace, 2, "getPrivilegeControl"], [_logger.trace, 2, "getSyncTimestamp"], [_logger.trace, 2, "getRoomInfo"], [_logger.trace, 2, "getRoomSchedule"], [_logger.trace, 2, "join"], [_logger.trace, 2, "leave"], [_logger.trace, 2, "start"], [_logger.trace, 2, "end"], [_logger.trace, 2, "close"], [_logger.trace, 2, "getRoomState"], [_logger.trace, 2, "getRoomProperties"], [_logger.trace, 2, "getRoomPropertiesByKeyPath"], [_logger.trace, 2, "updateRoomProperties"], [_logger.trace, 2, "updateIncrementRoomProperties"], [_logger.trace, 2, "deleteRoomProperties"], [_logger.trace, 2, "startCloudRecording"], [_logger.trace, 2, "pauseCloudRecording"], [_logger.trace, 2, "resumeCloudRecording"], [_logger.trace, 2, "stopCloudRecording"], [_logger.trace, 2, "getLiveStreamingState"], [_logger.trace, 2, "getLiveStreamingConfig"], [_logger.trace, 2, "startLiveStreaming"], [_logger.trace, 2, "updateLiveStreamingLayout"], [_logger.trace, 2, "stopLiveStreaming"], [_logger.trace, 2, "getCloudRecordingState"], [_logger.trace, 2, "sendRoomMessage"], [_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"]], []).e;
507
495
  class FcrSubRoomControlImpl extends FcrBaseRoomControlImpl {}
508
496
  exports.FcrSubRoomControlImpl = FcrSubRoomControlImpl;
@@ -75,8 +75,6 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
75
75
  this._addLogObserver();
76
76
  this._addSceneMainObserver();
77
77
  }
78
-
79
- // @trace
80
78
  getInterpreterControl() {
81
79
  return this._interpreterControl;
82
80
  }
@@ -90,8 +88,6 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
90
88
  }
91
89
  });
92
90
  }
93
-
94
- // @trace
95
91
  getGroupControl() {
96
92
  return this._groupControl;
97
93
  }
@@ -220,4 +216,4 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
220
216
  }
221
217
  exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
222
218
  _FcrMainRoomControlImpl = FcrMainRoomControlImpl;
223
- [_initProto] = _applyDecs(_FcrMainRoomControlImpl, [[_logger.trace, 2, "join"], [_logger.trace, 2, "leave"], [_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"], [_logger.trace, 2, "enableWaitingRoom"], [_logger.trace, 2, "moveToWaitingRoomByUserIds"], [_logger.trace, 2, "moveToWaitingRoomByUserRoles"], [_logger.trace, 2, "joinWithTicket"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
219
+ [_initProto] = _applyDecs(_FcrMainRoomControlImpl, [[_logger.trace, 2, "getInterpreterControl"], [_logger.trace, 2, "getGroupControl"], [_logger.trace, 2, "join"], [_logger.trace, 2, "leave"], [_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"], [_logger.trace, 2, "enableWaitingRoom"], [_logger.trace, 2, "moveToWaitingRoomByUserIds"], [_logger.trace, 2, "moveToWaitingRoomByUserRoles"], [_logger.trace, 2, "joinWithTicket"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
@@ -67,7 +67,6 @@ class FcrPrivilegeControlImpl {
67
67
  const info = this._scene.getScenePropertiesByKeyPath("security.".concat(action));
68
68
  return this._convertSecurityInfo(info, action);
69
69
  }
70
- // @trace
71
70
  getAllSecurityInfo() {
72
71
  const map = this._scene.getScenePropertiesByKeyPath('security');
73
72
  const securityKeys = Object.keys(map);
@@ -85,7 +84,6 @@ class FcrPrivilegeControlImpl {
85
84
  );
86
85
  return infoListOfTargetRole.map((key) => this._convertSecurityInfo(map[key], key));
87
86
  } */
88
-
89
87
  getLocalUserPermissionInfo(action) {
90
88
  const permissionStringArray = this._scene.getUserPropertiesByKeyPath("permission.list", this._scene.localUser.getLocalUserId());
91
89
  const permissionString = permissionStringArray.find(permission => permission.startsWith(action));
@@ -96,8 +94,6 @@ class FcrPrivilegeControlImpl {
96
94
  }
97
95
  return this._convertPermissionInfo(_helper.FcrPermission.fromString(permissionString), _type2.FcrOperatePermissionType.GET);
98
96
  }
99
-
100
- // @trace
101
97
  getAllLocalUserPermissionInfo() {
102
98
  const permissionStringArray = this._scene.getUserPropertiesByKeyPath("permission.list", this._scene.localUser.getLocalUserId());
103
99
  return permissionStringArray.map(permissionString => this._convertPermissionInfo(_helper.FcrPermission.fromString(permissionString), _type2.FcrOperatePermissionType.GET));
@@ -284,4 +280,4 @@ class FcrPrivilegeControlImpl {
284
280
  }
285
281
  exports.FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
286
282
  _FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
287
- [_initProto] = _applyDecs(_FcrPrivilegeControlImpl, [[_logger.trace, 2, "getSecurityInfo"], [_logger.trace, 2, "getLocalUserPermissionInfo"], [_logger.trace, 2, "enableLockedRoom"], [_logger.trace, 2, "allowShare"], [_logger.trace, 2, "allowWriteBoard"], [_logger.trace, 2, "allowSendChat"], [_logger.trace, 2, "allowStartAudio"], [_logger.trace, 2, "allowStartVideo"], [_logger.trace, 2, "allowJoinWithMutedAudio"], [_logger.trace, 2, "allowWatermark"], [_logger.trace, 2, "allowChangeUserName"]], []).e;
283
+ [_initProto] = _applyDecs(_FcrPrivilegeControlImpl, [[_logger.trace, 2, "getSecurityInfo"], [_logger.trace, 2, "getAllSecurityInfo"], [_logger.trace, 2, "getLocalUserPermissionInfo"], [_logger.trace, 2, "getAllLocalUserPermissionInfo"], [_logger.trace, 2, "enableLockedRoom"], [_logger.trace, 2, "allowShare"], [_logger.trace, 2, "allowWriteBoard"], [_logger.trace, 2, "allowSendChat"], [_logger.trace, 2, "allowStartAudio"], [_logger.trace, 2, "allowStartVideo"], [_logger.trace, 2, "allowJoinWithMutedAudio"], [_logger.trace, 2, "allowWatermark"], [_logger.trace, 2, "allowChangeUserName"]], []).e;
@@ -204,19 +204,15 @@ class FcrStreamControlImpl {
204
204
  this._scene.addObserver(this._sceneObserver);
205
205
  this._scene.streamPlayer.addObserver(this._addSceneStreamPlayerObserver);
206
206
  }
207
- // @trace
208
207
  getStreams() {
209
208
  return this._streamMapByUserId;
210
209
  }
211
- // @trace
212
210
  getStreamList() {
213
211
  return this._streamList;
214
212
  }
215
- // @trace
216
213
  getStreamsByUserId(userId) {
217
214
  return this._scene.getStreamsByUserId(userId).map(this._convertStreamInfo);
218
215
  }
219
- // @trace
220
216
  getStreamByStreamId(streamId) {
221
217
  const streamInfo = this._scene.getStreamByStreamId(streamId);
222
218
  if (streamInfo) {
@@ -354,4 +350,4 @@ class FcrStreamControlImpl {
354
350
  }
355
351
  exports.FcrStreamControlImpl = FcrStreamControlImpl;
356
352
  _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;
353
+ [_initProto] = _applyDecs(_FcrStreamControlImpl, [[[_imports.bound, _logger.trace], 2, "getStreams"], [[_imports.bound, _logger.trace], 2, "getStreamList"], [[_imports.bound, _logger.trace], 2, "getStreamsByUserId"], [[_imports.bound, _logger.trace], 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;
@@ -73,12 +73,12 @@ class FcrUserControlImpl {
73
73
  onRemoteUsersJoined: (roomId, events) => {
74
74
  const fcrUserEvents = events.map(e => {
75
75
  return {
76
- modifiedUser: e.modifiedUser && (0, _user.convertRteUserToFcrUser)(e.modifiedUser),
76
+ userInfo: e.userInfo && (0, _user.convertRteUserToFcrUser)(e.userInfo),
77
77
  operatorUser: e.operatorUser && (0, _user.convertRteUserToFcrUser)(e.operatorUser)
78
78
  };
79
79
  });
80
80
  fcrUserEvents.forEach(event => {
81
- const user = event.modifiedUser;
81
+ const user = event.userInfo;
82
82
  const exists = user.userId in this._userMapByUserId;
83
83
  if (exists) {
84
84
  this.logger.warn("[FcrUserControl] user joined when the user already exists, userId: ".concat(user.userId));
@@ -93,13 +93,14 @@ class FcrUserControlImpl {
93
93
  const fcrUserEvents = events.map(e => {
94
94
  var _e$cause;
95
95
  return {
96
- modifiedUser: e.modifiedUser && (0, _user.convertRteUserToFcrUser)(e.modifiedUser),
96
+ userInfo: e.userInfo && (0, _user.convertRteUserToFcrUser)(e.userInfo),
97
+ userProperties: e.userProperties,
97
98
  operatorUser: e.operatorUser && (0, _user.convertRteUserToFcrUser)(e.operatorUser),
98
99
  reason: ((_e$cause = e.cause) === null || _e$cause === void 0 ? void 0 : _e$cause.cmd) === 5 ? _type2.FcrUserLeftReason.kickOut : _type2.FcrUserLeftReason.LeaveRoom
99
100
  };
100
101
  });
101
102
  fcrUserEvents.forEach(event => {
102
- const user = event.modifiedUser;
103
+ const user = event.userInfo;
103
104
  const exists = user.userId in this._userMapByUserId;
104
105
  if (!exists) {
105
106
  this.logger.warn("[FcrUserControl] user left when the user does not exist, userId: ".concat(user.userId));
@@ -196,20 +197,16 @@ class FcrUserControlImpl {
196
197
  this._addLogObserver();
197
198
  this._scene.addObserver(this._sceneObserver);
198
199
  }
199
- // @trace
200
200
  getLocalUser() {
201
201
  const localUserId = this._scene.localUser.getLocalUserId();
202
202
  return (0, _user.convertRteUserToFcrUser)(this._scene.getUser(localUserId));
203
203
  }
204
- // @trace
205
204
  getUsers() {
206
205
  return this._userMapByUserId;
207
206
  }
208
- // @trace
209
207
  getUserList() {
210
208
  return this._userList;
211
209
  }
212
- // @trace
213
210
  getUser(userId) {
214
211
  const user = this._scene.getUser(userId);
215
212
  if (user) {
@@ -327,4 +324,4 @@ class FcrUserControlImpl {
327
324
  }
328
325
  exports.FcrUserControlImpl = FcrUserControlImpl;
329
326
  _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;
327
+ [_initProto] = _applyDecs(_FcrUserControlImpl, [[[_imports.bound, _logger.trace], 2, "getLocalUser"], [[_imports.bound, _logger.trace], 2, "getUsers"], [[_imports.bound, _logger.trace], 2, "getUserList"], [[_imports.bound, _logger.trace], 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;
@@ -106,11 +106,12 @@ export type FcrUserPageParams = AgoraRteUserPageParams;
106
106
  export type FcrUserPageResponse = AgoraRteUserPageResponse;
107
107
  /** user */
108
108
  export type FcrUserJoinedEvent = {
109
- readonly modifiedUser: FcrUserInfo;
109
+ readonly userInfo: FcrUserInfo;
110
110
  };
111
111
  export type FcrUserLeftEvent = {
112
- readonly modifiedUser: FcrUserInfo;
112
+ readonly userInfo: FcrUserInfo;
113
113
  readonly operatorUser?: FcrUserInfo;
114
+ readonly userProperties?: Record<string, unknown>;
114
115
  readonly reason: FcrUserLeftReason;
115
116
  };
116
117
  export type FcrUserUpdatedEvent = {
@@ -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,8 +1,10 @@
1
1
  import { Room } from '@netless/window-manager';
2
+ import '@netless/appliance-plugin/dist/style.css';
2
3
  import '@netless/window-manager/dist/style.css';
3
4
  import { FcrBoardToolType } from './enums';
4
- import { Color, FcrBoardWindowObserver, FcrBoardMainWindow } from './types';
5
+ import { Color, FcrBoardWindowObserver, FcrBoardMainWindow, FcrBoardPage, FcrBoardEraserSize } from './types';
5
6
  import { FcrPrivilegeControl } from '../privilege-control/type';
7
+ import { FcrBoardSubWindowImpl } from './board-subwindow';
6
8
  export declare class FcrBoardMainWindowImpl implements FcrBoardMainWindow {
7
9
  protected logger: import("agora-foundation/lib/logger").Logger;
8
10
  private _whiteBoardroom;
@@ -18,6 +20,9 @@ export declare class FcrBoardMainWindowImpl implements FcrBoardMainWindow {
18
20
  addObserver(observer: FcrBoardWindowObserver): void;
19
21
  removeObserver(observer: FcrBoardWindowObserver): void;
20
22
  getContentView(): HTMLElement;
23
+ setScale(value: number): void;
24
+ openSubWindowWithTaskId(title: string, taskId: string, urlPrefix?: string): Promise<FcrBoardSubWindowImpl | undefined>;
25
+ openSubWindowWithPageList(title: string, pageList: FcrBoardPage[]): Promise<FcrBoardSubWindowImpl | undefined>;
21
26
  setContainerSizeRatio(ratio: number): Promise<void>;
22
27
  getPageInfo(): {
23
28
  showIndex: number;
@@ -35,9 +40,13 @@ export declare class FcrBoardMainWindowImpl implements FcrBoardMainWindow {
35
40
  setStrokeColor(color: Color): Promise<void>;
36
41
  setTextColor(color: Color): Promise<void>;
37
42
  setTextSize(size: number): Promise<void>;
43
+ setFillColor(fillColor: Color): Promise<void>;
44
+ setEraserSize(size: FcrBoardEraserSize): Promise<void>;
38
45
  setBackgroundColor(color: string): Promise<void>;
39
46
  insertImage(resourceUrl: string, x: number, y: number, width: number, height: number): Promise<void>;
47
+ insertMedia(resourceUrl: string, title?: string): Promise<void>;
40
48
  destroy(): void;
49
+ private _convertToScenes;
41
50
  private _preCheck;
42
51
  private _setBoardWritable;
43
52
  private _addWindowManagerEventListeners;
@@ -33,17 +33,29 @@ require("core-js/modules/es.promise.finally.js");
33
33
  require("core-js/modules/esnext.async-iterator.map.js");
34
34
  require("core-js/modules/esnext.iterator.map.js");
35
35
  require("core-js/modules/web.dom-collections.iterator.js");
36
+ require("core-js/modules/web.url.js");
37
+ require("core-js/modules/web.url.to-json.js");
38
+ require("core-js/modules/web.url-search-params.js");
39
+ require("core-js/modules/web.url-search-params.delete.js");
40
+ require("core-js/modules/web.url-search-params.has.js");
41
+ require("core-js/modules/web.url-search-params.size.js");
36
42
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
37
43
  var _whiteSnapshot = require("@netless/white-snapshot");
38
44
  var _windowManager = require("@netless/window-manager");
45
+ var _appliancePlugin = require("@netless/appliance-plugin");
46
+ require("@netless/appliance-plugin/dist/style.css");
39
47
  require("@netless/window-manager/dist/style.css");
40
48
  var _utils = require("./utils");
41
49
  var _mountManager = require("./mount-manager");
42
50
  var _jsMd = require("js-md5");
43
51
  var _logger = require("../../utilities/logger");
44
52
  var _imports = require("../../imports");
53
+ var _boardSubwindow = require("./board-subwindow");
54
+ var _fullWorker = _interopRequireDefault(require("@netless/appliance-plugin/dist/fullWorker.js?raw"));
55
+ var _subWorker = _interopRequireDefault(require("@netless/appliance-plugin/dist/subWorker.js?raw"));
45
56
  var _FcrBoardMainWindowImpl;
46
- let _initProto;
57
+ let _initProto; //@ts-ignore
58
+ //@ts-ignore
47
59
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
48
60
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
49
61
  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)]; } }; }
@@ -111,10 +123,53 @@ class FcrBoardMainWindowImpl {
111
123
  getContentView() {
112
124
  return this._whiteView;
113
125
  }
114
- async setContainerSizeRatio(ratio) {
126
+ setScale(value) {
115
127
  var _this$_windowManager;
128
+ const scale = Math.max(Math.min(value, 3), -3);
129
+ (_this$_windowManager = this._windowManager) === null || _this$_windowManager === void 0 || _this$_windowManager.moveCamera({
130
+ scale
131
+ });
132
+ }
133
+ async openSubWindowWithTaskId(title, taskId, urlPrefix) {
134
+ var _this$_windowManager2;
135
+ const appId = await ((_this$_windowManager2 = this._windowManager) === null || _this$_windowManager2 === void 0 ? void 0 : _this$_windowManager2.addApp({
136
+ kind: 'Slide',
137
+ options: {
138
+ scenePath: "/ppt".concat(taskId),
139
+ title
140
+ },
141
+ attributes: {
142
+ taskId,
143
+ url: urlPrefix
144
+ }
145
+ }));
146
+ if (appId) {
147
+ var _this$_windowManager3;
148
+ const app = (_this$_windowManager3 = this._windowManager) === null || _this$_windowManager3 === void 0 || (_this$_windowManager3 = _this$_windowManager3.apps) === null || _this$_windowManager3 === void 0 ? void 0 : _this$_windowManager3[appId];
149
+ return app ? new _boardSubwindow.FcrBoardSubWindowImpl(appId) : undefined;
150
+ }
151
+ }
152
+ async openSubWindowWithPageList(title, pageList) {
153
+ var _this$_windowManager4;
154
+ const scenePath = "/".concat(Date.now());
155
+ const appId = await ((_this$_windowManager4 = this._windowManager) === null || _this$_windowManager4 === void 0 ? void 0 : _this$_windowManager4.addApp({
156
+ kind: _windowManager.BuiltinApps.DocsViewer,
157
+ options: {
158
+ scenePath,
159
+ title,
160
+ scenes: this._convertToScenes(pageList)
161
+ }
162
+ }));
163
+ if (appId) {
164
+ var _this$_windowManager5;
165
+ const app = (_this$_windowManager5 = this._windowManager) === null || _this$_windowManager5 === void 0 || (_this$_windowManager5 = _this$_windowManager5.apps) === null || _this$_windowManager5 === void 0 ? void 0 : _this$_windowManager5[appId];
166
+ return app ? new _boardSubwindow.FcrBoardSubWindowImpl(appId) : undefined;
167
+ }
168
+ }
169
+ async setContainerSizeRatio(ratio) {
170
+ var _this$_windowManager6;
116
171
  this._preCheck();
117
- (_this$_windowManager = this._windowManager) === null || _this$_windowManager === void 0 || _this$_windowManager.setContainerSizeRatio(ratio);
172
+ (_this$_windowManager6 = this._windowManager) === null || _this$_windowManager6 === void 0 || _this$_windowManager6.setContainerSizeRatio(ratio);
118
173
  }
119
174
  getPageInfo() {
120
175
  this._preCheck();
@@ -125,31 +180,31 @@ class FcrBoardMainWindowImpl {
125
180
  };
126
181
  }
127
182
  async addPage() {
128
- var _this$_windowManager2;
183
+ var _this$_windowManager7;
129
184
  this._preCheck();
130
- if ((_this$_windowManager2 = this._windowManager) !== null && _this$_windowManager2 !== void 0 && _this$_windowManager2.addPage) {
185
+ if ((_this$_windowManager7 = this._windowManager) !== null && _this$_windowManager7 !== void 0 && _this$_windowManager7.addPage) {
131
186
  await this._windowManager.addPage();
132
187
  await this._windowManager.nextPage();
133
188
  }
134
189
  }
135
190
  async removePage() {
136
- var _this$_windowManager3;
191
+ var _this$_windowManager8;
137
192
  this._preCheck();
138
- if ((_this$_windowManager3 = this._windowManager) !== null && _this$_windowManager3 !== void 0 && _this$_windowManager3.removePage) {
193
+ if ((_this$_windowManager8 = this._windowManager) !== null && _this$_windowManager8 !== void 0 && _this$_windowManager8.removePage) {
139
194
  await this._windowManager.removePage();
140
195
  }
141
196
  }
142
197
  async prevPage() {
143
- var _this$_windowManager4;
198
+ var _this$_windowManager9;
144
199
  this._preCheck();
145
- if ((_this$_windowManager4 = this._windowManager) !== null && _this$_windowManager4 !== void 0 && _this$_windowManager4.prevPage) {
200
+ if ((_this$_windowManager9 = this._windowManager) !== null && _this$_windowManager9 !== void 0 && _this$_windowManager9.prevPage) {
146
201
  await this._windowManager.prevPage();
147
202
  }
148
203
  }
149
204
  async nextPage() {
150
- var _this$_windowManager5;
205
+ var _this$_windowManager10;
151
206
  this._preCheck();
152
- if ((_this$_windowManager5 = this._windowManager) !== null && _this$_windowManager5 !== void 0 && _this$_windowManager5.nextPage) {
207
+ if ((_this$_windowManager10 = this._windowManager) !== null && _this$_windowManager10 !== void 0 && _this$_windowManager10.nextPage) {
153
208
  await this._windowManager.nextPage();
154
209
  }
155
210
  }
@@ -197,9 +252,11 @@ class FcrBoardMainWindowImpl {
197
252
  }
198
253
  }
199
254
  async setStrokeColor(color) {
255
+ var _color$a;
200
256
  this._preCheck();
201
257
  const change = {
202
- strokeColor: [color.r, color.g, color.b]
258
+ strokeColor: [color.r, color.g, color.b],
259
+ strokeOpacity: (_color$a = color.a) !== null && _color$a !== void 0 ? _color$a : 1
203
260
  };
204
261
  this._memberState = _objectSpread(_objectSpread({}, this._memberState), change);
205
262
  if (this._windowManager) {
@@ -207,9 +264,11 @@ class FcrBoardMainWindowImpl {
207
264
  }
208
265
  }
209
266
  async setTextColor(color) {
267
+ var _color$a2;
210
268
  this._preCheck();
211
269
  const change = {
212
- textColor: [color.r, color.g, color.b]
270
+ textColor: [color.r, color.g, color.b],
271
+ textOpacity: (_color$a2 = color.a) !== null && _color$a2 !== void 0 ? _color$a2 : 1
213
272
  };
214
273
  this._memberState = _objectSpread(_objectSpread({}, this._memberState), change);
215
274
  if (this._windowManager) {
@@ -226,6 +285,28 @@ class FcrBoardMainWindowImpl {
226
285
  this._whiteBoardroom.setMemberState(change);
227
286
  }
228
287
  }
288
+ async setFillColor(fillColor) {
289
+ var _fillColor$a;
290
+ this._preCheck();
291
+ const change = {
292
+ fillColor: [fillColor.r, fillColor.g, fillColor.b],
293
+ fillOpacity: (_fillColor$a = fillColor.a) !== null && _fillColor$a !== void 0 ? _fillColor$a : 1
294
+ };
295
+ this._memberState = _objectSpread(_objectSpread({}, this._memberState), change);
296
+ if (this._windowManager) {
297
+ this._whiteBoardroom.setMemberState(change);
298
+ }
299
+ }
300
+ async setEraserSize(size) {
301
+ this._preCheck();
302
+ const change = {
303
+ pencilEraserSize: size
304
+ };
305
+ this._memberState = _objectSpread(_objectSpread({}, this._memberState), change);
306
+ if (this._windowManager) {
307
+ this._whiteBoardroom.setMemberState(change);
308
+ }
309
+ }
229
310
  async setBackgroundColor(color) {
230
311
  var _this$_whiteView$quer;
231
312
  this._preCheck();
@@ -276,6 +357,22 @@ class FcrBoardMainWindowImpl {
276
357
  room.completeImageUpload(uuid, resourceUrl);
277
358
  }
278
359
  }
360
+ async insertMedia(resourceUrl, title) {
361
+ const windowManager = this._windowManager;
362
+ const room = this._whiteBoardroom;
363
+ if (windowManager) {
364
+ windowManager.addApp({
365
+ kind: _windowManager.BuiltinApps.MediaPlayer,
366
+ src: resourceUrl,
367
+ options: {
368
+ title: title
369
+ },
370
+ attributes: {
371
+ url: resourceUrl
372
+ }
373
+ });
374
+ }
375
+ }
279
376
  destroy() {
280
377
  if (this._windowManager) {
281
378
  this._windowManager.destroy();
@@ -283,6 +380,17 @@ class FcrBoardMainWindowImpl {
283
380
  }
284
381
  this._destroyed = true;
285
382
  }
383
+ _convertToScenes(pageList) {
384
+ return pageList.map(page => ({
385
+ name: page.name,
386
+ ppt: {
387
+ src: page.contentUrl,
388
+ width: page.contentWidth,
389
+ height: page.contentHeight,
390
+ previewURL: page.previewUrl
391
+ }
392
+ }));
393
+ }
286
394
  _preCheck() {
287
395
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
288
396
  const {
@@ -360,7 +468,8 @@ class FcrBoardMainWindowImpl {
360
468
  cursor: true,
361
469
  chessboard: false,
362
470
  collectorContainer: options.collectorContainer,
363
- containerSizeRatio: options.containerSizeRatio
471
+ containerSizeRatio: options.containerSizeRatio,
472
+ supportAppliancePlugin: true
364
473
  }).then(async wm => {
365
474
  if (this._destroyed) {
366
475
  wm.destroy();
@@ -377,6 +486,23 @@ class FcrBoardMainWindowImpl {
377
486
  var _this$_whiteView$quer2;
378
487
  (_this$_whiteView$quer2 = this._whiteView.querySelector('.netless-whiteboard')) === null || _this$_whiteView$quer2 === void 0 || _this$_whiteView$quer2.style.setProperty('background-color', this._backgroundColor);
379
488
  }
489
+ const fullWorkerBlob = new Blob([_fullWorker.default], {
490
+ type: 'text/javascript'
491
+ });
492
+ const fullWorkerUrl = URL.createObjectURL(fullWorkerBlob);
493
+ const subWorkerBlob = new Blob([_subWorker.default], {
494
+ type: 'text/javascript'
495
+ });
496
+ const subWorkerUrl = URL.createObjectURL(subWorkerBlob);
497
+ await this._windowManager.switchMainViewToWriter();
498
+ await _appliancePlugin.ApplianceMultiPlugin.getInstance(wm, {
499
+ options: {
500
+ cdn: {
501
+ fullWorkerUrl,
502
+ subWorkerUrl
503
+ }
504
+ }
505
+ });
380
506
  }).catch(e => {
381
507
  this.logger.error('[FcrBoardMainWindow] failed to mount', e);
382
508
  }).finally(() => {
@@ -396,4 +522,4 @@ class FcrBoardMainWindowImpl {
396
522
  }
397
523
  exports.FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
398
524
  _FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
399
- [_initProto] = _applyDecs(_FcrBoardMainWindowImpl, [[[_imports.bound, _logger.trace], 2, "getSnapshotImage"], [_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"], [_logger.trace, 2, "getContentView"], [_logger.trace, 2, "setContainerSizeRatio"], [_logger.trace, 2, "getPageInfo"], [[_imports.bound, _logger.trace], 2, "addPage"], [[_imports.bound, _logger.trace], 2, "removePage"], [_logger.trace, 2, "prevPage"], [_logger.trace, 2, "nextPage"], [[_imports.bound, _logger.trace], 2, "undo"], [[_imports.bound, _logger.trace], 2, "redo"], [[_imports.bound, _logger.trace], 2, "clean"], [[_imports.bound, _logger.trace], 2, "setToolType"], [[_imports.bound, _logger.trace], 2, "setStrokeWidth"], [[_imports.bound, _logger.trace], 2, "setStrokeColor"], [[_imports.bound, _logger.trace], 2, "setTextColor"], [[_imports.bound, _logger.trace], 2, "setTextSize"], [[_imports.bound, _logger.trace], 2, "setBackgroundColor"], [[_imports.bound, _logger.trace], 2, "insertImage"], [_logger.trace, 2, "destroy"], [_imports.bound, 2, "_updateOperationPrivilege"], [_imports.bound, 2, "_mount"]], []).e;
525
+ [_initProto] = _applyDecs(_FcrBoardMainWindowImpl, [[[_imports.bound, _logger.trace], 2, "getSnapshotImage"], [_logger.trace, 2, "addObserver"], [_logger.trace, 2, "removeObserver"], [_logger.trace, 2, "getContentView"], [_imports.bound, 2, "setScale"], [_imports.bound, 2, "openSubWindowWithTaskId"], [_imports.bound, 2, "openSubWindowWithPageList"], [_logger.trace, 2, "getPageInfo"], [[_imports.bound, _logger.trace], 2, "addPage"], [[_imports.bound, _logger.trace], 2, "removePage"], [_logger.trace, 2, "prevPage"], [_logger.trace, 2, "nextPage"], [[_imports.bound, _logger.trace], 2, "undo"], [[_imports.bound, _logger.trace], 2, "redo"], [[_imports.bound, _logger.trace], 2, "clean"], [[_imports.bound, _logger.trace], 2, "setToolType"], [[_imports.bound, _logger.trace], 2, "setStrokeWidth"], [[_imports.bound, _logger.trace], 2, "setStrokeColor"], [[_imports.bound, _logger.trace], 2, "setTextColor"], [[_imports.bound, _logger.trace], 2, "setTextSize"], [[_imports.bound, _logger.trace], 2, "setFillColor"], [[_imports.bound, _logger.trace], 2, "setEraserSize"], [[_imports.bound, _logger.trace], 2, "setBackgroundColor"], [[_imports.bound, _logger.trace], 2, "insertImage"], [[_imports.bound, _logger.trace], 2, "insertMedia"], [_logger.trace, 2, "destroy"], [_imports.bound, 2, "_updateOperationPrivilege"], [_imports.bound, 2, "_mount"]], []).e;
@@ -31,9 +31,11 @@ require("core-js/modules/esnext.async-iterator.map.js");
31
31
  require("core-js/modules/esnext.iterator.map.js");
32
32
  require("core-js/modules/web.dom-collections.iterator.js");
33
33
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
34
+ var _appSlide = _interopRequireDefault(require("@netless/app-slide"));
34
35
  var _whiteWebSdk = require("white-web-sdk");
35
36
  var netlessVideoPlugin = _interopRequireWildcard(require("@netless/video-js-plugin"));
36
37
  var _windowManager = require("@netless/window-manager");
38
+ var _appliancePlugin = require("@netless/appliance-plugin");
37
39
  var _utils = require("./utils");
38
40
  var _observable = require("agora-foundation/lib/utilities/observable");
39
41
  var _asyncRetry = require("agora-foundation/lib/utilities/async-retry");
@@ -99,7 +101,10 @@ class FcrWhiteboardControlImpl {
99
101
  }
100
102
  }
101
103
  });
102
- this._addLogObserver();
104
+ _windowManager.WindowManager.register({
105
+ kind: 'Slide',
106
+ src: _appSlide.default
107
+ });
103
108
  }
104
109
  async active() {
105
110
  return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.ON), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'active failed');
@@ -155,7 +160,7 @@ class FcrWhiteboardControlImpl {
155
160
  disableNewPencil: false,
156
161
  disableEraseImage: false,
157
162
  wrappedComponents: [],
158
- invisiblePlugins: [_windowManager.WindowManager],
163
+ invisiblePlugins: [_windowManager.WindowManager, _appliancePlugin.ApplianceMultiPlugin],
159
164
  useMultiViews: true,
160
165
  disableMagixEventDispatchLimit: true,
161
166
  userPayload: {
@@ -54,7 +54,13 @@ export type Color = {
54
54
  r: number;
55
55
  g: number;
56
56
  b: number;
57
+ a?: number;
57
58
  };
59
+ export declare enum FcrBoardEraserSize {
60
+ SMALL = 1,
61
+ MEDIUM = 2,
62
+ LARGE = 3
63
+ }
58
64
  export type BoardState = {
59
65
  strokeColor: Color;
60
66
  strokeWidth: number;
@@ -246,6 +252,16 @@ export interface FcrBoardMainWindow {
246
252
  * @param textSize
247
253
  */
248
254
  setTextSize(textSize: number): Promise<void>;
255
+ /**
256
+ * Sets the fill color.
257
+ * @param color
258
+ */
259
+ setFillColor(color: Color): Promise<void>;
260
+ /**
261
+ * Set eraser size.
262
+ * @param size small: 1, medium: 2, large: 3
263
+ */
264
+ setEraserSize(size: FcrBoardEraserSize): Promise<void>;
249
265
  /**
250
266
  * Inserts an image.
251
267
  * @param resourceUrl
@@ -255,6 +271,12 @@ export interface FcrBoardMainWindow {
255
271
  * @param height
256
272
  */
257
273
  insertImage(resourceUrl: string, x: number, y: number, width: number, height: number): Promise<void>;
274
+ /**
275
+ * Inserts a media.
276
+ * @param resourceUrl
277
+ * @param title
278
+ */
279
+ insertMedia(resourceUrl: string, title?: string): Promise<void>;
258
280
  /**
259
281
  * Gets the content view.
260
282
  */
@@ -264,6 +286,24 @@ export interface FcrBoardMainWindow {
264
286
  * @param ratio
265
287
  */
266
288
  setContainerSizeRatio(ratio: number): Promise<void>;
289
+ /**
290
+ * open the sub window with task id.
291
+ * @param title
292
+ * @param taskId
293
+ * @param urlPrefix
294
+ */
295
+ openSubWindowWithTaskId(title: string, taskId: string, urlPrefix?: string): Promise<FcrBoardSubWindow | undefined>;
296
+ /**
297
+ * open the sub window with page list.
298
+ * @param title
299
+ * @param pageList
300
+ */
301
+ openSubWindowWithPageList(title: string, pageList: FcrBoardPage[]): Promise<FcrBoardSubWindow | undefined>;
302
+ /**
303
+ * set scale.
304
+ * @param scale
305
+ */
306
+ setScale(scale: number): void;
267
307
  /**
268
308
  * Adds an observer to the main window.
269
309
  * @param observer
@@ -275,6 +315,9 @@ export interface FcrBoardMainWindow {
275
315
  */
276
316
  removeObserver(observer: FcrBoardWindowObserver): void;
277
317
  }
318
+ export interface FcrBoardSubWindow {
319
+ exportPdf(): Promise<ArrayBuffer>;
320
+ }
278
321
  export type FcrBoardInfo = {
279
322
  state: FcrSharePermissionState;
280
323
  isActive: boolean;
@@ -3,7 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FcrBoardInactiveReason = void 0;
6
+ exports.FcrBoardInactiveReason = exports.FcrBoardEraserSize = void 0;
7
+ let FcrBoardEraserSize = exports.FcrBoardEraserSize = /*#__PURE__*/function (FcrBoardEraserSize) {
8
+ FcrBoardEraserSize[FcrBoardEraserSize["SMALL"] = 1] = "SMALL";
9
+ FcrBoardEraserSize[FcrBoardEraserSize["MEDIUM"] = 2] = "MEDIUM";
10
+ FcrBoardEraserSize[FcrBoardEraserSize["LARGE"] = 3] = "LARGE";
11
+ return FcrBoardEraserSize;
12
+ }({});
7
13
  let FcrBoardInactiveReason = exports.FcrBoardInactiveReason = /*#__PURE__*/function (FcrBoardInactiveReason) {
8
14
  FcrBoardInactiveReason[FcrBoardInactiveReason["CLOSE"] = 1] = "CLOSE";
9
15
  FcrBoardInactiveReason[FcrBoardInactiveReason["TIMEOUT"] = 2] = "TIMEOUT";
@@ -45,7 +45,7 @@ export declare const defaultStrokeColor: {
45
45
  };
46
46
  export declare const defaultTextSize = 24;
47
47
  export declare const mediaMimeTypes: Record<string, string>;
48
- export declare const convertToNetlessBoardTool: (tool: FcrBoardToolType) => never[] | readonly [ApplianceNames.selector] | readonly [ApplianceNames.pencilEraser] | readonly [ApplianceNames.laserPointer] | readonly [ApplianceNames.hand] | readonly [ApplianceNames.text] | readonly [ApplianceNames.arrow] | readonly [ApplianceNames.rectangle] | readonly [ApplianceNames.ellipse] | readonly [ApplianceNames.straight] | readonly [ApplianceNames.pencil] | readonly [ApplianceNames.shape, ShapeType.Triangle] | readonly [ApplianceNames.shape, ShapeType.Pentagram] | readonly [ApplianceNames.shape, ShapeType.Rhombus];
48
+ export declare const convertToNetlessBoardTool: (tool: FcrBoardToolType) => never[] | readonly [ApplianceNames.selector] | readonly [ApplianceNames.pencilEraser] | readonly [ApplianceNames.laserPointer] | readonly [ApplianceNames.hand] | readonly [ApplianceNames.text] | readonly [ApplianceNames.arrow] | readonly [ApplianceNames.rectangle] | readonly [ApplianceNames.ellipse] | readonly [ApplianceNames.straight] | readonly [ApplianceNames.pencil] | readonly [ApplianceNames.shape, ShapeType.Triangle] | readonly [ApplianceNames.shape, ShapeType.Pentagram] | readonly [ApplianceNames.shape, ShapeType.Rhombus] | readonly [ApplianceNames.clicker];
49
49
  export declare const convertToFcrBoardToolShape: (tool?: ApplianceNames, shape?: ShapeType) => FcrBoardToolType[] | (FcrBoardShape | undefined)[];
50
50
  export declare const hexColorToWhiteboardColor: (val: string) => number[];
51
51
  export declare const src2DataURL: (src: string) => Promise<string>;
@@ -198,6 +198,8 @@ const convertToNetlessBoardTool = tool => {
198
198
  return [_enums.ApplianceNames.shape, _enums.ShapeType.Pentagram];
199
199
  case _enums.FcrBoardToolType.RHOMBUS:
200
200
  return [_enums.ApplianceNames.shape, _enums.ShapeType.Rhombus];
201
+ case _enums.FcrBoardToolType.NONE:
202
+ return [_enums.ApplianceNames.clicker];
201
203
  default:
202
204
  return [];
203
205
  }
package/lib/type.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AgoraRtcNetworkStats, AgoraRteNetworkQualityEvent, AgoraRtcDeviceInfo, AgoraRtcDisplayInfo, AgoraRtcWindowInfo, AgoraRtePerformanceInfo, AgoraRteScenePropertiesDeletedEvent, AgoraRteStreamEncryptionConfig, AgoraRteStreamJoinConfig, AgoraRteDualVideoStreamConfig, AgoraRteMessage, AgoraRteConnectionState, AgoraRteScenePropertiesUpdatedEvent, AgoraRteOperatCause, AgoraRteRenderView, AgoraRteVideoEncoderConfig, AgoraRteLatencyLevel } from './imports';
1
+ import { AgoraRtcNetworkStats, AgoraRteNetworkQualityEvent, AgoraRtcDeviceInfo, AgoraRtcDisplayInfo, AgoraRtcWindowInfo, AgoraRtePerformanceInfo, AgoraRteScenePropertiesDeletedEvent, AgoraRteStreamEncryptionConfig, AgoraRteStreamJoinConfig, AgoraRteDualVideoStreamConfig, AgoraRteMessage, AgoraRteConnectionState, AgoraRteScenePropertiesUpdatedEvent, AgoraRteOperatCause, AgoraRteRenderView, AgoraRteUploadEvent, AgoraRteVideoEncoderConfig, AgoraRteLatencyLevel } from './imports';
2
2
  import { FcrSharePermissionState } from './room-control/whiteboard-control/enums';
3
3
  import { FcrUserLeftReason } from './room-control/user-control/type';
4
4
  import { FcrAudioSourceType, FcrMediaSourceState, FcrRegion, FcrRoomConnectorType, FcrStreamType, FcrVideoRenderMode, FcrVideoSourceType } from '.';
@@ -251,4 +251,5 @@ export declare enum RoomMessageKey {
251
251
  USER_WAITING_ROOM_JOINED = "USER_WAITING_ROOM_JOINED"
252
252
  }
253
253
  export type FcrRenderView = AgoraRteRenderView;
254
+ export type FcrMonitorUploadEvent = AgoraRteUploadEvent;
254
255
  export {};
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.100",
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
@@ -52,14 +52,16 @@
52
52
  "typescript": "^5.3.2"
53
53
  },
54
54
  "dependencies": {
55
+ "@netless/app-docs-viewer": "^0.2.17",
55
56
  "@netless/app-slide": "^0.2.58",
56
57
  "@netless/app-talkative": "^0.1.1",
58
+ "@netless/appliance-plugin": "^1.1.9",
57
59
  "@netless/forge-room": "0.1.4",
58
60
  "@netless/forge-rtm": "^0.1.6",
59
61
  "@netless/forge-whiteboard": "0.1.10",
60
62
  "@netless/video-js-plugin": "^0.3.8",
61
63
  "@netless/white-snapshot": "^0.4.2",
62
- "@netless/window-manager": "^0.4.72",
64
+ "@netless/window-manager": "^1.0.0",
63
65
  "agora-foundation": "^3.4.1",
64
66
  "agora-rte-sdk": "^3.4.1",
65
67
  "await-to-js": "^3.0.0",