@whereby.com/core 1.32.1 → 1.33.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
@@ -1354,7 +1354,7 @@ const createReactor = (selectors, callback) => {
1354
1354
  });
1355
1355
  };
1356
1356
 
1357
- const coreVersion = "1.32.1";
1357
+ const coreVersion = "1.33.0";
1358
1358
 
1359
1359
  const initialState$2 = {
1360
1360
  displayName: null,
@@ -1443,6 +1443,7 @@ const signalEvents = {
1443
1443
  screenshareEnableRequested: createSignalEventAction("screenshareEnableRequested"),
1444
1444
  spotlightAdded: createSignalEventAction("spotlightAdded"),
1445
1445
  spotlightRemoved: createSignalEventAction("spotlightRemoved"),
1446
+ spotlightOrderSwapped: createSignalEventAction("spotlightOrderSwapped"),
1446
1447
  streamingStopped: createSignalEventAction("streamingStopped"),
1447
1448
  videoEnabled: createSignalEventAction("videoEnabled"),
1448
1449
  videoEnableRequested: createSignalEventAction("videoEnableRequested"),
@@ -1641,6 +1642,7 @@ function forwardSocketEvents(socket, dispatch) {
1641
1642
  socket.on("streaming_stopped", () => dispatch(signalEvents.streamingStopped()));
1642
1643
  socket.on("spotlight_added", (payload) => dispatch(signalEvents.spotlightAdded(payload)));
1643
1644
  socket.on("spotlight_removed", (payload) => dispatch(signalEvents.spotlightRemoved(payload)));
1645
+ socket.on("spotlight_order_swapped", (payload) => dispatch(signalEvents.spotlightOrderSwapped(payload)));
1644
1646
  socket.on("live_transcription_started", (payload) => dispatch(signalEvents.liveTranscriptionStarted(payload)));
1645
1647
  socket.on("live_transcription_stopped", (payload) => dispatch(signalEvents.liveTranscriptionStopped(payload)));
1646
1648
  socket.on("live_captions_started", (payload) => dispatch(signalEvents.liveCaptionsStarted(payload)));
@@ -3864,7 +3866,7 @@ createReactor([selectShouldFetchRoom], ({ dispatch, getState }, shouldFetchRoom)
3864
3866
 
3865
3867
  function streamIdForClient({ isPresentation, stream }) {
3866
3868
  var _a, _b;
3867
- return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id : media.CAMERA_STREAM_ID;
3869
+ return isPresentation ? ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id) : media.CAMERA_STREAM_ID;
3868
3870
  }
3869
3871
  function isClientSpotlighted({ spotlights, isPresentation, clientId, stream, }) {
3870
3872
  return !!spotlights.find((s) => {
@@ -3879,6 +3881,17 @@ function mergeSpotlight(spotlights, spotlight) {
3879
3881
  }
3880
3882
  return spotlights.concat(spotlight);
3881
3883
  }
3884
+ const isSameSpotlight = (a, b) => a.clientId === b.clientId && a.streamId === b.streamId;
3885
+ function swapSpotlights(spotlights, source, target) {
3886
+ const index = spotlights.findIndex((s) => isSameSpotlight(s, source));
3887
+ const targetIndex = spotlights.findIndex((s) => isSameSpotlight(s, target));
3888
+ if (index < 0 || targetIndex < 0 || index === targetIndex) {
3889
+ return spotlights;
3890
+ }
3891
+ const swapped = [...spotlights];
3892
+ [swapped[index], swapped[targetIndex]] = [swapped[targetIndex], swapped[index]];
3893
+ return swapped;
3894
+ }
3882
3895
  function mapSpotlightsToClientViews(spotlights, clientViews) {
3883
3896
  return spotlights.reduce((acc, s) => {
3884
3897
  const clientView = clientViews.find((c) => s.clientId === c.clientId && s.streamId === streamIdForClient(c));
@@ -3924,6 +3937,14 @@ const spotlightsSlice = toolkit.createSlice({
3924
3937
  const { clientId, streamId } = action.payload;
3925
3938
  return Object.assign(Object.assign({}, state), { sorted: state.sorted.filter((s) => !(s.clientId === clientId && s.streamId === streamId)) });
3926
3939
  });
3940
+ builder.addCase(signalEvents.spotlightOrderSwapped, (state, action) => {
3941
+ if ("error" in action.payload) {
3942
+ return state;
3943
+ }
3944
+ const { source, target } = action.payload;
3945
+ const sorted = swapSpotlights(state.sorted, source, target);
3946
+ return sorted === state.sorted ? state : Object.assign(Object.assign({}, state), { sorted });
3947
+ });
3927
3948
  builder.addMatcher(toolkit.isAnyOf(signalEvents.clientKicked, signalEvents.clientLeft), (state, action) => {
3928
3949
  const { clientId } = action.payload;
3929
3950
  return Object.assign(Object.assign({}, state), { sorted: state.sorted.filter((s) => s.clientId !== clientId) });
@@ -3953,6 +3974,31 @@ const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorized
3953
3974
  const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : media.CAMERA_STREAM_ID };
3954
3975
  socket === null || socket === void 0 ? void 0 : socket.emit("remove_spotlight", payload);
3955
3976
  });
3977
+ const doSwapSpotlightOrder = createAppAuthorizedThunk((state) => selectIsAuthorizedToSpotlight(state), ({ id, targetId }) => (_, getState) => {
3978
+ const state = getState();
3979
+ const clientViews = selectAllClientViews(state);
3980
+ const spotlights = selectSpotlights(state);
3981
+ const toSpotlight = (clientViewId) => {
3982
+ var _a;
3983
+ const clientView = clientViews.find((c) => c.id === clientViewId);
3984
+ if (!clientView) {
3985
+ return null;
3986
+ }
3987
+ const spotlight = {
3988
+ clientId: clientView.clientId,
3989
+ streamId: (_a = streamIdForClient(clientView)) !== null && _a !== void 0 ? _a : media.CAMERA_STREAM_ID,
3990
+ };
3991
+ return spotlights.some((s) => isSameSpotlight(s, spotlight)) ? spotlight : null;
3992
+ };
3993
+ const source = toSpotlight(id);
3994
+ const target = toSpotlight(targetId);
3995
+ if (!source || !target || isSameSpotlight(source, target)) {
3996
+ return;
3997
+ }
3998
+ const { socket } = selectSignalConnectionRaw(state);
3999
+ const payload = { source, target };
4000
+ socket === null || socket === void 0 ? void 0 : socket.emit("swap_spotlight_order", payload);
4001
+ });
3956
4002
  const selectSpotlights = (state) => state.spotlights.sorted;
3957
4003
  toolkit.createSelector(selectLocalParticipantRaw, selectSpotlights, (localParticipant, spotlights) => {
3958
4004
  return isClientSpotlighted({ clientId: localParticipant.id, stream: localParticipant.stream, spotlights });
@@ -5190,6 +5236,50 @@ createReactor([selectBreakoutAssignments, selectDeviceId, selectLocalParticipant
5190
5236
  }
5191
5237
  });
5192
5238
 
5239
+ const roomLayoutSliceInitialState = {
5240
+ sortedClientIds: [],
5241
+ };
5242
+ const roomLayoutSlice = toolkit.createSlice({
5243
+ name: "roomLayout",
5244
+ initialState: roomLayoutSliceInitialState,
5245
+ reducers: {
5246
+ setSortedClientIds(state, action) {
5247
+ return Object.assign(Object.assign({}, state), { sortedClientIds: Array.from(new Set(action.payload)) });
5248
+ },
5249
+ },
5250
+ });
5251
+ const { setSortedClientIds } = roomLayoutSlice.actions;
5252
+ const doReorderClientViews = createAppThunk(({ id, targetId }) => (dispatch, getState) => {
5253
+ const clientIds = selectSortedClientViews(getState()).map((c) => c.id);
5254
+ const index = clientIds.indexOf(id);
5255
+ const targetIndex = clientIds.indexOf(targetId);
5256
+ if (index < 0 || targetIndex < 0 || index === targetIndex) {
5257
+ return;
5258
+ }
5259
+ [clientIds[index], clientIds[targetIndex]] = [clientIds[targetIndex], clientIds[index]];
5260
+ dispatch(setSortedClientIds(clientIds));
5261
+ });
5262
+ const doSetClientViewOrder = createAppThunk((ids) => (dispatch, getState) => {
5263
+ const listed = new Set(ids);
5264
+ const unlisted = selectSortedClientViews(getState())
5265
+ .map((c) => c.id)
5266
+ .filter((id) => !listed.has(id));
5267
+ dispatch(setSortedClientIds([...ids, ...unlisted]));
5268
+ });
5269
+ const selectSortedClientIds = (state) => state.roomLayout.sortedClientIds;
5270
+ const selectSortedClientViews = toolkit.createSelector(selectAllClientViews, selectSortedClientIds, (clientViews, sortedClientIds) => sortClientViews({ sortedClientIds, clientViews }));
5271
+ function sortClientViews({ sortedClientIds, clientViews, }) {
5272
+ if (!sortedClientIds.length) {
5273
+ return clientViews;
5274
+ }
5275
+ const rank = new Map(sortedClientIds.map((id, index) => [id, index]));
5276
+ const unranked = sortedClientIds.length;
5277
+ return clientViews
5278
+ .map((clientView, index) => { var _a; return ({ clientView, index, rank: (_a = rank.get(clientView.id)) !== null && _a !== void 0 ? _a : unranked }); })
5279
+ .sort((a, b) => a.rank - b.rank || a.index - b.index)
5280
+ .map(({ clientView }) => clientView);
5281
+ }
5282
+
5193
5283
  function isCustomElementName(value) {
5194
5284
  return typeof value === "string" && value === value.toLowerCase() && value.includes("-");
5195
5285
  }
@@ -6174,6 +6264,7 @@ const appReducer = toolkit.combineReducers({
6174
6264
  room: roomSlice.reducer,
6175
6265
  roomConnection: roomConnectionSlice.reducer,
6176
6266
  roomIntegrations: roomIntegrationsSlice.reducer,
6267
+ roomLayout: roomLayoutSlice.reducer,
6177
6268
  rtcAnalytics: rtcAnalyticsSlice.reducer,
6178
6269
  rtcConnection: rtcConnectionSlice.reducer,
6179
6270
  signalConnection: signalConnectionSlice.reducer,
@@ -6215,12 +6306,13 @@ const CLIENT_VIEW_SPOTLIGHTS_CHANGED = "grid:client-view-spotlights-changed";
6215
6306
  const NUMBER_OF_CLIENT_VIEWS_CHANGED = "grid:number-of-client-views-changed";
6216
6307
  const RUNNING_ROOM_INTEGRATIONS_CHANGED = "grid:running-room-integrations-changed";
6217
6308
 
6218
- const selectGridState = toolkit.createSelector(selectAllClientViews, selectSpotlightedClientViews, selectNumClients, selectRunningRoomIntegrations, (allClientViews, spotlightedParticipants, numClients, runningRoomIntegrations) => {
6309
+ const selectGridState = toolkit.createSelector(selectSortedClientViews, selectSpotlightedClientViews, selectNumClients, selectRunningRoomIntegrations, selectIsAuthorizedToSpotlight, (allClientViews, spotlightedParticipants, numClients, runningRoomIntegrations, canSpotlight) => {
6219
6310
  return {
6220
6311
  allClientViews,
6221
6312
  spotlightedParticipants,
6222
6313
  numParticipants: numClients,
6223
6314
  runningRoomIntegrations,
6315
+ canSpotlight,
6224
6316
  };
6225
6317
  });
6226
6318
 
@@ -6304,6 +6396,24 @@ class GridClient extends BaseClient {
6304
6396
  removeSpotlight(id) {
6305
6397
  this.store.dispatch(doRemoveSpotlight({ id }));
6306
6398
  }
6399
+ reorderClientViews({ id, targetId }) {
6400
+ if (typeof id !== "string" || typeof targetId !== "string") {
6401
+ throw new TypeError("reorderClientViews expects { id, targetId } with string client view ids");
6402
+ }
6403
+ this.store.dispatch(doReorderClientViews({ id, targetId }));
6404
+ }
6405
+ setClientViewOrder(ids) {
6406
+ if (!Array.isArray(ids) || ids.some((id) => typeof id !== "string")) {
6407
+ throw new TypeError("setClientViewOrder expects an array of client view ids");
6408
+ }
6409
+ this.store.dispatch(doSetClientViewOrder(ids));
6410
+ }
6411
+ swapSpotlightOrder({ id, targetId }) {
6412
+ if (typeof id !== "string" || typeof targetId !== "string") {
6413
+ throw new TypeError("swapSpotlightOrder expects { id, targetId } with string client view ids");
6414
+ }
6415
+ this.store.dispatch(doSwapSpotlightOrder({ id, targetId }));
6416
+ }
6307
6417
  destroy() {
6308
6418
  super.destroy();
6309
6419
  this.clientViewSubscribers.clear();
package/dist/index.d.cts CHANGED
@@ -1243,85 +1243,6 @@ interface RoomState {
1243
1243
  mode: RoomMode | null;
1244
1244
  }
1245
1245
 
1246
- type LocalMediaOptions$1 = {
1247
- audio: boolean;
1248
- video: boolean;
1249
- };
1250
- /**
1251
- * Reducer
1252
- */
1253
- interface LocalMediaState$1 {
1254
- beforeEffectTracks?: {
1255
- audio?: MediaStreamTrack;
1256
- video?: MediaStreamTrack;
1257
- };
1258
- busyDeviceIds: string[];
1259
- cameraDeviceError?: unknown;
1260
- cameraEnabled: boolean;
1261
- currentCameraDeviceId?: string;
1262
- currentMicrophoneDeviceId?: string;
1263
- currentSpeakerDeviceId?: string;
1264
- devices: MediaDeviceInfo[];
1265
- hdMode: boolean;
1266
- isSettingCameraDevice: boolean;
1267
- isSettingMicrophoneDevice: boolean;
1268
- isSettingSpeakerDevice: boolean;
1269
- isSwitchingStream: boolean;
1270
- isTogglingCamera: boolean;
1271
- lowDataMode: boolean;
1272
- microphoneDeviceError?: unknown;
1273
- microphoneEnabled: boolean;
1274
- onDeviceChange?: () => void;
1275
- options?: LocalMediaOptions$1;
1276
- speakerDeviceError?: unknown;
1277
- status: "inactive" | "stopped" | "starting" | "started" | "error";
1278
- startError?: unknown;
1279
- stream?: MediaStream;
1280
- widescreenMode: boolean;
1281
- }
1282
-
1283
- /**
1284
- * Reducer
1285
- */
1286
- /**
1287
- * Whether to join with the camera and/or microphone muted. The devices are still
1288
- * acquired according to `localMediaOptions` - this only decides the state we join
1289
- * with. `true` means muted, an omitted key leaves that device untouched.
1290
- */
1291
- type InitialMuteStates = {
1292
- camera?: boolean;
1293
- microphone?: boolean;
1294
- };
1295
- interface AppConfig {
1296
- assistantKey?: string | null;
1297
- displayName: string;
1298
- externalId: string | null;
1299
- ignoreBreakoutGroups?: boolean;
1300
- initialMuteStates?: InitialMuteStates;
1301
- isAudioRecorder?: boolean;
1302
- isDialIn?: boolean;
1303
- isNodeSdk?: boolean;
1304
- localMediaOptions?: LocalMediaOptions$1;
1305
- roomKey: string | null;
1306
- roomUrl: string;
1307
- userAgent?: string;
1308
- }
1309
- interface AppState {
1310
- displayName: string | null;
1311
- externalId: string | null;
1312
- ignoreBreakoutGroups: boolean;
1313
- initialConfig?: AppConfig;
1314
- initialMuteStates?: InitialMuteStates;
1315
- isActive: boolean;
1316
- isAssistant: boolean;
1317
- isAudioRecorder: boolean;
1318
- isDialIn: boolean;
1319
- isNodeSdk: boolean;
1320
- roomName: string | null;
1321
- roomUrl: string | null;
1322
- userAgent: string | null;
1323
- }
1324
-
1325
1246
  type ConnectionStatus = "ready" | "connecting" | "connected" | "room_locked" | "knocking" | "knock_on_hold" | "knock_rejected" | "kicked" | "leaving" | "left" | "disconnected" | "reconnecting";
1326
1247
  type JoinRoomStage = "credentials" | "organization" | "local_media" | "signal_connect" | "identify_device" | "join_room";
1327
1248
  type JoinRoomErrorNames = "organization_fetch_failed" | "join_cancelled";
@@ -1408,6 +1329,92 @@ declare function roomIntegrationPickerUrl({ integration, parentOrigin, featureSo
1408
1329
  featureSource?: string;
1409
1330
  }): string;
1410
1331
 
1332
+ type LocalMediaOptions$1 = {
1333
+ audio: boolean;
1334
+ video: boolean;
1335
+ };
1336
+ /**
1337
+ * Reducer
1338
+ */
1339
+ interface LocalMediaState$1 {
1340
+ beforeEffectTracks?: {
1341
+ audio?: MediaStreamTrack;
1342
+ video?: MediaStreamTrack;
1343
+ };
1344
+ busyDeviceIds: string[];
1345
+ cameraDeviceError?: unknown;
1346
+ cameraEnabled: boolean;
1347
+ currentCameraDeviceId?: string;
1348
+ currentMicrophoneDeviceId?: string;
1349
+ currentSpeakerDeviceId?: string;
1350
+ devices: MediaDeviceInfo[];
1351
+ hdMode: boolean;
1352
+ isSettingCameraDevice: boolean;
1353
+ isSettingMicrophoneDevice: boolean;
1354
+ isSettingSpeakerDevice: boolean;
1355
+ isSwitchingStream: boolean;
1356
+ isTogglingCamera: boolean;
1357
+ lowDataMode: boolean;
1358
+ microphoneDeviceError?: unknown;
1359
+ microphoneEnabled: boolean;
1360
+ onDeviceChange?: () => void;
1361
+ options?: LocalMediaOptions$1;
1362
+ speakerDeviceError?: unknown;
1363
+ status: "inactive" | "stopped" | "starting" | "started" | "error";
1364
+ startError?: unknown;
1365
+ stream?: MediaStream;
1366
+ widescreenMode: boolean;
1367
+ }
1368
+
1369
+ /**
1370
+ * Reducer
1371
+ */
1372
+ /**
1373
+ * Whether to join with the camera and/or microphone muted. The devices are still
1374
+ * acquired according to `localMediaOptions` - this only decides the state we join
1375
+ * with. `true` means muted, an omitted key leaves that device untouched.
1376
+ */
1377
+ type InitialMuteStates = {
1378
+ camera?: boolean;
1379
+ microphone?: boolean;
1380
+ };
1381
+ interface AppConfig {
1382
+ assistantKey?: string | null;
1383
+ displayName: string;
1384
+ externalId: string | null;
1385
+ ignoreBreakoutGroups?: boolean;
1386
+ initialMuteStates?: InitialMuteStates;
1387
+ isAudioRecorder?: boolean;
1388
+ isDialIn?: boolean;
1389
+ isNodeSdk?: boolean;
1390
+ localMediaOptions?: LocalMediaOptions$1;
1391
+ roomKey: string | null;
1392
+ roomUrl: string;
1393
+ userAgent?: string;
1394
+ }
1395
+ interface AppState {
1396
+ displayName: string | null;
1397
+ externalId: string | null;
1398
+ ignoreBreakoutGroups: boolean;
1399
+ initialConfig?: AppConfig;
1400
+ initialMuteStates?: InitialMuteStates;
1401
+ isActive: boolean;
1402
+ isAssistant: boolean;
1403
+ isAudioRecorder: boolean;
1404
+ isDialIn: boolean;
1405
+ isNodeSdk: boolean;
1406
+ roomName: string | null;
1407
+ roomUrl: string | null;
1408
+ userAgent: string | null;
1409
+ }
1410
+
1411
+ /**
1412
+ * Reducer
1413
+ */
1414
+ interface RoomLayoutState {
1415
+ sortedClientIds: string[];
1416
+ }
1417
+
1411
1418
  /**
1412
1419
  * Reducer
1413
1420
  */
@@ -1476,6 +1483,7 @@ declare const appReducer: redux.Reducer<{
1476
1483
  room: RoomState;
1477
1484
  roomConnection: RoomConnectionState$1;
1478
1485
  roomIntegrations: RoomIntegrationsState$1;
1486
+ roomLayout: RoomLayoutState;
1479
1487
  rtcAnalytics: rtcAnalyticsState;
1480
1488
  rtcConnection: RtcConnectionState;
1481
1489
  signalConnection: SignalConnectionState;
@@ -1504,6 +1512,7 @@ declare const appReducer: redux.Reducer<{
1504
1512
  room: RoomState | undefined;
1505
1513
  roomConnection: RoomConnectionState$1 | undefined;
1506
1514
  roomIntegrations: RoomIntegrationsState$1 | undefined;
1515
+ roomLayout: RoomLayoutState | undefined;
1507
1516
  rtcAnalytics: rtcAnalyticsState | undefined;
1508
1517
  rtcConnection: RtcConnectionState | undefined;
1509
1518
  signalConnection: SignalConnectionState | undefined;
@@ -1536,6 +1545,7 @@ declare const createStore: ({ preloadedState, injectServices, }: {
1536
1545
  room: RoomState;
1537
1546
  roomConnection: RoomConnectionState$1;
1538
1547
  roomIntegrations: RoomIntegrationsState$1;
1548
+ roomLayout: RoomLayoutState;
1539
1549
  rtcAnalytics: rtcAnalyticsState;
1540
1550
  rtcConnection: RtcConnectionState;
1541
1551
  signalConnection: SignalConnectionState;
@@ -1565,6 +1575,7 @@ declare const createStore: ({ preloadedState, injectServices, }: {
1565
1575
  room: RoomState;
1566
1576
  roomConnection: RoomConnectionState$1;
1567
1577
  roomIntegrations: RoomIntegrationsState$1;
1578
+ roomLayout: RoomLayoutState;
1568
1579
  rtcAnalytics: rtcAnalyticsState;
1569
1580
  rtcConnection: RtcConnectionState;
1570
1581
  signalConnection: SignalConnectionState;
@@ -1602,6 +1613,7 @@ interface GridState {
1602
1613
  spotlightedParticipants: ClientView[];
1603
1614
  numParticipants: number;
1604
1615
  runningRoomIntegrations: RoomIntegrationSessionView[];
1616
+ canSpotlight: boolean;
1605
1617
  }
1606
1618
 
1607
1619
  declare abstract class BaseClient<TState, TEvents extends Record<string, unknown[]>> extends EventEmitter<TEvents> {
@@ -1656,6 +1668,18 @@ declare class GridClient extends BaseClient<GridState, GridEvents> {
1656
1668
  subscribeRunningRoomIntegrations(callback: (sessions: RoomIntegrationSessionView[]) => void): () => void;
1657
1669
  spotlightParticipant(id: string): void;
1658
1670
  removeSpotlight(id: string): void;
1671
+ /** Only for this participant. */
1672
+ reorderClientViews({ id, targetId }: {
1673
+ id: string;
1674
+ targetId: string;
1675
+ }): void;
1676
+ /** Only for this participant. Puts the listed client views first; the rest keep their current order. */
1677
+ setClientViewOrder(ids: string[]): void;
1678
+ /** For everyone in the room. Needs `canSpotlight`. */
1679
+ swapSpotlightOrder({ id, targetId }: {
1680
+ id: string;
1681
+ targetId: string;
1682
+ }): void;
1659
1683
  destroy(): void;
1660
1684
  }
1661
1685
 
package/dist/index.d.mts CHANGED
@@ -1243,85 +1243,6 @@ interface RoomState {
1243
1243
  mode: RoomMode | null;
1244
1244
  }
1245
1245
 
1246
- type LocalMediaOptions$1 = {
1247
- audio: boolean;
1248
- video: boolean;
1249
- };
1250
- /**
1251
- * Reducer
1252
- */
1253
- interface LocalMediaState$1 {
1254
- beforeEffectTracks?: {
1255
- audio?: MediaStreamTrack;
1256
- video?: MediaStreamTrack;
1257
- };
1258
- busyDeviceIds: string[];
1259
- cameraDeviceError?: unknown;
1260
- cameraEnabled: boolean;
1261
- currentCameraDeviceId?: string;
1262
- currentMicrophoneDeviceId?: string;
1263
- currentSpeakerDeviceId?: string;
1264
- devices: MediaDeviceInfo[];
1265
- hdMode: boolean;
1266
- isSettingCameraDevice: boolean;
1267
- isSettingMicrophoneDevice: boolean;
1268
- isSettingSpeakerDevice: boolean;
1269
- isSwitchingStream: boolean;
1270
- isTogglingCamera: boolean;
1271
- lowDataMode: boolean;
1272
- microphoneDeviceError?: unknown;
1273
- microphoneEnabled: boolean;
1274
- onDeviceChange?: () => void;
1275
- options?: LocalMediaOptions$1;
1276
- speakerDeviceError?: unknown;
1277
- status: "inactive" | "stopped" | "starting" | "started" | "error";
1278
- startError?: unknown;
1279
- stream?: MediaStream;
1280
- widescreenMode: boolean;
1281
- }
1282
-
1283
- /**
1284
- * Reducer
1285
- */
1286
- /**
1287
- * Whether to join with the camera and/or microphone muted. The devices are still
1288
- * acquired according to `localMediaOptions` - this only decides the state we join
1289
- * with. `true` means muted, an omitted key leaves that device untouched.
1290
- */
1291
- type InitialMuteStates = {
1292
- camera?: boolean;
1293
- microphone?: boolean;
1294
- };
1295
- interface AppConfig {
1296
- assistantKey?: string | null;
1297
- displayName: string;
1298
- externalId: string | null;
1299
- ignoreBreakoutGroups?: boolean;
1300
- initialMuteStates?: InitialMuteStates;
1301
- isAudioRecorder?: boolean;
1302
- isDialIn?: boolean;
1303
- isNodeSdk?: boolean;
1304
- localMediaOptions?: LocalMediaOptions$1;
1305
- roomKey: string | null;
1306
- roomUrl: string;
1307
- userAgent?: string;
1308
- }
1309
- interface AppState {
1310
- displayName: string | null;
1311
- externalId: string | null;
1312
- ignoreBreakoutGroups: boolean;
1313
- initialConfig?: AppConfig;
1314
- initialMuteStates?: InitialMuteStates;
1315
- isActive: boolean;
1316
- isAssistant: boolean;
1317
- isAudioRecorder: boolean;
1318
- isDialIn: boolean;
1319
- isNodeSdk: boolean;
1320
- roomName: string | null;
1321
- roomUrl: string | null;
1322
- userAgent: string | null;
1323
- }
1324
-
1325
1246
  type ConnectionStatus = "ready" | "connecting" | "connected" | "room_locked" | "knocking" | "knock_on_hold" | "knock_rejected" | "kicked" | "leaving" | "left" | "disconnected" | "reconnecting";
1326
1247
  type JoinRoomStage = "credentials" | "organization" | "local_media" | "signal_connect" | "identify_device" | "join_room";
1327
1248
  type JoinRoomErrorNames = "organization_fetch_failed" | "join_cancelled";
@@ -1408,6 +1329,92 @@ declare function roomIntegrationPickerUrl({ integration, parentOrigin, featureSo
1408
1329
  featureSource?: string;
1409
1330
  }): string;
1410
1331
 
1332
+ type LocalMediaOptions$1 = {
1333
+ audio: boolean;
1334
+ video: boolean;
1335
+ };
1336
+ /**
1337
+ * Reducer
1338
+ */
1339
+ interface LocalMediaState$1 {
1340
+ beforeEffectTracks?: {
1341
+ audio?: MediaStreamTrack;
1342
+ video?: MediaStreamTrack;
1343
+ };
1344
+ busyDeviceIds: string[];
1345
+ cameraDeviceError?: unknown;
1346
+ cameraEnabled: boolean;
1347
+ currentCameraDeviceId?: string;
1348
+ currentMicrophoneDeviceId?: string;
1349
+ currentSpeakerDeviceId?: string;
1350
+ devices: MediaDeviceInfo[];
1351
+ hdMode: boolean;
1352
+ isSettingCameraDevice: boolean;
1353
+ isSettingMicrophoneDevice: boolean;
1354
+ isSettingSpeakerDevice: boolean;
1355
+ isSwitchingStream: boolean;
1356
+ isTogglingCamera: boolean;
1357
+ lowDataMode: boolean;
1358
+ microphoneDeviceError?: unknown;
1359
+ microphoneEnabled: boolean;
1360
+ onDeviceChange?: () => void;
1361
+ options?: LocalMediaOptions$1;
1362
+ speakerDeviceError?: unknown;
1363
+ status: "inactive" | "stopped" | "starting" | "started" | "error";
1364
+ startError?: unknown;
1365
+ stream?: MediaStream;
1366
+ widescreenMode: boolean;
1367
+ }
1368
+
1369
+ /**
1370
+ * Reducer
1371
+ */
1372
+ /**
1373
+ * Whether to join with the camera and/or microphone muted. The devices are still
1374
+ * acquired according to `localMediaOptions` - this only decides the state we join
1375
+ * with. `true` means muted, an omitted key leaves that device untouched.
1376
+ */
1377
+ type InitialMuteStates = {
1378
+ camera?: boolean;
1379
+ microphone?: boolean;
1380
+ };
1381
+ interface AppConfig {
1382
+ assistantKey?: string | null;
1383
+ displayName: string;
1384
+ externalId: string | null;
1385
+ ignoreBreakoutGroups?: boolean;
1386
+ initialMuteStates?: InitialMuteStates;
1387
+ isAudioRecorder?: boolean;
1388
+ isDialIn?: boolean;
1389
+ isNodeSdk?: boolean;
1390
+ localMediaOptions?: LocalMediaOptions$1;
1391
+ roomKey: string | null;
1392
+ roomUrl: string;
1393
+ userAgent?: string;
1394
+ }
1395
+ interface AppState {
1396
+ displayName: string | null;
1397
+ externalId: string | null;
1398
+ ignoreBreakoutGroups: boolean;
1399
+ initialConfig?: AppConfig;
1400
+ initialMuteStates?: InitialMuteStates;
1401
+ isActive: boolean;
1402
+ isAssistant: boolean;
1403
+ isAudioRecorder: boolean;
1404
+ isDialIn: boolean;
1405
+ isNodeSdk: boolean;
1406
+ roomName: string | null;
1407
+ roomUrl: string | null;
1408
+ userAgent: string | null;
1409
+ }
1410
+
1411
+ /**
1412
+ * Reducer
1413
+ */
1414
+ interface RoomLayoutState {
1415
+ sortedClientIds: string[];
1416
+ }
1417
+
1411
1418
  /**
1412
1419
  * Reducer
1413
1420
  */
@@ -1476,6 +1483,7 @@ declare const appReducer: redux.Reducer<{
1476
1483
  room: RoomState;
1477
1484
  roomConnection: RoomConnectionState$1;
1478
1485
  roomIntegrations: RoomIntegrationsState$1;
1486
+ roomLayout: RoomLayoutState;
1479
1487
  rtcAnalytics: rtcAnalyticsState;
1480
1488
  rtcConnection: RtcConnectionState;
1481
1489
  signalConnection: SignalConnectionState;
@@ -1504,6 +1512,7 @@ declare const appReducer: redux.Reducer<{
1504
1512
  room: RoomState | undefined;
1505
1513
  roomConnection: RoomConnectionState$1 | undefined;
1506
1514
  roomIntegrations: RoomIntegrationsState$1 | undefined;
1515
+ roomLayout: RoomLayoutState | undefined;
1507
1516
  rtcAnalytics: rtcAnalyticsState | undefined;
1508
1517
  rtcConnection: RtcConnectionState | undefined;
1509
1518
  signalConnection: SignalConnectionState | undefined;
@@ -1536,6 +1545,7 @@ declare const createStore: ({ preloadedState, injectServices, }: {
1536
1545
  room: RoomState;
1537
1546
  roomConnection: RoomConnectionState$1;
1538
1547
  roomIntegrations: RoomIntegrationsState$1;
1548
+ roomLayout: RoomLayoutState;
1539
1549
  rtcAnalytics: rtcAnalyticsState;
1540
1550
  rtcConnection: RtcConnectionState;
1541
1551
  signalConnection: SignalConnectionState;
@@ -1565,6 +1575,7 @@ declare const createStore: ({ preloadedState, injectServices, }: {
1565
1575
  room: RoomState;
1566
1576
  roomConnection: RoomConnectionState$1;
1567
1577
  roomIntegrations: RoomIntegrationsState$1;
1578
+ roomLayout: RoomLayoutState;
1568
1579
  rtcAnalytics: rtcAnalyticsState;
1569
1580
  rtcConnection: RtcConnectionState;
1570
1581
  signalConnection: SignalConnectionState;
@@ -1602,6 +1613,7 @@ interface GridState {
1602
1613
  spotlightedParticipants: ClientView[];
1603
1614
  numParticipants: number;
1604
1615
  runningRoomIntegrations: RoomIntegrationSessionView[];
1616
+ canSpotlight: boolean;
1605
1617
  }
1606
1618
 
1607
1619
  declare abstract class BaseClient<TState, TEvents extends Record<string, unknown[]>> extends EventEmitter<TEvents> {
@@ -1656,6 +1668,18 @@ declare class GridClient extends BaseClient<GridState, GridEvents> {
1656
1668
  subscribeRunningRoomIntegrations(callback: (sessions: RoomIntegrationSessionView[]) => void): () => void;
1657
1669
  spotlightParticipant(id: string): void;
1658
1670
  removeSpotlight(id: string): void;
1671
+ /** Only for this participant. */
1672
+ reorderClientViews({ id, targetId }: {
1673
+ id: string;
1674
+ targetId: string;
1675
+ }): void;
1676
+ /** Only for this participant. Puts the listed client views first; the rest keep their current order. */
1677
+ setClientViewOrder(ids: string[]): void;
1678
+ /** For everyone in the room. Needs `canSpotlight`. */
1679
+ swapSpotlightOrder({ id, targetId }: {
1680
+ id: string;
1681
+ targetId: string;
1682
+ }): void;
1659
1683
  destroy(): void;
1660
1684
  }
1661
1685