@whereby.com/core 1.21.2 → 1.23.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.
@@ -1,5 +1,5 @@
1
1
  import nodeBtoa from 'btoa';
2
- import { assert, fromLocation, ServerSocket, isFileShareError, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues } from '@whereby.com/media';
2
+ import { assert, fromLocation, ServerSocket, isFileShareError, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues, isRoomIntegrationErrorCode } from '@whereby.com/media';
3
3
  import axios from 'axios';
4
4
  import { EventEmitter } from 'events';
5
5
  import { createListenerMiddleware, addListener, createSlice, createAction, createSelector, createAsyncThunk, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
@@ -970,15 +970,6 @@ class RoomService {
970
970
  }
971
971
  }
972
972
 
973
- class LiveCaption {
974
- constructor({ resultId, senderId, text }) {
975
- this.resultId = resultId;
976
- this.participantId = senderId;
977
- this.text = text;
978
- this.timestamp = Date.now();
979
- }
980
- }
981
-
982
973
  /******************************************************************************
983
974
  Copyright (c) Microsoft Corporation.
984
975
 
@@ -1023,6 +1014,49 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1023
1014
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1024
1015
  };
1025
1016
 
1017
+ function roomPath(organizationId, roomName, suffix = "") {
1018
+ const encodedRoomName = encodeURIComponent(roomName.replace(/^\//, ""));
1019
+ return `/organizations/${encodeURIComponent(organizationId)}/room/${encodedRoomName}${suffix}`;
1020
+ }
1021
+ function asArray(value) {
1022
+ return Array.isArray(value) ? value : [];
1023
+ }
1024
+ class RoomIntegrationService {
1025
+ constructor({ apiClient }) {
1026
+ this._apiClient = apiClient;
1027
+ }
1028
+ findRoomIntegrations(_a) {
1029
+ return __awaiter(this, arguments, void 0, function* ({ organizationId, roomName, }) {
1030
+ const response = yield this._apiClient.request(roomPath(organizationId, roomName, "/room-integrations"), {
1031
+ method: "GET",
1032
+ });
1033
+ const data = (response.data || {});
1034
+ return {
1035
+ enabledRoomIntegrations: asArray(data.enabledRoomIntegrations),
1036
+ disabledRoomIntegrations: asArray(data.disabledRoomIntegrations),
1037
+ unavailableRoomIntegrations: asArray(data.unavailableRoomIntegrations),
1038
+ };
1039
+ });
1040
+ }
1041
+ toggleRoomIntegration(_a) {
1042
+ return __awaiter(this, arguments, void 0, function* ({ organizationId, roomName, roomIntegrationId, enable, }) {
1043
+ yield this._apiClient.request(roomPath(organizationId, roomName, `/room-integrations/${roomIntegrationId}`), {
1044
+ method: "PUT",
1045
+ data: { enable },
1046
+ });
1047
+ });
1048
+ }
1049
+ }
1050
+
1051
+ class LiveCaption {
1052
+ constructor({ resultId, senderId, text }) {
1053
+ this.resultId = resultId;
1054
+ this.participantId = senderId;
1055
+ this.text = text;
1056
+ this.timestamp = Date.now();
1057
+ }
1058
+ }
1059
+
1026
1060
  function getUsableCameraEffectPresets() {
1027
1061
  return __awaiter(this, void 0, void 0, function* () {
1028
1062
  const { getUsablePresets } = yield import('@whereby.com/camera-effects');
@@ -1036,6 +1070,54 @@ function isAudioDenoiserSupported() {
1036
1070
  });
1037
1071
  }
1038
1072
 
1073
+ function roomIntegrationContentTagName(integrationName) {
1074
+ return `${integrationName}-integration-contentframe`;
1075
+ }
1076
+ const YOUTUBE_ID = /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/|live\/))([\w-]{11})/i;
1077
+ const YOUTUBE_BARE_ID = /^[\w-]{11}$/;
1078
+ function youtubeStartSeconds(url) {
1079
+ const match = url.match(/[?&](?:t|start)=(\d+)s?/i);
1080
+ return match ? parseInt(match[1], 10) : 0;
1081
+ }
1082
+ function youtube({ url, startAt, metadata = {}, }) {
1083
+ var _a;
1084
+ const trimmed = (url || "").trim();
1085
+ const videoref = YOUTUBE_BARE_ID.test(trimmed) ? trimmed : (_a = trimmed.match(YOUTUBE_ID)) === null || _a === void 0 ? void 0 : _a[1];
1086
+ if (!videoref) {
1087
+ return null;
1088
+ }
1089
+ const time = startAt !== null && startAt !== void 0 ? startAt : youtubeStartSeconds(trimmed);
1090
+ const { aspectRatio = 16 / 9, isLive = false, title } = metadata;
1091
+ return {
1092
+ tagName: roomIntegrationContentTagName("youtube"),
1093
+ shareUrl: `https://www.youtube.com/watch?v=${videoref}${time ? `&t=${time}s` : ""}`,
1094
+ props: {
1095
+ videoref,
1096
+ time,
1097
+ seek: time,
1098
+ playerstate: "playing",
1099
+ started: Date.now() + 4000,
1100
+ paused: false,
1101
+ aspectratio: aspectRatio,
1102
+ islive: isLive,
1103
+ metadata: JSON.stringify(Object.assign({ id: videoref, aspectratio: aspectRatio, live: isLive }, (title ? { title } : {}))),
1104
+ },
1105
+ };
1106
+ }
1107
+ const MIRO_EMBED_LINK = /^https:\/\/miro\.com\/app\/(?:live-embed|access-link)\/[0-9a-zA-Z]+/i;
1108
+ function miro({ accessLink }) {
1109
+ const trimmed = (accessLink || "").trim();
1110
+ if (!MIRO_EMBED_LINK.test(trimmed)) {
1111
+ return null;
1112
+ }
1113
+ return {
1114
+ tagName: roomIntegrationContentTagName("miro"),
1115
+ shareUrl: trimmed,
1116
+ props: { accesslink: trimmed },
1117
+ };
1118
+ }
1119
+ const roomIntegrationContent = { youtube, miro };
1120
+
1039
1121
  class RoomParticipant {
1040
1122
  constructor({ breakoutGroup, displayName, id, isAudioEnabled, isAudioRecorder, isDialIn, isVideoEnabled, stickyReaction, stream, }) {
1041
1123
  this.isLocalParticipant = false;
@@ -1077,6 +1159,7 @@ function createServices() {
1077
1159
  baseUrl: API_BASE_URL,
1078
1160
  });
1079
1161
  const organizationService = new OrganizationService({ apiClient });
1162
+ const roomIntegrationService = new RoomIntegrationService({ apiClient });
1080
1163
  const fetchOrganizationFromRoomUrl = (roomUrl) => {
1081
1164
  const roomUrlObj = new URL(roomUrl);
1082
1165
  const urls = fromLocation({ host: roomUrlObj.host });
@@ -1090,6 +1173,7 @@ function createServices() {
1090
1173
  credentialsService,
1091
1174
  apiClient,
1092
1175
  organizationService,
1176
+ roomIntegrationService,
1093
1177
  fetchOrganizationFromRoomUrl,
1094
1178
  };
1095
1179
  }
@@ -1224,7 +1308,7 @@ const createReactor = (selectors, callback) => {
1224
1308
  });
1225
1309
  };
1226
1310
 
1227
- const coreVersion = "1.21.2";
1311
+ const coreVersion = "1.23.0";
1228
1312
 
1229
1313
  function decodeRoomName(roomName) {
1230
1314
  if (!roomName) {
@@ -1304,6 +1388,11 @@ const signalEvents = {
1304
1388
  knockerLeft: createSignalEventAction("knockerLeft"),
1305
1389
  knockHandled: createSignalEventAction("knockHandled"),
1306
1390
  newClient: createSignalEventAction("newClient"),
1391
+ roomIntegrationStarted: createSignalEventAction("roomIntegrationStarted"),
1392
+ roomIntegrationStopped: createSignalEventAction("roomIntegrationStopped"),
1393
+ roomIntegrationPropsUpdated: createSignalEventAction("roomIntegrationPropsUpdated"),
1394
+ roomIntegrationEnabled: createSignalEventAction("roomIntegrationEnabled"),
1395
+ roomIntegrationDisabled: createSignalEventAction("roomIntegrationDisabled"),
1307
1396
  roomJoined: createSignalEventAction("roomJoined"),
1308
1397
  roomKnocked: createSignalEventAction("roomKnocked"),
1309
1398
  roomLeft: createSignalEventAction("roomLeft"),
@@ -1334,6 +1423,7 @@ const ROOM_ACTION_PERMISSIONS_BY_ROLE = {
1334
1423
  canAskToSpeak: ["host"],
1335
1424
  canSpotlight: ["host"],
1336
1425
  canManageBreakout: ["host"],
1426
+ canManageRoomIntegration: ["host"],
1337
1427
  };
1338
1428
  const authorizationSliceInitialState = {
1339
1429
  roomKey: null,
@@ -1378,6 +1468,7 @@ const selectIsAuthorizedToEndMeeting = createSelector(selectAuthorizationRoleNam
1378
1468
  const selectIsAuthorizedToAskToSpeak = createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canAskToSpeak.includes(localParticipantRole));
1379
1469
  const selectIsAuthorizedToSpotlight = createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canSpotlight.includes(localParticipantRole));
1380
1470
  const selectIsAuthorizedToManageBreakout = createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canManageBreakout.includes(localParticipantRole));
1471
+ const selectIsAuthorizedToManageRoomIntegration = createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canManageRoomIntegration.includes(localParticipantRole));
1381
1472
 
1382
1473
  function createAppAsyncThunk(typePrefix, payloadCreator) {
1383
1474
  return createAsyncThunk(typePrefix, payloadCreator);
@@ -1511,6 +1602,11 @@ function forwardSocketEvents(socket, dispatch) {
1511
1602
  socket.on("video_enable_requested", (payload) => dispatch(signalEvents.videoEnableRequested(payload)));
1512
1603
  socket.on("breakout_group_joined", (payload) => dispatch(signalEvents.breakoutGroupJoined(payload)));
1513
1604
  socket.on("breakout_session_updated", (payload) => dispatch(signalEvents.breakoutSessionUpdated(payload)));
1605
+ socket.on("room_integration_started", (payload) => dispatch(signalEvents.roomIntegrationStarted(payload)));
1606
+ socket.on("room_integration_stopped", (payload) => dispatch(signalEvents.roomIntegrationStopped(payload)));
1607
+ socket.on("room_integration_props_updated", (payload) => dispatch(signalEvents.roomIntegrationPropsUpdated(payload)));
1608
+ socket.on("room_integration_enabled", (payload) => dispatch(signalEvents.roomIntegrationEnabled(payload)));
1609
+ socket.on("room_integration_disabled", (payload) => dispatch(signalEvents.roomIntegrationDisabled(payload)));
1514
1610
  socket.on("breakout_move_to_group", () => dispatch(signalEvents.breakoutMoveToGroup()));
1515
1611
  socket.on("breakout_move_to_main", () => dispatch(signalEvents.breakoutMoveToMain()));
1516
1612
  socket.on("breakout_ending", () => dispatch(signalEvents.breakoutEnding()));
@@ -2214,7 +2310,7 @@ const selectLocalParticipantDisplayName = (state) => state.localParticipant.disp
2214
2310
  const selectLocalParticipantClientClaim = (state) => state.localParticipant.clientClaim;
2215
2311
  const selectLocalParticipantStickyReaction = (state) => state.localParticipant.stickyReaction;
2216
2312
  const selectLocalParticipantBreakoutGroup = (state) => state.localParticipant.breakoutGroup;
2217
- const selectLocalParticipantView = createSelector(selectLocalParticipantRaw, selectLocalMediaStream, (participant, localStream) => {
2313
+ const selectLocalParticipantView = createSelector(selectLocalParticipantRaw, selectLocalMediaStream, (state) => state.rtcConnection.isAudioOnlyModeEnabled, (participant, localStream, isAudioOnlyModeEnabled) => {
2218
2314
  const clientView = {
2219
2315
  id: participant.id,
2220
2316
  clientId: participant.id,
@@ -2224,6 +2320,7 @@ const selectLocalParticipantView = createSelector(selectLocalParticipantRaw, sel
2224
2320
  isLocalClient: true,
2225
2321
  isAudioEnabled: participant.isAudioEnabled,
2226
2322
  isVideoEnabled: participant.isVideoEnabled,
2323
+ isAudioOnlyModeEnabled,
2227
2324
  };
2228
2325
  if (NON_PERSON_ROLES.includes(participant.roleName)) {
2229
2326
  return null;
@@ -3222,6 +3319,13 @@ const selectScreenshares = createSelector(selectLocalScreenshareStream, selectLo
3222
3319
  }
3223
3320
  return screenshares;
3224
3321
  });
3322
+ const selectRemoteScreenshareVideoTrackIds = createSelector(selectScreenshares, (screenshares) => screenshares
3323
+ .filter((screenshare) => !screenshare.isLocal)
3324
+ .flatMap((screenshare) => { var _a, _b; return (_b = (_a = screenshare.stream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().map((track) => track.id)) !== null && _b !== void 0 ? _b : []; }), {
3325
+ memoizeOptions: {
3326
+ resultEqualityCheck: (a, b) => a.length === b.length && a.every((trackId, index) => trackId === b[index]),
3327
+ },
3328
+ });
3225
3329
  const selectRemoteClientViews = createSelector(selectLocalScreenshareStream, selectLocalParticipantRaw, selectRemoteParticipants, selectBreakoutCurrentId, selectBreakoutAssignments, (localScreenshareStream, localParticipant, remoteParticipants, breakoutCurrentId, breakoutAssignments) => {
3226
3330
  const views = [];
3227
3331
  if (localScreenshareStream) {
@@ -3433,11 +3537,16 @@ const rtcConnectionSliceInitialState = {
3433
3537
  rtcManagerInitialized: false,
3434
3538
  status: "inactive",
3435
3539
  isAcceptingStreams: false,
3540
+ isAudioOnlyModeEnabled: false,
3436
3541
  };
3437
3542
  const rtcConnectionSlice = createSlice({
3438
3543
  name: "rtcConnection",
3439
3544
  initialState: rtcConnectionSliceInitialState,
3440
3545
  reducers: {
3546
+ audioOnlyModeToggled: (state, action) => {
3547
+ var _a;
3548
+ return Object.assign(Object.assign({}, state), { isAudioOnlyModeEnabled: (_a = action.payload.enabled) !== null && _a !== void 0 ? _a : !state.isAudioOnlyModeEnabled });
3549
+ },
3441
3550
  isAcceptingStreams: (state, action) => {
3442
3551
  return Object.assign(Object.assign({}, state), { isAcceptingStreams: action.payload });
3443
3552
  },
@@ -3455,7 +3564,7 @@ const rtcConnectionSlice = createSlice({
3455
3564
  return Object.assign(Object.assign({}, state), { rtcManager: action.payload, status: "ready" });
3456
3565
  },
3457
3566
  rtcManagerDestroyed: (state) => {
3458
- return Object.assign(Object.assign({}, state), { rtcManager: null });
3567
+ return Object.assign(Object.assign({}, state), { rtcManager: null, rtcManagerInitialized: false });
3459
3568
  },
3460
3569
  rtcManagerInitialized: (state) => {
3461
3570
  return Object.assign(Object.assign({}, state), { rtcManagerInitialized: true });
@@ -3486,7 +3595,7 @@ const rtcConnectionSlice = createSlice({
3486
3595
  });
3487
3596
  },
3488
3597
  });
3489
- const { resolutionReported, rtcDispatcherCreated, rtcDisconnected, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, isAcceptingStreams, rtcClientConnectionStatusChanged, } = rtcConnectionSlice.actions;
3598
+ const { audioOnlyModeToggled, resolutionReported, rtcDispatcherCreated, rtcDisconnected, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, isAcceptingStreams, rtcClientConnectionStatusChanged, } = rtcConnectionSlice.actions;
3490
3599
  const doConnectRtc = createAppThunk(() => (dispatch, getState) => {
3491
3600
  const state = getState();
3492
3601
  const socket = selectSignalConnectionRaw(state).socket;
@@ -3584,8 +3693,19 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
3584
3693
  videoPaused: !isCameraEnabled,
3585
3694
  });
3586
3695
  }
3696
+ const screenshareStream = selectLocalScreenshareStream(getState());
3697
+ if (screenshareStream && rtcManager) {
3698
+ rtcManager.addScreenshareStream(screenshareStream);
3699
+ }
3587
3700
  dispatch(rtcManagerInitialized());
3588
3701
  });
3702
+ const doToggleAudioOnlyMode = createAppThunk(({ enabled, autoDisableLocalCamera }) => (dispatch, getState) => {
3703
+ dispatch(audioOnlyModeToggled({ enabled }));
3704
+ const state = getState();
3705
+ if (autoDisableLocalCamera && selectIsAudioOnlyModeEnabled(state) && selectIsCameraEnabled(state)) {
3706
+ dispatch(toggleCameraEnabled({ enabled: false }));
3707
+ }
3708
+ });
3589
3709
  const selectRtcConnectionRaw = (state) => state.rtcConnection;
3590
3710
  const selectRtcManagerInitialized = (state) => state.rtcConnection.rtcManagerInitialized;
3591
3711
  const selectRtcManager = (state) => state.rtcConnection.rtcManager;
@@ -3593,6 +3713,7 @@ const selectRtcDispatcherCreated = (state) => state.rtcConnection.dispatcherCrea
3593
3713
  const selectRtcIsCreatingDispatcher = (state) => state.rtcConnection.isCreatingDispatcher;
3594
3714
  const selectRtcStatus = (state) => state.rtcConnection.status;
3595
3715
  const selectIsAcceptingStreams = (state) => state.rtcConnection.isAcceptingStreams;
3716
+ const selectIsAudioOnlyModeEnabled = (state) => state.rtcConnection.isAudioOnlyModeEnabled;
3596
3717
  startAppListening({
3597
3718
  actionCreator: doSetDevice.fulfilled,
3598
3719
  effect: ({ payload }, { getState }) => {
@@ -3648,6 +3769,22 @@ startAppListening({
3648
3769
  }
3649
3770
  },
3650
3771
  });
3772
+ startAppListening({
3773
+ actionCreator: audioOnlyModeToggled,
3774
+ effect: (_, { getState }) => {
3775
+ const state = getState();
3776
+ const rtcManager = selectRtcManager(state);
3777
+ rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.setAudioOnly(selectIsAudioOnlyModeEnabled(state));
3778
+ },
3779
+ });
3780
+ startAppListening({
3781
+ actionCreator: rtcManagerCreated,
3782
+ effect: ({ payload: rtcManager }, { getState }) => {
3783
+ if (selectIsAudioOnlyModeEnabled(getState())) {
3784
+ rtcManager.setAudioOnly(true);
3785
+ }
3786
+ },
3787
+ });
3651
3788
  startAppListening({
3652
3789
  actionCreator: rtcEvents.clientConnectionStatusChanged,
3653
3790
  effect: (_, { dispatch, getState }) => {
@@ -3709,6 +3846,9 @@ createReactor([selectShouldDisconnectRtc], ({ dispatch }, shouldDisconnectRtc) =
3709
3846
  dispatch(doDisconnectRtc());
3710
3847
  }
3711
3848
  });
3849
+ createReactor([selectRtcManager, selectRemoteScreenshareVideoTrackIds], (_, rtcManager, remoteScreenshareVideoTrackIds) => {
3850
+ rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds);
3851
+ });
3712
3852
  const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClients, selectBreakoutCurrentId, selectSpotlights, selectAppIgnoreBreakoutGroups, (rtcStatus, remoteParticipants, breakoutCurrentId, spotlights, ignoreBreakoutGroups) => {
3713
3853
  if (rtcStatus !== "ready") {
3714
3854
  return [];
@@ -3781,6 +3921,7 @@ const doStartConnectionMonitor = createAppThunk(() => (dispatch, getState) => {
3781
3921
  return ({
3782
3922
  id: clientView.id,
3783
3923
  clientId: clientView.clientId,
3924
+ isAudioOnlyModeEnabled: clientView.isAudioOnlyModeEnabled,
3784
3925
  isLocalClient: clientView.isLocalClient,
3785
3926
  audio: {
3786
3927
  enabled: clientView.isAudioEnabled,
@@ -4553,6 +4694,378 @@ startAppListening({
4553
4694
  },
4554
4695
  });
4555
4696
 
4697
+ function isCustomElementName(value) {
4698
+ return typeof value === "string" && value === value.toLowerCase() && value.includes("-");
4699
+ }
4700
+ function isHttpsUrl(value) {
4701
+ if (typeof value !== "string") {
4702
+ return false;
4703
+ }
4704
+ try {
4705
+ return new URL(value).protocol === "https:";
4706
+ }
4707
+ catch (_a) {
4708
+ return false;
4709
+ }
4710
+ }
4711
+ function isValidProps(value) {
4712
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
4713
+ return false;
4714
+ }
4715
+ return Object.values(value).every((entry) => entry === null || ["string", "number", "boolean"].includes(typeof entry));
4716
+ }
4717
+ function parseMatcher(matcher) {
4718
+ if (typeof matcher !== "string") {
4719
+ return null;
4720
+ }
4721
+ const parts = matcher.match(/^\/([\s\S]*)\/([a-z]*)$/);
4722
+ if (!parts) {
4723
+ return null;
4724
+ }
4725
+ const flags = (parts[2] || "").replace(/[gy]/g, "");
4726
+ try {
4727
+ return new RegExp(parts[1], flags);
4728
+ }
4729
+ catch (_a) {
4730
+ return null;
4731
+ }
4732
+ }
4733
+ function parseRoomIntegration(response) {
4734
+ const { roomIntegrationId, name, title, description, type, icons, link, entrypoint, webview, isEmbeddable } = response || {};
4735
+ const matcher = parseMatcher(response === null || response === void 0 ? void 0 : response.matcher);
4736
+ if (roomIntegrationId === undefined ||
4737
+ roomIntegrationId === null ||
4738
+ !name ||
4739
+ !title ||
4740
+ !type ||
4741
+ !(icons === null || icons === void 0 ? void 0 : icons.small) ||
4742
+ !(icons === null || icons === void 0 ? void 0 : icons.large) ||
4743
+ !entrypoint ||
4744
+ !webview ||
4745
+ !matcher) {
4746
+ console.warn(`Ignoring malformed room integration: ${name || roomIntegrationId}`);
4747
+ return null;
4748
+ }
4749
+ return {
4750
+ roomIntegrationId: String(roomIntegrationId),
4751
+ name,
4752
+ title,
4753
+ description: description || "",
4754
+ type,
4755
+ contentTagName: roomIntegrationContentTagName(name),
4756
+ icons: { small: icons.small, large: icons.large },
4757
+ link: { href: (link === null || link === void 0 ? void 0 : link.href) || "", text: (link === null || link === void 0 ? void 0 : link.text) || "" },
4758
+ entrypoint,
4759
+ webview,
4760
+ matcher,
4761
+ isEmbeddable: isEmbeddable !== null && isEmbeddable !== void 0 ? isEmbeddable : false,
4762
+ };
4763
+ }
4764
+ function parseRoomIntegrationSession(event) {
4765
+ const { roomIntegrationId, roomIntegrationSessionId, breakoutGroupId, tagName, shareUrl, props, clientId, roomIntegrationSessionStartedAt, } = event || {};
4766
+ if (typeof roomIntegrationSessionId !== "string" ||
4767
+ roomIntegrationId === undefined ||
4768
+ roomIntegrationId === null ||
4769
+ typeof clientId !== "string" ||
4770
+ !isCustomElementName(tagName) ||
4771
+ !isHttpsUrl(shareUrl) ||
4772
+ !isValidProps(props)) {
4773
+ console.warn(`Ignoring malformed room integration session: ${roomIntegrationSessionId}`);
4774
+ return null;
4775
+ }
4776
+ return {
4777
+ roomIntegrationSessionId,
4778
+ roomIntegrationId: String(roomIntegrationId),
4779
+ breakoutGroupId: breakoutGroupId || "",
4780
+ tagName,
4781
+ shareUrl,
4782
+ props,
4783
+ clientId,
4784
+ roomIntegrationSessionStartedAt: typeof roomIntegrationSessionStartedAt === "number" && isFinite(roomIntegrationSessionStartedAt)
4785
+ ? roomIntegrationSessionStartedAt
4786
+ : null,
4787
+ };
4788
+ }
4789
+ const SIGNAL_ERROR_MESSAGES = {
4790
+ not_in_a_room: (action) => `Cannot ${action} a room integration: not in a room. The signal connection has a room session, but the server does not consider this client a participant of it.`,
4791
+ forbidden: (action) => `Not allowed to ${action} this room integration (forbidden)`,
4792
+ missing_parameters: (action) => `Could not ${action} the room integration: the request was missing parameters`,
4793
+ invalid_parameters: (action) => `Could not ${action} the room integration: the request had invalid parameters`,
4794
+ internal_server_error: (action) => `The server failed to ${action} the room integration`,
4795
+ };
4796
+ function roomIntegrationSignalError(error, action) {
4797
+ if (!isRoomIntegrationErrorCode(error)) {
4798
+ return { code: "unknown", message: `Could not ${action} the room integration: ${error}` };
4799
+ }
4800
+ return { code: error, message: SIGNAL_ERROR_MESSAGES[error](action) };
4801
+ }
4802
+ const roomIntegrationsSliceInitialState = {
4803
+ available: [],
4804
+ unavailable: [],
4805
+ enabled: [],
4806
+ running: [],
4807
+ isFetching: false,
4808
+ hasFetched: false,
4809
+ error: null,
4810
+ };
4811
+ const roomIntegrationsSlice = createSlice({
4812
+ name: "roomIntegrations",
4813
+ initialState: roomIntegrationsSliceInitialState,
4814
+ reducers: {
4815
+ setRoomIntegrationsError: (state, action) => {
4816
+ state.error = action.payload.error;
4817
+ },
4818
+ },
4819
+ extraReducers: (builder) => {
4820
+ builder.addCase(doFetchRoomIntegrations.pending, (state) => {
4821
+ state.isFetching = true;
4822
+ });
4823
+ builder.addCase(doFetchRoomIntegrations.fulfilled, (state, action) => {
4824
+ const { enabledRoomIntegrations, disabledRoomIntegrations, unavailableRoomIntegrations } = action.payload;
4825
+ const parse = (entries) => entries.map(parseRoomIntegration).filter((entry) => entry !== null);
4826
+ state.isFetching = false;
4827
+ state.hasFetched = true;
4828
+ state.error = null;
4829
+ state.available = [...parse(enabledRoomIntegrations), ...parse(disabledRoomIntegrations)];
4830
+ state.unavailable = parse(unavailableRoomIntegrations);
4831
+ state.enabled = enabledRoomIntegrations.map(({ roomIntegrationId }) => String(roomIntegrationId));
4832
+ });
4833
+ builder.addCase(doFetchRoomIntegrations.rejected, (state, action) => {
4834
+ state.isFetching = false;
4835
+ state.hasFetched = true;
4836
+ state.error = {
4837
+ code: "unknown",
4838
+ message: action.error.message || "Failed to fetch room integrations",
4839
+ };
4840
+ });
4841
+ builder.addCase(signalEvents.roomJoined, (state, action) => {
4842
+ if ("error" in action.payload) {
4843
+ return;
4844
+ }
4845
+ state.running = (action.payload.roomIntegrationSession || [])
4846
+ .map(parseRoomIntegrationSession)
4847
+ .filter((session) => session !== null);
4848
+ });
4849
+ builder.addCase(signalEvents.roomIntegrationStarted, (state, action) => {
4850
+ if ("error" in action.payload) {
4851
+ state.error = roomIntegrationSignalError(action.payload.error, "start");
4852
+ return;
4853
+ }
4854
+ const { roomIntegrationId, roomIntegrationSessionId, breakoutGroupId, roomIntegrationSessionStartedAt } = action.payload;
4855
+ const session = parseRoomIntegrationSession(Object.assign(Object.assign({}, action.payload.state), { roomIntegrationId,
4856
+ roomIntegrationSessionId,
4857
+ breakoutGroupId,
4858
+ roomIntegrationSessionStartedAt }));
4859
+ if (!session) {
4860
+ return;
4861
+ }
4862
+ const existing = state.running.findIndex((running) => running.roomIntegrationSessionId === session.roomIntegrationSessionId);
4863
+ if (existing >= 0) {
4864
+ state.running[existing] = session;
4865
+ return;
4866
+ }
4867
+ state.running.push(session);
4868
+ });
4869
+ builder.addCase(signalEvents.roomIntegrationStopped, (state, action) => {
4870
+ if ("error" in action.payload) {
4871
+ state.error = roomIntegrationSignalError(action.payload.error, "stop");
4872
+ return;
4873
+ }
4874
+ const { roomIntegrationSessionId } = action.payload;
4875
+ state.running = state.running.filter((running) => running.roomIntegrationSessionId !== roomIntegrationSessionId);
4876
+ });
4877
+ builder.addCase(signalEvents.roomIntegrationPropsUpdated, (state, action) => {
4878
+ if ("error" in action.payload) {
4879
+ state.error = roomIntegrationSignalError(action.payload.error, "update the props of");
4880
+ return;
4881
+ }
4882
+ const { roomIntegrationSessionId, props } = action.payload;
4883
+ const session = state.running.find((running) => running.roomIntegrationSessionId === roomIntegrationSessionId);
4884
+ if (!session || !isValidProps(props)) {
4885
+ return;
4886
+ }
4887
+ session.props = Object.assign(Object.assign({}, session.props), props);
4888
+ });
4889
+ builder.addCase(signalEvents.roomIntegrationEnabled, (state, action) => {
4890
+ const roomIntegrationId = String(action.payload.roomIntegrationId);
4891
+ if (!state.enabled.includes(roomIntegrationId)) {
4892
+ state.enabled.push(roomIntegrationId);
4893
+ }
4894
+ });
4895
+ builder.addCase(signalEvents.roomIntegrationDisabled, (state, action) => {
4896
+ const roomIntegrationId = String(action.payload.roomIntegrationId);
4897
+ state.enabled = state.enabled.filter((id) => id !== roomIntegrationId);
4898
+ });
4899
+ },
4900
+ });
4901
+ const { setRoomIntegrationsError } = roomIntegrationsSlice.actions;
4902
+ const doFetchRoomIntegrations = createAppAsyncThunk("roomIntegrations/doFetchRoomIntegrations", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { extra, getState }) {
4903
+ const state = getState();
4904
+ const organizationId = selectOrganizationId(state);
4905
+ const roomName = selectAppRoomName(state);
4906
+ if (!organizationId || !roomName) {
4907
+ throw new Error("Cannot fetch room integrations before the organization and room are known");
4908
+ }
4909
+ return extra.services.roomIntegrationService.findRoomIntegrations({ organizationId, roomName });
4910
+ }));
4911
+ const doStartRoomIntegration = createRoomConnectedThunk((payload) => (dispatch, getState) => {
4912
+ var _a;
4913
+ const state = getState();
4914
+ const { roomIntegrationId, tagName, shareUrl, props = {} } = payload;
4915
+ const integration = selectRoomIntegrationsRaw(state).available.find((entry) => entry.roomIntegrationId === roomIntegrationId);
4916
+ if (!integration) {
4917
+ dispatch(setRoomIntegrationsError({
4918
+ error: {
4919
+ code: "unknown_integration",
4920
+ message: `Unknown room integration: ${roomIntegrationId}`,
4921
+ },
4922
+ }));
4923
+ return;
4924
+ }
4925
+ if (!selectRoomIntegrationsEnabled(state).includes(roomIntegrationId)) {
4926
+ dispatch(setRoomIntegrationsError({
4927
+ error: {
4928
+ code: "integration_not_enabled",
4929
+ message: `Room integration is not enabled for this room: ${integration.name}`,
4930
+ },
4931
+ }));
4932
+ return;
4933
+ }
4934
+ if (!isCustomElementName(tagName)) {
4935
+ dispatch(setRoomIntegrationsError({
4936
+ error: {
4937
+ code: "invalid_content",
4938
+ message: `tagName must be a valid custom element name, got: ${tagName}`,
4939
+ },
4940
+ }));
4941
+ return;
4942
+ }
4943
+ if (!isHttpsUrl(shareUrl)) {
4944
+ dispatch(setRoomIntegrationsError({
4945
+ error: {
4946
+ code: "invalid_content",
4947
+ message: `shareUrl must be an https url, got: ${shareUrl}`,
4948
+ },
4949
+ }));
4950
+ return;
4951
+ }
4952
+ if (!isValidProps(props)) {
4953
+ dispatch(setRoomIntegrationsError({
4954
+ error: {
4955
+ code: "invalid_content",
4956
+ message: "props must be a flat object of primitive values",
4957
+ },
4958
+ }));
4959
+ return;
4960
+ }
4961
+ const clientId = selectSelfId(state);
4962
+ if (!clientId) {
4963
+ return;
4964
+ }
4965
+ dispatch(setRoomIntegrationsError({ error: null }));
4966
+ const request = {
4967
+ roomIntegrationId: Number(roomIntegrationId),
4968
+ breakoutGroupId: selectBreakoutCurrentId(state) || null,
4969
+ state: { tagName, shareUrl, props, clientId },
4970
+ };
4971
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("start_room_integration", request);
4972
+ });
4973
+ const ROOM_INTEGRATION_PICKER_MESSAGES = {
4974
+ FORM_SUBMIT: "whereby:formSubmit",
4975
+ FORM_CLOSE: "whereby:formClose",
4976
+ ERROR: "whereby:bootstrapError",
4977
+ };
4978
+ function roomIntegrationPickerUrl({ integration, parentOrigin, featureSource, }) {
4979
+ const url = new URL("bootstrap.html", integration.webview);
4980
+ url.searchParams.set("parentOrigin", parentOrigin);
4981
+ if (featureSource) {
4982
+ url.searchParams.set("featuresource", featureSource);
4983
+ }
4984
+ return url.href;
4985
+ }
4986
+ const doStopRoomIntegration = createRoomConnectedThunk((payload) => (dispatch, getState) => {
4987
+ var _a;
4988
+ const state = getState();
4989
+ const { roomIntegrationSessionId, intent = "stop" } = payload;
4990
+ const session = selectRunningRoomIntegrations(state).find((running) => running.roomIntegrationSessionId === roomIntegrationSessionId);
4991
+ if (!session) {
4992
+ dispatch(setRoomIntegrationsError({
4993
+ error: {
4994
+ code: "unknown_integration",
4995
+ message: `No running room integration with session id: ${roomIntegrationSessionId}`,
4996
+ },
4997
+ }));
4998
+ return;
4999
+ }
5000
+ if (!session.canStop) {
5001
+ dispatch(setRoomIntegrationsError({
5002
+ error: {
5003
+ code: "not_allowed_to_stop",
5004
+ message: "Only the participant who started a room integration, or a host, can stop it",
5005
+ },
5006
+ }));
5007
+ return;
5008
+ }
5009
+ dispatch(setRoomIntegrationsError({ error: null }));
5010
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("stop_room_integration", { roomIntegrationSessionId, intent });
5011
+ });
5012
+ const doUpdateRoomIntegrationProps = createRoomConnectedThunk((payload) => (dispatch, getState) => {
5013
+ var _a;
5014
+ const state = getState();
5015
+ const { roomIntegrationSessionId, props } = payload;
5016
+ if (!isValidProps(props)) {
5017
+ dispatch(setRoomIntegrationsError({
5018
+ error: {
5019
+ code: "invalid_content",
5020
+ message: "props must be a flat object of primitive values",
5021
+ },
5022
+ }));
5023
+ return;
5024
+ }
5025
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("update_room_integration_props", {
5026
+ roomIntegrationSessionId,
5027
+ props,
5028
+ });
5029
+ });
5030
+ const selectRoomIntegrationsRaw = (state) => state.roomIntegrations;
5031
+ const selectRoomIntegrationsEnabled = (state) => state.roomIntegrations.enabled;
5032
+ const selectAvailableRoomIntegrations = (state) => state.roomIntegrations.available;
5033
+ const selectEnabledRoomIntegrations = createSelector(selectAvailableRoomIntegrations, selectRoomIntegrationsEnabled, (available, enabled) => available.filter((integration) => enabled.includes(integration.roomIntegrationId)));
5034
+ const selectEmbeddableRoomIntegrations = createSelector(selectEnabledRoomIntegrations, (enabled) => enabled.filter((integration) => integration.isEmbeddable));
5035
+ const selectRunningRoomIntegrations = createSelector(selectRoomIntegrationsRaw, selectEnabledRoomIntegrations, selectBreakoutActive, selectBreakoutCurrentId, selectSelfId, selectRemoteParticipants, selectIsAuthorizedToManageRoomIntegration, (raw, enabledIntegrations, breakoutActive, breakoutCurrentId, selfId, remoteParticipants, canManageRoomIntegration) => {
5036
+ const currentGroupId = breakoutActive ? breakoutCurrentId : "";
5037
+ return raw.running.reduce((acc, session) => {
5038
+ var _a;
5039
+ if (session.breakoutGroupId !== currentGroupId) {
5040
+ return acc;
5041
+ }
5042
+ const integration = enabledIntegrations.find((entry) => entry.roomIntegrationId === session.roomIntegrationId);
5043
+ if (!integration) {
5044
+ return acc;
5045
+ }
5046
+ const isPresenter = !!selfId && session.clientId === selfId;
5047
+ acc.push(Object.assign(Object.assign({}, session), { integration,
5048
+ isPresenter, canStop: isPresenter || canManageRoomIntegration, presenterDisplayName: isPresenter
5049
+ ? null
5050
+ : ((_a = remoteParticipants.find((participant) => participant.id === session.clientId)) === null || _a === void 0 ? void 0 : _a.displayName) ||
5051
+ null }));
5052
+ return acc;
5053
+ }, []);
5054
+ });
5055
+ createSelector(selectRunningRoomIntegrations, (running) => running.length > 0);
5056
+ createSelector(selectEmbeddableRoomIntegrations, (integrations) => (url) => integrations.find((integration) => integration.matcher.test(url)) || null);
5057
+ const selectShouldFetchRoomIntegrations = createSelector(selectAppIsActive, selectRoomConnectionStatus, selectOrganizationId, selectAppRoomName, selectRoomIntegrationsRaw, (appIsActive, connectionStatus, organizationId, roomName, raw) => appIsActive &&
5058
+ connectionStatus === "connected" &&
5059
+ !!organizationId &&
5060
+ !!roomName &&
5061
+ !raw.hasFetched &&
5062
+ !raw.isFetching);
5063
+ createReactor([selectShouldFetchRoomIntegrations], ({ dispatch }, shouldFetchRoomIntegrations) => {
5064
+ if (shouldFetchRoomIntegrations) {
5065
+ dispatch(doFetchRoomIntegrations());
5066
+ }
5067
+ });
5068
+
4556
5069
  function createRtcAnalyticsCustomEvent(parameters) {
4557
5070
  return parameters;
4558
5071
  }
@@ -5164,6 +5677,7 @@ const appReducer = combineReducers({
5164
5677
  remoteParticipants: remoteParticipantsSlice.reducer,
5165
5678
  room: roomSlice.reducer,
5166
5679
  roomConnection: roomConnectionSlice.reducer,
5680
+ roomIntegrations: roomIntegrationsSlice.reducer,
5167
5681
  rtcAnalytics: rtcAnalyticsSlice.reducer,
5168
5682
  rtcConnection: rtcConnectionSlice.reducer,
5169
5683
  signalConnection: signalConnectionSlice.reducer,
@@ -5201,12 +5715,14 @@ const createStore = ({ preloadedState, injectServices, }) => {
5201
5715
  const CLIENT_VIEW_CHANGED = "grid:client-view-changed";
5202
5716
  const CLIENT_VIEW_SPOTLIGHTS_CHANGED = "grid:client-view-spotlights-changed";
5203
5717
  const NUMBER_OF_CLIENT_VIEWS_CHANGED = "grid:number-of-client-views-changed";
5718
+ const RUNNING_ROOM_INTEGRATIONS_CHANGED = "grid:running-room-integrations-changed";
5204
5719
 
5205
- const selectGridState = createSelector(selectAllClientViews, selectSpotlightedClientViews, selectNumClients, (allClientViews, spotlightedParticipants, numClients) => {
5720
+ const selectGridState = createSelector(selectAllClientViews, selectSpotlightedClientViews, selectNumClients, selectRunningRoomIntegrations, (allClientViews, spotlightedParticipants, numClients, runningRoomIntegrations) => {
5206
5721
  return {
5207
5722
  allClientViews,
5208
5723
  spotlightedParticipants,
5209
5724
  numParticipants: numClients,
5725
+ runningRoomIntegrations,
5210
5726
  };
5211
5727
  });
5212
5728
 
@@ -5245,6 +5761,7 @@ class GridClient extends BaseClient {
5245
5761
  this.clientViewSubscribers = new Set();
5246
5762
  this.spotlightedSubscribers = new Set();
5247
5763
  this.numberOfClientViewsSubscribers = new Set();
5764
+ this.runningRoomIntegrationsSubscribers = new Set();
5248
5765
  }
5249
5766
  handleStateChanges(state, previousState) {
5250
5767
  if (state.allClientViews !== previousState.allClientViews) {
@@ -5259,6 +5776,10 @@ class GridClient extends BaseClient {
5259
5776
  this.numberOfClientViewsSubscribers.forEach((cb) => cb(state.numParticipants));
5260
5777
  this.emit(NUMBER_OF_CLIENT_VIEWS_CHANGED, state.numParticipants);
5261
5778
  }
5779
+ if (state.runningRoomIntegrations !== previousState.runningRoomIntegrations) {
5780
+ this.runningRoomIntegrationsSubscribers.forEach((cb) => cb(state.runningRoomIntegrations));
5781
+ this.emit(RUNNING_ROOM_INTEGRATIONS_CHANGED, state.runningRoomIntegrations);
5782
+ }
5262
5783
  }
5263
5784
  getState() {
5264
5785
  return selectGridState(this.store.getState());
@@ -5275,6 +5796,10 @@ class GridClient extends BaseClient {
5275
5796
  this.numberOfClientViewsSubscribers.add(callback);
5276
5797
  return () => this.numberOfClientViewsSubscribers.delete(callback);
5277
5798
  }
5799
+ subscribeRunningRoomIntegrations(callback) {
5800
+ this.runningRoomIntegrationsSubscribers.add(callback);
5801
+ return () => this.runningRoomIntegrationsSubscribers.delete(callback);
5802
+ }
5278
5803
  spotlightParticipant(id) {
5279
5804
  this.store.dispatch(doSpotlightParticipant({ id }));
5280
5805
  }
@@ -5286,6 +5811,7 @@ class GridClient extends BaseClient {
5286
5811
  this.clientViewSubscribers.clear();
5287
5812
  this.spotlightedSubscribers.clear();
5288
5813
  this.numberOfClientViewsSubscribers.clear();
5814
+ this.runningRoomIntegrationsSubscribers.clear();
5289
5815
  this.removeAllListeners();
5290
5816
  }
5291
5817
  }
@@ -5532,6 +6058,7 @@ const CONNECTION_STATUS_CHANGED = "connection:status-changed";
5532
6058
  const LIVE_CAPTIONS_STATUS_CHANGED = "live-captions:status-changed";
5533
6059
  const LIVE_TRANSCRIPTION_STATUS_CHANGED = "live-transcription:status-changed";
5534
6060
  const CONNECTION_ERROR_CHANGED = "connection:error-changed";
6061
+ const AUDIO_ONLY_MODE_CHANGED = "audio-only-mode:changed";
5535
6062
  const LOCAL_PARTICIPANT_CHANGED = "local-participant:changed";
5536
6063
  const LOCAL_SCREENSHARE_STATUS_CHANGED = "local-screenshare:status-changed";
5537
6064
  const LOCAL_SCREENSHARE_CHANGED = "local-screenshare:state-changed";
@@ -5549,7 +6076,7 @@ const SPOTLIGHT_PARTICIPANT_REMOVED = "spotlight:participant-removed";
5549
6076
  const ROOM_JOINED = "room:joined";
5550
6077
  const ROOM_JOINED_ERROR = "room:joined:error";
5551
6078
 
5552
- const selectRoomConnectionState = createSelector(selectChatMessages, selectFileUploads, selectCloudRecordingRaw, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutActive, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutAssignments, selectBreakoutEnforceAssignment, selectBreakoutTimerSetting, selectBreakoutTimerDuration, selectBreakoutAutoMoveToGroup, selectBreakoutMoveToGroupGracePeriod, selectBreakoutAutoMoveToMain, selectBreakoutMoveToMainGracePeriod, selectBreakoutStartedAt, selectBreakoutEndTime, selectBreakoutMoveToGroupAt, selectBreakoutMoveToMainAt, selectBreakoutIsAvailable, selectBreakoutError, selectAllClientViewsInCurrentGroup, selectLiveCaptionsRaw, selectLiveTranscriptionRaw, selectLocalParticipantRaw, selectLocalMediaStream, selectLocalScreenshareRaw, selectRemoteParticipants, selectScreenshares, selectRoomConnectionStatus, selectRoomConnectionError, selectRoomConnectionKnockResponse, selectStreamingRaw, selectWaitingParticipants, selectNotificationsEmitter, selectSpotlightedClientViews, selectIsCameraEnabled, selectIsMicrophoneEnabled, (chatMessages, fileUploads, cloudRecording, breakoutCurrentGroup, breakoutCurrentId, breakoutActive, breakoutGroupedParticipants, breakoutGroups, breakoutAssignments, breakoutEnforceAssignment, breakoutTimerSetting, breakoutTimerDuration, breakoutAutoMoveToGroup, breakoutMoveToGroupGracePeriod, breakoutAutoMoveToMain, breakoutMoveToMainGracePeriod, breakoutStartedAt, breakoutEndTime, breakoutMoveToGroupAt, breakoutMoveToMainAt, breakoutIsAvailable, breakoutError, clientViewsInCurrentGroup, liveCaptions, liveTranscription, localParticipant, localMediaStream, localScreenshare, remoteParticipants, screenshares, connectionStatus, connectionError, knockResponse, streaming, waitingParticipants, notificationsEmitter, spotlightedClientViews, isCameraEnabled, isMicrophoneEnabled) => {
6079
+ const selectRoomConnectionState = createSelector(selectChatMessages, selectFileUploads, selectCloudRecordingRaw, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutActive, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutAssignments, selectBreakoutEnforceAssignment, selectBreakoutTimerSetting, selectBreakoutTimerDuration, selectBreakoutAutoMoveToGroup, selectBreakoutMoveToGroupGracePeriod, selectBreakoutAutoMoveToMain, selectBreakoutMoveToMainGracePeriod, selectBreakoutStartedAt, selectBreakoutEndTime, selectBreakoutMoveToGroupAt, selectBreakoutMoveToMainAt, selectBreakoutIsAvailable, selectBreakoutError, selectAllClientViewsInCurrentGroup, selectLiveCaptionsRaw, selectLiveTranscriptionRaw, selectLocalParticipantRaw, selectLocalMediaStream, selectLocalScreenshareRaw, selectRemoteParticipants, selectScreenshares, selectRoomConnectionStatus, selectRoomConnectionError, selectRoomConnectionKnockResponse, selectStreamingRaw, selectWaitingParticipants, selectNotificationsEmitter, selectSpotlightedClientViews, selectIsCameraEnabled, selectIsMicrophoneEnabled, selectRoomIntegrationsRaw, selectEnabledRoomIntegrations, selectEmbeddableRoomIntegrations, selectRunningRoomIntegrations, selectIsAudioOnlyModeEnabled, (chatMessages, fileUploads, cloudRecording, breakoutCurrentGroup, breakoutCurrentId, breakoutActive, breakoutGroupedParticipants, breakoutGroups, breakoutAssignments, breakoutEnforceAssignment, breakoutTimerSetting, breakoutTimerDuration, breakoutAutoMoveToGroup, breakoutMoveToGroupGracePeriod, breakoutAutoMoveToMain, breakoutMoveToMainGracePeriod, breakoutStartedAt, breakoutEndTime, breakoutMoveToGroupAt, breakoutMoveToMainAt, breakoutIsAvailable, breakoutError, clientViewsInCurrentGroup, liveCaptions, liveTranscription, localParticipant, localMediaStream, localScreenshare, remoteParticipants, screenshares, connectionStatus, connectionError, knockResponse, streaming, waitingParticipants, notificationsEmitter, spotlightedClientViews, isCameraEnabled, isMicrophoneEnabled, roomIntegrationsRaw, enabledRoomIntegrations, embeddableRoomIntegrations, runningRoomIntegrations, isAudioOnlyModeEnabled) => {
5553
6080
  const broadcastingParticipants = breakoutActive && breakoutCurrentId
5554
6081
  ? spotlightedClientViews.filter((c) => !c.breakoutGroup && c.isAudioEnabled && !c.isPresentation)
5555
6082
  : [];
@@ -5588,6 +6115,7 @@ const selectRoomConnectionState = createSelector(selectChatMessages, selectFileU
5588
6115
  connectionError,
5589
6116
  knockResponse,
5590
6117
  events: notificationsEmitter,
6118
+ isAudioOnlyModeEnabled,
5591
6119
  isCameraEnabled,
5592
6120
  isMicrophoneEnabled,
5593
6121
  liveStream: streaming.isStreaming
@@ -5627,6 +6155,14 @@ const selectRoomConnectionState = createSelector(selectChatMessages, selectFileU
5627
6155
  : undefined,
5628
6156
  localParticipant: Object.assign(Object.assign({}, localParticipant), { isScreenSharing: localScreenshare.status === "active", stream: localMediaStream }),
5629
6157
  remoteParticipants: remoteParticipants.map((participant) => (Object.assign(Object.assign({}, participant), { breakoutGroupAssigned: (breakoutAssignments === null || breakoutAssignments === void 0 ? void 0 : breakoutAssignments[participant.deviceId]) || "" }))),
6158
+ roomIntegrations: {
6159
+ hasFetched: roomIntegrationsRaw.hasFetched,
6160
+ isFetching: roomIntegrationsRaw.isFetching,
6161
+ error: roomIntegrationsRaw.error,
6162
+ embeddable: embeddableRoomIntegrations,
6163
+ enabled: enabledRoomIntegrations,
6164
+ running: runningRoomIntegrations,
6165
+ },
5630
6166
  screenshares,
5631
6167
  waitingParticipants,
5632
6168
  spotlightedParticipants: spotlightedClientViews,
@@ -5644,6 +6180,7 @@ class RoomConnectionClient extends BaseClient {
5644
6180
  this.fileUploadsSubscribers = new Set();
5645
6181
  this.cloudRecordingSubscribers = new Set();
5646
6182
  this.connectionErrorSubscribers = new Set();
6183
+ this.audioOnlyModeSubscribers = new Set();
5647
6184
  this.connectionStatusSubscribers = new Set();
5648
6185
  this.liveStreamSubscribers = new Set();
5649
6186
  this.liveCaptionsSubscribers = new Set();
@@ -5691,6 +6228,10 @@ class RoomConnectionClient extends BaseClient {
5691
6228
  this.connectionErrorSubscribers.forEach((cb) => cb(state.connectionError));
5692
6229
  this.emit(CONNECTION_ERROR_CHANGED, state.connectionError);
5693
6230
  }
6231
+ if (state.isAudioOnlyModeEnabled !== previousState.isAudioOnlyModeEnabled) {
6232
+ this.audioOnlyModeSubscribers.forEach((cb) => cb(state.isAudioOnlyModeEnabled));
6233
+ this.emit(AUDIO_ONLY_MODE_CHANGED, state.isAudioOnlyModeEnabled);
6234
+ }
5694
6235
  if (state.isCameraEnabled !== previousState.isCameraEnabled) {
5695
6236
  this.cameraStateSubscribers.forEach((cb) => cb(state.isCameraEnabled));
5696
6237
  this.emit(CAMERA_STATE_CHANGED, state.isCameraEnabled);
@@ -5813,6 +6354,10 @@ class RoomConnectionClient extends BaseClient {
5813
6354
  this.connectionErrorSubscribers.add(callback);
5814
6355
  return () => this.connectionErrorSubscribers.delete(callback);
5815
6356
  }
6357
+ subscribeToAudioOnlyMode(callback) {
6358
+ this.audioOnlyModeSubscribers.add(callback);
6359
+ return () => this.audioOnlyModeSubscribers.delete(callback);
6360
+ }
5816
6361
  subscribeToLiveStream(callback) {
5817
6362
  this.liveStreamSubscribers.add(callback);
5818
6363
  return () => this.liveStreamSubscribers.delete(callback);
@@ -5939,6 +6484,9 @@ class RoomConnectionClient extends BaseClient {
5939
6484
  toggleLowDataMode(enabled) {
5940
6485
  this.store.dispatch(toggleLowDataModeEnabled({ enabled }));
5941
6486
  }
6487
+ toggleAudioOnlyMode(enabled, options) {
6488
+ this.store.dispatch(doToggleAudioOnlyMode(Object.assign({ enabled }, options)));
6489
+ }
5942
6490
  toggleWidescreenMode(enabled) {
5943
6491
  this.store.dispatch(toggleWidescreenModeEnabled({ enabled }));
5944
6492
  }
@@ -6011,6 +6559,15 @@ class RoomConnectionClient extends BaseClient {
6011
6559
  endMeeting(stayBehind = false) {
6012
6560
  this.store.dispatch(doEndMeeting({ stayBehind }));
6013
6561
  }
6562
+ startRoomIntegration(options) {
6563
+ this.store.dispatch(doStartRoomIntegration(options));
6564
+ }
6565
+ stopRoomIntegration(options) {
6566
+ this.store.dispatch(doStopRoomIntegration(options));
6567
+ }
6568
+ updateRoomIntegrationProps(options) {
6569
+ this.store.dispatch(doUpdateRoomIntegrationProps(options));
6570
+ }
6014
6571
  joinBreakoutGroup(group) {
6015
6572
  this.store.dispatch(doBreakoutJoin({ group }));
6016
6573
  }
@@ -6122,6 +6679,7 @@ class RoomConnectionClient extends BaseClient {
6122
6679
  this.fileUploadsSubscribers.clear();
6123
6680
  this.cloudRecordingSubscribers.clear();
6124
6681
  this.connectionErrorSubscribers.clear();
6682
+ this.audioOnlyModeSubscribers.clear();
6125
6683
  this.connectionStatusSubscribers.clear();
6126
6684
  this.liveStreamSubscribers.clear();
6127
6685
  this.localParticipantSubscribers.clear();
@@ -6162,4 +6720,4 @@ class WherebyClient {
6162
6720
  }
6163
6721
  }
6164
6722
 
6165
- export { ACCEPTED_FILE_TYPES, ApiClient, BREAKOUT_CONFIG_CHANGED, BREAKOUT_GROUPS_MIN_MAX, BREAKOUT_UNAVAILABLE_ERROR, CAMERA_DEVICES_CHANGED, CAMERA_DEVICE_ERROR_CHANGED, CAMERA_ENABLED_CHANGED, CAMERA_STATE_CHANGED, CHAT_NEW_MESSAGE, CLIENT_VIEW_CHANGED, CLIENT_VIEW_SPOTLIGHTS_CHANGED, CLOUD_RECORDING_STATUS_CHANGED, CONNECTION_ERROR_CHANGED, CONNECTION_STATUS_CHANGED, CURRENT_CAMERA_CHANGED, CURRENT_MICROPHONE_CHANGED, CURRENT_SPEAKER_CHANGED, Credentials, CredentialsService, DEFAULT_BREAKOUT_TIMER_DURATION, GridClient, IS_SETTING_CAMERA_DEVICE, IS_SETTING_MICROPHONE_DEVICE, LIVE_CAPTIONS_STATUS_CHANGED, LIVE_TRANSCRIPTION_STATUS_CHANGED, LOCAL_MEDIA_STARTING, LOCAL_MEDIA_START_ERROR_CHANGED, LOCAL_PARTICIPANT_CHANGED, LOCAL_SCREENSHARE_CHANGED, LOCAL_SCREENSHARE_STATUS_CHANGED, LOCAL_STREAM_CHANGED, LiveCaption, LocalMediaClient, LocalParticipant, MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, MICROPHONE_DEVICES_CHANGED, MICROPHONE_DEVICE_ERROR_CHANGED, MICROPHONE_ENABLED_CHANGED, MICROPHONE_STATE_CHANGED, NUMBER_OF_CLIENT_VIEWS_CHANGED, Organization, OrganizationApiClient, OrganizationService, OrganizationServiceCache, REMOTE_PARTICIPANTS_CHANGED, ROOM_JOINED, ROOM_JOINED_ERROR, RoomConnectionClient, RoomService, SCREENSHARE_STARTED, SCREENSHARE_STOPPED, SPEAKER_DEVICES_CHANGED, SPOTLIGHT_PARTICIPANT_ADDED, SPOTLIGHT_PARTICIPANT_REMOVED, STREAMING_STARTED, STREAMING_STOPPED, WAITING_PARTICIPANT_JOINED, WAITING_PARTICIPANT_LEFT, WherebyClient, createBreakoutGroups, createServices, debounce, defaultBreakoutGroupName, getAudioTrack, getFakeMediaStream, getUsableCameraEffectPresets, getVideoTrack, hasValue, isAudioDenoiserSupported, parseUnverifiedRoomKeyData };
6723
+ export { ACCEPTED_FILE_TYPES, AUDIO_ONLY_MODE_CHANGED, ApiClient, BREAKOUT_CONFIG_CHANGED, BREAKOUT_GROUPS_MIN_MAX, BREAKOUT_UNAVAILABLE_ERROR, CAMERA_DEVICES_CHANGED, CAMERA_DEVICE_ERROR_CHANGED, CAMERA_ENABLED_CHANGED, CAMERA_STATE_CHANGED, CHAT_NEW_MESSAGE, CLIENT_VIEW_CHANGED, CLIENT_VIEW_SPOTLIGHTS_CHANGED, CLOUD_RECORDING_STATUS_CHANGED, CONNECTION_ERROR_CHANGED, CONNECTION_STATUS_CHANGED, CURRENT_CAMERA_CHANGED, CURRENT_MICROPHONE_CHANGED, CURRENT_SPEAKER_CHANGED, Credentials, CredentialsService, DEFAULT_BREAKOUT_TIMER_DURATION, GridClient, IS_SETTING_CAMERA_DEVICE, IS_SETTING_MICROPHONE_DEVICE, LIVE_CAPTIONS_STATUS_CHANGED, LIVE_TRANSCRIPTION_STATUS_CHANGED, LOCAL_MEDIA_STARTING, LOCAL_MEDIA_START_ERROR_CHANGED, LOCAL_PARTICIPANT_CHANGED, LOCAL_SCREENSHARE_CHANGED, LOCAL_SCREENSHARE_STATUS_CHANGED, LOCAL_STREAM_CHANGED, LiveCaption, LocalMediaClient, LocalParticipant, MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, MICROPHONE_DEVICES_CHANGED, MICROPHONE_DEVICE_ERROR_CHANGED, MICROPHONE_ENABLED_CHANGED, MICROPHONE_STATE_CHANGED, NUMBER_OF_CLIENT_VIEWS_CHANGED, Organization, OrganizationApiClient, OrganizationService, OrganizationServiceCache, REMOTE_PARTICIPANTS_CHANGED, ROOM_INTEGRATION_PICKER_MESSAGES, ROOM_JOINED, ROOM_JOINED_ERROR, RUNNING_ROOM_INTEGRATIONS_CHANGED, RoomConnectionClient, RoomIntegrationService, RoomService, SCREENSHARE_STARTED, SCREENSHARE_STOPPED, SPEAKER_DEVICES_CHANGED, SPOTLIGHT_PARTICIPANT_ADDED, SPOTLIGHT_PARTICIPANT_REMOVED, STREAMING_STARTED, STREAMING_STOPPED, WAITING_PARTICIPANT_JOINED, WAITING_PARTICIPANT_LEFT, WherebyClient, createBreakoutGroups, createServices, debounce, defaultBreakoutGroupName, getAudioTrack, getFakeMediaStream, getUsableCameraEffectPresets, getVideoTrack, hasValue, isAudioDenoiserSupported, miro, parseUnverifiedRoomKeyData, roomIntegrationContent, roomIntegrationContentTagName, roomIntegrationPickerUrl, youtube };