@whereby.com/core 0.17.0 → 0.19.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 CHANGED
@@ -45,7 +45,7 @@ const createReactor = (selectors, callback) => {
45
45
  });
46
46
  };
47
47
 
48
- const coreVersion = "0.17.0";
48
+ const coreVersion = "0.19.0";
49
49
 
50
50
  const initialState$f = {
51
51
  isNodeSdk: false,
@@ -947,8 +947,8 @@ const selectIsLocalMediaStarting = toolkit.createSelector(selectLocalMediaStatus
947
947
  const selectCameraDevices = toolkit.createSelector(selectLocalMediaDevices, selectBusyDeviceIds, (devices, busyDeviceIds) => devices.filter((d) => d.kind === "videoinput").filter((d) => !busyDeviceIds.includes(d.deviceId)));
948
948
  const selectMicrophoneDevices = toolkit.createSelector(selectLocalMediaDevices, selectBusyDeviceIds, (devices, busyDeviceIds) => devices.filter((d) => d.kind === "audioinput").filter((d) => !busyDeviceIds.includes(d.deviceId)));
949
949
  const selectSpeakerDevices = toolkit.createSelector(selectLocalMediaDevices, (devices) => devices.filter((d) => d.kind === "audiooutput"));
950
- const selectLocalMediaShouldStartWithOptions = toolkit.createSelector(selectAppIsActive, selectLocalMediaStatus, selectLocalMediaOptions, selectAppIsNodeSdk, (appIsActive, localMediaStatus, localMediaOptions, isNodeSdk) => {
951
- if (appIsActive && ["inactive", "stopped"].includes(localMediaStatus) && !isNodeSdk && localMediaOptions) {
950
+ const selectLocalMediaShouldStartWithOptions = toolkit.createSelector(selectAppIsActive, selectLocalMediaStatus, selectLocalMediaOptions, (appIsActive, localMediaStatus, localMediaOptions) => {
951
+ if (appIsActive && ["inactive", "stopped"].includes(localMediaStatus) && localMediaOptions) {
952
952
  return localMediaOptions;
953
953
  }
954
954
  });
@@ -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 selectRemoteParticipants = (state) => state.remoteParticipants.remoteParticipants;
1446
- const selectNumParticipants = toolkit.createSelector(selectRemoteParticipants, (clients) => clients.filter((c) => !NON_PERSON_ROLES.includes(c.roleName)).length + 1);
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,
@@ -1614,10 +1625,9 @@ const selectShouldConnectRoom = toolkit.createSelector([
1614
1625
  selectRoomConnectionStatus,
1615
1626
  selectSignalConnectionDeviceIdentified,
1616
1627
  selectLocalMediaStatus,
1617
- selectAppIsNodeSdk,
1618
- ], (appIsActive, hasOrganizationIdFetched, roomConnectionStatus, signalConnectionDeviceIdentified, localMediaStatus, isNodeSdk) => {
1628
+ ], (appIsActive, hasOrganizationIdFetched, roomConnectionStatus, signalConnectionDeviceIdentified, localMediaStatus) => {
1619
1629
  if (appIsActive &&
1620
- (localMediaStatus === "started" || isNodeSdk) &&
1630
+ localMediaStatus === "started" &&
1621
1631
  signalConnectionDeviceIdentified &&
1622
1632
  !!hasOrganizationIdFetched &&
1623
1633
  ["ready", "reconnecting", "disconnected"].includes(roomConnectionStatus)) {
@@ -1837,7 +1847,7 @@ const doKickParticipant = createAppAuthorizedThunk((state) => selectIsAuthorized
1837
1847
  });
1838
1848
  const doEndMeeting = createAppAuthorizedThunk((state) => selectIsAuthorizedToEndMeeting(state), (payload) => (dispatch, getState) => {
1839
1849
  const state = getState();
1840
- const clientsToKick = selectRemoteParticipants(state).map((c) => c.id);
1850
+ const clientsToKick = selectRemoteClients(state).map((c) => c.id);
1841
1851
  if (clientsToKick.length) {
1842
1852
  const { socket } = selectSignalConnectionRaw(state);
1843
1853
  socket === null || socket === void 0 ? void 0 : socket.emit("kick_client", { clientIds: clientsToKick, reasonId: "end-meeting" });
@@ -1904,7 +1914,7 @@ const selectRemoteClientViews = toolkit.createSelector(selectLocalScreenshareStr
1904
1914
  return views;
1905
1915
  });
1906
1916
  const selectAllClientViews = toolkit.createSelector(selectLocalParticipantView, selectRemoteClientViews, (localParticipant, remoteParticipants) => {
1907
- return [localParticipant, ...remoteParticipants];
1917
+ return [...(localParticipant ? [localParticipant] : []), ...remoteParticipants];
1908
1918
  });
1909
1919
 
1910
1920
  const createWebRtcEmitter = (dispatch) => {
@@ -2019,7 +2029,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
2019
2029
  dispatch(isAcceptingStreams(true));
2020
2030
  const state = getState();
2021
2031
  const rtcManager = selectRtcConnectionRaw(state).rtcManager;
2022
- const remoteParticipants = selectRemoteParticipants(state);
2032
+ const remoteClients = selectRemoteClients(state);
2023
2033
  if (!rtcManager) {
2024
2034
  throw new Error("No rtc manager");
2025
2035
  }
@@ -2027,7 +2037,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
2027
2037
  const shouldAcceptNewClients = (_a = rtcManager.shouldAcceptStreamsFromBothSides) === null || _a === void 0 ? void 0 : _a.call(rtcManager);
2028
2038
  const updates = [];
2029
2039
  for (const { clientId, streamId, state } of payload) {
2030
- const participant = remoteParticipants.find((p) => p.id === clientId);
2040
+ const participant = remoteClients.find((p) => p.id === clientId);
2031
2041
  if (!participant)
2032
2042
  continue;
2033
2043
  if (state === "to_accept" ||
@@ -2167,7 +2177,7 @@ createReactor([selectShouldDisconnectRtc], ({ dispatch }, shouldDisconnectRtc) =
2167
2177
  dispatch(doDisconnectRtc());
2168
2178
  }
2169
2179
  });
2170
- const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemoteParticipants, (rtcStatus, remoteParticipants) => {
2180
+ const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemoteClients, (rtcStatus, remoteParticipants) => {
2171
2181
  if (rtcStatus !== "ready") {
2172
2182
  return [];
2173
2183
  }
@@ -3715,6 +3725,7 @@ exports.hasValue = hasValue;
3715
3725
  exports.initialCloudRecordingState = initialCloudRecordingState;
3716
3726
  exports.initialLocalMediaState = initialLocalMediaState;
3717
3727
  exports.initialNotificationsState = initialNotificationsState;
3728
+ exports.initialState = initialState$f;
3718
3729
  exports.isAcceptingStreams = isAcceptingStreams;
3719
3730
  exports.isClientSpotlighted = isClientSpotlighted;
3720
3731
  exports.listenerMiddleware = listenerMiddleware;
@@ -3812,10 +3823,12 @@ exports.selectMicrophoneDevices = selectMicrophoneDevices;
3812
3823
  exports.selectNotificationsEmitter = selectNotificationsEmitter;
3813
3824
  exports.selectNotificationsEvents = selectNotificationsEvents;
3814
3825
  exports.selectNotificationsRaw = selectNotificationsRaw;
3826
+ exports.selectNumClients = selectNumClients;
3815
3827
  exports.selectNumParticipants = selectNumParticipants;
3816
3828
  exports.selectOrganizationId = selectOrganizationId;
3817
3829
  exports.selectOrganizationRaw = selectOrganizationRaw;
3818
3830
  exports.selectRemoteClientViews = selectRemoteClientViews;
3831
+ exports.selectRemoteClients = selectRemoteClients;
3819
3832
  exports.selectRemoteParticipants = selectRemoteParticipants;
3820
3833
  exports.selectRemoteParticipantsRaw = selectRemoteParticipantsRaw;
3821
3834
  exports.selectRoomConnectionError = selectRoomConnectionError;