@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.mjs
CHANGED
|
@@ -11,6 +11,16 @@ function createAppAsyncThunk(typePrefix, payloadCreator) {
|
|
|
11
11
|
function createAppThunk(thunk) {
|
|
12
12
|
return thunk;
|
|
13
13
|
}
|
|
14
|
+
function createAppAuthorizedThunk(authorizationSelector, thunk) {
|
|
15
|
+
return createAppThunk((payload) => (dispatch, getState, extra) => {
|
|
16
|
+
const isAuthorized = authorizationSelector(getState());
|
|
17
|
+
if (!isAuthorized) {
|
|
18
|
+
console.warn("Not authorized to perform this action");
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return thunk(payload)(dispatch, getState, extra);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
14
24
|
|
|
15
25
|
const listenerMiddleware = createListenerMiddleware();
|
|
16
26
|
const startAppListening = listenerMiddleware.startListening;
|
|
@@ -33,13 +43,12 @@ const createReactor = (selectors, callback) => {
|
|
|
33
43
|
});
|
|
34
44
|
};
|
|
35
45
|
|
|
36
|
-
const coreVersion = "0.
|
|
46
|
+
const coreVersion = "0.10.0";
|
|
37
47
|
|
|
38
|
-
const initialState$
|
|
48
|
+
const initialState$d = {
|
|
39
49
|
isNodeSdk: false,
|
|
40
50
|
wantsToJoin: false,
|
|
41
51
|
roomName: null,
|
|
42
|
-
roomKey: null,
|
|
43
52
|
roomUrl: null,
|
|
44
53
|
displayName: null,
|
|
45
54
|
userAgent: `core:${coreVersion}`,
|
|
@@ -47,7 +56,7 @@ const initialState$c = {
|
|
|
47
56
|
};
|
|
48
57
|
const appSlice = createSlice({
|
|
49
58
|
name: "app",
|
|
50
|
-
initialState: initialState$
|
|
59
|
+
initialState: initialState$d,
|
|
51
60
|
reducers: {
|
|
52
61
|
doAppJoin: (state, action) => {
|
|
53
62
|
const url = new URL(action.payload.roomUrl);
|
|
@@ -56,17 +65,13 @@ const appSlice = createSlice({
|
|
|
56
65
|
appLeft: (state) => {
|
|
57
66
|
return Object.assign(Object.assign({}, state), { wantsToJoin: false });
|
|
58
67
|
},
|
|
59
|
-
setRoomKey: (state, action) => {
|
|
60
|
-
return Object.assign(Object.assign({}, state), { roomKey: action.payload });
|
|
61
|
-
},
|
|
62
68
|
},
|
|
63
69
|
});
|
|
64
|
-
const { doAppJoin, appLeft
|
|
70
|
+
const { doAppJoin, appLeft } = appSlice.actions;
|
|
65
71
|
const selectAppRaw = (state) => state.app;
|
|
66
72
|
const selectAppWantsToJoin = (state) => state.app.wantsToJoin;
|
|
67
73
|
const selectAppRoomName = (state) => state.app.roomName;
|
|
68
74
|
const selectAppRoomUrl = (state) => state.app.roomUrl;
|
|
69
|
-
const selectAppRoomKey = (state) => state.app.roomKey;
|
|
70
75
|
const selectAppDisplayName = (state) => state.app.displayName;
|
|
71
76
|
const selectAppUserAgent = (state) => state.app.userAgent;
|
|
72
77
|
const selectAppExternalId = (state) => state.app.externalId;
|
|
@@ -89,6 +94,7 @@ const signalEvents = {
|
|
|
89
94
|
newClient: createSignalEventAction("newClient"),
|
|
90
95
|
roomJoined: createSignalEventAction("roomJoined"),
|
|
91
96
|
roomKnocked: createSignalEventAction("roomKnocked"),
|
|
97
|
+
roomLocked: createSignalEventAction("roomLocked"),
|
|
92
98
|
roomSessionEnded: createSignalEventAction("roomSessionEnded"),
|
|
93
99
|
screenshareStarted: createSignalEventAction("screenshareStarted"),
|
|
94
100
|
screenshareStopped: createSignalEventAction("screenshareStopped"),
|
|
@@ -140,13 +146,13 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
140
146
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
141
147
|
};
|
|
142
148
|
|
|
143
|
-
const initialState$
|
|
149
|
+
const initialState$c = {
|
|
144
150
|
isFetching: false,
|
|
145
151
|
data: null,
|
|
146
152
|
};
|
|
147
153
|
const deviceCredentialsSlice = createSlice({
|
|
148
154
|
name: "deviceCredentials",
|
|
149
|
-
initialState: initialState$
|
|
155
|
+
initialState: initialState$c,
|
|
150
156
|
reducers: {},
|
|
151
157
|
extraReducers: (builder) => {
|
|
152
158
|
builder.addCase(doGetDeviceCredentials.pending, (state) => {
|
|
@@ -195,6 +201,7 @@ function forwardSocketEvents(socket, dispatch) {
|
|
|
195
201
|
socket.on("chat_message", (payload) => dispatch(signalEvents.chatMessage(payload)));
|
|
196
202
|
socket.on("disconnect", () => dispatch(signalEvents.disconnect()));
|
|
197
203
|
socket.on("room_knocked", (payload) => dispatch(signalEvents.roomKnocked(payload)));
|
|
204
|
+
socket.on("room_locked", (payload) => dispatch(signalEvents.roomLocked(payload)));
|
|
198
205
|
socket.on("room_session_ended", (payload) => dispatch(signalEvents.roomSessionEnded(payload)));
|
|
199
206
|
socket.on("knocker_left", (payload) => dispatch(signalEvents.knockerLeft(payload)));
|
|
200
207
|
socket.on("knock_handled", (payload) => dispatch(signalEvents.knockHandled(payload)));
|
|
@@ -213,7 +220,7 @@ function createSocket() {
|
|
|
213
220
|
};
|
|
214
221
|
return new ServerSocket(socketHost, socketOverrides);
|
|
215
222
|
}
|
|
216
|
-
const initialState$
|
|
223
|
+
const initialState$b = {
|
|
217
224
|
deviceIdentified: false,
|
|
218
225
|
isIdentifyingDevice: false,
|
|
219
226
|
status: "",
|
|
@@ -221,7 +228,7 @@ const initialState$a = {
|
|
|
221
228
|
};
|
|
222
229
|
const signalConnectionSlice = createSlice({
|
|
223
230
|
name: "signalConnection",
|
|
224
|
-
initialState: initialState$
|
|
231
|
+
initialState: initialState$b,
|
|
225
232
|
reducers: {
|
|
226
233
|
socketConnecting: (state) => {
|
|
227
234
|
return Object.assign(Object.assign({}, state), { status: "connecting" });
|
|
@@ -320,92 +327,6 @@ createReactor([selectShouldIdentifyDevice, selectDeviceCredentialsRaw], ({ dispa
|
|
|
320
327
|
}
|
|
321
328
|
});
|
|
322
329
|
|
|
323
|
-
const initialState$9 = {
|
|
324
|
-
chatMessages: [],
|
|
325
|
-
};
|
|
326
|
-
const chatSlice = createSlice({
|
|
327
|
-
name: "chat",
|
|
328
|
-
initialState: initialState$9,
|
|
329
|
-
reducers: {},
|
|
330
|
-
extraReducers(builder) {
|
|
331
|
-
builder.addCase(signalEvents.chatMessage, (state, action) => {
|
|
332
|
-
const message = {
|
|
333
|
-
senderId: action.payload.senderId,
|
|
334
|
-
timestamp: action.payload.timestamp,
|
|
335
|
-
text: action.payload.text,
|
|
336
|
-
};
|
|
337
|
-
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, message] });
|
|
338
|
-
});
|
|
339
|
-
},
|
|
340
|
-
});
|
|
341
|
-
const doSendChatMessage = createAppThunk((payload) => (_, getState) => {
|
|
342
|
-
const state = getState();
|
|
343
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
344
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("chat_message", { text: payload.text });
|
|
345
|
-
});
|
|
346
|
-
const selectChatRaw = (state) => state.chat;
|
|
347
|
-
const selectChatMessages = (state) => state.chat.chatMessages;
|
|
348
|
-
|
|
349
|
-
const initialCloudRecordingState = {
|
|
350
|
-
isRecording: false,
|
|
351
|
-
error: null,
|
|
352
|
-
startedAt: undefined,
|
|
353
|
-
};
|
|
354
|
-
const cloudRecordingSlice = createSlice({
|
|
355
|
-
name: "cloudRecording",
|
|
356
|
-
initialState: initialCloudRecordingState,
|
|
357
|
-
reducers: {
|
|
358
|
-
recordingRequestStarted: (state) => {
|
|
359
|
-
return Object.assign(Object.assign({}, state), { status: "requested" });
|
|
360
|
-
},
|
|
361
|
-
},
|
|
362
|
-
extraReducers: (builder) => {
|
|
363
|
-
builder.addCase(signalEvents.cloudRecordingStopped, (state) => {
|
|
364
|
-
return Object.assign(Object.assign({}, state), { isRecording: false, status: undefined });
|
|
365
|
-
});
|
|
366
|
-
builder.addCase(signalEvents.cloudRecordingStarted, (state, action) => {
|
|
367
|
-
const { payload } = action;
|
|
368
|
-
if (!payload.error) {
|
|
369
|
-
return state;
|
|
370
|
-
}
|
|
371
|
-
return Object.assign(Object.assign({}, state), { isRecording: false, status: "error", error: payload.error });
|
|
372
|
-
});
|
|
373
|
-
builder.addCase(signalEvents.newClient, (state, { payload }) => {
|
|
374
|
-
var _a;
|
|
375
|
-
const { client } = payload;
|
|
376
|
-
if (((_a = client.role) === null || _a === void 0 ? void 0 : _a.roleName) === "recorder") {
|
|
377
|
-
return Object.assign(Object.assign({}, state), { isRecording: true, status: "recording", startedAt: client.startedCloudRecordingAt
|
|
378
|
-
? new Date(client.startedCloudRecordingAt).getTime()
|
|
379
|
-
: new Date().getTime() });
|
|
380
|
-
}
|
|
381
|
-
return state;
|
|
382
|
-
});
|
|
383
|
-
},
|
|
384
|
-
});
|
|
385
|
-
const { recordingRequestStarted } = cloudRecordingSlice.actions;
|
|
386
|
-
const doStartCloudRecording = createAppThunk(() => (dispatch, getState) => {
|
|
387
|
-
const state = getState();
|
|
388
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
389
|
-
const status = selectCloudRecordingStatus(state);
|
|
390
|
-
if (status && ["recording", "requested"].includes(status)) {
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("start_recording", {
|
|
394
|
-
recording: "cloud",
|
|
395
|
-
});
|
|
396
|
-
dispatch(recordingRequestStarted());
|
|
397
|
-
});
|
|
398
|
-
const doStopCloudRecording = createAppThunk(() => (dispatch, getState) => {
|
|
399
|
-
const state = getState();
|
|
400
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
401
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("stop_recording");
|
|
402
|
-
});
|
|
403
|
-
const selectCloudRecordingRaw = (state) => state.cloudRecording;
|
|
404
|
-
const selectCloudRecordingStatus = (state) => state.cloudRecording.status;
|
|
405
|
-
const selectCloudRecordingStartedAt = (state) => state.cloudRecording.startedAt;
|
|
406
|
-
const selectCloudRecordingError = (state) => state.cloudRecording.error;
|
|
407
|
-
const selectIsCloudRecording = (state) => state.cloudRecording.isRecording;
|
|
408
|
-
|
|
409
330
|
function fakeAudioStream() {
|
|
410
331
|
const audioCtx = new AudioContext();
|
|
411
332
|
const oscillator = audioCtx.createOscillator();
|
|
@@ -513,6 +434,22 @@ function parseRoomUrlAndSubdomain(roomAttribute, subdomainAttribute) {
|
|
|
513
434
|
};
|
|
514
435
|
}
|
|
515
436
|
|
|
437
|
+
function parseUnverifiedRoomKeyData(roomKey) {
|
|
438
|
+
const [, roomKeyData] = /\.(.*)\./i.exec(roomKey) || [];
|
|
439
|
+
if (!roomKeyData) {
|
|
440
|
+
return {};
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
try {
|
|
444
|
+
const base64DecodedJwtData = atob(roomKeyData);
|
|
445
|
+
return JSON.parse(base64DecodedJwtData);
|
|
446
|
+
}
|
|
447
|
+
catch (e) {
|
|
448
|
+
return {};
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
516
453
|
const initialLocalMediaState = {
|
|
517
454
|
busyDeviceIds: [],
|
|
518
455
|
cameraEnabled: false,
|
|
@@ -942,7 +879,7 @@ startAppListening({
|
|
|
942
879
|
},
|
|
943
880
|
});
|
|
944
881
|
|
|
945
|
-
const initialState$
|
|
882
|
+
const initialState$a = {
|
|
946
883
|
displayName: "",
|
|
947
884
|
id: "",
|
|
948
885
|
isAudioEnabled: true,
|
|
@@ -950,7 +887,7 @@ const initialState$8 = {
|
|
|
950
887
|
isLocalParticipant: true,
|
|
951
888
|
stream: undefined,
|
|
952
889
|
isScreenSharing: false,
|
|
953
|
-
roleName: "",
|
|
890
|
+
roleName: "none",
|
|
954
891
|
clientClaim: undefined,
|
|
955
892
|
};
|
|
956
893
|
const doEnableAudio = createAppAsyncThunk("localParticipant/doEnableAudio", (payload, { getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -976,7 +913,7 @@ const doSetDisplayName = createAppAsyncThunk("localParticipant/doSetDisplayName"
|
|
|
976
913
|
}));
|
|
977
914
|
const localParticipantSlice = createSlice({
|
|
978
915
|
name: "localParticipant",
|
|
979
|
-
initialState: initialState$
|
|
916
|
+
initialState: initialState$a,
|
|
980
917
|
reducers: {
|
|
981
918
|
doSetLocalParticipant: (state, action) => {
|
|
982
919
|
return Object.assign(Object.assign({}, state), action.payload);
|
|
@@ -998,7 +935,7 @@ const localParticipantSlice = createSlice({
|
|
|
998
935
|
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
999
936
|
var _a, _b;
|
|
1000
937
|
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); });
|
|
1001
|
-
return Object.assign(Object.assign({}, state), { id: action.payload.selfId,
|
|
938
|
+
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 });
|
|
1002
939
|
});
|
|
1003
940
|
},
|
|
1004
941
|
});
|
|
@@ -1025,6 +962,134 @@ startAppListening({
|
|
|
1025
962
|
},
|
|
1026
963
|
});
|
|
1027
964
|
|
|
965
|
+
const ACTION_PERMISSIONS_BY_ROLE = {
|
|
966
|
+
canLockRoom: ["host"],
|
|
967
|
+
};
|
|
968
|
+
const initialState$9 = {
|
|
969
|
+
roomKey: null,
|
|
970
|
+
roomLocked: false,
|
|
971
|
+
};
|
|
972
|
+
const authorizationSlice = createSlice({
|
|
973
|
+
name: "authorization",
|
|
974
|
+
initialState: initialState$9,
|
|
975
|
+
reducers: {
|
|
976
|
+
setRoomKey: (state, action) => {
|
|
977
|
+
return Object.assign(Object.assign({}, state), { roomKey: action.payload });
|
|
978
|
+
},
|
|
979
|
+
},
|
|
980
|
+
extraReducers: (builder) => {
|
|
981
|
+
builder.addCase(doAppJoin, (state, action) => {
|
|
982
|
+
return Object.assign(Object.assign({}, state), { roomKey: action.payload.roomKey });
|
|
983
|
+
});
|
|
984
|
+
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
985
|
+
const { error, isLocked } = action.payload;
|
|
986
|
+
if (error) {
|
|
987
|
+
return state;
|
|
988
|
+
}
|
|
989
|
+
return Object.assign(Object.assign({}, state), { roomLocked: isLocked });
|
|
990
|
+
});
|
|
991
|
+
builder.addCase(signalEvents.roomLocked, (state, action) => {
|
|
992
|
+
const { isLocked } = action.payload;
|
|
993
|
+
return Object.assign(Object.assign({}, state), { roomLocked: isLocked });
|
|
994
|
+
});
|
|
995
|
+
},
|
|
996
|
+
});
|
|
997
|
+
const { setRoomKey } = authorizationSlice.actions;
|
|
998
|
+
const doLockRoom = createAppAuthorizedThunk((state) => selectIsAuthorizedToLockRoom(state), (payload) => (_, getState) => {
|
|
999
|
+
const state = getState();
|
|
1000
|
+
const { socket } = selectSignalConnectionRaw(state);
|
|
1001
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("set_lock", { locked: payload.locked });
|
|
1002
|
+
});
|
|
1003
|
+
const selectAuthorizationRoomKey = (state) => state.authorization.roomKey;
|
|
1004
|
+
const selectAuthorizationRoomLocked = (state) => state.authorization.roomLocked;
|
|
1005
|
+
const selectIsAuthorizedToLockRoom = createSelector(selectLocalParticipantRole, (localParticipantRole) => ACTION_PERMISSIONS_BY_ROLE.canLockRoom.includes(localParticipantRole));
|
|
1006
|
+
|
|
1007
|
+
const initialState$8 = {
|
|
1008
|
+
chatMessages: [],
|
|
1009
|
+
};
|
|
1010
|
+
const chatSlice = createSlice({
|
|
1011
|
+
name: "chat",
|
|
1012
|
+
initialState: initialState$8,
|
|
1013
|
+
reducers: {},
|
|
1014
|
+
extraReducers(builder) {
|
|
1015
|
+
builder.addCase(signalEvents.chatMessage, (state, action) => {
|
|
1016
|
+
const message = {
|
|
1017
|
+
senderId: action.payload.senderId,
|
|
1018
|
+
timestamp: action.payload.timestamp,
|
|
1019
|
+
text: action.payload.text,
|
|
1020
|
+
};
|
|
1021
|
+
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, message] });
|
|
1022
|
+
});
|
|
1023
|
+
},
|
|
1024
|
+
});
|
|
1025
|
+
const doSendChatMessage = createAppThunk((payload) => (_, getState) => {
|
|
1026
|
+
const state = getState();
|
|
1027
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1028
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("chat_message", { text: payload.text });
|
|
1029
|
+
});
|
|
1030
|
+
const selectChatRaw = (state) => state.chat;
|
|
1031
|
+
const selectChatMessages = (state) => state.chat.chatMessages;
|
|
1032
|
+
|
|
1033
|
+
const initialCloudRecordingState = {
|
|
1034
|
+
isRecording: false,
|
|
1035
|
+
error: null,
|
|
1036
|
+
startedAt: undefined,
|
|
1037
|
+
};
|
|
1038
|
+
const cloudRecordingSlice = createSlice({
|
|
1039
|
+
name: "cloudRecording",
|
|
1040
|
+
initialState: initialCloudRecordingState,
|
|
1041
|
+
reducers: {
|
|
1042
|
+
recordingRequestStarted: (state) => {
|
|
1043
|
+
return Object.assign(Object.assign({}, state), { status: "requested" });
|
|
1044
|
+
},
|
|
1045
|
+
},
|
|
1046
|
+
extraReducers: (builder) => {
|
|
1047
|
+
builder.addCase(signalEvents.cloudRecordingStopped, (state) => {
|
|
1048
|
+
return Object.assign(Object.assign({}, state), { isRecording: false, status: undefined });
|
|
1049
|
+
});
|
|
1050
|
+
builder.addCase(signalEvents.cloudRecordingStarted, (state, action) => {
|
|
1051
|
+
const { payload } = action;
|
|
1052
|
+
if (!payload.error) {
|
|
1053
|
+
return state;
|
|
1054
|
+
}
|
|
1055
|
+
return Object.assign(Object.assign({}, state), { isRecording: false, status: "error", error: payload.error });
|
|
1056
|
+
});
|
|
1057
|
+
builder.addCase(signalEvents.newClient, (state, { payload }) => {
|
|
1058
|
+
var _a;
|
|
1059
|
+
const { client } = payload;
|
|
1060
|
+
if (((_a = client.role) === null || _a === void 0 ? void 0 : _a.roleName) === "recorder") {
|
|
1061
|
+
return Object.assign(Object.assign({}, state), { isRecording: true, status: "recording", startedAt: client.startedCloudRecordingAt
|
|
1062
|
+
? new Date(client.startedCloudRecordingAt).getTime()
|
|
1063
|
+
: new Date().getTime() });
|
|
1064
|
+
}
|
|
1065
|
+
return state;
|
|
1066
|
+
});
|
|
1067
|
+
},
|
|
1068
|
+
});
|
|
1069
|
+
const { recordingRequestStarted } = cloudRecordingSlice.actions;
|
|
1070
|
+
const doStartCloudRecording = createAppThunk(() => (dispatch, getState) => {
|
|
1071
|
+
const state = getState();
|
|
1072
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1073
|
+
const status = selectCloudRecordingStatus(state);
|
|
1074
|
+
if (status && ["recording", "requested"].includes(status)) {
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("start_recording", {
|
|
1078
|
+
recording: "cloud",
|
|
1079
|
+
});
|
|
1080
|
+
dispatch(recordingRequestStarted());
|
|
1081
|
+
});
|
|
1082
|
+
const doStopCloudRecording = createAppThunk(() => (dispatch, getState) => {
|
|
1083
|
+
const state = getState();
|
|
1084
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1085
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("stop_recording");
|
|
1086
|
+
});
|
|
1087
|
+
const selectCloudRecordingRaw = (state) => state.cloudRecording;
|
|
1088
|
+
const selectCloudRecordingStatus = (state) => state.cloudRecording.status;
|
|
1089
|
+
const selectCloudRecordingStartedAt = (state) => state.cloudRecording.startedAt;
|
|
1090
|
+
const selectCloudRecordingError = (state) => state.cloudRecording.error;
|
|
1091
|
+
const selectIsCloudRecording = (state) => state.cloudRecording.isRecording;
|
|
1092
|
+
|
|
1028
1093
|
const initialState$7 = {
|
|
1029
1094
|
status: "",
|
|
1030
1095
|
stream: null,
|
|
@@ -1165,9 +1230,9 @@ const rtcEvents = {
|
|
|
1165
1230
|
};
|
|
1166
1231
|
|
|
1167
1232
|
const NON_PERSON_ROLES = ["recorder", "streamer"];
|
|
1168
|
-
function
|
|
1169
|
-
const { streams } = client, rest = __rest(client, ["streams"]);
|
|
1170
|
-
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 });
|
|
1233
|
+
function createRemoteParticipant(client, newJoiner = false) {
|
|
1234
|
+
const { streams, role } = client, rest = __rest(client, ["streams", "role"]);
|
|
1235
|
+
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 });
|
|
1171
1236
|
}
|
|
1172
1237
|
function findParticipant(state, participantId) {
|
|
1173
1238
|
const index = state.remoteParticipants.findIndex((c) => c.id === participantId);
|
|
@@ -1291,7 +1356,7 @@ const remoteParticipantsSlice = createSlice({
|
|
|
1291
1356
|
return Object.assign(Object.assign({}, state), { remoteParticipants: clients
|
|
1292
1357
|
.filter((c) => c.id !== selfId)
|
|
1293
1358
|
.filter((c) => !NON_PERSON_ROLES.includes(c.role.roleName))
|
|
1294
|
-
.map((c) =>
|
|
1359
|
+
.map((c) => createRemoteParticipant(c)) });
|
|
1295
1360
|
});
|
|
1296
1361
|
builder.addCase(rtcEvents.streamAdded, (state, action) => {
|
|
1297
1362
|
return addStream(state, action.payload);
|
|
@@ -1301,7 +1366,7 @@ const remoteParticipantsSlice = createSlice({
|
|
|
1301
1366
|
if (NON_PERSON_ROLES.includes(client.role.roleName)) {
|
|
1302
1367
|
return state;
|
|
1303
1368
|
}
|
|
1304
|
-
return addParticipant(state,
|
|
1369
|
+
return addParticipant(state, createRemoteParticipant(client, true));
|
|
1305
1370
|
});
|
|
1306
1371
|
builder.addCase(signalEvents.clientLeft, (state, action) => {
|
|
1307
1372
|
const { clientId } = action.payload;
|
|
@@ -1415,7 +1480,7 @@ const doKnockRoom = createAppThunk(() => (dispatch, getState) => {
|
|
|
1415
1480
|
const state = getState();
|
|
1416
1481
|
const socket = selectSignalConnectionRaw(state).socket;
|
|
1417
1482
|
const roomName = selectAppRoomName(state);
|
|
1418
|
-
const roomKey =
|
|
1483
|
+
const roomKey = selectAuthorizationRoomKey(state);
|
|
1419
1484
|
const displayName = selectAppDisplayName(state);
|
|
1420
1485
|
const userAgent = selectAppUserAgent(state);
|
|
1421
1486
|
const externalId = selectAppExternalId(state);
|
|
@@ -1444,7 +1509,7 @@ const doConnectRoom = createAppThunk(() => (dispatch, getState) => {
|
|
|
1444
1509
|
const state = getState();
|
|
1445
1510
|
const socket = selectSignalConnectionRaw(state).socket;
|
|
1446
1511
|
const roomName = selectAppRoomName(state);
|
|
1447
|
-
const roomKey =
|
|
1512
|
+
const roomKey = selectAuthorizationRoomKey(state);
|
|
1448
1513
|
const displayName = selectAppDisplayName(state);
|
|
1449
1514
|
const userAgent = selectAppUserAgent(state);
|
|
1450
1515
|
const externalId = selectAppExternalId(state);
|
|
@@ -2035,6 +2100,7 @@ var _a;
|
|
|
2035
2100
|
const IS_DEV = (_a = undefined === "true") !== null && _a !== void 0 ? _a : false;
|
|
2036
2101
|
const rootReducer = combineReducers({
|
|
2037
2102
|
app: appSlice.reducer,
|
|
2103
|
+
authorization: authorizationSlice.reducer,
|
|
2038
2104
|
chat: chatSlice.reducer,
|
|
2039
2105
|
cloudRecording: cloudRecordingSlice.reducer,
|
|
2040
2106
|
deviceCredentials: deviceCredentialsSlice.reducer,
|
|
@@ -3084,4 +3150,4 @@ function createServices() {
|
|
|
3084
3150
|
};
|
|
3085
3151
|
}
|
|
3086
3152
|
|
|
3087
|
-
export { ApiClient, Credentials, CredentialsService, LocalParticipant, OrganizationApiClient, OrganizationService, OrganizationServiceCache, RoomService, addAppListener, appLeft, appSlice, chatSlice, cloudRecordingSlice, createAppAsyncThunk, createAppThunk, createReactor, createServices, createStore, createWebRtcEmitter, debounce, deviceBusy, deviceCredentialsSlice, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppJoin, doConnectRoom, doConnectRtc, doDisconnectRtc, doEnableAudio, doEnableVideo, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKnockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSetDevice, doSetDisplayName, doSetLocalParticipant, doSignalDisconnect, doSignalIdentifyDevice, doSignalReconnect, doSignalSocketConnect, doStartCloudRecording, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doUpdateDeviceList, fakeAudioStream, fakeWebcamFrame, initialCloudRecordingState, initialLocalMediaState, isAcceptingStreams, listenerMiddleware, localMediaSlice, localMediaStopped, localParticipantSlice, localScreenshareSlice, localStreamMetadataUpdated, observeStore, organizationSlice, parseRoomUrlAndSubdomain, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, resolutionReported, roomConnectionSlice, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcConnectionSlice, rtcDisconnected, rtcDispatcherCreated, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAppDisplayName, selectAppExternalId, selectAppIsNodeSdk, selectAppRaw,
|
|
3153
|
+
export { ApiClient, Credentials, CredentialsService, LocalParticipant, OrganizationApiClient, OrganizationService, OrganizationServiceCache, RoomService, addAppListener, appLeft, appSlice, authorizationSlice, chatSlice, cloudRecordingSlice, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createReactor, createServices, createStore, createWebRtcEmitter, debounce, deviceBusy, deviceCredentialsSlice, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppJoin, doConnectRoom, doConnectRtc, doDisconnectRtc, doEnableAudio, doEnableVideo, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKnockRoom, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSetDevice, doSetDisplayName, doSetLocalParticipant, doSignalDisconnect, doSignalIdentifyDevice, doSignalReconnect, doSignalSocketConnect, doStartCloudRecording, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doUpdateDeviceList, fakeAudioStream, fakeWebcamFrame, initialCloudRecordingState, initialLocalMediaState, isAcceptingStreams, listenerMiddleware, localMediaSlice, localMediaStopped, localParticipantSlice, localScreenshareSlice, localStreamMetadataUpdated, observeStore, organizationSlice, parseRoomUrlAndSubdomain, parseUnverifiedRoomKeyData, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, resolutionReported, roomConnectionSlice, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcConnectionSlice, rtcDisconnected, rtcDispatcherCreated, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAppDisplayName, selectAppExternalId, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAppWantsToJoin, selectAuthorizationRoomKey, selectAuthorizationRoomLocked, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToLockRoom, selectIsCameraEnabled, selectIsCloudRecording, selectIsLocalMediaStarting, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantClientClaim, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantRole, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectOrganizationId, selectOrganizationRaw, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, startAppListening, stopScreenshare, streamStatusUpdated, streamingSlice, toggleCameraEnabled, toggleMicrophoneEnabled, updateReportedValues, waitingParticipantsSlice };
|
package/package.json
CHANGED