@reactoo/watchtogether-sdk-js 2.4.40 → 2.5.0
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.
- package/dist/watchtogether-sdk.js +2187 -2418
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/bulk_join_room/bulk_join_room.html +200 -0
- package/example/bulk_join_room/persons_gifs/1.gif +0 -0
- package/example/bulk_join_room/persons_gifs/10.gif +0 -0
- package/example/bulk_join_room/persons_gifs/11.gif +0 -0
- package/example/bulk_join_room/persons_gifs/12.gif +0 -0
- package/example/bulk_join_room/persons_gifs/13.gif +0 -0
- package/example/bulk_join_room/persons_gifs/14.gif +0 -0
- package/example/bulk_join_room/persons_gifs/15.gif +0 -0
- package/example/bulk_join_room/persons_gifs/16.gif +0 -0
- package/example/bulk_join_room/persons_gifs/17.gif +0 -0
- package/example/bulk_join_room/persons_gifs/18.gif +0 -0
- package/example/bulk_join_room/persons_gifs/19.gif +0 -0
- package/example/bulk_join_room/persons_gifs/2.gif +0 -0
- package/example/bulk_join_room/persons_gifs/20.gif +0 -0
- package/example/bulk_join_room/persons_gifs/21.gif +0 -0
- package/example/bulk_join_room/persons_gifs/22.gif +0 -0
- package/example/bulk_join_room/persons_gifs/23.gif +0 -0
- package/example/bulk_join_room/persons_gifs/24.gif +0 -0
- package/example/bulk_join_room/persons_gifs/25.gif +0 -0
- package/example/bulk_join_room/persons_gifs/26.gif +0 -0
- package/example/bulk_join_room/persons_gifs/27.gif +0 -0
- package/example/bulk_join_room/persons_gifs/28.gif +0 -0
- package/example/bulk_join_room/persons_gifs/29.gif +0 -0
- package/example/bulk_join_room/persons_gifs/3.gif +0 -0
- package/example/bulk_join_room/persons_gifs/30.gif +0 -0
- package/example/bulk_join_room/persons_gifs/31.gif +0 -0
- package/example/bulk_join_room/persons_gifs/32.gif +0 -0
- package/example/bulk_join_room/persons_gifs/4.gif +0 -0
- package/example/bulk_join_room/persons_gifs/5.gif +0 -0
- package/example/bulk_join_room/persons_gifs/6.gif +0 -0
- package/example/bulk_join_room/persons_gifs/7.gif +0 -0
- package/example/bulk_join_room/persons_gifs/8.gif +0 -0
- package/example/bulk_join_room/persons_gifs/9.gif +0 -0
- package/example/index.html +19 -13
- package/package.json +8 -8
- package/src/index.js +7 -6
- package/src/models/auth.js +2 -2
- package/src/models/iot.js +81 -70
- package/src/models/room-session.js +31 -12
- package/src/models/room.js +138 -97
- package/src/models/system.js +45 -0
- package/src/models/user.js +11 -6
- package/src/modules/wt-iot.js +124 -74
- package/src/modules/wt-room.js +65 -131
- package/src/modules/wt-utils.js +2 -2
- package/example/shaka-basic-sync.html +0 -137
- package/src/models/iot2.js +0 -119
- package/src/modules/wt-iot2.js +0 -238
|
@@ -54,13 +54,27 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
54
54
|
|
|
55
55
|
syncModule: null,
|
|
56
56
|
playerInterface: null,
|
|
57
|
-
|
|
57
|
+
|
|
58
|
+
get userId() {
|
|
59
|
+
return room.userId;
|
|
60
|
+
},
|
|
61
|
+
get roomId() {
|
|
62
|
+
return roomId;
|
|
63
|
+
},
|
|
64
|
+
get sessionId () {
|
|
65
|
+
return room.sessionId;
|
|
66
|
+
},
|
|
67
|
+
get constructId () {
|
|
68
|
+
return room.constructId;
|
|
69
|
+
},
|
|
70
|
+
|
|
58
71
|
destroy: function () {
|
|
59
72
|
clearTimeout(alpTimeoutId);
|
|
60
73
|
this.detachPlayer();
|
|
61
|
-
return
|
|
74
|
+
return room.destroy()
|
|
62
75
|
.finally(() => {
|
|
63
76
|
this.$clear();
|
|
77
|
+
return true;
|
|
64
78
|
});
|
|
65
79
|
},
|
|
66
80
|
|
|
@@ -92,7 +106,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
92
106
|
},
|
|
93
107
|
|
|
94
108
|
//TODO: refactor restart method
|
|
95
|
-
restart: function (
|
|
109
|
+
restart: function (isObserver = false) {
|
|
96
110
|
|
|
97
111
|
emitter.emit('reconnecting', true);
|
|
98
112
|
room.isRestarting = true;
|
|
@@ -100,7 +114,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
100
114
|
let wasPublished = room._isPublished;
|
|
101
115
|
let handle = room._getHandle(room.handleId);
|
|
102
116
|
let stream = null;
|
|
103
|
-
if (handle
|
|
117
|
+
if (handle?.webrtcStuff?.stream && wasPublished) {
|
|
104
118
|
stream = handle.webrtcStuff.stream;
|
|
105
119
|
}
|
|
106
120
|
|
|
@@ -141,9 +155,9 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
141
155
|
if (msg.videoroom === 'message') {
|
|
142
156
|
if (msg.action === 'pending_shutdown' || msg.action === 'shutting_down') {
|
|
143
157
|
emitter.emit('scaling');
|
|
144
|
-
this.restart(
|
|
158
|
+
this.restart(); // current videoroom was reassigned to a different WebRTC instance
|
|
145
159
|
} else if (msg.action === 'force_restart') {
|
|
146
|
-
this.restart(
|
|
160
|
+
this.restart();
|
|
147
161
|
} else if (msg.action === 'user_update_displayname' || msg.action === 'user_update_avatar' || msg.action === 'user_update_customattributes' || msg.action === 'user_update_privateattributes') {
|
|
148
162
|
emitter.emit('userUpdate', msg.text);
|
|
149
163
|
} else if (msg.action === 'observer_connecting' || msg.action === 'talkback_connecting' || msg.action === 'instructor_connecting') {
|
|
@@ -165,11 +179,16 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
165
179
|
}
|
|
166
180
|
}
|
|
167
181
|
},
|
|
168
|
-
|
|
169
|
-
renderPlayer: function (playerWrapper, fullscreenElement
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
182
|
+
|
|
183
|
+
renderPlayer: function (playerWrapper, fullscreenElement) {
|
|
184
|
+
try {
|
|
185
|
+
this.syncModule = syncUniversal({room, wt, roomSession: this, emitter});
|
|
186
|
+
this.playerInterface = wt.__privates.playerFactory(playerWrapper, fullscreenElement, this.syncModule.getHandlers(), {roomId: room.roomId});
|
|
187
|
+
this.syncModule.initialize({playerInterface: this.playerInterface});
|
|
188
|
+
return true;
|
|
189
|
+
} catch (e) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
173
192
|
},
|
|
174
193
|
|
|
175
194
|
attachPlayer: function (type, inputs) {
|
|
@@ -309,7 +328,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
309
328
|
"request": "configure",
|
|
310
329
|
"bitrate": parseInt(bitrate)
|
|
311
330
|
}
|
|
312
|
-
}).catch(
|
|
331
|
+
}).catch(() => null)
|
|
313
332
|
},
|
|
314
333
|
|
|
315
334
|
switchChannel: (channelId) => {
|
package/src/models/room.js
CHANGED
|
@@ -4,26 +4,44 @@ import roomSession from './room-session';
|
|
|
4
4
|
import streamingSession from "./streaming-session";
|
|
5
5
|
|
|
6
6
|
let room = function () {
|
|
7
|
+
|
|
8
|
+
let roomSessions = [];
|
|
9
|
+
|
|
10
|
+
let setExitListeners = () => {
|
|
11
|
+
window.addEventListener('pagehide', (event) => {
|
|
12
|
+
if (!event.persisted) {
|
|
13
|
+
this.room.destroySessions()
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
window.addEventListener('beforeunload', () => {
|
|
17
|
+
this.room.destroySessions()
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setExitListeners();
|
|
22
|
+
|
|
7
23
|
return {
|
|
8
|
-
|
|
9
|
-
//TODO:
|
|
10
|
-
|
|
24
|
+
|
|
25
|
+
//TODO: new model
|
|
11
26
|
integration: (data = {}) => {
|
|
12
27
|
return this.__privates.auth.__client
|
|
13
|
-
.then(client => client.apis.system.integration({type: this.__instanceType},
|
|
28
|
+
.then(client => client.apis.system.integration({type: this.__instanceType}, {
|
|
29
|
+
requestBody: {...data}, requestInterceptor: (req) => {
|
|
14
30
|
if (!req.headers) {
|
|
15
31
|
req.headers = {};
|
|
16
32
|
}
|
|
17
33
|
req.headers['Authorization'] = 'Bearer ' + localStorage.getItem('rwt_idToken');
|
|
18
34
|
return req;
|
|
19
|
-
}
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
20
37
|
},
|
|
21
|
-
|
|
38
|
+
|
|
39
|
+
//TODO: new model
|
|
22
40
|
getAnalytics: (data = {}) => {
|
|
23
41
|
return this.__privates.auth.__client
|
|
24
42
|
.then(client => client.apis.system.getAnalytics({instanceType: this.__instanceType, ...data}))
|
|
25
43
|
},
|
|
26
|
-
|
|
44
|
+
|
|
27
45
|
sendChatMessage: ({roomId, message, options, senderUserId}) => {
|
|
28
46
|
return this.__privates.auth.__client
|
|
29
47
|
.then(client => client.apis.wt.sendRoomMessage({}, {
|
|
@@ -35,22 +53,8 @@ let room = function () {
|
|
|
35
53
|
}
|
|
36
54
|
}))
|
|
37
55
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
description,
|
|
41
|
-
isPublic,
|
|
42
|
-
isListed,
|
|
43
|
-
isStudioLayout,
|
|
44
|
-
allowedParticipants,
|
|
45
|
-
wtChannelId,
|
|
46
|
-
isHd,
|
|
47
|
-
disableSync,
|
|
48
|
-
reduceRoomControls,
|
|
49
|
-
muteParticipantOnJoin,
|
|
50
|
-
hasStudioChat,
|
|
51
|
-
maxParticipants,
|
|
52
|
-
customAttributes
|
|
53
|
-
} = {}) => {
|
|
56
|
+
|
|
57
|
+
createRoom: ({title, description, isPublic, isListed, isStudioLayout, allowedParticipants, wtChannelId, isHd, disableSync, reduceRoomControls, muteParticipantOnJoin, hasStudioChat, maxParticipants, customAttributes} = {}) => {
|
|
54
58
|
return this.__privates.auth.__client
|
|
55
59
|
.then(client => client.apis.wt.createRoom({}, {
|
|
56
60
|
requestBody: {
|
|
@@ -72,33 +76,12 @@ let room = function () {
|
|
|
72
76
|
}
|
|
73
77
|
}))
|
|
74
78
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
title,
|
|
78
|
-
description,
|
|
79
|
-
isPublic,
|
|
80
|
-
isListed,
|
|
81
|
-
allowedParticipants,
|
|
82
|
-
recordings,
|
|
83
|
-
slug,
|
|
84
|
-
password,
|
|
85
|
-
maxParticipants,
|
|
86
|
-
setInstanceType = false,
|
|
87
|
-
wtChannelId,
|
|
88
|
-
isHd,
|
|
89
|
-
isStudioLayout,
|
|
90
|
-
hasStudioChat,
|
|
91
|
-
reduceRoomControls,
|
|
92
|
-
muteParticipantOnJoin,
|
|
93
|
-
disableSync,
|
|
94
|
-
defaultRegion,
|
|
95
|
-
customAttributes,
|
|
96
|
-
dotAttribute
|
|
97
|
-
} = {}) => {
|
|
79
|
+
|
|
80
|
+
updateRoom: ({roomId, title, description, isPublic, isListed, allowedParticipants, recordings, slug, password, maxParticipants, setInstanceType = false, wtChannelId, isHd, isStudioLayout, hasStudioChat, reduceRoomControls, muteParticipantOnJoin, disableSync, defaultRegion, customAttributes, dotAttribute} = {}) => {
|
|
98
81
|
let _da = dotAttribute
|
|
99
82
|
? (Array.isArray(dotAttribute)
|
|
100
83
|
? dotAttribute.reduce((p, cv) => (p[cv.name] = cv.value) && p || p, {})
|
|
101
|
-
: {[dotAttribute.name]
|
|
84
|
+
: {[dotAttribute.name]: dotAttribute.value})
|
|
102
85
|
: {};
|
|
103
86
|
return this.__privates.auth.__client
|
|
104
87
|
.then(client => client.apis.wt.updateRoom({id: roomId}, {
|
|
@@ -123,19 +106,21 @@ let room = function () {
|
|
|
123
106
|
}
|
|
124
107
|
}))
|
|
125
108
|
},
|
|
109
|
+
|
|
126
110
|
deleteRoom: (roomId) => {
|
|
127
111
|
return this.__privates.auth.__client
|
|
128
112
|
.then(client => client.apis.wt.deleteRoom({id: roomId}))
|
|
129
113
|
},
|
|
114
|
+
|
|
130
115
|
leaveRoom: (roomId) => {
|
|
131
116
|
return this.__privates.auth.__client
|
|
132
117
|
.then(client => client.apis.wt.leave({roomId}))
|
|
133
118
|
},
|
|
134
|
-
|
|
119
|
+
|
|
135
120
|
updateLayout: ({roomId, operation, name, attributeName, value, target}) => {
|
|
136
|
-
|
|
121
|
+
|
|
137
122
|
//operation : clearLayouts, setLayout, setLayouts, unsetLayout, setName, setTarget, setStyle, setAttribute, unsetAttribute,'sendMessage'
|
|
138
|
-
|
|
123
|
+
|
|
139
124
|
return this.__privates.auth.__client
|
|
140
125
|
.then(client => client.apis.wt.updateLayout({}, {
|
|
141
126
|
requestBody: {
|
|
@@ -148,6 +133,7 @@ let room = function () {
|
|
|
148
133
|
}
|
|
149
134
|
}))
|
|
150
135
|
},
|
|
136
|
+
|
|
151
137
|
getInviteUrl: (roomId, domain, url) => {
|
|
152
138
|
return this.__privates.auth.__client
|
|
153
139
|
.then(client => client.apis.wt.invite({}, {
|
|
@@ -158,7 +144,7 @@ let room = function () {
|
|
|
158
144
|
}
|
|
159
145
|
}))
|
|
160
146
|
},
|
|
161
|
-
|
|
147
|
+
|
|
162
148
|
getRoomChatList: ({roomId, type = "normal", size = 50, startKey = null} = {}) => {
|
|
163
149
|
let apiParams = {
|
|
164
150
|
roomId, type,
|
|
@@ -168,18 +154,8 @@ let room = function () {
|
|
|
168
154
|
return this.__privates.auth.__client
|
|
169
155
|
.then(client => client.apis.wt.getRoomChatList(apiParams))
|
|
170
156
|
},
|
|
171
|
-
|
|
172
|
-
getRoomsList: ({
|
|
173
|
-
type = 'participant',
|
|
174
|
-
activeOnly = null,
|
|
175
|
-
instanceType = this.__instanceType,
|
|
176
|
-
size = 20,
|
|
177
|
-
startKey = null,
|
|
178
|
-
includeWtEventModels = false,
|
|
179
|
-
demo = false,
|
|
180
|
-
viewType = 'list',
|
|
181
|
-
wtChannelId = undefined
|
|
182
|
-
} = {}) => {
|
|
157
|
+
|
|
158
|
+
getRoomsList: ({ type = 'participant', activeOnly = null, instanceType = this.__instanceType, size = 20, startKey = null, includeWtEventModels = false, demo = false, viewType = 'list', wtChannelId = undefined} = {}) => {
|
|
183
159
|
let apiParams = {
|
|
184
160
|
type, instanceType,
|
|
185
161
|
size,
|
|
@@ -190,30 +166,30 @@ let room = function () {
|
|
|
190
166
|
...(activeOnly && {activeOnly}),
|
|
191
167
|
...(startKey && {startKey})
|
|
192
168
|
};
|
|
193
|
-
|
|
169
|
+
|
|
194
170
|
return this.__privates.auth.__client
|
|
195
171
|
.then(client => client.apis.wt.getRoomList(apiParams))
|
|
196
|
-
|
|
172
|
+
|
|
197
173
|
},
|
|
198
|
-
|
|
174
|
+
|
|
199
175
|
setUser: ({messageId, userId, roomId, flag, timestamp, option}) => {
|
|
200
176
|
//leave, kick, ban, unban, approve, report
|
|
201
177
|
return this.__privates.auth.__client
|
|
202
178
|
.then(client => client.apis.wt.setUser({messageId, userId, roomId, flag, timestamp, option}));
|
|
203
179
|
},
|
|
204
|
-
|
|
180
|
+
|
|
205
181
|
getRoomById: (id, pinHash = undefined, showPublic = undefined, demo = false) => {
|
|
206
182
|
return this.__privates.auth.__client
|
|
207
183
|
.then(client => client.apis.wt.getRoom({id, pinHash, "public": showPublic, demo}))
|
|
208
|
-
|
|
184
|
+
|
|
209
185
|
},
|
|
210
|
-
|
|
186
|
+
|
|
211
187
|
getRoomBySlug: (slug, password = undefined, showPublic = undefined, demo = false) => {
|
|
212
188
|
return this.__privates.auth.__client
|
|
213
189
|
.then(client => client.apis.wt.getRoom({slug, password, "public": showPublic, demo}))
|
|
214
|
-
|
|
190
|
+
|
|
215
191
|
},
|
|
216
|
-
|
|
192
|
+
|
|
217
193
|
roomRecorder: ({roomId, operation = 'get', config} = {}) => {
|
|
218
194
|
return this.__privates.auth.__client
|
|
219
195
|
.then(client => client.apis.wt.recordRoom({}, {
|
|
@@ -222,16 +198,8 @@ let room = function () {
|
|
|
222
198
|
}
|
|
223
199
|
}))
|
|
224
200
|
},
|
|
225
|
-
|
|
226
|
-
__joinRoom: ({
|
|
227
|
-
roomId,
|
|
228
|
-
pinHash,
|
|
229
|
-
instanceType = this.__instanceType,
|
|
230
|
-
isTalkback = undefined,
|
|
231
|
-
isMonitor = undefined,
|
|
232
|
-
isInstructor = undefined,
|
|
233
|
-
customBearer = undefined
|
|
234
|
-
} = {}) => {
|
|
201
|
+
|
|
202
|
+
__joinRoom: ({roomId, pinHash, instanceType = this.__instanceType, isTalkback = undefined, isMonitor = undefined, isInstructor = undefined, customBearer = undefined} = {}) => {
|
|
235
203
|
return this.__privates.auth.__client
|
|
236
204
|
.then(client => client.apis.wt.join({
|
|
237
205
|
roomId,
|
|
@@ -253,13 +221,17 @@ let room = function () {
|
|
|
253
221
|
} : {})
|
|
254
222
|
}))
|
|
255
223
|
},
|
|
256
|
-
|
|
257
|
-
|
|
224
|
+
|
|
225
|
+
isSafariSupported: () => {
|
|
258
226
|
return this.__privates.room.safariVp8;
|
|
259
227
|
},
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return this.__privates.room.
|
|
228
|
+
|
|
229
|
+
isWebrtcSupported: () => {
|
|
230
|
+
return this.__privates.room.isWebrtcSupported;
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
createStreamingSession: ({constructId, roomId, pinHash, streamId, href, iceServers, accessToken} = {}) => {
|
|
234
|
+
return this.__privates.room.whenInitialized
|
|
263
235
|
.then(lib => streamingSession.call(this, {
|
|
264
236
|
roomId,
|
|
265
237
|
pinHash,
|
|
@@ -267,24 +239,93 @@ let room = function () {
|
|
|
267
239
|
href,
|
|
268
240
|
iceServers,
|
|
269
241
|
accessToken
|
|
270
|
-
}, lib.createSession('streaming'), this))
|
|
242
|
+
}, lib.createSession(constructId, 'streaming'), this))
|
|
243
|
+
.then(newSession => {
|
|
244
|
+
let existingSessionIndex = roomSessions.findIndex(session => session.constructId === newSession.constructId);
|
|
245
|
+
if(existingSessionIndex > -1) {
|
|
246
|
+
return this.room.destroySession(newSession.constructId).then(() => {
|
|
247
|
+
roomSessions.push(newSession);
|
|
248
|
+
return newSession;
|
|
249
|
+
});
|
|
250
|
+
} else {
|
|
251
|
+
roomSessions.push(newSession);
|
|
252
|
+
return newSession;
|
|
253
|
+
}
|
|
254
|
+
})
|
|
271
255
|
},
|
|
272
|
-
|
|
273
|
-
createSession: ({roomId, pinHash, isTalkback, isMonitor, isInstructor, options}) => {
|
|
274
|
-
return this.__privates.room.
|
|
256
|
+
|
|
257
|
+
createSession: ({constructId, roomId, pinHash, isTalkback, isMonitor, isInstructor, options}) => {
|
|
258
|
+
return this.__privates.room.whenInitialized
|
|
275
259
|
.then(lib => roomSession.call(this, {
|
|
276
260
|
roomId,
|
|
277
261
|
pinHash,
|
|
278
262
|
isTalkback,
|
|
279
263
|
isMonitor,
|
|
280
264
|
isInstructor
|
|
281
|
-
}, lib.createSession('reactooroom', options), this))
|
|
265
|
+
}, lib.createSession(constructId, 'reactooroom', options), this))
|
|
266
|
+
.then(newSession => {
|
|
267
|
+
let existingSessionIndex = roomSessions.findIndex(session => session.constructId === newSession.constructId);
|
|
268
|
+
if(existingSessionIndex > -1) {
|
|
269
|
+
return this.room.destroySession(newSession.constructId).then(() => {
|
|
270
|
+
roomSessions.push(newSession);
|
|
271
|
+
return newSession;
|
|
272
|
+
});
|
|
273
|
+
} else {
|
|
274
|
+
roomSessions.push(newSession);
|
|
275
|
+
return newSession;
|
|
276
|
+
}
|
|
277
|
+
})
|
|
282
278
|
},
|
|
283
|
-
|
|
279
|
+
|
|
280
|
+
getSessions: () => {
|
|
281
|
+
return roomSessions;
|
|
282
|
+
},
|
|
283
|
+
getSessionByConstructId: (constructId) => {
|
|
284
|
+
return roomSessions.find(session => session.constructId === constructId) || null
|
|
285
|
+
},
|
|
286
|
+
getSessionBySessionId: (sessionId) => {
|
|
287
|
+
return roomSessions.find(session => session.sessionId === sessionId) || null
|
|
288
|
+
},
|
|
289
|
+
getSessionByRoomId: (roomId) => {
|
|
290
|
+
return roomSessions.find(session => session.roomId === roomId) || null
|
|
291
|
+
},
|
|
292
|
+
getSessionByUserId: (userId) => {
|
|
293
|
+
return roomSessions.find(session => session.userId === userId) || null
|
|
294
|
+
},
|
|
295
|
+
getSessionByStreamId: (streamId) => {
|
|
296
|
+
return roomSessions.find(session => session.streamId === streamId) || null
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
|
|
284
300
|
destroySession: (constructId) => {
|
|
285
|
-
|
|
301
|
+
let sessionIndex = roomSessions.findIndex(session => session.constructId === constructId);
|
|
302
|
+
if (sessionIndex > -1) {
|
|
303
|
+
return roomSessions[sessionIndex].destroy()
|
|
304
|
+
.finally(() => {
|
|
305
|
+
roomSessions.splice(sessionIndex, 1);
|
|
306
|
+
return true
|
|
307
|
+
})
|
|
308
|
+
}
|
|
309
|
+
return Promise.resolve();
|
|
286
310
|
},
|
|
287
|
-
|
|
311
|
+
|
|
312
|
+
destroySessionBySessionId: (sessionId) => {
|
|
313
|
+
let sessionIndex = roomSessions.findIndex(session => session.sessionId === sessionId);
|
|
314
|
+
if (sessionIndex > -1) {
|
|
315
|
+
return roomSessions[sessionIndex].destroy()
|
|
316
|
+
.finally(() => {
|
|
317
|
+
roomSessions.splice(sessionIndex, 1);
|
|
318
|
+
return true
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
return Promise.resolve();
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
destroySessions: () => {
|
|
325
|
+
roomSessions.forEach(session => session.destroy().catch(e => this.log(e)));
|
|
326
|
+
roomSessions.length = 0;
|
|
327
|
+
},
|
|
328
|
+
|
|
288
329
|
queue: ({roomId, operation, userId} = {}) => {
|
|
289
330
|
//Enum: "status" "join" "approve" "reject" "block" "unblock"
|
|
290
331
|
return this.__privates.auth.__client
|
|
@@ -294,13 +335,13 @@ let room = function () {
|
|
|
294
335
|
}
|
|
295
336
|
}))
|
|
296
337
|
},
|
|
297
|
-
|
|
338
|
+
|
|
298
339
|
getDefaultRegions: () => {
|
|
299
340
|
return this.__privates.auth.__client
|
|
300
341
|
.then(client => [...(client.spec?.components?.schemas?.WtRoom?.properties?.defaultRegion?.enum || [''])])
|
|
301
342
|
}
|
|
302
|
-
|
|
303
|
-
|
|
343
|
+
|
|
344
|
+
|
|
304
345
|
}
|
|
305
346
|
};
|
|
306
347
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
let system = function () {
|
|
4
|
+
return {
|
|
5
|
+
integration: (data = {}) => {
|
|
6
|
+
return this.__privates.auth.__client
|
|
7
|
+
.then(client => client.apis.system.integration({type: this.__instanceType}, {
|
|
8
|
+
requestBody: {...data}, requestInterceptor: (req) => {
|
|
9
|
+
if (!req.headers) {
|
|
10
|
+
req.headers = {};
|
|
11
|
+
}
|
|
12
|
+
req.headers['Authorization'] = 'Bearer ' + localStorage.getItem('rwt_idToken');
|
|
13
|
+
return req;
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
getAnalytics: (data = {}) => {
|
|
19
|
+
return this.__privates.auth.__client
|
|
20
|
+
.then(client => client.apis.system.getAnalytics({instanceType: this.__instanceType, ...data}))
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
getTranslation: ({namespace = 'wt'} = {}) => {
|
|
24
|
+
return this.__privates.auth.__client
|
|
25
|
+
.then(client => client.apis.system.getTranslation({namespace}))
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
getConfig: ({instanceType = this.__instanceType, domain = location.hostname} = {}) => {
|
|
29
|
+
return this.__privates.auth.__client
|
|
30
|
+
.then(client => client.apis.system.getConfig({instanceType, domain}));
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
updateConfig: (data = {}) => {
|
|
34
|
+
return this.__privates.auth.__client
|
|
35
|
+
.then(client => client.apis.system.updateConfig({id: data.instanceType || this.__instanceType},{requestBody:{...data}}));
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
getIntegrationPublic: (type, data = {}) => {
|
|
39
|
+
return this.__privates.auth.__client
|
|
40
|
+
.then(client => client.apis.system.integrationPublic({type}, {requestBody:{...data}}))
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default system;
|
package/src/models/user.js
CHANGED
|
@@ -111,28 +111,33 @@ let user = function () {
|
|
|
111
111
|
|
|
112
112
|
track: ({eventType = 'ERROR', message} = {}) => {
|
|
113
113
|
return this.__privates.auth.__client
|
|
114
|
-
.then(client => client.apis.wt.track({},{
|
|
114
|
+
.then(client => client.apis.wt.track({},{
|
|
115
|
+
requestBody:{
|
|
115
116
|
"eventType": eventType,
|
|
116
117
|
"appType": "web",
|
|
117
|
-
"deviceType": `desktop${navigator.maxTouchPoints ? '/
|
|
118
|
+
"deviceType": `desktop${navigator.maxTouchPoints ? '/touch' : ''}`,
|
|
118
119
|
"os": navigator.platform,
|
|
119
120
|
"browser": navigator.userAgent,
|
|
120
121
|
"domain": location.host,
|
|
121
122
|
"url": location.href,
|
|
122
123
|
"message": serializeError(message)
|
|
123
|
-
}
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
124
126
|
},
|
|
125
|
-
|
|
127
|
+
|
|
128
|
+
//TODO: new model
|
|
126
129
|
getTranslation: ({namespace = 'wt'} = {}) => {
|
|
127
130
|
return this.__privates.auth.__client
|
|
128
131
|
.then(client => client.apis.system.getTranslation({namespace}))
|
|
129
132
|
},
|
|
130
|
-
|
|
133
|
+
|
|
134
|
+
//TODO: new model
|
|
131
135
|
getConfig: ({instanceType = this.__instanceType, domain = location.hostname} = {}) => {
|
|
132
136
|
return this.__privates.auth.__client
|
|
133
137
|
.then(client => client.apis.system.getConfig({instanceType, domain}));
|
|
134
138
|
},
|
|
135
|
-
|
|
139
|
+
|
|
140
|
+
//TODO: new model
|
|
136
141
|
getIntegrationPublic: (type, data = {}) => {
|
|
137
142
|
return this.__privates.auth.__client
|
|
138
143
|
.then(client => client.apis.system.integrationPublic({type}, {requestBody:{...data}}))
|