@whereby.com/core 0.16.3 → 0.18.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 +59 -10
- package/dist/index.d.cts +368 -28
- package/dist/index.d.mts +368 -28
- package/dist/index.d.ts +368 -28
- package/dist/index.mjs +56 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,7 +45,7 @@ const createReactor = (selectors, callback) => {
|
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const coreVersion = "0.
|
|
48
|
+
const coreVersion = "0.18.0";
|
|
49
49
|
|
|
50
50
|
const initialState$f = {
|
|
51
51
|
isNodeSdk: false,
|
|
@@ -1050,6 +1050,8 @@ startAppListening({
|
|
|
1050
1050
|
},
|
|
1051
1051
|
});
|
|
1052
1052
|
|
|
1053
|
+
const NON_PERSON_ROLES = ["recorder", "streamer"];
|
|
1054
|
+
|
|
1053
1055
|
const initialState$a = {
|
|
1054
1056
|
displayName: "",
|
|
1055
1057
|
id: "",
|
|
@@ -1146,6 +1148,9 @@ const selectLocalParticipantView = toolkit.createSelector(selectLocalParticipant
|
|
|
1146
1148
|
isAudioEnabled: participant.isAudioEnabled,
|
|
1147
1149
|
isVideoEnabled: participant.isVideoEnabled,
|
|
1148
1150
|
};
|
|
1151
|
+
if (NON_PERSON_ROLES.includes(participant.roleName)) {
|
|
1152
|
+
return null;
|
|
1153
|
+
}
|
|
1149
1154
|
return clientView;
|
|
1150
1155
|
});
|
|
1151
1156
|
startAppListening({
|
|
@@ -1253,7 +1258,6 @@ const rtcEvents = {
|
|
|
1253
1258
|
streamAdded: createRtcEventAction("streamAdded"),
|
|
1254
1259
|
};
|
|
1255
1260
|
|
|
1256
|
-
const NON_PERSON_ROLES = ["recorder", "streamer"];
|
|
1257
1261
|
function createRemoteParticipant(client, newJoiner = false) {
|
|
1258
1262
|
const { streams, role } = client, rest = __rest(client, ["streams", "role"]);
|
|
1259
1263
|
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 });
|
|
@@ -1442,8 +1446,15 @@ const doRequestAudioEnable = createAppAuthorizedThunk((state) => selectIsAuthori
|
|
|
1442
1446
|
socket === null || socket === void 0 ? void 0 : socket.emit("request_audio_enable", payload);
|
|
1443
1447
|
});
|
|
1444
1448
|
const selectRemoteParticipantsRaw = (state) => state.remoteParticipants;
|
|
1445
|
-
const
|
|
1446
|
-
const
|
|
1449
|
+
const selectRemoteClients = (state) => state.remoteParticipants.remoteParticipants;
|
|
1450
|
+
const selectRemoteParticipants = toolkit.createSelector(selectRemoteClients, (clients) => clients.filter((c) => !NON_PERSON_ROLES.includes(c.roleName)));
|
|
1451
|
+
const selectNumClients = toolkit.createSelector(selectRemoteClients, (clients) => clients.length + 1);
|
|
1452
|
+
const selectNumParticipants = toolkit.createSelector(selectRemoteParticipants, selectLocalParticipantRaw, (clients, localParticipant) => {
|
|
1453
|
+
if (NON_PERSON_ROLES.includes(localParticipant.roleName)) {
|
|
1454
|
+
return clients.length;
|
|
1455
|
+
}
|
|
1456
|
+
return clients.length + 1;
|
|
1457
|
+
});
|
|
1447
1458
|
|
|
1448
1459
|
const initialState$7 = {
|
|
1449
1460
|
data: null,
|
|
@@ -1837,7 +1848,7 @@ const doKickParticipant = createAppAuthorizedThunk((state) => selectIsAuthorized
|
|
|
1837
1848
|
});
|
|
1838
1849
|
const doEndMeeting = createAppAuthorizedThunk((state) => selectIsAuthorizedToEndMeeting(state), (payload) => (dispatch, getState) => {
|
|
1839
1850
|
const state = getState();
|
|
1840
|
-
const clientsToKick =
|
|
1851
|
+
const clientsToKick = selectRemoteClients(state).map((c) => c.id);
|
|
1841
1852
|
if (clientsToKick.length) {
|
|
1842
1853
|
const { socket } = selectSignalConnectionRaw(state);
|
|
1843
1854
|
socket === null || socket === void 0 ? void 0 : socket.emit("kick_client", { clientIds: clientsToKick, reasonId: "end-meeting" });
|
|
@@ -1904,7 +1915,7 @@ const selectRemoteClientViews = toolkit.createSelector(selectLocalScreenshareStr
|
|
|
1904
1915
|
return views;
|
|
1905
1916
|
});
|
|
1906
1917
|
const selectAllClientViews = toolkit.createSelector(selectLocalParticipantView, selectRemoteClientViews, (localParticipant, remoteParticipants) => {
|
|
1907
|
-
return [localParticipant, ...remoteParticipants];
|
|
1918
|
+
return [...(localParticipant ? [localParticipant] : []), ...remoteParticipants];
|
|
1908
1919
|
});
|
|
1909
1920
|
|
|
1910
1921
|
const createWebRtcEmitter = (dispatch) => {
|
|
@@ -2019,7 +2030,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
2019
2030
|
dispatch(isAcceptingStreams(true));
|
|
2020
2031
|
const state = getState();
|
|
2021
2032
|
const rtcManager = selectRtcConnectionRaw(state).rtcManager;
|
|
2022
|
-
const
|
|
2033
|
+
const remoteClients = selectRemoteClients(state);
|
|
2023
2034
|
if (!rtcManager) {
|
|
2024
2035
|
throw new Error("No rtc manager");
|
|
2025
2036
|
}
|
|
@@ -2027,7 +2038,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
2027
2038
|
const shouldAcceptNewClients = (_a = rtcManager.shouldAcceptStreamsFromBothSides) === null || _a === void 0 ? void 0 : _a.call(rtcManager);
|
|
2028
2039
|
const updates = [];
|
|
2029
2040
|
for (const { clientId, streamId, state } of payload) {
|
|
2030
|
-
const participant =
|
|
2041
|
+
const participant = remoteClients.find((p) => p.id === clientId);
|
|
2031
2042
|
if (!participant)
|
|
2032
2043
|
continue;
|
|
2033
2044
|
if (state === "to_accept" ||
|
|
@@ -2167,7 +2178,7 @@ createReactor([selectShouldDisconnectRtc], ({ dispatch }, shouldDisconnectRtc) =
|
|
|
2167
2178
|
dispatch(doDisconnectRtc());
|
|
2168
2179
|
}
|
|
2169
2180
|
});
|
|
2170
|
-
const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus,
|
|
2181
|
+
const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemoteClients, (rtcStatus, remoteParticipants) => {
|
|
2171
2182
|
if (rtcStatus !== "ready") {
|
|
2172
2183
|
return [];
|
|
2173
2184
|
}
|
|
@@ -2407,7 +2418,16 @@ const initialState$2 = {
|
|
|
2407
2418
|
const spotlightsSlice = toolkit.createSlice({
|
|
2408
2419
|
name: "spotlights",
|
|
2409
2420
|
initialState: initialState$2,
|
|
2410
|
-
reducers: {
|
|
2421
|
+
reducers: {
|
|
2422
|
+
addSpotlight(state, action) {
|
|
2423
|
+
const { clientId, streamId } = action.payload;
|
|
2424
|
+
return Object.assign(Object.assign({}, state), { sorted: mergeSpotlight(state.sorted, { clientId, streamId }) });
|
|
2425
|
+
},
|
|
2426
|
+
removeSpotlight(state, action) {
|
|
2427
|
+
const { clientId, streamId } = action.payload;
|
|
2428
|
+
return Object.assign(Object.assign({}, state), { sorted: state.sorted.filter((s) => !(s.clientId === clientId && s.streamId === streamId)) });
|
|
2429
|
+
},
|
|
2430
|
+
},
|
|
2411
2431
|
extraReducers: (builder) => {
|
|
2412
2432
|
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
2413
2433
|
if (!action.payload.room) {
|
|
@@ -2430,6 +2450,7 @@ const spotlightsSlice = toolkit.createSlice({
|
|
|
2430
2450
|
});
|
|
2431
2451
|
},
|
|
2432
2452
|
});
|
|
2453
|
+
const { addSpotlight, removeSpotlight } = spotlightsSlice.actions;
|
|
2433
2454
|
const doSpotlightParticipant = createAppAuthorizedThunk((state) => selectIsAuthorizedToSpotlight(state), ({ id }) => (_, getState) => {
|
|
2434
2455
|
const state = getState();
|
|
2435
2456
|
const clientView = selectAllClientViews(state).find((c) => c.clientId === id);
|
|
@@ -2460,6 +2481,30 @@ const selectIsLocalParticipantSpotlighted = toolkit.createSelector(selectLocalPa
|
|
|
2460
2481
|
const selectSpotlightedClientViews = toolkit.createSelector(selectAllClientViews, selectSpotlights, (clientViews, spotlights) => {
|
|
2461
2482
|
return mapSpotlightsToClientViews(spotlights, clientViews);
|
|
2462
2483
|
});
|
|
2484
|
+
startAppListening({
|
|
2485
|
+
actionCreator: doStartScreenshare.fulfilled,
|
|
2486
|
+
effect: ({ payload }, { getState, dispatch }) => {
|
|
2487
|
+
const { stream } = payload;
|
|
2488
|
+
const state = getState();
|
|
2489
|
+
const localParticipant = selectLocalParticipantRaw(state);
|
|
2490
|
+
if (!localParticipant) {
|
|
2491
|
+
return;
|
|
2492
|
+
}
|
|
2493
|
+
dispatch(addSpotlight({ clientId: localParticipant.id, streamId: stream.id }));
|
|
2494
|
+
},
|
|
2495
|
+
});
|
|
2496
|
+
startAppListening({
|
|
2497
|
+
actionCreator: stopScreenshare,
|
|
2498
|
+
effect: ({ payload }, { getState, dispatch }) => {
|
|
2499
|
+
const { stream } = payload;
|
|
2500
|
+
const state = getState();
|
|
2501
|
+
const localParticipant = selectLocalParticipantRaw(state);
|
|
2502
|
+
if (!localParticipant) {
|
|
2503
|
+
return;
|
|
2504
|
+
}
|
|
2505
|
+
dispatch(removeSpotlight({ clientId: localParticipant.id, streamId: stream.id }));
|
|
2506
|
+
},
|
|
2507
|
+
});
|
|
2463
2508
|
|
|
2464
2509
|
const initialState$1 = {
|
|
2465
2510
|
isStreaming: false,
|
|
@@ -3612,6 +3657,7 @@ exports.OrganizationService = OrganizationService;
|
|
|
3612
3657
|
exports.OrganizationServiceCache = OrganizationServiceCache;
|
|
3613
3658
|
exports.RoomService = RoomService;
|
|
3614
3659
|
exports.addAppListener = addAppListener;
|
|
3660
|
+
exports.addSpotlight = addSpotlight;
|
|
3615
3661
|
exports.appSlice = appSlice;
|
|
3616
3662
|
exports.authorizationSlice = authorizationSlice;
|
|
3617
3663
|
exports.chatSlice = chatSlice;
|
|
@@ -3697,6 +3743,7 @@ exports.participantStreamAdded = participantStreamAdded;
|
|
|
3697
3743
|
exports.participantStreamIdAdded = participantStreamIdAdded;
|
|
3698
3744
|
exports.recordingRequestStarted = recordingRequestStarted;
|
|
3699
3745
|
exports.remoteParticipantsSlice = remoteParticipantsSlice;
|
|
3746
|
+
exports.removeSpotlight = removeSpotlight;
|
|
3700
3747
|
exports.resolutionReported = resolutionReported;
|
|
3701
3748
|
exports.roomConnectionSlice = roomConnectionSlice;
|
|
3702
3749
|
exports.roomSlice = roomSlice;
|
|
@@ -3776,10 +3823,12 @@ exports.selectMicrophoneDevices = selectMicrophoneDevices;
|
|
|
3776
3823
|
exports.selectNotificationsEmitter = selectNotificationsEmitter;
|
|
3777
3824
|
exports.selectNotificationsEvents = selectNotificationsEvents;
|
|
3778
3825
|
exports.selectNotificationsRaw = selectNotificationsRaw;
|
|
3826
|
+
exports.selectNumClients = selectNumClients;
|
|
3779
3827
|
exports.selectNumParticipants = selectNumParticipants;
|
|
3780
3828
|
exports.selectOrganizationId = selectOrganizationId;
|
|
3781
3829
|
exports.selectOrganizationRaw = selectOrganizationRaw;
|
|
3782
3830
|
exports.selectRemoteClientViews = selectRemoteClientViews;
|
|
3831
|
+
exports.selectRemoteClients = selectRemoteClients;
|
|
3783
3832
|
exports.selectRemoteParticipants = selectRemoteParticipants;
|
|
3784
3833
|
exports.selectRemoteParticipantsRaw = selectRemoteParticipantsRaw;
|
|
3785
3834
|
exports.selectRoomConnectionError = selectRoomConnectionError;
|