@whereby.com/core 0.9.2 → 0.10.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/index.cjs +183 -111
- package/dist/index.d.cts +133 -32
- package/dist/index.d.mts +133 -32
- package/dist/index.d.ts +133 -32
- package/dist/index.mjs +177 -111
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13,6 +13,16 @@ function createAppAsyncThunk(typePrefix, payloadCreator) {
|
|
|
13
13
|
function createAppThunk(thunk) {
|
|
14
14
|
return thunk;
|
|
15
15
|
}
|
|
16
|
+
function createAppAuthorizedThunk(authorizationSelector, thunk) {
|
|
17
|
+
return createAppThunk((payload) => (dispatch, getState, extra) => {
|
|
18
|
+
const isAuthorized = authorizationSelector(getState());
|
|
19
|
+
if (!isAuthorized) {
|
|
20
|
+
console.warn("Not authorized to perform this action");
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return thunk(payload)(dispatch, getState, extra);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
16
26
|
|
|
17
27
|
const listenerMiddleware = toolkit.createListenerMiddleware();
|
|
18
28
|
const startAppListening = listenerMiddleware.startListening;
|
|
@@ -35,13 +45,12 @@ const createReactor = (selectors, callback) => {
|
|
|
35
45
|
});
|
|
36
46
|
};
|
|
37
47
|
|
|
38
|
-
const coreVersion = "0.
|
|
48
|
+
const coreVersion = "0.10.0";
|
|
39
49
|
|
|
40
|
-
const initialState$
|
|
50
|
+
const initialState$d = {
|
|
41
51
|
isNodeSdk: false,
|
|
42
52
|
wantsToJoin: false,
|
|
43
53
|
roomName: null,
|
|
44
|
-
roomKey: null,
|
|
45
54
|
roomUrl: null,
|
|
46
55
|
displayName: null,
|
|
47
56
|
userAgent: `core:${coreVersion}`,
|
|
@@ -49,7 +58,7 @@ const initialState$c = {
|
|
|
49
58
|
};
|
|
50
59
|
const appSlice = toolkit.createSlice({
|
|
51
60
|
name: "app",
|
|
52
|
-
initialState: initialState$
|
|
61
|
+
initialState: initialState$d,
|
|
53
62
|
reducers: {
|
|
54
63
|
doAppJoin: (state, action) => {
|
|
55
64
|
const url = new URL(action.payload.roomUrl);
|
|
@@ -58,17 +67,13 @@ const appSlice = toolkit.createSlice({
|
|
|
58
67
|
appLeft: (state) => {
|
|
59
68
|
return Object.assign(Object.assign({}, state), { wantsToJoin: false });
|
|
60
69
|
},
|
|
61
|
-
setRoomKey: (state, action) => {
|
|
62
|
-
return Object.assign(Object.assign({}, state), { roomKey: action.payload });
|
|
63
|
-
},
|
|
64
70
|
},
|
|
65
71
|
});
|
|
66
|
-
const { doAppJoin, appLeft
|
|
72
|
+
const { doAppJoin, appLeft } = appSlice.actions;
|
|
67
73
|
const selectAppRaw = (state) => state.app;
|
|
68
74
|
const selectAppWantsToJoin = (state) => state.app.wantsToJoin;
|
|
69
75
|
const selectAppRoomName = (state) => state.app.roomName;
|
|
70
76
|
const selectAppRoomUrl = (state) => state.app.roomUrl;
|
|
71
|
-
const selectAppRoomKey = (state) => state.app.roomKey;
|
|
72
77
|
const selectAppDisplayName = (state) => state.app.displayName;
|
|
73
78
|
const selectAppUserAgent = (state) => state.app.userAgent;
|
|
74
79
|
const selectAppExternalId = (state) => state.app.externalId;
|
|
@@ -91,6 +96,7 @@ const signalEvents = {
|
|
|
91
96
|
newClient: createSignalEventAction("newClient"),
|
|
92
97
|
roomJoined: createSignalEventAction("roomJoined"),
|
|
93
98
|
roomKnocked: createSignalEventAction("roomKnocked"),
|
|
99
|
+
roomLocked: createSignalEventAction("roomLocked"),
|
|
94
100
|
roomSessionEnded: createSignalEventAction("roomSessionEnded"),
|
|
95
101
|
screenshareStarted: createSignalEventAction("screenshareStarted"),
|
|
96
102
|
screenshareStopped: createSignalEventAction("screenshareStopped"),
|
|
@@ -142,13 +148,13 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
142
148
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
143
149
|
};
|
|
144
150
|
|
|
145
|
-
const initialState$
|
|
151
|
+
const initialState$c = {
|
|
146
152
|
isFetching: false,
|
|
147
153
|
data: null,
|
|
148
154
|
};
|
|
149
155
|
const deviceCredentialsSlice = toolkit.createSlice({
|
|
150
156
|
name: "deviceCredentials",
|
|
151
|
-
initialState: initialState$
|
|
157
|
+
initialState: initialState$c,
|
|
152
158
|
reducers: {},
|
|
153
159
|
extraReducers: (builder) => {
|
|
154
160
|
builder.addCase(doGetDeviceCredentials.pending, (state) => {
|
|
@@ -197,6 +203,7 @@ function forwardSocketEvents(socket, dispatch) {
|
|
|
197
203
|
socket.on("chat_message", (payload) => dispatch(signalEvents.chatMessage(payload)));
|
|
198
204
|
socket.on("disconnect", () => dispatch(signalEvents.disconnect()));
|
|
199
205
|
socket.on("room_knocked", (payload) => dispatch(signalEvents.roomKnocked(payload)));
|
|
206
|
+
socket.on("room_locked", (payload) => dispatch(signalEvents.roomLocked(payload)));
|
|
200
207
|
socket.on("room_session_ended", (payload) => dispatch(signalEvents.roomSessionEnded(payload)));
|
|
201
208
|
socket.on("knocker_left", (payload) => dispatch(signalEvents.knockerLeft(payload)));
|
|
202
209
|
socket.on("knock_handled", (payload) => dispatch(signalEvents.knockHandled(payload)));
|
|
@@ -215,7 +222,7 @@ function createSocket() {
|
|
|
215
222
|
};
|
|
216
223
|
return new media.ServerSocket(socketHost, socketOverrides);
|
|
217
224
|
}
|
|
218
|
-
const initialState$
|
|
225
|
+
const initialState$b = {
|
|
219
226
|
deviceIdentified: false,
|
|
220
227
|
isIdentifyingDevice: false,
|
|
221
228
|
status: "",
|
|
@@ -223,7 +230,7 @@ const initialState$a = {
|
|
|
223
230
|
};
|
|
224
231
|
const signalConnectionSlice = toolkit.createSlice({
|
|
225
232
|
name: "signalConnection",
|
|
226
|
-
initialState: initialState$
|
|
233
|
+
initialState: initialState$b,
|
|
227
234
|
reducers: {
|
|
228
235
|
socketConnecting: (state) => {
|
|
229
236
|
return Object.assign(Object.assign({}, state), { status: "connecting" });
|
|
@@ -322,92 +329,6 @@ createReactor([selectShouldIdentifyDevice, selectDeviceCredentialsRaw], ({ dispa
|
|
|
322
329
|
}
|
|
323
330
|
});
|
|
324
331
|
|
|
325
|
-
const initialState$9 = {
|
|
326
|
-
chatMessages: [],
|
|
327
|
-
};
|
|
328
|
-
const chatSlice = toolkit.createSlice({
|
|
329
|
-
name: "chat",
|
|
330
|
-
initialState: initialState$9,
|
|
331
|
-
reducers: {},
|
|
332
|
-
extraReducers(builder) {
|
|
333
|
-
builder.addCase(signalEvents.chatMessage, (state, action) => {
|
|
334
|
-
const message = {
|
|
335
|
-
senderId: action.payload.senderId,
|
|
336
|
-
timestamp: action.payload.timestamp,
|
|
337
|
-
text: action.payload.text,
|
|
338
|
-
};
|
|
339
|
-
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, message] });
|
|
340
|
-
});
|
|
341
|
-
},
|
|
342
|
-
});
|
|
343
|
-
const doSendChatMessage = createAppThunk((payload) => (_, getState) => {
|
|
344
|
-
const state = getState();
|
|
345
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
346
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("chat_message", { text: payload.text });
|
|
347
|
-
});
|
|
348
|
-
const selectChatRaw = (state) => state.chat;
|
|
349
|
-
const selectChatMessages = (state) => state.chat.chatMessages;
|
|
350
|
-
|
|
351
|
-
const initialCloudRecordingState = {
|
|
352
|
-
isRecording: false,
|
|
353
|
-
error: null,
|
|
354
|
-
startedAt: undefined,
|
|
355
|
-
};
|
|
356
|
-
const cloudRecordingSlice = toolkit.createSlice({
|
|
357
|
-
name: "cloudRecording",
|
|
358
|
-
initialState: initialCloudRecordingState,
|
|
359
|
-
reducers: {
|
|
360
|
-
recordingRequestStarted: (state) => {
|
|
361
|
-
return Object.assign(Object.assign({}, state), { status: "requested" });
|
|
362
|
-
},
|
|
363
|
-
},
|
|
364
|
-
extraReducers: (builder) => {
|
|
365
|
-
builder.addCase(signalEvents.cloudRecordingStopped, (state) => {
|
|
366
|
-
return Object.assign(Object.assign({}, state), { isRecording: false, status: undefined });
|
|
367
|
-
});
|
|
368
|
-
builder.addCase(signalEvents.cloudRecordingStarted, (state, action) => {
|
|
369
|
-
const { payload } = action;
|
|
370
|
-
if (!payload.error) {
|
|
371
|
-
return state;
|
|
372
|
-
}
|
|
373
|
-
return Object.assign(Object.assign({}, state), { isRecording: false, status: "error", error: payload.error });
|
|
374
|
-
});
|
|
375
|
-
builder.addCase(signalEvents.newClient, (state, { payload }) => {
|
|
376
|
-
var _a;
|
|
377
|
-
const { client } = payload;
|
|
378
|
-
if (((_a = client.role) === null || _a === void 0 ? void 0 : _a.roleName) === "recorder") {
|
|
379
|
-
return Object.assign(Object.assign({}, state), { isRecording: true, status: "recording", startedAt: client.startedCloudRecordingAt
|
|
380
|
-
? new Date(client.startedCloudRecordingAt).getTime()
|
|
381
|
-
: new Date().getTime() });
|
|
382
|
-
}
|
|
383
|
-
return state;
|
|
384
|
-
});
|
|
385
|
-
},
|
|
386
|
-
});
|
|
387
|
-
const { recordingRequestStarted } = cloudRecordingSlice.actions;
|
|
388
|
-
const doStartCloudRecording = createAppThunk(() => (dispatch, getState) => {
|
|
389
|
-
const state = getState();
|
|
390
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
391
|
-
const status = selectCloudRecordingStatus(state);
|
|
392
|
-
if (status && ["recording", "requested"].includes(status)) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("start_recording", {
|
|
396
|
-
recording: "cloud",
|
|
397
|
-
});
|
|
398
|
-
dispatch(recordingRequestStarted());
|
|
399
|
-
});
|
|
400
|
-
const doStopCloudRecording = createAppThunk(() => (dispatch, getState) => {
|
|
401
|
-
const state = getState();
|
|
402
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
403
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("stop_recording");
|
|
404
|
-
});
|
|
405
|
-
const selectCloudRecordingRaw = (state) => state.cloudRecording;
|
|
406
|
-
const selectCloudRecordingStatus = (state) => state.cloudRecording.status;
|
|
407
|
-
const selectCloudRecordingStartedAt = (state) => state.cloudRecording.startedAt;
|
|
408
|
-
const selectCloudRecordingError = (state) => state.cloudRecording.error;
|
|
409
|
-
const selectIsCloudRecording = (state) => state.cloudRecording.isRecording;
|
|
410
|
-
|
|
411
332
|
function fakeAudioStream() {
|
|
412
333
|
const audioCtx = new AudioContext();
|
|
413
334
|
const oscillator = audioCtx.createOscillator();
|
|
@@ -515,6 +436,22 @@ function parseRoomUrlAndSubdomain(roomAttribute, subdomainAttribute) {
|
|
|
515
436
|
};
|
|
516
437
|
}
|
|
517
438
|
|
|
439
|
+
function parseUnverifiedRoomKeyData(roomKey) {
|
|
440
|
+
const [, roomKeyData] = /\.(.*)\./i.exec(roomKey) || [];
|
|
441
|
+
if (!roomKeyData) {
|
|
442
|
+
return {};
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
try {
|
|
446
|
+
const base64DecodedJwtData = atob(roomKeyData);
|
|
447
|
+
return JSON.parse(base64DecodedJwtData);
|
|
448
|
+
}
|
|
449
|
+
catch (e) {
|
|
450
|
+
return {};
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
518
455
|
const initialLocalMediaState = {
|
|
519
456
|
busyDeviceIds: [],
|
|
520
457
|
cameraEnabled: false,
|
|
@@ -944,7 +881,7 @@ startAppListening({
|
|
|
944
881
|
},
|
|
945
882
|
});
|
|
946
883
|
|
|
947
|
-
const initialState$
|
|
884
|
+
const initialState$a = {
|
|
948
885
|
displayName: "",
|
|
949
886
|
id: "",
|
|
950
887
|
isAudioEnabled: true,
|
|
@@ -952,7 +889,7 @@ const initialState$8 = {
|
|
|
952
889
|
isLocalParticipant: true,
|
|
953
890
|
stream: undefined,
|
|
954
891
|
isScreenSharing: false,
|
|
955
|
-
roleName: "",
|
|
892
|
+
roleName: "none",
|
|
956
893
|
clientClaim: undefined,
|
|
957
894
|
};
|
|
958
895
|
const doEnableAudio = createAppAsyncThunk("localParticipant/doEnableAudio", (payload, { getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -978,7 +915,7 @@ const doSetDisplayName = createAppAsyncThunk("localParticipant/doSetDisplayName"
|
|
|
978
915
|
}));
|
|
979
916
|
const localParticipantSlice = toolkit.createSlice({
|
|
980
917
|
name: "localParticipant",
|
|
981
|
-
initialState: initialState$
|
|
918
|
+
initialState: initialState$a,
|
|
982
919
|
reducers: {
|
|
983
920
|
doSetLocalParticipant: (state, action) => {
|
|
984
921
|
return Object.assign(Object.assign({}, state), action.payload);
|
|
@@ -1000,7 +937,7 @@ const localParticipantSlice = toolkit.createSlice({
|
|
|
1000
937
|
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
1001
938
|
var _a, _b;
|
|
1002
939
|
const client = (_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.room) === null || _b === void 0 ? void 0 : _b.clients.find((c) => { var _a; return c.id === ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.selfId); });
|
|
1003
|
-
return Object.assign(Object.assign({}, state), { id: action.payload.selfId,
|
|
940
|
+
return Object.assign(Object.assign({}, state), { id: action.payload.selfId, roleName: (client === null || client === void 0 ? void 0 : client.role.roleName) || "none", clientClaim: action.payload.clientClaim });
|
|
1004
941
|
});
|
|
1005
942
|
},
|
|
1006
943
|
});
|
|
@@ -1027,6 +964,134 @@ startAppListening({
|
|
|
1027
964
|
},
|
|
1028
965
|
});
|
|
1029
966
|
|
|
967
|
+
const ACTION_PERMISSIONS_BY_ROLE = {
|
|
968
|
+
canLockRoom: ["host"],
|
|
969
|
+
};
|
|
970
|
+
const initialState$9 = {
|
|
971
|
+
roomKey: null,
|
|
972
|
+
roomLocked: false,
|
|
973
|
+
};
|
|
974
|
+
const authorizationSlice = toolkit.createSlice({
|
|
975
|
+
name: "authorization",
|
|
976
|
+
initialState: initialState$9,
|
|
977
|
+
reducers: {
|
|
978
|
+
setRoomKey: (state, action) => {
|
|
979
|
+
return Object.assign(Object.assign({}, state), { roomKey: action.payload });
|
|
980
|
+
},
|
|
981
|
+
},
|
|
982
|
+
extraReducers: (builder) => {
|
|
983
|
+
builder.addCase(doAppJoin, (state, action) => {
|
|
984
|
+
return Object.assign(Object.assign({}, state), { roomKey: action.payload.roomKey });
|
|
985
|
+
});
|
|
986
|
+
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
987
|
+
const { error, isLocked } = action.payload;
|
|
988
|
+
if (error) {
|
|
989
|
+
return state;
|
|
990
|
+
}
|
|
991
|
+
return Object.assign(Object.assign({}, state), { roomLocked: isLocked });
|
|
992
|
+
});
|
|
993
|
+
builder.addCase(signalEvents.roomLocked, (state, action) => {
|
|
994
|
+
const { isLocked } = action.payload;
|
|
995
|
+
return Object.assign(Object.assign({}, state), { roomLocked: isLocked });
|
|
996
|
+
});
|
|
997
|
+
},
|
|
998
|
+
});
|
|
999
|
+
const { setRoomKey } = authorizationSlice.actions;
|
|
1000
|
+
const doLockRoom = createAppAuthorizedThunk((state) => selectIsAuthorizedToLockRoom(state), (payload) => (_, getState) => {
|
|
1001
|
+
const state = getState();
|
|
1002
|
+
const { socket } = selectSignalConnectionRaw(state);
|
|
1003
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("set_lock", { locked: payload.locked });
|
|
1004
|
+
});
|
|
1005
|
+
const selectAuthorizationRoomKey = (state) => state.authorization.roomKey;
|
|
1006
|
+
const selectAuthorizationRoomLocked = (state) => state.authorization.roomLocked;
|
|
1007
|
+
const selectIsAuthorizedToLockRoom = toolkit.createSelector(selectLocalParticipantRole, (localParticipantRole) => ACTION_PERMISSIONS_BY_ROLE.canLockRoom.includes(localParticipantRole));
|
|
1008
|
+
|
|
1009
|
+
const initialState$8 = {
|
|
1010
|
+
chatMessages: [],
|
|
1011
|
+
};
|
|
1012
|
+
const chatSlice = toolkit.createSlice({
|
|
1013
|
+
name: "chat",
|
|
1014
|
+
initialState: initialState$8,
|
|
1015
|
+
reducers: {},
|
|
1016
|
+
extraReducers(builder) {
|
|
1017
|
+
builder.addCase(signalEvents.chatMessage, (state, action) => {
|
|
1018
|
+
const message = {
|
|
1019
|
+
senderId: action.payload.senderId,
|
|
1020
|
+
timestamp: action.payload.timestamp,
|
|
1021
|
+
text: action.payload.text,
|
|
1022
|
+
};
|
|
1023
|
+
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, message] });
|
|
1024
|
+
});
|
|
1025
|
+
},
|
|
1026
|
+
});
|
|
1027
|
+
const doSendChatMessage = createAppThunk((payload) => (_, getState) => {
|
|
1028
|
+
const state = getState();
|
|
1029
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1030
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("chat_message", { text: payload.text });
|
|
1031
|
+
});
|
|
1032
|
+
const selectChatRaw = (state) => state.chat;
|
|
1033
|
+
const selectChatMessages = (state) => state.chat.chatMessages;
|
|
1034
|
+
|
|
1035
|
+
const initialCloudRecordingState = {
|
|
1036
|
+
isRecording: false,
|
|
1037
|
+
error: null,
|
|
1038
|
+
startedAt: undefined,
|
|
1039
|
+
};
|
|
1040
|
+
const cloudRecordingSlice = toolkit.createSlice({
|
|
1041
|
+
name: "cloudRecording",
|
|
1042
|
+
initialState: initialCloudRecordingState,
|
|
1043
|
+
reducers: {
|
|
1044
|
+
recordingRequestStarted: (state) => {
|
|
1045
|
+
return Object.assign(Object.assign({}, state), { status: "requested" });
|
|
1046
|
+
},
|
|
1047
|
+
},
|
|
1048
|
+
extraReducers: (builder) => {
|
|
1049
|
+
builder.addCase(signalEvents.cloudRecordingStopped, (state) => {
|
|
1050
|
+
return Object.assign(Object.assign({}, state), { isRecording: false, status: undefined });
|
|
1051
|
+
});
|
|
1052
|
+
builder.addCase(signalEvents.cloudRecordingStarted, (state, action) => {
|
|
1053
|
+
const { payload } = action;
|
|
1054
|
+
if (!payload.error) {
|
|
1055
|
+
return state;
|
|
1056
|
+
}
|
|
1057
|
+
return Object.assign(Object.assign({}, state), { isRecording: false, status: "error", error: payload.error });
|
|
1058
|
+
});
|
|
1059
|
+
builder.addCase(signalEvents.newClient, (state, { payload }) => {
|
|
1060
|
+
var _a;
|
|
1061
|
+
const { client } = payload;
|
|
1062
|
+
if (((_a = client.role) === null || _a === void 0 ? void 0 : _a.roleName) === "recorder") {
|
|
1063
|
+
return Object.assign(Object.assign({}, state), { isRecording: true, status: "recording", startedAt: client.startedCloudRecordingAt
|
|
1064
|
+
? new Date(client.startedCloudRecordingAt).getTime()
|
|
1065
|
+
: new Date().getTime() });
|
|
1066
|
+
}
|
|
1067
|
+
return state;
|
|
1068
|
+
});
|
|
1069
|
+
},
|
|
1070
|
+
});
|
|
1071
|
+
const { recordingRequestStarted } = cloudRecordingSlice.actions;
|
|
1072
|
+
const doStartCloudRecording = createAppThunk(() => (dispatch, getState) => {
|
|
1073
|
+
const state = getState();
|
|
1074
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1075
|
+
const status = selectCloudRecordingStatus(state);
|
|
1076
|
+
if (status && ["recording", "requested"].includes(status)) {
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("start_recording", {
|
|
1080
|
+
recording: "cloud",
|
|
1081
|
+
});
|
|
1082
|
+
dispatch(recordingRequestStarted());
|
|
1083
|
+
});
|
|
1084
|
+
const doStopCloudRecording = createAppThunk(() => (dispatch, getState) => {
|
|
1085
|
+
const state = getState();
|
|
1086
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1087
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("stop_recording");
|
|
1088
|
+
});
|
|
1089
|
+
const selectCloudRecordingRaw = (state) => state.cloudRecording;
|
|
1090
|
+
const selectCloudRecordingStatus = (state) => state.cloudRecording.status;
|
|
1091
|
+
const selectCloudRecordingStartedAt = (state) => state.cloudRecording.startedAt;
|
|
1092
|
+
const selectCloudRecordingError = (state) => state.cloudRecording.error;
|
|
1093
|
+
const selectIsCloudRecording = (state) => state.cloudRecording.isRecording;
|
|
1094
|
+
|
|
1030
1095
|
const initialState$7 = {
|
|
1031
1096
|
status: "",
|
|
1032
1097
|
stream: null,
|
|
@@ -1167,9 +1232,9 @@ const rtcEvents = {
|
|
|
1167
1232
|
};
|
|
1168
1233
|
|
|
1169
1234
|
const NON_PERSON_ROLES = ["recorder", "streamer"];
|
|
1170
|
-
function
|
|
1171
|
-
const { streams } = client, rest = __rest(client, ["streams"]);
|
|
1172
|
-
return Object.assign(Object.assign({}, rest), { stream: null, streams: streams.map((streamId) => ({ id: streamId, state: newJoiner ? "new_accept" : "to_accept" })), isLocalParticipant: false, presentationStream: null, newJoiner });
|
|
1235
|
+
function createRemoteParticipant(client, newJoiner = false) {
|
|
1236
|
+
const { streams, role } = client, rest = __rest(client, ["streams", "role"]);
|
|
1237
|
+
return Object.assign(Object.assign({}, rest), { stream: null, streams: streams.map((streamId) => ({ id: streamId, state: newJoiner ? "new_accept" : "to_accept" })), isLocalParticipant: false, roleName: (role === null || role === void 0 ? void 0 : role.roleName) || "none", presentationStream: null, newJoiner });
|
|
1173
1238
|
}
|
|
1174
1239
|
function findParticipant(state, participantId) {
|
|
1175
1240
|
const index = state.remoteParticipants.findIndex((c) => c.id === participantId);
|
|
@@ -1293,7 +1358,7 @@ const remoteParticipantsSlice = toolkit.createSlice({
|
|
|
1293
1358
|
return Object.assign(Object.assign({}, state), { remoteParticipants: clients
|
|
1294
1359
|
.filter((c) => c.id !== selfId)
|
|
1295
1360
|
.filter((c) => !NON_PERSON_ROLES.includes(c.role.roleName))
|
|
1296
|
-
.map((c) =>
|
|
1361
|
+
.map((c) => createRemoteParticipant(c)) });
|
|
1297
1362
|
});
|
|
1298
1363
|
builder.addCase(rtcEvents.streamAdded, (state, action) => {
|
|
1299
1364
|
return addStream(state, action.payload);
|
|
@@ -1303,7 +1368,7 @@ const remoteParticipantsSlice = toolkit.createSlice({
|
|
|
1303
1368
|
if (NON_PERSON_ROLES.includes(client.role.roleName)) {
|
|
1304
1369
|
return state;
|
|
1305
1370
|
}
|
|
1306
|
-
return addParticipant(state,
|
|
1371
|
+
return addParticipant(state, createRemoteParticipant(client, true));
|
|
1307
1372
|
});
|
|
1308
1373
|
builder.addCase(signalEvents.clientLeft, (state, action) => {
|
|
1309
1374
|
const { clientId } = action.payload;
|
|
@@ -1417,7 +1482,7 @@ const doKnockRoom = createAppThunk(() => (dispatch, getState) => {
|
|
|
1417
1482
|
const state = getState();
|
|
1418
1483
|
const socket = selectSignalConnectionRaw(state).socket;
|
|
1419
1484
|
const roomName = selectAppRoomName(state);
|
|
1420
|
-
const roomKey =
|
|
1485
|
+
const roomKey = selectAuthorizationRoomKey(state);
|
|
1421
1486
|
const displayName = selectAppDisplayName(state);
|
|
1422
1487
|
const userAgent = selectAppUserAgent(state);
|
|
1423
1488
|
const externalId = selectAppExternalId(state);
|
|
@@ -1446,7 +1511,7 @@ const doConnectRoom = createAppThunk(() => (dispatch, getState) => {
|
|
|
1446
1511
|
const state = getState();
|
|
1447
1512
|
const socket = selectSignalConnectionRaw(state).socket;
|
|
1448
1513
|
const roomName = selectAppRoomName(state);
|
|
1449
|
-
const roomKey =
|
|
1514
|
+
const roomKey = selectAuthorizationRoomKey(state);
|
|
1450
1515
|
const displayName = selectAppDisplayName(state);
|
|
1451
1516
|
const userAgent = selectAppUserAgent(state);
|
|
1452
1517
|
const externalId = selectAppExternalId(state);
|
|
@@ -2037,6 +2102,7 @@ var _a;
|
|
|
2037
2102
|
const IS_DEV = (_a = undefined === "true") !== null && _a !== void 0 ? _a : false;
|
|
2038
2103
|
const rootReducer = toolkit.combineReducers({
|
|
2039
2104
|
app: appSlice.reducer,
|
|
2105
|
+
authorization: authorizationSlice.reducer,
|
|
2040
2106
|
chat: chatSlice.reducer,
|
|
2041
2107
|
cloudRecording: cloudRecordingSlice.reducer,
|
|
2042
2108
|
deviceCredentials: deviceCredentialsSlice.reducer,
|
|
@@ -3097,9 +3163,11 @@ exports.RoomService = RoomService;
|
|
|
3097
3163
|
exports.addAppListener = addAppListener;
|
|
3098
3164
|
exports.appLeft = appLeft;
|
|
3099
3165
|
exports.appSlice = appSlice;
|
|
3166
|
+
exports.authorizationSlice = authorizationSlice;
|
|
3100
3167
|
exports.chatSlice = chatSlice;
|
|
3101
3168
|
exports.cloudRecordingSlice = cloudRecordingSlice;
|
|
3102
3169
|
exports.createAppAsyncThunk = createAppAsyncThunk;
|
|
3170
|
+
exports.createAppAuthorizedThunk = createAppAuthorizedThunk;
|
|
3103
3171
|
exports.createAppThunk = createAppThunk;
|
|
3104
3172
|
exports.createReactor = createReactor;
|
|
3105
3173
|
exports.createServices = createServices;
|
|
@@ -3122,6 +3190,7 @@ exports.doHandleAcceptStreams = doHandleAcceptStreams;
|
|
|
3122
3190
|
exports.doHandleStreamingStarted = doHandleStreamingStarted;
|
|
3123
3191
|
exports.doHandleStreamingStopped = doHandleStreamingStopped;
|
|
3124
3192
|
exports.doKnockRoom = doKnockRoom;
|
|
3193
|
+
exports.doLockRoom = doLockRoom;
|
|
3125
3194
|
exports.doOrganizationFetch = doOrganizationFetch;
|
|
3126
3195
|
exports.doRejectWaitingParticipant = doRejectWaitingParticipant;
|
|
3127
3196
|
exports.doRtcAnalyticsCustomEventsInitialize = doRtcAnalyticsCustomEventsInitialize;
|
|
@@ -3159,6 +3228,7 @@ exports.localStreamMetadataUpdated = localStreamMetadataUpdated;
|
|
|
3159
3228
|
exports.observeStore = observeStore;
|
|
3160
3229
|
exports.organizationSlice = organizationSlice;
|
|
3161
3230
|
exports.parseRoomUrlAndSubdomain = parseRoomUrlAndSubdomain;
|
|
3231
|
+
exports.parseUnverifiedRoomKeyData = parseUnverifiedRoomKeyData;
|
|
3162
3232
|
exports.participantStreamAdded = participantStreamAdded;
|
|
3163
3233
|
exports.participantStreamIdAdded = participantStreamIdAdded;
|
|
3164
3234
|
exports.recordingRequestStarted = recordingRequestStarted;
|
|
@@ -3178,11 +3248,12 @@ exports.selectAppDisplayName = selectAppDisplayName;
|
|
|
3178
3248
|
exports.selectAppExternalId = selectAppExternalId;
|
|
3179
3249
|
exports.selectAppIsNodeSdk = selectAppIsNodeSdk;
|
|
3180
3250
|
exports.selectAppRaw = selectAppRaw;
|
|
3181
|
-
exports.selectAppRoomKey = selectAppRoomKey;
|
|
3182
3251
|
exports.selectAppRoomName = selectAppRoomName;
|
|
3183
3252
|
exports.selectAppRoomUrl = selectAppRoomUrl;
|
|
3184
3253
|
exports.selectAppUserAgent = selectAppUserAgent;
|
|
3185
3254
|
exports.selectAppWantsToJoin = selectAppWantsToJoin;
|
|
3255
|
+
exports.selectAuthorizationRoomKey = selectAuthorizationRoomKey;
|
|
3256
|
+
exports.selectAuthorizationRoomLocked = selectAuthorizationRoomLocked;
|
|
3186
3257
|
exports.selectBusyDeviceIds = selectBusyDeviceIds;
|
|
3187
3258
|
exports.selectCameraDeviceError = selectCameraDeviceError;
|
|
3188
3259
|
exports.selectCameraDevices = selectCameraDevices;
|
|
@@ -3198,6 +3269,7 @@ exports.selectDeviceCredentialsRaw = selectDeviceCredentialsRaw;
|
|
|
3198
3269
|
exports.selectDeviceId = selectDeviceId;
|
|
3199
3270
|
exports.selectHasFetchedDeviceCredentials = selectHasFetchedDeviceCredentials;
|
|
3200
3271
|
exports.selectIsAcceptingStreams = selectIsAcceptingStreams;
|
|
3272
|
+
exports.selectIsAuthorizedToLockRoom = selectIsAuthorizedToLockRoom;
|
|
3201
3273
|
exports.selectIsCameraEnabled = selectIsCameraEnabled;
|
|
3202
3274
|
exports.selectIsCloudRecording = selectIsCloudRecording;
|
|
3203
3275
|
exports.selectIsLocalMediaStarting = selectIsLocalMediaStarting;
|