@whereby.com/core 1.17.0 → 1.18.1
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 +694 -420
- package/dist/index.d.cts +84 -6
- package/dist/index.d.mts +84 -6
- package/dist/index.d.ts +84 -6
- package/dist/index.mjs +690 -421
- package/dist/legacy-esm.js +690 -421
- package/dist/redux/index.cjs +667 -417
- package/dist/redux/index.d.cts +333 -33
- package/dist/redux/index.d.mts +333 -33
- package/dist/redux/index.d.ts +333 -33
- package/dist/redux/index.js +637 -418
- package/dist/redux/index.mjs +637 -418
- package/package.json +4 -4
package/dist/redux/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var toolkit = require('@reduxjs/toolkit');
|
|
4
4
|
var media = require('@whereby.com/media');
|
|
5
|
-
var uuid = require('uuid');
|
|
6
5
|
var events$1 = require('events');
|
|
6
|
+
var uuid = require('uuid');
|
|
7
7
|
var nodeBtoa = require('btoa');
|
|
8
8
|
var axios = require('axios');
|
|
9
9
|
|
|
@@ -76,7 +76,7 @@ const createReactor = (selectors, callback) => {
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
const coreVersion = "1.
|
|
79
|
+
const coreVersion = "1.18.1";
|
|
80
80
|
|
|
81
81
|
function decodeRoomName(roomName) {
|
|
82
82
|
if (!roomName) {
|
|
@@ -141,6 +141,9 @@ const signalEvents = {
|
|
|
141
141
|
breakoutMoveToGroup: createSignalEventAction("breakoutMoveToGroup"),
|
|
142
142
|
breakoutMoveToMain: createSignalEventAction("breakoutMoveToMain"),
|
|
143
143
|
breakoutSessionUpdated: createSignalEventAction("breakoutSessionUpdated"),
|
|
144
|
+
breakoutEnding: createSignalEventAction("breakoutEnding"),
|
|
145
|
+
breakoutTimerEnded: createSignalEventAction("breakoutTimerEnded"),
|
|
146
|
+
breakoutTimerExtended: createSignalEventAction("breakoutTimerExtended"),
|
|
144
147
|
chatMessage: createSignalEventAction("chatMessage"),
|
|
145
148
|
chatMessageRemoved: createSignalEventAction("chatMessageRemoved"),
|
|
146
149
|
fileSharingError: createSignalEventAction("fileSharingError"),
|
|
@@ -181,6 +184,7 @@ const ROOM_ACTION_PERMISSIONS_BY_ROLE = {
|
|
|
181
184
|
canEndMeeting: ["host"],
|
|
182
185
|
canAskToSpeak: ["host"],
|
|
183
186
|
canSpotlight: ["host"],
|
|
187
|
+
canManageBreakout: ["host"],
|
|
184
188
|
};
|
|
185
189
|
const authorizationSliceInitialState = {
|
|
186
190
|
roomKey: null,
|
|
@@ -223,6 +227,7 @@ const selectIsAuthorizedToKickClient = toolkit.createSelector(selectAuthorizatio
|
|
|
223
227
|
const selectIsAuthorizedToEndMeeting = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canEndMeeting.includes(localParticipantRole));
|
|
224
228
|
const selectIsAuthorizedToAskToSpeak = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canAskToSpeak.includes(localParticipantRole));
|
|
225
229
|
const selectIsAuthorizedToSpotlight = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canSpotlight.includes(localParticipantRole));
|
|
230
|
+
const selectIsAuthorizedToManageBreakout = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canManageBreakout.includes(localParticipantRole));
|
|
226
231
|
|
|
227
232
|
/******************************************************************************
|
|
228
233
|
Copyright (c) Microsoft Corporation.
|
|
@@ -354,6 +359,9 @@ function forwardSocketEvents(socket, dispatch) {
|
|
|
354
359
|
socket.on("breakout_session_updated", (payload) => dispatch(signalEvents.breakoutSessionUpdated(payload)));
|
|
355
360
|
socket.on("breakout_move_to_group", () => dispatch(signalEvents.breakoutMoveToGroup()));
|
|
356
361
|
socket.on("breakout_move_to_main", () => dispatch(signalEvents.breakoutMoveToMain()));
|
|
362
|
+
socket.on("breakout_ending", () => dispatch(signalEvents.breakoutEnding()));
|
|
363
|
+
socket.on("breakout_timer_ended", () => dispatch(signalEvents.breakoutTimerEnded()));
|
|
364
|
+
socket.on("breakout_timer_extended", () => dispatch(signalEvents.breakoutTimerExtended()));
|
|
357
365
|
}
|
|
358
366
|
const SIGNAL_BASE_URL = "wss://signal.appearin.net";
|
|
359
367
|
function createSocket() {
|
|
@@ -1076,209 +1084,6 @@ const selectLocalParticipantView = toolkit.createSelector(selectLocalParticipant
|
|
|
1076
1084
|
return clientView;
|
|
1077
1085
|
});
|
|
1078
1086
|
|
|
1079
|
-
function createBreakout({ assignments, groups, startedAt, initiatedBy, breakoutStartedAt, breakoutEndedAt, breakoutNotification, breakoutTimerDuration, autoMoveToGroup, moveToGroupGracePeriod, autoMoveToMain, moveToMainGracePeriod, enforceAssignment, breakoutTimerSetting, } = {}) {
|
|
1080
|
-
return {
|
|
1081
|
-
assignments: assignments || null,
|
|
1082
|
-
groups: groups || null,
|
|
1083
|
-
startedAt: startedAt ? new Date(startedAt) : null,
|
|
1084
|
-
initiatedBy,
|
|
1085
|
-
breakoutStartedAt: breakoutStartedAt || null,
|
|
1086
|
-
breakoutEndedAt: breakoutEndedAt || null,
|
|
1087
|
-
breakoutNotification: breakoutNotification || null,
|
|
1088
|
-
breakoutTimerDuration: breakoutTimerDuration || 1800,
|
|
1089
|
-
autoMoveToGroup: autoMoveToGroup || false,
|
|
1090
|
-
moveToGroupGracePeriod: moveToGroupGracePeriod || 10,
|
|
1091
|
-
autoMoveToMain: autoMoveToMain || false,
|
|
1092
|
-
moveToMainGracePeriod: moveToMainGracePeriod || 30,
|
|
1093
|
-
enforceAssignment: enforceAssignment || false,
|
|
1094
|
-
breakoutTimerSetting: breakoutTimerSetting || false,
|
|
1095
|
-
};
|
|
1096
|
-
}
|
|
1097
|
-
const breakoutSliceInitialState = Object.assign(Object.assign({}, createBreakout()), { groupId: null });
|
|
1098
|
-
const breakoutSlice = toolkit.createSlice({
|
|
1099
|
-
name: "breakout",
|
|
1100
|
-
initialState: breakoutSliceInitialState,
|
|
1101
|
-
reducers: {},
|
|
1102
|
-
extraReducers: (builder) => {
|
|
1103
|
-
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
1104
|
-
if ("error" in action.payload) {
|
|
1105
|
-
return state;
|
|
1106
|
-
}
|
|
1107
|
-
const { breakout } = action.payload || {};
|
|
1108
|
-
if (breakout) {
|
|
1109
|
-
return Object.assign(Object.assign({}, state), createBreakout(breakout));
|
|
1110
|
-
}
|
|
1111
|
-
return state;
|
|
1112
|
-
});
|
|
1113
|
-
builder.addCase(signalEvents.breakoutSessionUpdated, (state, action) => {
|
|
1114
|
-
return Object.assign(Object.assign({}, state), createBreakout(action.payload));
|
|
1115
|
-
});
|
|
1116
|
-
builder.addCase(signalEvents.breakoutGroupJoined, (state, action) => {
|
|
1117
|
-
var _a;
|
|
1118
|
-
if (((_a = action.meta) === null || _a === void 0 ? void 0 : _a.localParticipantId) !== action.payload.clientId) {
|
|
1119
|
-
return state;
|
|
1120
|
-
}
|
|
1121
|
-
return Object.assign(Object.assign({}, state), { groupId: action.payload.group });
|
|
1122
|
-
});
|
|
1123
|
-
},
|
|
1124
|
-
});
|
|
1125
|
-
const doBreakoutJoin = createAppThunk((payload) => (_, getState) => {
|
|
1126
|
-
const state = getState();
|
|
1127
|
-
const { socket } = selectSignalConnectionRaw(state);
|
|
1128
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("join_breakout_group", { group: payload.group });
|
|
1129
|
-
});
|
|
1130
|
-
const selectBreakoutRaw = (state) => state.breakout;
|
|
1131
|
-
const selectBreakoutInitiatedBy = (state) => state.breakout.initiatedBy;
|
|
1132
|
-
const selectBreakoutActive = (state) => !!state.breakout.startedAt;
|
|
1133
|
-
const selectBreakoutAssignments = (state) => state.breakout.assignments;
|
|
1134
|
-
const selectBreakoutGroups = (state) => state.breakout.groups;
|
|
1135
|
-
const selectBreakoutCurrentId = toolkit.createSelector(selectBreakoutRaw, selectLocalParticipantBreakoutGroup, (raw, localParticipantBreakoutGroup) => {
|
|
1136
|
-
return raw.groupId || localParticipantBreakoutGroup || "";
|
|
1137
|
-
});
|
|
1138
|
-
const selectBreakoutCurrentGroup = toolkit.createSelector(selectBreakoutRaw, selectBreakoutCurrentId, (raw, breakoutCurrentId) => {
|
|
1139
|
-
var _a;
|
|
1140
|
-
const name = (_a = raw.groups) === null || _a === void 0 ? void 0 : _a[breakoutCurrentId];
|
|
1141
|
-
if (!name)
|
|
1142
|
-
return null;
|
|
1143
|
-
return { id: breakoutCurrentId, name };
|
|
1144
|
-
});
|
|
1145
|
-
startAppListening({
|
|
1146
|
-
actionCreator: signalEvents.breakoutMoveToGroup,
|
|
1147
|
-
effect: (_, { dispatch, getState }) => {
|
|
1148
|
-
const state = getState();
|
|
1149
|
-
const localParticipant = selectLocalParticipantRaw(state);
|
|
1150
|
-
const breakoutGroupAssigned = localParticipant.breakoutGroupAssigned;
|
|
1151
|
-
if (breakoutGroupAssigned) {
|
|
1152
|
-
dispatch(doBreakoutJoin({ group: breakoutGroupAssigned }));
|
|
1153
|
-
}
|
|
1154
|
-
},
|
|
1155
|
-
});
|
|
1156
|
-
startAppListening({
|
|
1157
|
-
actionCreator: signalEvents.breakoutMoveToMain,
|
|
1158
|
-
effect: (_, { dispatch }) => {
|
|
1159
|
-
dispatch(doBreakoutJoin({ group: "" }));
|
|
1160
|
-
},
|
|
1161
|
-
});
|
|
1162
|
-
startAppListening({
|
|
1163
|
-
actionCreator: signalEvents.breakoutSessionUpdated,
|
|
1164
|
-
effect: ({ payload }, { dispatch, getState }) => {
|
|
1165
|
-
var _a;
|
|
1166
|
-
const state = getState();
|
|
1167
|
-
const autoMoveToMain = selectBreakoutRaw(state).autoMoveToMain;
|
|
1168
|
-
if (((_a = payload.initiatedBy) === null || _a === void 0 ? void 0 : _a.active) === false) {
|
|
1169
|
-
if (!autoMoveToMain) {
|
|
1170
|
-
dispatch(doBreakoutJoin({ group: "" }));
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
},
|
|
1174
|
-
});
|
|
1175
|
-
|
|
1176
|
-
const chatSliceInitialState = {
|
|
1177
|
-
chatMessages: [],
|
|
1178
|
-
};
|
|
1179
|
-
const chatSlice = toolkit.createSlice({
|
|
1180
|
-
name: "chat",
|
|
1181
|
-
initialState: chatSliceInitialState,
|
|
1182
|
-
reducers: {},
|
|
1183
|
-
extraReducers(builder) {
|
|
1184
|
-
builder.addCase(signalEvents.chatMessage, (state, action) => {
|
|
1185
|
-
const message = Object.assign({ id: action.payload.id, senderId: action.payload.senderId, parentId: action.payload.parentId, timestamp: action.payload.timestamp, text: action.payload.text, sig: action.payload.sig, removed: false }, (action.payload.file && { file: action.payload.file }));
|
|
1186
|
-
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, message] });
|
|
1187
|
-
});
|
|
1188
|
-
builder.addCase(signalEvents.chatMessageRemoved, (state, action) => {
|
|
1189
|
-
return Object.assign(Object.assign({}, state), { chatMessages: state.chatMessages.map((m) => {
|
|
1190
|
-
return Object.assign(Object.assign({}, m), (m.id === action.payload.id && {
|
|
1191
|
-
removed: true,
|
|
1192
|
-
}));
|
|
1193
|
-
}) });
|
|
1194
|
-
});
|
|
1195
|
-
},
|
|
1196
|
-
});
|
|
1197
|
-
const doSendChatMessage = createRoomConnectedThunk((payload) => (_, getState) => {
|
|
1198
|
-
const state = getState();
|
|
1199
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
1200
|
-
const breakoutCurrentId = selectBreakoutCurrentId(state);
|
|
1201
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("chat_message", Object.assign(Object.assign(Object.assign({ text: payload.text }, (payload.parentId && { parentId: payload.parentId })), (breakoutCurrentId && { breakoutGroup: breakoutCurrentId })), (payload.isBroadcast && { broadcast: true })));
|
|
1202
|
-
});
|
|
1203
|
-
const doRemoveChatMessage = createRoomConnectedThunk(({ id, sig }) => (_, getState) => {
|
|
1204
|
-
const state = getState();
|
|
1205
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
1206
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("remove_chat_message", {
|
|
1207
|
-
id,
|
|
1208
|
-
sig,
|
|
1209
|
-
});
|
|
1210
|
-
});
|
|
1211
|
-
const selectChatRaw = (state) => state.chat;
|
|
1212
|
-
const selectChatMessages = (state) => state.chat.chatMessages;
|
|
1213
|
-
|
|
1214
|
-
const initialCloudRecordingState = {
|
|
1215
|
-
isInitiator: false,
|
|
1216
|
-
isRecording: false,
|
|
1217
|
-
startedAt: undefined,
|
|
1218
|
-
};
|
|
1219
|
-
const cloudRecordingSlice = toolkit.createSlice({
|
|
1220
|
-
name: "cloudRecording",
|
|
1221
|
-
initialState: initialCloudRecordingState,
|
|
1222
|
-
reducers: {
|
|
1223
|
-
recordingRequestStarted: (state) => {
|
|
1224
|
-
return Object.assign(Object.assign({}, state), { isInitiator: true, status: "requested" });
|
|
1225
|
-
},
|
|
1226
|
-
},
|
|
1227
|
-
extraReducers: (builder) => {
|
|
1228
|
-
builder.addCase(signalEvents.cloudRecordingStopped, (state) => {
|
|
1229
|
-
return Object.assign(Object.assign({}, state), { isInitiator: false, isRecording: false, status: undefined });
|
|
1230
|
-
});
|
|
1231
|
-
builder.addCase(signalEvents.cloudRecordingStarted, (state, action) => {
|
|
1232
|
-
const { payload } = action;
|
|
1233
|
-
if (!payload.error) {
|
|
1234
|
-
return state;
|
|
1235
|
-
}
|
|
1236
|
-
return Object.assign(Object.assign({}, state), { isInitiator: false, isRecording: false, status: "error", error: payload.error });
|
|
1237
|
-
});
|
|
1238
|
-
builder.addCase(signalEvents.newClient, (state, { payload }) => {
|
|
1239
|
-
var _a;
|
|
1240
|
-
const { client } = payload;
|
|
1241
|
-
if (((_a = client.role) === null || _a === void 0 ? void 0 : _a.roleName) === "recorder") {
|
|
1242
|
-
return Object.assign(Object.assign({}, state), { isRecording: true, status: "recording", startedAt: client.startedCloudRecordingAt
|
|
1243
|
-
? new Date(client.startedCloudRecordingAt).getTime()
|
|
1244
|
-
: new Date().getTime() });
|
|
1245
|
-
}
|
|
1246
|
-
return state;
|
|
1247
|
-
});
|
|
1248
|
-
},
|
|
1249
|
-
});
|
|
1250
|
-
const { recordingRequestStarted } = cloudRecordingSlice.actions;
|
|
1251
|
-
const doStartCloudRecording = createRoomConnectedThunk(() => (dispatch, getState) => {
|
|
1252
|
-
const state = getState();
|
|
1253
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
1254
|
-
const status = selectCloudRecordingStatus(state);
|
|
1255
|
-
if (status && ["recording", "requested"].includes(status)) {
|
|
1256
|
-
return;
|
|
1257
|
-
}
|
|
1258
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("start_recording", {
|
|
1259
|
-
recording: "cloud",
|
|
1260
|
-
});
|
|
1261
|
-
dispatch(recordingRequestStarted());
|
|
1262
|
-
});
|
|
1263
|
-
const doStopCloudRecording = createRoomConnectedThunk(() => (dispatch, getState) => {
|
|
1264
|
-
const state = getState();
|
|
1265
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
1266
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("stop_recording");
|
|
1267
|
-
});
|
|
1268
|
-
const selectCloudRecordingRaw = (state) => state.cloudRecording;
|
|
1269
|
-
const selectCloudRecordingStatus = (state) => state.cloudRecording.status;
|
|
1270
|
-
const selectCloudRecordingStartedAt = (state) => state.cloudRecording.startedAt;
|
|
1271
|
-
const selectCloudRecordingError = (state) => state.cloudRecording.error;
|
|
1272
|
-
const selectIsCloudRecording = (state) => state.cloudRecording.isRecording;
|
|
1273
|
-
const selectCloudRecordingIsInitiator = (state) => state.cloudRecording.isInitiator;
|
|
1274
|
-
|
|
1275
|
-
const selectRoomConnectionRaw = (state) => state.roomConnection;
|
|
1276
|
-
const selectRoomConnectionSession = (state) => state.roomConnection.session;
|
|
1277
|
-
const selectRoomConnectionSessionId = (state) => { var _a; return (_a = state.roomConnection.session) === null || _a === void 0 ? void 0 : _a.id; };
|
|
1278
|
-
const selectRoomConnectionStatus = (state) => state.roomConnection.status;
|
|
1279
|
-
const selectRoomConnectionError = (state) => state.roomConnection.error;
|
|
1280
|
-
const selectRoomConnectionKnockResponse = (state) => state.roomConnection.knockResponse;
|
|
1281
|
-
|
|
1282
1087
|
function createRtcEventAction(name) {
|
|
1283
1088
|
return toolkit.createAction(`rtcConnection/event/${name}`);
|
|
1284
1089
|
}
|
|
@@ -1455,6 +1260,9 @@ const remoteParticipantsSlice = toolkit.createSlice({
|
|
|
1455
1260
|
});
|
|
1456
1261
|
builder.addCase(signalEvents.breakoutGroupJoined, (state, action) => {
|
|
1457
1262
|
const { clientId, group } = action.payload;
|
|
1263
|
+
if (!findParticipant(state, clientId).participant) {
|
|
1264
|
+
return state;
|
|
1265
|
+
}
|
|
1458
1266
|
return updateParticipant(state, clientId, {
|
|
1459
1267
|
breakoutGroup: group || null,
|
|
1460
1268
|
});
|
|
@@ -1496,43 +1304,618 @@ const selectNumParticipants = toolkit.createSelector(selectRemoteParticipants, s
|
|
|
1496
1304
|
return clients.length + 1;
|
|
1497
1305
|
});
|
|
1498
1306
|
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1307
|
+
const selectRoomConnectionRaw = (state) => state.roomConnection;
|
|
1308
|
+
const selectRoomConnectionSession = (state) => state.roomConnection.session;
|
|
1309
|
+
const selectRoomConnectionSessionId = (state) => { var _a; return (_a = state.roomConnection.session) === null || _a === void 0 ? void 0 : _a.id; };
|
|
1310
|
+
const selectRoomConnectionStatus = (state) => state.roomConnection.status;
|
|
1311
|
+
const selectRoomConnectionError = (state) => state.roomConnection.error;
|
|
1312
|
+
const selectRoomConnectionKnockResponse = (state) => state.roomConnection.knockResponse;
|
|
1313
|
+
|
|
1314
|
+
const emitter = new events$1.EventEmitter();
|
|
1315
|
+
function createNotificationEvent(payload) {
|
|
1316
|
+
const notificationEvent = Object.assign(Object.assign({}, payload), { timestamp: Date.now() });
|
|
1317
|
+
return notificationEvent;
|
|
1318
|
+
}
|
|
1319
|
+
const initialNotificationsState = {
|
|
1320
|
+
emitter,
|
|
1321
|
+
events: [],
|
|
1503
1322
|
};
|
|
1504
|
-
const
|
|
1505
|
-
name: "
|
|
1506
|
-
initialState:
|
|
1323
|
+
const notificationsSlice = toolkit.createSlice({
|
|
1324
|
+
name: "notifications",
|
|
1325
|
+
initialState: initialNotificationsState,
|
|
1507
1326
|
reducers: {
|
|
1508
|
-
|
|
1509
|
-
return Object.assign(Object.assign({}, state), {
|
|
1327
|
+
addNotification: (state, action) => {
|
|
1328
|
+
return Object.assign(Object.assign({}, state), { events: [...state.events, Object.assign({}, action.payload)] });
|
|
1329
|
+
},
|
|
1330
|
+
doClearNotifications: (state) => {
|
|
1331
|
+
return Object.assign(Object.assign({}, state), { events: [] });
|
|
1510
1332
|
},
|
|
1511
|
-
},
|
|
1512
|
-
extraReducers: (builder) => {
|
|
1513
|
-
builder.addCase(doStartScreenshare.pending, (state) => {
|
|
1514
|
-
return Object.assign(Object.assign({}, state), { status: "starting" });
|
|
1515
|
-
});
|
|
1516
|
-
builder.addCase(doStartScreenshare.fulfilled, (state, { payload: { stream } }) => {
|
|
1517
|
-
return Object.assign(Object.assign({}, state), { status: "active", stream });
|
|
1518
|
-
});
|
|
1519
|
-
builder.addCase(doStartScreenshare.rejected, (state, { payload }) => {
|
|
1520
|
-
return Object.assign(Object.assign({}, state), { error: payload, status: "inactive", stream: null });
|
|
1521
|
-
});
|
|
1522
1333
|
},
|
|
1523
1334
|
});
|
|
1524
|
-
const {
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1335
|
+
const { doClearNotifications } = notificationsSlice.actions;
|
|
1336
|
+
const doSetNotification = createAppThunk((payload) => (dispatch, getState) => {
|
|
1337
|
+
dispatch(notificationsSlice.actions.addNotification(payload));
|
|
1338
|
+
const state = getState();
|
|
1339
|
+
const emitter = selectNotificationsEmitter(state);
|
|
1340
|
+
emitter.emit(payload.type, payload);
|
|
1341
|
+
emitter.emit("*", payload);
|
|
1342
|
+
});
|
|
1343
|
+
const selectNotificationsRaw = (state) => state.notifications;
|
|
1344
|
+
const selectNotificationsEvents = (state) => state.notifications.events;
|
|
1345
|
+
const selectNotificationsEmitter = (state) => state.notifications.emitter;
|
|
1346
|
+
startAppListening({
|
|
1347
|
+
actionCreator: signalEvents.chatMessage,
|
|
1348
|
+
effect: ({ payload }, { dispatch, getState }) => {
|
|
1349
|
+
const state = getState();
|
|
1350
|
+
const selfId = selectSelfId(state);
|
|
1351
|
+
if (selfId === payload.senderId) {
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
const client = selectRemoteParticipants(state).find(({ id }) => id === payload.senderId);
|
|
1355
|
+
if (!client) {
|
|
1356
|
+
console.warn("Could not find remote client that sent chat message");
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1360
|
+
type: "chatMessageReceived",
|
|
1361
|
+
message: `${client.displayName} says: ${payload.text}`,
|
|
1362
|
+
props: {
|
|
1363
|
+
client,
|
|
1364
|
+
chatMessage: {
|
|
1365
|
+
id: payload.id,
|
|
1366
|
+
senderId: payload.senderId,
|
|
1367
|
+
parentId: payload.parentId,
|
|
1368
|
+
timestamp: payload.timestamp,
|
|
1369
|
+
text: payload.text,
|
|
1370
|
+
sig: payload.sig,
|
|
1371
|
+
removed: false,
|
|
1372
|
+
},
|
|
1373
|
+
},
|
|
1374
|
+
})));
|
|
1375
|
+
},
|
|
1376
|
+
});
|
|
1377
|
+
startAppListening({
|
|
1378
|
+
actionCreator: signalEvents.audioEnableRequested,
|
|
1379
|
+
effect: ({ payload }, { dispatch, getState }) => {
|
|
1380
|
+
const { enable, requestedByClientId } = payload;
|
|
1381
|
+
const state = getState();
|
|
1382
|
+
const client = selectRemoteParticipants(state).find(({ id }) => id === requestedByClientId);
|
|
1383
|
+
if (!client) {
|
|
1384
|
+
console.warn("Could not find remote client that requested a local audio change");
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1388
|
+
type: enable ? "requestAudioEnable" : "requestAudioDisable",
|
|
1389
|
+
message: enable
|
|
1390
|
+
? `${client.displayName} has requested for you to speak`
|
|
1391
|
+
: `${client.displayName} has muted your microphone`,
|
|
1392
|
+
props: {
|
|
1393
|
+
client,
|
|
1394
|
+
enable,
|
|
1395
|
+
},
|
|
1396
|
+
})));
|
|
1397
|
+
},
|
|
1398
|
+
});
|
|
1399
|
+
startAppListening({
|
|
1400
|
+
actionCreator: signalEvents.videoEnableRequested,
|
|
1401
|
+
effect: ({ payload }, { dispatch, getState }) => {
|
|
1402
|
+
const { enable, requestedByClientId } = payload;
|
|
1403
|
+
const state = getState();
|
|
1404
|
+
const client = selectRemoteParticipants(state).find(({ id }) => id === requestedByClientId);
|
|
1405
|
+
if (!client) {
|
|
1406
|
+
console.warn("Could not find remote client that requested a local video change");
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1410
|
+
type: enable ? "requestVideoEnable" : "requestVideoDisable",
|
|
1411
|
+
message: enable
|
|
1412
|
+
? `${client.displayName} has requested for you to start video`
|
|
1413
|
+
: `${client.displayName} has stopped your video`,
|
|
1414
|
+
props: {
|
|
1415
|
+
client,
|
|
1416
|
+
enable,
|
|
1417
|
+
},
|
|
1418
|
+
})));
|
|
1419
|
+
},
|
|
1420
|
+
});
|
|
1421
|
+
startAppListening({
|
|
1422
|
+
actionCreator: signalEvents.clientMetadataReceived,
|
|
1423
|
+
effect: (action, { dispatch, getOriginalState, getState }) => {
|
|
1424
|
+
var _a;
|
|
1425
|
+
const { error, payload } = action.payload;
|
|
1426
|
+
if (error || !payload) {
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
const { clientId, stickyReaction } = payload;
|
|
1430
|
+
const state = getState();
|
|
1431
|
+
const canAskToSpeak = selectIsAuthorizedToAskToSpeak(state);
|
|
1432
|
+
if (!canAskToSpeak) {
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
const client = selectRemoteParticipants(state).find(({ id }) => id === clientId);
|
|
1436
|
+
if (!client) {
|
|
1437
|
+
console.warn("Could not find remote client that provided updated metadata");
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
const previousState = getOriginalState();
|
|
1441
|
+
const previousClient = selectRemoteParticipants(previousState).find(({ id }) => id === clientId);
|
|
1442
|
+
if ((!stickyReaction && !(previousClient === null || previousClient === void 0 ? void 0 : previousClient.stickyReaction)) ||
|
|
1443
|
+
(stickyReaction === null || stickyReaction === void 0 ? void 0 : stickyReaction.timestamp) === ((_a = previousClient === null || previousClient === void 0 ? void 0 : previousClient.stickyReaction) === null || _a === void 0 ? void 0 : _a.timestamp)) {
|
|
1444
|
+
return;
|
|
1445
|
+
}
|
|
1446
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1447
|
+
type: stickyReaction ? "remoteHandRaised" : "remoteHandLowered",
|
|
1448
|
+
message: `${client.displayName} ${stickyReaction ? "raised" : "lowered"} their hand`,
|
|
1449
|
+
props: {
|
|
1450
|
+
client,
|
|
1451
|
+
stickyReaction,
|
|
1452
|
+
},
|
|
1453
|
+
})));
|
|
1454
|
+
},
|
|
1455
|
+
});
|
|
1456
|
+
createReactor([selectSignalStatus], ({ dispatch, getState }, signalStatus) => {
|
|
1457
|
+
const state = getState();
|
|
1458
|
+
const roomConnectionStatus = selectRoomConnectionStatus(state);
|
|
1459
|
+
if (["left", "kicked"].includes(roomConnectionStatus)) {
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
if (signalStatus === "disconnected") {
|
|
1463
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1464
|
+
type: "signalTrouble",
|
|
1465
|
+
message: `Network connection lost. Trying to reconnect you...`,
|
|
1466
|
+
props: {},
|
|
1467
|
+
})));
|
|
1468
|
+
}
|
|
1469
|
+
else if (signalStatus === "connected") {
|
|
1470
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1471
|
+
type: "signalOk",
|
|
1472
|
+
message: `Network connection available`,
|
|
1473
|
+
props: {},
|
|
1474
|
+
})));
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
startAppListening({
|
|
1478
|
+
actionCreator: signalEvents.clientUnableToJoin,
|
|
1479
|
+
effect: (action, { dispatch }) => {
|
|
1480
|
+
var _a;
|
|
1481
|
+
if (((_a = action.payload) === null || _a === void 0 ? void 0 : _a.error) === "room_full") {
|
|
1482
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1483
|
+
type: "clientUnableToJoinFullRoom",
|
|
1484
|
+
message: "Someone tried to join but the room is full and at capacity.",
|
|
1485
|
+
props: {},
|
|
1486
|
+
})));
|
|
1487
|
+
}
|
|
1488
|
+
},
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
const DEFAULT_BREAKOUT_TIMER_DURATION = 1800;
|
|
1492
|
+
function createBreakout({ assignments, groups, startedAt, initiatedBy, breakoutStartedAt, breakoutEndedAt, breakoutNotification, breakoutTimerDuration, autoMoveToGroup, moveToGroupGracePeriod, autoMoveToMain, moveToMainGracePeriod, enforceAssignment, breakoutTimerSetting, } = {}) {
|
|
1493
|
+
return {
|
|
1494
|
+
assignments: assignments || null,
|
|
1495
|
+
groups: groups || null,
|
|
1496
|
+
startedAt: startedAt ? new Date(startedAt) : null,
|
|
1497
|
+
initiatedBy,
|
|
1498
|
+
breakoutStartedAt: breakoutStartedAt || null,
|
|
1499
|
+
breakoutEndedAt: breakoutEndedAt || null,
|
|
1500
|
+
breakoutNotification: breakoutNotification || null,
|
|
1501
|
+
breakoutTimerDuration: breakoutTimerDuration || DEFAULT_BREAKOUT_TIMER_DURATION,
|
|
1502
|
+
autoMoveToGroup: autoMoveToGroup || false,
|
|
1503
|
+
moveToGroupGracePeriod: moveToGroupGracePeriod || 10,
|
|
1504
|
+
autoMoveToMain: autoMoveToMain || false,
|
|
1505
|
+
moveToMainGracePeriod: moveToMainGracePeriod || 30,
|
|
1506
|
+
enforceAssignment: enforceAssignment || false,
|
|
1507
|
+
breakoutTimerSetting: breakoutTimerSetting || false,
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
const breakoutSliceInitialState = Object.assign(Object.assign({}, createBreakout()), { error: null });
|
|
1511
|
+
const BREAKOUT_UNAVAILABLE_ERROR = "Breakout groups are not available in peer-to-peer rooms";
|
|
1512
|
+
const breakoutSlice = toolkit.createSlice({
|
|
1513
|
+
name: "breakout",
|
|
1514
|
+
initialState: breakoutSliceInitialState,
|
|
1515
|
+
reducers: {
|
|
1516
|
+
setBreakoutError: (state, action) => {
|
|
1517
|
+
return Object.assign(Object.assign({}, state), { error: action.payload.error });
|
|
1518
|
+
},
|
|
1519
|
+
},
|
|
1520
|
+
extraReducers: (builder) => {
|
|
1521
|
+
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
1522
|
+
if ("error" in action.payload) {
|
|
1523
|
+
return state;
|
|
1524
|
+
}
|
|
1525
|
+
const { breakout } = action.payload || {};
|
|
1526
|
+
state = Object.assign(Object.assign({}, state), { error: null });
|
|
1527
|
+
if (breakout) {
|
|
1528
|
+
return Object.assign(Object.assign({}, state), createBreakout(breakout));
|
|
1529
|
+
}
|
|
1530
|
+
return state;
|
|
1531
|
+
});
|
|
1532
|
+
builder.addCase(signalEvents.breakoutSessionUpdated, (state, action) => {
|
|
1533
|
+
return Object.assign(Object.assign({}, state), createBreakout(action.payload));
|
|
1534
|
+
});
|
|
1535
|
+
},
|
|
1536
|
+
});
|
|
1537
|
+
const { setBreakoutError } = breakoutSlice.actions;
|
|
1538
|
+
const doBreakoutJoin = createAppThunk((payload) => (_, getState) => {
|
|
1539
|
+
const state = getState();
|
|
1540
|
+
const { socket } = selectSignalConnectionRaw(state);
|
|
1541
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("join_breakout_group", { group: payload.group });
|
|
1542
|
+
});
|
|
1543
|
+
function ensureDefaults(state, payload) {
|
|
1544
|
+
const { moveToGroupGracePeriod, moveToMainGracePeriod, breakoutTimerDuration } = state.breakout;
|
|
1545
|
+
const next = Object.assign({}, payload);
|
|
1546
|
+
if (next.autoMoveToGroup === true && next.moveToGroupGracePeriod == null) {
|
|
1547
|
+
next.moveToGroupGracePeriod = moveToGroupGracePeriod !== null && moveToGroupGracePeriod !== void 0 ? moveToGroupGracePeriod : 10;
|
|
1548
|
+
}
|
|
1549
|
+
if (next.autoMoveToMain === true && next.moveToMainGracePeriod == null) {
|
|
1550
|
+
next.moveToMainGracePeriod = moveToMainGracePeriod !== null && moveToMainGracePeriod !== void 0 ? moveToMainGracePeriod : 30;
|
|
1551
|
+
}
|
|
1552
|
+
if (next.breakoutTimerSetting === true && !next.breakoutTimerDuration) {
|
|
1553
|
+
next.breakoutTimerDuration = breakoutTimerDuration || DEFAULT_BREAKOUT_TIMER_DURATION;
|
|
1554
|
+
}
|
|
1555
|
+
return next;
|
|
1556
|
+
}
|
|
1557
|
+
function emitBreakoutSessionUpdate(state, payload) {
|
|
1558
|
+
const { socket } = selectSignalConnectionRaw(state);
|
|
1559
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("update_breakout_session", ensureDefaults(state, payload));
|
|
1560
|
+
}
|
|
1561
|
+
function resolveClientAssignmentsToDeviceAssignments(state, clientAssignments) {
|
|
1562
|
+
const deviceIdByClientId = {};
|
|
1563
|
+
for (const participant of selectRemoteParticipants(state)) {
|
|
1564
|
+
deviceIdByClientId[participant.id] = participant.deviceId;
|
|
1565
|
+
}
|
|
1566
|
+
const localParticipant = selectLocalParticipantRaw(state);
|
|
1567
|
+
const localDeviceId = selectDeviceId(state);
|
|
1568
|
+
if (localParticipant.id && localDeviceId) {
|
|
1569
|
+
deviceIdByClientId[localParticipant.id] = localDeviceId;
|
|
1570
|
+
}
|
|
1571
|
+
const deviceAssignments = {};
|
|
1572
|
+
for (const [clientId, group] of Object.entries(clientAssignments)) {
|
|
1573
|
+
const deviceId = deviceIdByClientId[clientId];
|
|
1574
|
+
if (deviceId) {
|
|
1575
|
+
deviceAssignments[deviceId] = group;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
return deviceAssignments;
|
|
1579
|
+
}
|
|
1580
|
+
const doStartBreakoutSession = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), (payload) => (dispatch, getState) => {
|
|
1581
|
+
const state = getState();
|
|
1582
|
+
if (!selectBreakoutIsAvailable(state)) {
|
|
1583
|
+
dispatch(setBreakoutError({ error: BREAKOUT_UNAVAILABLE_ERROR }));
|
|
1584
|
+
console.warn(BREAKOUT_UNAVAILABLE_ERROR);
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
dispatch(setBreakoutError({ error: null }));
|
|
1588
|
+
const { assignments } = payload, rest = __rest(payload, ["assignments"]);
|
|
1589
|
+
emitBreakoutSessionUpdate(state, Object.assign(Object.assign(Object.assign({}, rest), (assignments ? { assignments: resolveClientAssignmentsToDeviceAssignments(state, assignments) } : {})), { active: true }));
|
|
1590
|
+
});
|
|
1591
|
+
const doUpdateBreakoutSession = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), (payload) => (_, getState) => {
|
|
1592
|
+
const state = getState();
|
|
1593
|
+
const { assignments } = payload, rest = __rest(payload, ["assignments"]);
|
|
1594
|
+
emitBreakoutSessionUpdate(state, Object.assign(Object.assign({}, rest), (assignments ? { assignments: resolveClientAssignmentsToDeviceAssignments(state, assignments) } : {})));
|
|
1595
|
+
});
|
|
1596
|
+
const doStopBreakoutSession = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), () => (_, getState) => {
|
|
1597
|
+
emitBreakoutSessionUpdate(getState(), { active: false });
|
|
1598
|
+
});
|
|
1599
|
+
const doAssignBreakoutParticipants = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), (payload) => (_, getState) => {
|
|
1600
|
+
const state = getState();
|
|
1601
|
+
const deviceAssignments = resolveClientAssignmentsToDeviceAssignments(state, payload.assignments);
|
|
1602
|
+
const mergedAssignments = Object.assign(Object.assign({}, (selectBreakoutAssignments(state) || {})), deviceAssignments);
|
|
1603
|
+
emitBreakoutSessionUpdate(state, { assignments: mergedAssignments });
|
|
1604
|
+
});
|
|
1605
|
+
const BREAKOUT_GROUPS_MIN_MAX = [2, 20];
|
|
1606
|
+
const GROUP_ID_ALPHABET = "abcdefghijklmnopqrstuvwxyz";
|
|
1607
|
+
function defaultBreakoutGroupName(groupId) {
|
|
1608
|
+
return `Group ${groupId.toUpperCase()}`;
|
|
1609
|
+
}
|
|
1610
|
+
function createBreakoutGroups(count = BREAKOUT_GROUPS_MIN_MAX[0]) {
|
|
1611
|
+
const [min, max] = BREAKOUT_GROUPS_MIN_MAX;
|
|
1612
|
+
const amount = Math.min(Math.max(count, min), max);
|
|
1613
|
+
const groups = {};
|
|
1614
|
+
for (let i = 0; i < amount; i++) {
|
|
1615
|
+
const id = GROUP_ID_ALPHABET[i];
|
|
1616
|
+
groups[id] = defaultBreakoutGroupName(id);
|
|
1617
|
+
}
|
|
1618
|
+
return groups;
|
|
1619
|
+
}
|
|
1620
|
+
function shuffle(items) {
|
|
1621
|
+
return [...items].sort(() => Math.random() - 0.5);
|
|
1622
|
+
}
|
|
1623
|
+
function chunk(items, chunkCount) {
|
|
1624
|
+
let remaining = [...items];
|
|
1625
|
+
let count = chunkCount;
|
|
1626
|
+
const chunks = [];
|
|
1627
|
+
while (remaining.length && count > 0) {
|
|
1628
|
+
const size = Math.ceil(remaining.length / count);
|
|
1629
|
+
chunks.push(remaining.slice(0, size));
|
|
1630
|
+
remaining = remaining.slice(size);
|
|
1631
|
+
count -= 1;
|
|
1632
|
+
}
|
|
1633
|
+
return chunks;
|
|
1634
|
+
}
|
|
1635
|
+
function randomizeAssignments(deviceIds, groupIds) {
|
|
1636
|
+
const assignments = {};
|
|
1637
|
+
chunk(deviceIds, groupIds.length).forEach((chunkOfDevices, index) => {
|
|
1638
|
+
chunkOfDevices.forEach((deviceId) => {
|
|
1639
|
+
assignments[deviceId] = groupIds[index];
|
|
1640
|
+
});
|
|
1641
|
+
});
|
|
1642
|
+
return assignments;
|
|
1643
|
+
}
|
|
1644
|
+
const doAssignAllBreakoutParticipants = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), () => (_, getState) => {
|
|
1645
|
+
const state = getState();
|
|
1646
|
+
const groupIds = Object.keys(selectBreakoutGroups(state) || {});
|
|
1647
|
+
if (!groupIds.length)
|
|
1648
|
+
return;
|
|
1649
|
+
const deviceIds = shuffle(selectRemoteParticipants(state).map((participant) => participant.deviceId));
|
|
1650
|
+
emitBreakoutSessionUpdate(state, { assignments: randomizeAssignments(deviceIds, groupIds) });
|
|
1651
|
+
});
|
|
1652
|
+
const doUnassignAllBreakoutParticipants = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), () => (_, getState) => {
|
|
1653
|
+
const state = getState();
|
|
1654
|
+
const assignments = selectBreakoutAssignments(state) || {};
|
|
1655
|
+
const cleared = Object.keys(assignments).reduce((acc, deviceId) => {
|
|
1656
|
+
acc[deviceId] = "";
|
|
1657
|
+
return acc;
|
|
1658
|
+
}, {});
|
|
1659
|
+
emitBreakoutSessionUpdate(state, { assignments: cleared });
|
|
1660
|
+
});
|
|
1661
|
+
const doShuffleBreakoutParticipants = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), () => (_, getState) => {
|
|
1662
|
+
const state = getState();
|
|
1663
|
+
const groupIds = Object.keys(selectBreakoutGroups(state) || {});
|
|
1664
|
+
if (!groupIds.length)
|
|
1665
|
+
return;
|
|
1666
|
+
const assignments = selectBreakoutAssignments(state) || {};
|
|
1667
|
+
const deviceIds = shuffle(Object.entries(assignments)
|
|
1668
|
+
.filter(([, groupId]) => !!groupId)
|
|
1669
|
+
.map(([deviceId]) => deviceId));
|
|
1670
|
+
emitBreakoutSessionUpdate(state, { assignments: randomizeAssignments(deviceIds, groupIds) });
|
|
1671
|
+
});
|
|
1672
|
+
const doExtendBreakoutTimer = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), (payload) => (_, getState) => {
|
|
1673
|
+
var _a;
|
|
1674
|
+
const state = getState();
|
|
1675
|
+
const additionalSeconds = (_a = payload === null || payload === void 0 ? void 0 : payload.seconds) !== null && _a !== void 0 ? _a : 60;
|
|
1676
|
+
const breakoutTimerDuration = (selectBreakoutTimerDuration(state) || 0) + additionalSeconds;
|
|
1677
|
+
emitBreakoutSessionUpdate(state, { breakoutTimerDuration });
|
|
1678
|
+
});
|
|
1679
|
+
const doStopBreakoutTimer = createAppAuthorizedThunk((state) => selectIsAuthorizedToManageBreakout(state), () => (_, getState) => {
|
|
1680
|
+
emitBreakoutSessionUpdate(getState(), { breakoutTimerSetting: false });
|
|
1681
|
+
});
|
|
1682
|
+
const selectBreakoutRaw = (state) => state.breakout;
|
|
1683
|
+
const selectBreakoutError = (state) => state.breakout.error;
|
|
1684
|
+
const selectBreakoutIsAvailable = (state) => state.room.mode === "group";
|
|
1685
|
+
const selectBreakoutInitiatedBy = (state) => state.breakout.initiatedBy;
|
|
1686
|
+
const selectBreakoutActive = (state) => !!state.breakout.startedAt;
|
|
1687
|
+
const selectBreakoutAssignments = (state) => state.breakout.assignments;
|
|
1688
|
+
const selectBreakoutGroups = (state) => state.breakout.groups;
|
|
1689
|
+
const selectBreakoutEnforceAssignment = (state) => state.breakout.enforceAssignment;
|
|
1690
|
+
const selectBreakoutTimerSetting = (state) => state.breakout.breakoutTimerSetting;
|
|
1691
|
+
const selectBreakoutTimerDuration = (state) => state.breakout.breakoutTimerDuration;
|
|
1692
|
+
const selectBreakoutAutoMoveToGroup = (state) => state.breakout.autoMoveToGroup;
|
|
1693
|
+
const selectBreakoutMoveToGroupGracePeriod = (state) => state.breakout.moveToGroupGracePeriod;
|
|
1694
|
+
const selectBreakoutAutoMoveToMain = (state) => state.breakout.autoMoveToMain;
|
|
1695
|
+
const selectBreakoutMoveToMainGracePeriod = (state) => state.breakout.moveToMainGracePeriod;
|
|
1696
|
+
const selectBreakoutStartedAt = (state) => state.breakout.startedAt;
|
|
1697
|
+
const selectBreakoutEndTime = toolkit.createSelector(selectBreakoutRaw, (raw) => {
|
|
1698
|
+
if (!raw.breakoutStartedAt)
|
|
1699
|
+
return null;
|
|
1700
|
+
const startTime = new Date(raw.breakoutStartedAt).getTime();
|
|
1701
|
+
const gracePeriod = raw.autoMoveToGroup ? raw.moveToGroupGracePeriod || 0 : 0;
|
|
1702
|
+
return startTime + ((raw.breakoutTimerDuration || 0) + gracePeriod) * 1000;
|
|
1703
|
+
});
|
|
1704
|
+
const selectBreakoutMoveToGroupAt = toolkit.createSelector(selectBreakoutRaw, (raw) => {
|
|
1705
|
+
if (!raw.autoMoveToGroup || !raw.breakoutStartedAt)
|
|
1706
|
+
return null;
|
|
1707
|
+
return new Date(raw.breakoutStartedAt).getTime() + (raw.moveToGroupGracePeriod || 0) * 1000;
|
|
1708
|
+
});
|
|
1709
|
+
const selectBreakoutMoveToMainAt = toolkit.createSelector(selectBreakoutRaw, (raw) => {
|
|
1710
|
+
if (!raw.autoMoveToMain || !raw.breakoutEndedAt)
|
|
1711
|
+
return null;
|
|
1712
|
+
return new Date(raw.breakoutEndedAt).getTime() + (raw.moveToMainGracePeriod || 0) * 1000;
|
|
1713
|
+
});
|
|
1714
|
+
const selectBreakoutCurrentId = toolkit.createSelector(selectLocalParticipantBreakoutGroup, (localParticipantBreakoutGroup) => localParticipantBreakoutGroup || "");
|
|
1715
|
+
const selectBreakoutCurrentGroup = toolkit.createSelector(selectBreakoutRaw, selectBreakoutCurrentId, (raw, breakoutCurrentId) => {
|
|
1716
|
+
var _a;
|
|
1717
|
+
const name = (_a = raw.groups) === null || _a === void 0 ? void 0 : _a[breakoutCurrentId];
|
|
1718
|
+
if (!name)
|
|
1719
|
+
return null;
|
|
1720
|
+
return { id: breakoutCurrentId, name };
|
|
1721
|
+
});
|
|
1722
|
+
startAppListening({
|
|
1723
|
+
actionCreator: signalEvents.breakoutMoveToGroup,
|
|
1724
|
+
effect: (_, { dispatch, getState }) => {
|
|
1725
|
+
const state = getState();
|
|
1726
|
+
const localParticipant = selectLocalParticipantRaw(state);
|
|
1727
|
+
const breakoutGroupAssigned = localParticipant.breakoutGroupAssigned;
|
|
1728
|
+
if (breakoutGroupAssigned) {
|
|
1729
|
+
dispatch(doBreakoutJoin({ group: breakoutGroupAssigned }));
|
|
1730
|
+
}
|
|
1731
|
+
},
|
|
1732
|
+
});
|
|
1733
|
+
startAppListening({
|
|
1734
|
+
actionCreator: signalEvents.breakoutMoveToMain,
|
|
1735
|
+
effect: (_, { dispatch }) => {
|
|
1736
|
+
dispatch(doBreakoutJoin({ group: "" }));
|
|
1737
|
+
},
|
|
1738
|
+
});
|
|
1739
|
+
startAppListening({
|
|
1740
|
+
actionCreator: signalEvents.breakoutSessionUpdated,
|
|
1741
|
+
effect: ({ payload }, { dispatch, getState }) => {
|
|
1742
|
+
var _a;
|
|
1743
|
+
const state = getState();
|
|
1744
|
+
const autoMoveToMain = selectBreakoutRaw(state).autoMoveToMain;
|
|
1745
|
+
if (((_a = payload.initiatedBy) === null || _a === void 0 ? void 0 : _a.active) === false) {
|
|
1746
|
+
if (!autoMoveToMain) {
|
|
1747
|
+
dispatch(doBreakoutJoin({ group: "" }));
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
},
|
|
1751
|
+
});
|
|
1752
|
+
startAppListening({
|
|
1753
|
+
actionCreator: signalEvents.breakoutEnding,
|
|
1754
|
+
effect: (_, { dispatch }) => {
|
|
1755
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1756
|
+
type: "breakoutTimerEnding",
|
|
1757
|
+
message: "The breakout session is ending soon",
|
|
1758
|
+
props: {},
|
|
1759
|
+
})));
|
|
1760
|
+
},
|
|
1761
|
+
});
|
|
1762
|
+
startAppListening({
|
|
1763
|
+
actionCreator: signalEvents.breakoutTimerExtended,
|
|
1764
|
+
effect: (_, { dispatch }) => {
|
|
1765
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1766
|
+
type: "breakoutTimerExtended",
|
|
1767
|
+
message: "The breakout timer was extended",
|
|
1768
|
+
props: {},
|
|
1769
|
+
})));
|
|
1770
|
+
},
|
|
1771
|
+
});
|
|
1772
|
+
startAppListening({
|
|
1773
|
+
actionCreator: signalEvents.breakoutTimerEnded,
|
|
1774
|
+
effect: (_, { dispatch }) => {
|
|
1775
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1776
|
+
type: "breakoutTimerEnded",
|
|
1777
|
+
message: "The breakout timer ended",
|
|
1778
|
+
props: {},
|
|
1779
|
+
})));
|
|
1780
|
+
},
|
|
1781
|
+
});
|
|
1782
|
+
|
|
1783
|
+
const chatSliceInitialState = {
|
|
1784
|
+
chatMessages: [],
|
|
1785
|
+
};
|
|
1786
|
+
const chatSlice = toolkit.createSlice({
|
|
1787
|
+
name: "chat",
|
|
1788
|
+
initialState: chatSliceInitialState,
|
|
1789
|
+
reducers: {},
|
|
1790
|
+
extraReducers(builder) {
|
|
1791
|
+
builder.addCase(signalEvents.chatMessage, (state, action) => {
|
|
1792
|
+
const message = Object.assign({ id: action.payload.id, senderId: action.payload.senderId, parentId: action.payload.parentId, timestamp: action.payload.timestamp, text: action.payload.text, sig: action.payload.sig, removed: false }, (action.payload.file && { file: action.payload.file }));
|
|
1793
|
+
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, message] });
|
|
1794
|
+
});
|
|
1795
|
+
builder.addCase(signalEvents.chatMessageRemoved, (state, action) => {
|
|
1796
|
+
return Object.assign(Object.assign({}, state), { chatMessages: state.chatMessages.map((m) => {
|
|
1797
|
+
return Object.assign(Object.assign({}, m), (m.id === action.payload.id && {
|
|
1798
|
+
removed: true,
|
|
1799
|
+
}));
|
|
1800
|
+
}) });
|
|
1801
|
+
});
|
|
1802
|
+
},
|
|
1803
|
+
});
|
|
1804
|
+
const doSendChatMessage = createRoomConnectedThunk((payload) => (_, getState) => {
|
|
1805
|
+
const state = getState();
|
|
1806
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1807
|
+
const breakoutCurrentId = selectBreakoutCurrentId(state);
|
|
1808
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("chat_message", Object.assign(Object.assign(Object.assign({ text: payload.text }, (payload.parentId && { parentId: payload.parentId })), (breakoutCurrentId && { breakoutGroup: breakoutCurrentId })), (payload.isBroadcast && { broadcast: true })));
|
|
1809
|
+
});
|
|
1810
|
+
const doRemoveChatMessage = createRoomConnectedThunk(({ id, sig }) => (_, getState) => {
|
|
1811
|
+
const state = getState();
|
|
1812
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1813
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("remove_chat_message", {
|
|
1814
|
+
id,
|
|
1815
|
+
sig,
|
|
1816
|
+
});
|
|
1817
|
+
});
|
|
1818
|
+
const selectChatRaw = (state) => state.chat;
|
|
1819
|
+
const selectChatMessages = (state) => state.chat.chatMessages;
|
|
1820
|
+
|
|
1821
|
+
const initialCloudRecordingState = {
|
|
1822
|
+
isInitiator: false,
|
|
1823
|
+
isRecording: false,
|
|
1824
|
+
startedAt: undefined,
|
|
1825
|
+
};
|
|
1826
|
+
const cloudRecordingSlice = toolkit.createSlice({
|
|
1827
|
+
name: "cloudRecording",
|
|
1828
|
+
initialState: initialCloudRecordingState,
|
|
1829
|
+
reducers: {
|
|
1830
|
+
recordingRequestStarted: (state) => {
|
|
1831
|
+
return Object.assign(Object.assign({}, state), { isInitiator: true, status: "requested" });
|
|
1832
|
+
},
|
|
1833
|
+
},
|
|
1834
|
+
extraReducers: (builder) => {
|
|
1835
|
+
builder.addCase(signalEvents.cloudRecordingStopped, (state) => {
|
|
1836
|
+
return Object.assign(Object.assign({}, state), { isInitiator: false, isRecording: false, status: undefined });
|
|
1837
|
+
});
|
|
1838
|
+
builder.addCase(signalEvents.cloudRecordingStarted, (state, action) => {
|
|
1839
|
+
const { payload } = action;
|
|
1840
|
+
if (!payload.error) {
|
|
1841
|
+
return state;
|
|
1842
|
+
}
|
|
1843
|
+
return Object.assign(Object.assign({}, state), { isInitiator: false, isRecording: false, status: "error", error: payload.error });
|
|
1844
|
+
});
|
|
1845
|
+
builder.addCase(signalEvents.newClient, (state, { payload }) => {
|
|
1846
|
+
var _a;
|
|
1847
|
+
const { client } = payload;
|
|
1848
|
+
if (((_a = client.role) === null || _a === void 0 ? void 0 : _a.roleName) === "recorder") {
|
|
1849
|
+
return Object.assign(Object.assign({}, state), { isRecording: true, status: "recording", startedAt: client.startedCloudRecordingAt
|
|
1850
|
+
? new Date(client.startedCloudRecordingAt).getTime()
|
|
1851
|
+
: new Date().getTime() });
|
|
1852
|
+
}
|
|
1853
|
+
return state;
|
|
1854
|
+
});
|
|
1855
|
+
},
|
|
1856
|
+
});
|
|
1857
|
+
const { recordingRequestStarted } = cloudRecordingSlice.actions;
|
|
1858
|
+
const doStartCloudRecording = createRoomConnectedThunk(() => (dispatch, getState) => {
|
|
1859
|
+
const state = getState();
|
|
1860
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1861
|
+
const status = selectCloudRecordingStatus(state);
|
|
1862
|
+
if (status && ["recording", "requested"].includes(status)) {
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("start_recording", {
|
|
1866
|
+
recording: "cloud",
|
|
1867
|
+
});
|
|
1868
|
+
dispatch(recordingRequestStarted());
|
|
1869
|
+
});
|
|
1870
|
+
const doStopCloudRecording = createRoomConnectedThunk(() => (dispatch, getState) => {
|
|
1871
|
+
const state = getState();
|
|
1872
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1873
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("stop_recording");
|
|
1874
|
+
});
|
|
1875
|
+
const selectCloudRecordingRaw = (state) => state.cloudRecording;
|
|
1876
|
+
const selectCloudRecordingStatus = (state) => state.cloudRecording.status;
|
|
1877
|
+
const selectCloudRecordingStartedAt = (state) => state.cloudRecording.startedAt;
|
|
1878
|
+
const selectCloudRecordingError = (state) => state.cloudRecording.error;
|
|
1879
|
+
const selectIsCloudRecording = (state) => state.cloudRecording.isRecording;
|
|
1880
|
+
const selectCloudRecordingIsInitiator = (state) => state.cloudRecording.isInitiator;
|
|
1881
|
+
|
|
1882
|
+
const localScreenshareSliceInitialState = {
|
|
1883
|
+
status: "inactive",
|
|
1884
|
+
stream: null,
|
|
1885
|
+
error: null,
|
|
1886
|
+
};
|
|
1887
|
+
const localScreenshareSlice = toolkit.createSlice({
|
|
1888
|
+
name: "localScreenshare",
|
|
1889
|
+
initialState: localScreenshareSliceInitialState,
|
|
1890
|
+
reducers: {
|
|
1891
|
+
stopScreenshare(state, action) {
|
|
1892
|
+
return Object.assign(Object.assign({}, state), { status: "inactive", stream: null });
|
|
1893
|
+
},
|
|
1894
|
+
},
|
|
1895
|
+
extraReducers: (builder) => {
|
|
1896
|
+
builder.addCase(doStartScreenshare.pending, (state) => {
|
|
1897
|
+
return Object.assign(Object.assign({}, state), { status: "starting" });
|
|
1898
|
+
});
|
|
1899
|
+
builder.addCase(doStartScreenshare.fulfilled, (state, { payload: { stream } }) => {
|
|
1900
|
+
return Object.assign(Object.assign({}, state), { status: "active", stream });
|
|
1901
|
+
});
|
|
1902
|
+
builder.addCase(doStartScreenshare.rejected, (state, { payload }) => {
|
|
1903
|
+
return Object.assign(Object.assign({}, state), { error: payload, status: "inactive", stream: null });
|
|
1904
|
+
});
|
|
1905
|
+
},
|
|
1906
|
+
});
|
|
1907
|
+
const { stopScreenshare } = localScreenshareSlice.actions;
|
|
1908
|
+
const doStartScreenshare = createAsyncRoomConnectedThunk("localScreenshare/doStartScreenshare", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch, getState, rejectWithValue }) {
|
|
1909
|
+
var _b;
|
|
1910
|
+
try {
|
|
1911
|
+
const state = getState();
|
|
1912
|
+
const screenshareStream = selectLocalScreenshareStream(state);
|
|
1913
|
+
if (screenshareStream) {
|
|
1914
|
+
return { stream: screenshareStream };
|
|
1915
|
+
}
|
|
1916
|
+
const stream = yield media.getDisplayMedia({
|
|
1917
|
+
video: {
|
|
1918
|
+
width: { max: window.screen.width },
|
|
1536
1919
|
height: { max: window.screen.height },
|
|
1537
1920
|
},
|
|
1538
1921
|
audio: {
|
|
@@ -1590,6 +1973,7 @@ function isRecorderClient(client) {
|
|
|
1590
1973
|
}
|
|
1591
1974
|
const roomSliceInitialState = {
|
|
1592
1975
|
isLocked: false,
|
|
1976
|
+
mode: null,
|
|
1593
1977
|
};
|
|
1594
1978
|
const roomSlice = toolkit.createSlice({
|
|
1595
1979
|
name: "room",
|
|
@@ -1597,6 +1981,7 @@ const roomSlice = toolkit.createSlice({
|
|
|
1597
1981
|
reducers: {},
|
|
1598
1982
|
extraReducers: (builder) => {
|
|
1599
1983
|
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
1984
|
+
var _a;
|
|
1600
1985
|
if ("error" in action.payload) {
|
|
1601
1986
|
if (action.payload.error === "room_locked") {
|
|
1602
1987
|
return Object.assign(Object.assign({}, state), { isLocked: Boolean(action.payload.isLocked) });
|
|
@@ -1604,7 +1989,7 @@ const roomSlice = toolkit.createSlice({
|
|
|
1604
1989
|
return state;
|
|
1605
1990
|
}
|
|
1606
1991
|
const { room } = action.payload;
|
|
1607
|
-
return Object.assign(Object.assign({}, state), { isLocked: Boolean(room.isLocked) });
|
|
1992
|
+
return Object.assign(Object.assign({}, state), { isLocked: Boolean(room.isLocked), mode: (_a = room.mode) !== null && _a !== void 0 ? _a : (room.sfuServer ? "group" : "normal") });
|
|
1608
1993
|
});
|
|
1609
1994
|
builder.addCase(signalEvents.roomLocked, (state, action) => {
|
|
1610
1995
|
const { isLocked } = action.payload;
|
|
@@ -1634,6 +2019,7 @@ const doEndMeeting = createAppAuthorizedThunk((state) => selectIsAuthorizedToEnd
|
|
|
1634
2019
|
}
|
|
1635
2020
|
});
|
|
1636
2021
|
const selectRoomIsLocked = (state) => state.room.isLocked;
|
|
2022
|
+
const selectRoomMode = (state) => state.room.mode;
|
|
1637
2023
|
const selectScreenshares = toolkit.createSelector(selectLocalScreenshareStream, selectLocalParticipantRaw, selectRemoteParticipants, (localScreenshareStream, localParticipant, remoteParticipants) => {
|
|
1638
2024
|
const screenshares = [];
|
|
1639
2025
|
if (localScreenshareStream) {
|
|
@@ -1975,8 +2361,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
1975
2361
|
const participant = remoteClients.find((p) => p.id === clientId);
|
|
1976
2362
|
if (!participant)
|
|
1977
2363
|
continue;
|
|
1978
|
-
if (state === "to_accept" ||
|
|
1979
|
-
(state === "new_accept" && shouldAcceptNewClients)) {
|
|
2364
|
+
if (state === "to_accept" || (state === "new_accept" && shouldAcceptNewClients)) {
|
|
1980
2365
|
rtcManager.acceptNewStream({
|
|
1981
2366
|
streamId: streamId === media.CAMERA_STREAM_ID ? clientId : streamId,
|
|
1982
2367
|
clientId,
|
|
@@ -2019,7 +2404,10 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
|
|
|
2019
2404
|
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
2020
2405
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
2021
2406
|
if (localMediaStream && rtcManager) {
|
|
2022
|
-
rtcManager.addCameraStream(localMediaStream, {
|
|
2407
|
+
rtcManager.addCameraStream(localMediaStream, {
|
|
2408
|
+
audioPaused: !isMicrophoneEnabled,
|
|
2409
|
+
videoPaused: !isCameraEnabled,
|
|
2410
|
+
});
|
|
2023
2411
|
}
|
|
2024
2412
|
dispatch(rtcManagerInitialized());
|
|
2025
2413
|
});
|
|
@@ -2162,7 +2550,7 @@ const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemo
|
|
|
2162
2550
|
}
|
|
2163
2551
|
if ((!client.breakoutGroup && !breakoutCurrentId) ||
|
|
2164
2552
|
client.breakoutGroup === breakoutCurrentId ||
|
|
2165
|
-
(
|
|
2553
|
+
(!client.breakoutGroup && clientSpotlight) ||
|
|
2166
2554
|
ignoreBreakoutGroups) {
|
|
2167
2555
|
if (state === "done_accept")
|
|
2168
2556
|
continue;
|
|
@@ -2748,190 +3136,21 @@ createReactor([
|
|
|
2748
3136
|
dispatch(doSendClientMetadata());
|
|
2749
3137
|
}
|
|
2750
3138
|
});
|
|
2751
|
-
createReactor([selectBreakoutAssignments, selectDeviceId, selectLocalParticipantRaw], ({ dispatch }, breakoutAssignments, deviceId, localParticipant) => {
|
|
3139
|
+
createReactor([selectBreakoutAssignments, selectDeviceId, selectLocalParticipantRaw, selectBreakoutGroups, selectBreakoutActive], ({ dispatch }, breakoutAssignments, deviceId, localParticipant, breakoutGroups, breakoutActive) => {
|
|
2752
3140
|
const breakoutGroupAssigned = (breakoutAssignments === null || breakoutAssignments === void 0 ? void 0 : breakoutAssignments[deviceId || ""]) || "";
|
|
2753
3141
|
if (localParticipant.breakoutGroupAssigned === breakoutGroupAssigned) {
|
|
2754
3142
|
return;
|
|
2755
3143
|
}
|
|
2756
3144
|
dispatch(setBreakoutGroupAssigned({ breakoutGroupAssigned }));
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
const emitter = new events$1.EventEmitter();
|
|
2760
|
-
function createNotificationEvent(payload) {
|
|
2761
|
-
const notificationEvent = Object.assign(Object.assign({}, payload), { timestamp: Date.now() });
|
|
2762
|
-
return notificationEvent;
|
|
2763
|
-
}
|
|
2764
|
-
const initialNotificationsState = {
|
|
2765
|
-
emitter,
|
|
2766
|
-
events: [],
|
|
2767
|
-
};
|
|
2768
|
-
const notificationsSlice = toolkit.createSlice({
|
|
2769
|
-
name: "notifications",
|
|
2770
|
-
initialState: initialNotificationsState,
|
|
2771
|
-
reducers: {
|
|
2772
|
-
addNotification: (state, action) => {
|
|
2773
|
-
return Object.assign(Object.assign({}, state), { events: [...state.events, Object.assign({}, action.payload)] });
|
|
2774
|
-
},
|
|
2775
|
-
doClearNotifications: (state) => {
|
|
2776
|
-
return Object.assign(Object.assign({}, state), { events: [] });
|
|
2777
|
-
},
|
|
2778
|
-
},
|
|
2779
|
-
});
|
|
2780
|
-
const { doClearNotifications } = notificationsSlice.actions;
|
|
2781
|
-
const doSetNotification = createAppThunk((payload) => (dispatch, getState) => {
|
|
2782
|
-
dispatch(notificationsSlice.actions.addNotification(payload));
|
|
2783
|
-
const state = getState();
|
|
2784
|
-
const emitter = selectNotificationsEmitter(state);
|
|
2785
|
-
emitter.emit(payload.type, payload);
|
|
2786
|
-
emitter.emit("*", payload);
|
|
2787
|
-
});
|
|
2788
|
-
const selectNotificationsRaw = (state) => state.notifications;
|
|
2789
|
-
const selectNotificationsEvents = (state) => state.notifications.events;
|
|
2790
|
-
const selectNotificationsEmitter = (state) => state.notifications.emitter;
|
|
2791
|
-
startAppListening({
|
|
2792
|
-
actionCreator: signalEvents.chatMessage,
|
|
2793
|
-
effect: ({ payload }, { dispatch, getState }) => {
|
|
2794
|
-
const state = getState();
|
|
2795
|
-
const selfId = selectSelfId(state);
|
|
2796
|
-
if (selfId === payload.senderId) {
|
|
2797
|
-
return;
|
|
2798
|
-
}
|
|
2799
|
-
const client = selectRemoteParticipants(state).find(({ id }) => id === payload.senderId);
|
|
2800
|
-
if (!client) {
|
|
2801
|
-
console.warn("Could not find remote client that sent chat message");
|
|
2802
|
-
return;
|
|
2803
|
-
}
|
|
2804
|
-
dispatch(doSetNotification(createNotificationEvent({
|
|
2805
|
-
type: "chatMessageReceived",
|
|
2806
|
-
message: `${client.displayName} says: ${payload.text}`,
|
|
2807
|
-
props: {
|
|
2808
|
-
client,
|
|
2809
|
-
chatMessage: {
|
|
2810
|
-
id: payload.id,
|
|
2811
|
-
senderId: payload.senderId,
|
|
2812
|
-
parentId: payload.parentId,
|
|
2813
|
-
timestamp: payload.timestamp,
|
|
2814
|
-
text: payload.text,
|
|
2815
|
-
sig: payload.sig,
|
|
2816
|
-
removed: false,
|
|
2817
|
-
},
|
|
2818
|
-
},
|
|
2819
|
-
})));
|
|
2820
|
-
},
|
|
2821
|
-
});
|
|
2822
|
-
startAppListening({
|
|
2823
|
-
actionCreator: signalEvents.audioEnableRequested,
|
|
2824
|
-
effect: ({ payload }, { dispatch, getState }) => {
|
|
2825
|
-
const { enable, requestedByClientId } = payload;
|
|
2826
|
-
const state = getState();
|
|
2827
|
-
const client = selectRemoteParticipants(state).find(({ id }) => id === requestedByClientId);
|
|
2828
|
-
if (!client) {
|
|
2829
|
-
console.warn("Could not find remote client that requested a local audio change");
|
|
2830
|
-
return;
|
|
2831
|
-
}
|
|
2832
|
-
dispatch(doSetNotification(createNotificationEvent({
|
|
2833
|
-
type: enable ? "requestAudioEnable" : "requestAudioDisable",
|
|
2834
|
-
message: enable
|
|
2835
|
-
? `${client.displayName} has requested for you to speak`
|
|
2836
|
-
: `${client.displayName} has muted your microphone`,
|
|
2837
|
-
props: {
|
|
2838
|
-
client,
|
|
2839
|
-
enable,
|
|
2840
|
-
},
|
|
2841
|
-
})));
|
|
2842
|
-
},
|
|
2843
|
-
});
|
|
2844
|
-
startAppListening({
|
|
2845
|
-
actionCreator: signalEvents.videoEnableRequested,
|
|
2846
|
-
effect: ({ payload }, { dispatch, getState }) => {
|
|
2847
|
-
const { enable, requestedByClientId } = payload;
|
|
2848
|
-
const state = getState();
|
|
2849
|
-
const client = selectRemoteParticipants(state).find(({ id }) => id === requestedByClientId);
|
|
2850
|
-
if (!client) {
|
|
2851
|
-
console.warn("Could not find remote client that requested a local video change");
|
|
2852
|
-
return;
|
|
2853
|
-
}
|
|
2854
|
-
dispatch(doSetNotification(createNotificationEvent({
|
|
2855
|
-
type: enable ? "requestVideoEnable" : "requestVideoDisable",
|
|
2856
|
-
message: enable
|
|
2857
|
-
? `${client.displayName} has requested for you to start video`
|
|
2858
|
-
: `${client.displayName} has stopped your video`,
|
|
2859
|
-
props: {
|
|
2860
|
-
client,
|
|
2861
|
-
enable,
|
|
2862
|
-
},
|
|
2863
|
-
})));
|
|
2864
|
-
},
|
|
2865
|
-
});
|
|
2866
|
-
startAppListening({
|
|
2867
|
-
actionCreator: signalEvents.clientMetadataReceived,
|
|
2868
|
-
effect: (action, { dispatch, getOriginalState, getState }) => {
|
|
2869
|
-
var _a;
|
|
2870
|
-
const { error, payload } = action.payload;
|
|
2871
|
-
if (error || !payload) {
|
|
2872
|
-
return;
|
|
2873
|
-
}
|
|
2874
|
-
const { clientId, stickyReaction } = payload;
|
|
2875
|
-
const state = getState();
|
|
2876
|
-
const canAskToSpeak = selectIsAuthorizedToAskToSpeak(state);
|
|
2877
|
-
if (!canAskToSpeak) {
|
|
2878
|
-
return;
|
|
2879
|
-
}
|
|
2880
|
-
const client = selectRemoteParticipants(state).find(({ id }) => id === clientId);
|
|
2881
|
-
if (!client) {
|
|
2882
|
-
console.warn("Could not find remote client that provided updated metadata");
|
|
2883
|
-
return;
|
|
2884
|
-
}
|
|
2885
|
-
const previousState = getOriginalState();
|
|
2886
|
-
const previousClient = selectRemoteParticipants(previousState).find(({ id }) => id === clientId);
|
|
2887
|
-
if ((!stickyReaction && !(previousClient === null || previousClient === void 0 ? void 0 : previousClient.stickyReaction)) ||
|
|
2888
|
-
(stickyReaction === null || stickyReaction === void 0 ? void 0 : stickyReaction.timestamp) === ((_a = previousClient === null || previousClient === void 0 ? void 0 : previousClient.stickyReaction) === null || _a === void 0 ? void 0 : _a.timestamp)) {
|
|
2889
|
-
return;
|
|
2890
|
-
}
|
|
2891
|
-
dispatch(doSetNotification(createNotificationEvent({
|
|
2892
|
-
type: stickyReaction ? "remoteHandRaised" : "remoteHandLowered",
|
|
2893
|
-
message: `${client.displayName} ${stickyReaction ? "raised" : "lowered"} their hand`,
|
|
2894
|
-
props: {
|
|
2895
|
-
client,
|
|
2896
|
-
stickyReaction,
|
|
2897
|
-
},
|
|
2898
|
-
})));
|
|
2899
|
-
},
|
|
2900
|
-
});
|
|
2901
|
-
createReactor([selectSignalStatus], ({ dispatch, getState }, signalStatus) => {
|
|
2902
|
-
const state = getState();
|
|
2903
|
-
const roomConnectionStatus = selectRoomConnectionStatus(state);
|
|
2904
|
-
if (["left", "kicked"].includes(roomConnectionStatus)) {
|
|
2905
|
-
return;
|
|
2906
|
-
}
|
|
2907
|
-
if (signalStatus === "disconnected") {
|
|
2908
|
-
dispatch(doSetNotification(createNotificationEvent({
|
|
2909
|
-
type: "signalTrouble",
|
|
2910
|
-
message: `Network connection lost. Trying to reconnect you...`,
|
|
2911
|
-
props: {},
|
|
2912
|
-
})));
|
|
2913
|
-
}
|
|
2914
|
-
else if (signalStatus === "connected") {
|
|
3145
|
+
if (breakoutGroupAssigned && breakoutActive) {
|
|
3146
|
+
const groupName = (breakoutGroups === null || breakoutGroups === void 0 ? void 0 : breakoutGroups[breakoutGroupAssigned]) || "";
|
|
2915
3147
|
dispatch(doSetNotification(createNotificationEvent({
|
|
2916
|
-
type: "
|
|
2917
|
-
message: `
|
|
2918
|
-
props: {},
|
|
3148
|
+
type: "breakoutGroupAssigned",
|
|
3149
|
+
message: groupName ? `You've been assigned to ${groupName}` : "You've been assigned to a group",
|
|
3150
|
+
props: { group: breakoutGroupAssigned, groupName },
|
|
2919
3151
|
})));
|
|
2920
3152
|
}
|
|
2921
3153
|
});
|
|
2922
|
-
startAppListening({
|
|
2923
|
-
actionCreator: signalEvents.clientUnableToJoin,
|
|
2924
|
-
effect: (action, { dispatch }) => {
|
|
2925
|
-
var _a;
|
|
2926
|
-
if (((_a = action.payload) === null || _a === void 0 ? void 0 : _a.error) === "room_full") {
|
|
2927
|
-
dispatch(doSetNotification(createNotificationEvent({
|
|
2928
|
-
type: "clientUnableToJoinFullRoom",
|
|
2929
|
-
message: "Someone tried to join but the room is full and at capacity.",
|
|
2930
|
-
props: {},
|
|
2931
|
-
})));
|
|
2932
|
-
}
|
|
2933
|
-
},
|
|
2934
|
-
});
|
|
2935
3154
|
|
|
2936
3155
|
const organizationSliceInitialState = {
|
|
2937
3156
|
data: null,
|
|
@@ -4561,6 +4780,9 @@ function createServices() {
|
|
|
4561
4780
|
}
|
|
4562
4781
|
|
|
4563
4782
|
exports.ACCEPTED_FILE_TYPES = ACCEPTED_FILE_TYPES;
|
|
4783
|
+
exports.BREAKOUT_GROUPS_MIN_MAX = BREAKOUT_GROUPS_MIN_MAX;
|
|
4784
|
+
exports.BREAKOUT_UNAVAILABLE_ERROR = BREAKOUT_UNAVAILABLE_ERROR;
|
|
4785
|
+
exports.DEFAULT_BREAKOUT_TIMER_DURATION = DEFAULT_BREAKOUT_TIMER_DURATION;
|
|
4564
4786
|
exports.MAX_FILES_PER_UPLOAD = MAX_FILES_PER_UPLOAD;
|
|
4565
4787
|
exports.MAX_FILE_SIZE = MAX_FILE_SIZE;
|
|
4566
4788
|
exports.addAppListener = addAppListener;
|
|
@@ -4585,12 +4807,15 @@ exports.createAppAuthorizedThunk = createAppAuthorizedThunk;
|
|
|
4585
4807
|
exports.createAppThunk = createAppThunk;
|
|
4586
4808
|
exports.createAsyncRoomConnectedThunk = createAsyncRoomConnectedThunk;
|
|
4587
4809
|
exports.createAuthorizedRoomConnectedThunk = createAuthorizedRoomConnectedThunk;
|
|
4810
|
+
exports.createBreakoutGroups = createBreakoutGroups;
|
|
4811
|
+
exports.createNotificationEvent = createNotificationEvent;
|
|
4588
4812
|
exports.createReactor = createReactor;
|
|
4589
4813
|
exports.createRemoteParticipant = createRemoteParticipant;
|
|
4590
4814
|
exports.createRoomConnectedThunk = createRoomConnectedThunk;
|
|
4591
4815
|
exports.createServices = createServices;
|
|
4592
4816
|
exports.createStore = createStore;
|
|
4593
4817
|
exports.createWebRtcEmitter = createWebRtcEmitter;
|
|
4818
|
+
exports.defaultBreakoutGroupName = defaultBreakoutGroupName;
|
|
4594
4819
|
exports.deviceBusy = deviceBusy;
|
|
4595
4820
|
exports.deviceCredentialsSlice = deviceCredentialsSlice;
|
|
4596
4821
|
exports.deviceCredentialsSliceInitialState = deviceCredentialsSliceInitialState;
|
|
@@ -4599,6 +4824,8 @@ exports.deviceIdentifying = deviceIdentifying;
|
|
|
4599
4824
|
exports.doAcceptWaitingParticipant = doAcceptWaitingParticipant;
|
|
4600
4825
|
exports.doAppStart = doAppStart;
|
|
4601
4826
|
exports.doAppStop = doAppStop;
|
|
4827
|
+
exports.doAssignAllBreakoutParticipants = doAssignAllBreakoutParticipants;
|
|
4828
|
+
exports.doAssignBreakoutParticipants = doAssignBreakoutParticipants;
|
|
4602
4829
|
exports.doBreakoutJoin = doBreakoutJoin;
|
|
4603
4830
|
exports.doCancelKnock = doCancelKnock;
|
|
4604
4831
|
exports.doClearNotifications = doClearNotifications;
|
|
@@ -4609,6 +4836,7 @@ exports.doDownloadFile = doDownloadFile;
|
|
|
4609
4836
|
exports.doEnableAudio = doEnableAudio;
|
|
4610
4837
|
exports.doEnableVideo = doEnableVideo;
|
|
4611
4838
|
exports.doEndMeeting = doEndMeeting;
|
|
4839
|
+
exports.doExtendBreakoutTimer = doExtendBreakoutTimer;
|
|
4612
4840
|
exports.doGetDeviceCredentials = doGetDeviceCredentials;
|
|
4613
4841
|
exports.doHandleAcceptStreams = doHandleAcceptStreams;
|
|
4614
4842
|
exports.doHandleStreamingStarted = doHandleStreamingStarted;
|
|
@@ -4635,16 +4863,20 @@ exports.doSetDevice = doSetDevice;
|
|
|
4635
4863
|
exports.doSetDisplayName = doSetDisplayName;
|
|
4636
4864
|
exports.doSetLocalStickyReaction = doSetLocalStickyReaction;
|
|
4637
4865
|
exports.doSetNotification = doSetNotification;
|
|
4866
|
+
exports.doShuffleBreakoutParticipants = doShuffleBreakoutParticipants;
|
|
4638
4867
|
exports.doSignalConnect = doSignalConnect;
|
|
4639
4868
|
exports.doSignalDisconnect = doSignalDisconnect;
|
|
4640
4869
|
exports.doSignalIdentifyDevice = doSignalIdentifyDevice;
|
|
4641
4870
|
exports.doSpotlightParticipant = doSpotlightParticipant;
|
|
4871
|
+
exports.doStartBreakoutSession = doStartBreakoutSession;
|
|
4642
4872
|
exports.doStartCloudRecording = doStartCloudRecording;
|
|
4643
4873
|
exports.doStartConnectionMonitor = doStartConnectionMonitor;
|
|
4644
4874
|
exports.doStartLiveCaptions = doStartLiveCaptions;
|
|
4645
4875
|
exports.doStartLiveTranscription = doStartLiveTranscription;
|
|
4646
4876
|
exports.doStartLocalMedia = doStartLocalMedia;
|
|
4647
4877
|
exports.doStartScreenshare = doStartScreenshare;
|
|
4878
|
+
exports.doStopBreakoutSession = doStopBreakoutSession;
|
|
4879
|
+
exports.doStopBreakoutTimer = doStopBreakoutTimer;
|
|
4648
4880
|
exports.doStopCloudRecording = doStopCloudRecording;
|
|
4649
4881
|
exports.doStopConnectionMonitor = doStopConnectionMonitor;
|
|
4650
4882
|
exports.doStopLiveCaptions = doStopLiveCaptions;
|
|
@@ -4654,6 +4886,8 @@ exports.doStopScreenshare = doStopScreenshare;
|
|
|
4654
4886
|
exports.doSwitchLocalStream = doSwitchLocalStream;
|
|
4655
4887
|
exports.doToggleCamera = doToggleCamera;
|
|
4656
4888
|
exports.doTriggerLocalStreamRefresh = doTriggerLocalStreamRefresh;
|
|
4889
|
+
exports.doUnassignAllBreakoutParticipants = doUnassignAllBreakoutParticipants;
|
|
4890
|
+
exports.doUpdateBreakoutSession = doUpdateBreakoutSession;
|
|
4657
4891
|
exports.doUpdateDeviceList = doUpdateDeviceList;
|
|
4658
4892
|
exports.fileShareRequestSettled = fileShareRequestSettled;
|
|
4659
4893
|
exports.fileShareSlice = fileShareSlice;
|
|
@@ -4726,12 +4960,25 @@ exports.selectAssistantKey = selectAssistantKey;
|
|
|
4726
4960
|
exports.selectAuthorizationRoleName = selectAuthorizationRoleName;
|
|
4727
4961
|
exports.selectBreakoutActive = selectBreakoutActive;
|
|
4728
4962
|
exports.selectBreakoutAssignments = selectBreakoutAssignments;
|
|
4963
|
+
exports.selectBreakoutAutoMoveToGroup = selectBreakoutAutoMoveToGroup;
|
|
4964
|
+
exports.selectBreakoutAutoMoveToMain = selectBreakoutAutoMoveToMain;
|
|
4729
4965
|
exports.selectBreakoutCurrentGroup = selectBreakoutCurrentGroup;
|
|
4730
4966
|
exports.selectBreakoutCurrentId = selectBreakoutCurrentId;
|
|
4967
|
+
exports.selectBreakoutEndTime = selectBreakoutEndTime;
|
|
4968
|
+
exports.selectBreakoutEnforceAssignment = selectBreakoutEnforceAssignment;
|
|
4969
|
+
exports.selectBreakoutError = selectBreakoutError;
|
|
4731
4970
|
exports.selectBreakoutGroupedParticipants = selectBreakoutGroupedParticipants;
|
|
4732
4971
|
exports.selectBreakoutGroups = selectBreakoutGroups;
|
|
4733
4972
|
exports.selectBreakoutInitiatedBy = selectBreakoutInitiatedBy;
|
|
4973
|
+
exports.selectBreakoutIsAvailable = selectBreakoutIsAvailable;
|
|
4974
|
+
exports.selectBreakoutMoveToGroupAt = selectBreakoutMoveToGroupAt;
|
|
4975
|
+
exports.selectBreakoutMoveToGroupGracePeriod = selectBreakoutMoveToGroupGracePeriod;
|
|
4976
|
+
exports.selectBreakoutMoveToMainAt = selectBreakoutMoveToMainAt;
|
|
4977
|
+
exports.selectBreakoutMoveToMainGracePeriod = selectBreakoutMoveToMainGracePeriod;
|
|
4734
4978
|
exports.selectBreakoutRaw = selectBreakoutRaw;
|
|
4979
|
+
exports.selectBreakoutStartedAt = selectBreakoutStartedAt;
|
|
4980
|
+
exports.selectBreakoutTimerDuration = selectBreakoutTimerDuration;
|
|
4981
|
+
exports.selectBreakoutTimerSetting = selectBreakoutTimerSetting;
|
|
4735
4982
|
exports.selectBusyDeviceIds = selectBusyDeviceIds;
|
|
4736
4983
|
exports.selectCameraDeviceError = selectCameraDeviceError;
|
|
4737
4984
|
exports.selectCameraDevices = selectCameraDevices;
|
|
@@ -4757,6 +5004,7 @@ exports.selectIsAuthorizedToAskToSpeak = selectIsAuthorizedToAskToSpeak;
|
|
|
4757
5004
|
exports.selectIsAuthorizedToEndMeeting = selectIsAuthorizedToEndMeeting;
|
|
4758
5005
|
exports.selectIsAuthorizedToKickClient = selectIsAuthorizedToKickClient;
|
|
4759
5006
|
exports.selectIsAuthorizedToLockRoom = selectIsAuthorizedToLockRoom;
|
|
5007
|
+
exports.selectIsAuthorizedToManageBreakout = selectIsAuthorizedToManageBreakout;
|
|
4760
5008
|
exports.selectIsAuthorizedToRequestAudioEnable = selectIsAuthorizedToRequestAudioEnable;
|
|
4761
5009
|
exports.selectIsAuthorizedToRequestVideoEnable = selectIsAuthorizedToRequestVideoEnable;
|
|
4762
5010
|
exports.selectIsAuthorizedToSpotlight = selectIsAuthorizedToSpotlight;
|
|
@@ -4828,6 +5076,7 @@ exports.selectRoomConnectionSessionId = selectRoomConnectionSessionId;
|
|
|
4828
5076
|
exports.selectRoomConnectionStatus = selectRoomConnectionStatus;
|
|
4829
5077
|
exports.selectRoomIsLocked = selectRoomIsLocked;
|
|
4830
5078
|
exports.selectRoomKey = selectRoomKey;
|
|
5079
|
+
exports.selectRoomMode = selectRoomMode;
|
|
4831
5080
|
exports.selectRtcConnectionRaw = selectRtcConnectionRaw;
|
|
4832
5081
|
exports.selectRtcDispatcherCreated = selectRtcDispatcherCreated;
|
|
4833
5082
|
exports.selectRtcIsCreatingDispatcher = selectRtcIsCreatingDispatcher;
|
|
@@ -4860,6 +5109,7 @@ exports.selectStreamingRaw = selectStreamingRaw;
|
|
|
4860
5109
|
exports.selectStreamsToAccept = selectStreamsToAccept;
|
|
4861
5110
|
exports.selectWaitingParticipants = selectWaitingParticipants;
|
|
4862
5111
|
exports.selectWaitingParticipantsRaw = selectWaitingParticipantsRaw;
|
|
5112
|
+
exports.setBreakoutError = setBreakoutError;
|
|
4863
5113
|
exports.setBreakoutGroupAssigned = setBreakoutGroupAssigned;
|
|
4864
5114
|
exports.setCurrentCameraDeviceId = setCurrentCameraDeviceId;
|
|
4865
5115
|
exports.setCurrentMicrophoneDeviceId = setCurrentMicrophoneDeviceId;
|