@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.
package/dist/index.cjs CHANGED
@@ -972,15 +972,6 @@ class RoomService {
972
972
  }
973
973
  }
974
974
 
975
- class LiveCaption {
976
- constructor({ resultId, senderId, text }) {
977
- this.resultId = resultId;
978
- this.participantId = senderId;
979
- this.text = text;
980
- this.timestamp = Date.now();
981
- }
982
- }
983
-
984
975
  /******************************************************************************
985
976
  Copyright (c) Microsoft Corporation.
986
977
 
@@ -1025,6 +1016,49 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1025
1016
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1026
1017
  };
1027
1018
 
1019
+ function roomPath(organizationId, roomName, suffix = "") {
1020
+ const encodedRoomName = encodeURIComponent(roomName.replace(/^\//, ""));
1021
+ return `/organizations/${encodeURIComponent(organizationId)}/room/${encodedRoomName}${suffix}`;
1022
+ }
1023
+ function asArray(value) {
1024
+ return Array.isArray(value) ? value : [];
1025
+ }
1026
+ class RoomIntegrationService {
1027
+ constructor({ apiClient }) {
1028
+ this._apiClient = apiClient;
1029
+ }
1030
+ findRoomIntegrations(_a) {
1031
+ return __awaiter(this, arguments, void 0, function* ({ organizationId, roomName, }) {
1032
+ const response = yield this._apiClient.request(roomPath(organizationId, roomName, "/room-integrations"), {
1033
+ method: "GET",
1034
+ });
1035
+ const data = (response.data || {});
1036
+ return {
1037
+ enabledRoomIntegrations: asArray(data.enabledRoomIntegrations),
1038
+ disabledRoomIntegrations: asArray(data.disabledRoomIntegrations),
1039
+ unavailableRoomIntegrations: asArray(data.unavailableRoomIntegrations),
1040
+ };
1041
+ });
1042
+ }
1043
+ toggleRoomIntegration(_a) {
1044
+ return __awaiter(this, arguments, void 0, function* ({ organizationId, roomName, roomIntegrationId, enable, }) {
1045
+ yield this._apiClient.request(roomPath(organizationId, roomName, `/room-integrations/${roomIntegrationId}`), {
1046
+ method: "PUT",
1047
+ data: { enable },
1048
+ });
1049
+ });
1050
+ }
1051
+ }
1052
+
1053
+ class LiveCaption {
1054
+ constructor({ resultId, senderId, text }) {
1055
+ this.resultId = resultId;
1056
+ this.participantId = senderId;
1057
+ this.text = text;
1058
+ this.timestamp = Date.now();
1059
+ }
1060
+ }
1061
+
1028
1062
  function getUsableCameraEffectPresets() {
1029
1063
  return __awaiter(this, void 0, void 0, function* () {
1030
1064
  const { getUsablePresets } = yield import('@whereby.com/camera-effects');
@@ -1038,6 +1072,54 @@ function isAudioDenoiserSupported() {
1038
1072
  });
1039
1073
  }
1040
1074
 
1075
+ function roomIntegrationContentTagName(integrationName) {
1076
+ return `${integrationName}-integration-contentframe`;
1077
+ }
1078
+ const YOUTUBE_ID = /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/|live\/))([\w-]{11})/i;
1079
+ const YOUTUBE_BARE_ID = /^[\w-]{11}$/;
1080
+ function youtubeStartSeconds(url) {
1081
+ const match = url.match(/[?&](?:t|start)=(\d+)s?/i);
1082
+ return match ? parseInt(match[1], 10) : 0;
1083
+ }
1084
+ function youtube({ url, startAt, metadata = {}, }) {
1085
+ var _a;
1086
+ const trimmed = (url || "").trim();
1087
+ const videoref = YOUTUBE_BARE_ID.test(trimmed) ? trimmed : (_a = trimmed.match(YOUTUBE_ID)) === null || _a === void 0 ? void 0 : _a[1];
1088
+ if (!videoref) {
1089
+ return null;
1090
+ }
1091
+ const time = startAt !== null && startAt !== void 0 ? startAt : youtubeStartSeconds(trimmed);
1092
+ const { aspectRatio = 16 / 9, isLive = false, title } = metadata;
1093
+ return {
1094
+ tagName: roomIntegrationContentTagName("youtube"),
1095
+ shareUrl: `https://www.youtube.com/watch?v=${videoref}${time ? `&t=${time}s` : ""}`,
1096
+ props: {
1097
+ videoref,
1098
+ time,
1099
+ seek: time,
1100
+ playerstate: "playing",
1101
+ started: Date.now() + 4000,
1102
+ paused: false,
1103
+ aspectratio: aspectRatio,
1104
+ islive: isLive,
1105
+ metadata: JSON.stringify(Object.assign({ id: videoref, aspectratio: aspectRatio, live: isLive }, (title ? { title } : {}))),
1106
+ },
1107
+ };
1108
+ }
1109
+ const MIRO_EMBED_LINK = /^https:\/\/miro\.com\/app\/(?:live-embed|access-link)\/[0-9a-zA-Z]+/i;
1110
+ function miro({ accessLink }) {
1111
+ const trimmed = (accessLink || "").trim();
1112
+ if (!MIRO_EMBED_LINK.test(trimmed)) {
1113
+ return null;
1114
+ }
1115
+ return {
1116
+ tagName: roomIntegrationContentTagName("miro"),
1117
+ shareUrl: trimmed,
1118
+ props: { accesslink: trimmed },
1119
+ };
1120
+ }
1121
+ const roomIntegrationContent = { youtube, miro };
1122
+
1041
1123
  class RoomParticipant {
1042
1124
  constructor({ breakoutGroup, displayName, id, isAudioEnabled, isAudioRecorder, isDialIn, isVideoEnabled, stickyReaction, stream, }) {
1043
1125
  this.isLocalParticipant = false;
@@ -1079,6 +1161,7 @@ function createServices() {
1079
1161
  baseUrl: API_BASE_URL,
1080
1162
  });
1081
1163
  const organizationService = new OrganizationService({ apiClient });
1164
+ const roomIntegrationService = new RoomIntegrationService({ apiClient });
1082
1165
  const fetchOrganizationFromRoomUrl = (roomUrl) => {
1083
1166
  const roomUrlObj = new URL(roomUrl);
1084
1167
  const urls = media.fromLocation({ host: roomUrlObj.host });
@@ -1092,6 +1175,7 @@ function createServices() {
1092
1175
  credentialsService,
1093
1176
  apiClient,
1094
1177
  organizationService,
1178
+ roomIntegrationService,
1095
1179
  fetchOrganizationFromRoomUrl,
1096
1180
  };
1097
1181
  }
@@ -1226,7 +1310,7 @@ const createReactor = (selectors, callback) => {
1226
1310
  });
1227
1311
  };
1228
1312
 
1229
- const coreVersion = "1.21.2";
1313
+ const coreVersion = "1.23.0";
1230
1314
 
1231
1315
  function decodeRoomName(roomName) {
1232
1316
  if (!roomName) {
@@ -1306,6 +1390,11 @@ const signalEvents = {
1306
1390
  knockerLeft: createSignalEventAction("knockerLeft"),
1307
1391
  knockHandled: createSignalEventAction("knockHandled"),
1308
1392
  newClient: createSignalEventAction("newClient"),
1393
+ roomIntegrationStarted: createSignalEventAction("roomIntegrationStarted"),
1394
+ roomIntegrationStopped: createSignalEventAction("roomIntegrationStopped"),
1395
+ roomIntegrationPropsUpdated: createSignalEventAction("roomIntegrationPropsUpdated"),
1396
+ roomIntegrationEnabled: createSignalEventAction("roomIntegrationEnabled"),
1397
+ roomIntegrationDisabled: createSignalEventAction("roomIntegrationDisabled"),
1309
1398
  roomJoined: createSignalEventAction("roomJoined"),
1310
1399
  roomKnocked: createSignalEventAction("roomKnocked"),
1311
1400
  roomLeft: createSignalEventAction("roomLeft"),
@@ -1336,6 +1425,7 @@ const ROOM_ACTION_PERMISSIONS_BY_ROLE = {
1336
1425
  canAskToSpeak: ["host"],
1337
1426
  canSpotlight: ["host"],
1338
1427
  canManageBreakout: ["host"],
1428
+ canManageRoomIntegration: ["host"],
1339
1429
  };
1340
1430
  const authorizationSliceInitialState = {
1341
1431
  roomKey: null,
@@ -1380,6 +1470,7 @@ const selectIsAuthorizedToEndMeeting = toolkit.createSelector(selectAuthorizatio
1380
1470
  const selectIsAuthorizedToAskToSpeak = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canAskToSpeak.includes(localParticipantRole));
1381
1471
  const selectIsAuthorizedToSpotlight = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canSpotlight.includes(localParticipantRole));
1382
1472
  const selectIsAuthorizedToManageBreakout = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canManageBreakout.includes(localParticipantRole));
1473
+ const selectIsAuthorizedToManageRoomIntegration = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canManageRoomIntegration.includes(localParticipantRole));
1383
1474
 
1384
1475
  function createAppAsyncThunk(typePrefix, payloadCreator) {
1385
1476
  return toolkit.createAsyncThunk(typePrefix, payloadCreator);
@@ -1513,6 +1604,11 @@ function forwardSocketEvents(socket, dispatch) {
1513
1604
  socket.on("video_enable_requested", (payload) => dispatch(signalEvents.videoEnableRequested(payload)));
1514
1605
  socket.on("breakout_group_joined", (payload) => dispatch(signalEvents.breakoutGroupJoined(payload)));
1515
1606
  socket.on("breakout_session_updated", (payload) => dispatch(signalEvents.breakoutSessionUpdated(payload)));
1607
+ socket.on("room_integration_started", (payload) => dispatch(signalEvents.roomIntegrationStarted(payload)));
1608
+ socket.on("room_integration_stopped", (payload) => dispatch(signalEvents.roomIntegrationStopped(payload)));
1609
+ socket.on("room_integration_props_updated", (payload) => dispatch(signalEvents.roomIntegrationPropsUpdated(payload)));
1610
+ socket.on("room_integration_enabled", (payload) => dispatch(signalEvents.roomIntegrationEnabled(payload)));
1611
+ socket.on("room_integration_disabled", (payload) => dispatch(signalEvents.roomIntegrationDisabled(payload)));
1516
1612
  socket.on("breakout_move_to_group", () => dispatch(signalEvents.breakoutMoveToGroup()));
1517
1613
  socket.on("breakout_move_to_main", () => dispatch(signalEvents.breakoutMoveToMain()));
1518
1614
  socket.on("breakout_ending", () => dispatch(signalEvents.breakoutEnding()));
@@ -2216,7 +2312,7 @@ const selectLocalParticipantDisplayName = (state) => state.localParticipant.disp
2216
2312
  const selectLocalParticipantClientClaim = (state) => state.localParticipant.clientClaim;
2217
2313
  const selectLocalParticipantStickyReaction = (state) => state.localParticipant.stickyReaction;
2218
2314
  const selectLocalParticipantBreakoutGroup = (state) => state.localParticipant.breakoutGroup;
2219
- const selectLocalParticipantView = toolkit.createSelector(selectLocalParticipantRaw, selectLocalMediaStream, (participant, localStream) => {
2315
+ const selectLocalParticipantView = toolkit.createSelector(selectLocalParticipantRaw, selectLocalMediaStream, (state) => state.rtcConnection.isAudioOnlyModeEnabled, (participant, localStream, isAudioOnlyModeEnabled) => {
2220
2316
  const clientView = {
2221
2317
  id: participant.id,
2222
2318
  clientId: participant.id,
@@ -2226,6 +2322,7 @@ const selectLocalParticipantView = toolkit.createSelector(selectLocalParticipant
2226
2322
  isLocalClient: true,
2227
2323
  isAudioEnabled: participant.isAudioEnabled,
2228
2324
  isVideoEnabled: participant.isVideoEnabled,
2325
+ isAudioOnlyModeEnabled,
2229
2326
  };
2230
2327
  if (NON_PERSON_ROLES.includes(participant.roleName)) {
2231
2328
  return null;
@@ -3224,6 +3321,13 @@ const selectScreenshares = toolkit.createSelector(selectLocalScreenshareStream,
3224
3321
  }
3225
3322
  return screenshares;
3226
3323
  });
3324
+ const selectRemoteScreenshareVideoTrackIds = toolkit.createSelector(selectScreenshares, (screenshares) => screenshares
3325
+ .filter((screenshare) => !screenshare.isLocal)
3326
+ .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 : []; }), {
3327
+ memoizeOptions: {
3328
+ resultEqualityCheck: (a, b) => a.length === b.length && a.every((trackId, index) => trackId === b[index]),
3329
+ },
3330
+ });
3227
3331
  const selectRemoteClientViews = toolkit.createSelector(selectLocalScreenshareStream, selectLocalParticipantRaw, selectRemoteParticipants, selectBreakoutCurrentId, selectBreakoutAssignments, (localScreenshareStream, localParticipant, remoteParticipants, breakoutCurrentId, breakoutAssignments) => {
3228
3332
  const views = [];
3229
3333
  if (localScreenshareStream) {
@@ -3435,11 +3539,16 @@ const rtcConnectionSliceInitialState = {
3435
3539
  rtcManagerInitialized: false,
3436
3540
  status: "inactive",
3437
3541
  isAcceptingStreams: false,
3542
+ isAudioOnlyModeEnabled: false,
3438
3543
  };
3439
3544
  const rtcConnectionSlice = toolkit.createSlice({
3440
3545
  name: "rtcConnection",
3441
3546
  initialState: rtcConnectionSliceInitialState,
3442
3547
  reducers: {
3548
+ audioOnlyModeToggled: (state, action) => {
3549
+ var _a;
3550
+ return Object.assign(Object.assign({}, state), { isAudioOnlyModeEnabled: (_a = action.payload.enabled) !== null && _a !== void 0 ? _a : !state.isAudioOnlyModeEnabled });
3551
+ },
3443
3552
  isAcceptingStreams: (state, action) => {
3444
3553
  return Object.assign(Object.assign({}, state), { isAcceptingStreams: action.payload });
3445
3554
  },
@@ -3457,7 +3566,7 @@ const rtcConnectionSlice = toolkit.createSlice({
3457
3566
  return Object.assign(Object.assign({}, state), { rtcManager: action.payload, status: "ready" });
3458
3567
  },
3459
3568
  rtcManagerDestroyed: (state) => {
3460
- return Object.assign(Object.assign({}, state), { rtcManager: null });
3569
+ return Object.assign(Object.assign({}, state), { rtcManager: null, rtcManagerInitialized: false });
3461
3570
  },
3462
3571
  rtcManagerInitialized: (state) => {
3463
3572
  return Object.assign(Object.assign({}, state), { rtcManagerInitialized: true });
@@ -3488,7 +3597,7 @@ const rtcConnectionSlice = toolkit.createSlice({
3488
3597
  });
3489
3598
  },
3490
3599
  });
3491
- const { resolutionReported, rtcDispatcherCreated, rtcDisconnected, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, isAcceptingStreams, rtcClientConnectionStatusChanged, } = rtcConnectionSlice.actions;
3600
+ const { audioOnlyModeToggled, resolutionReported, rtcDispatcherCreated, rtcDisconnected, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, isAcceptingStreams, rtcClientConnectionStatusChanged, } = rtcConnectionSlice.actions;
3492
3601
  const doConnectRtc = createAppThunk(() => (dispatch, getState) => {
3493
3602
  const state = getState();
3494
3603
  const socket = selectSignalConnectionRaw(state).socket;
@@ -3586,8 +3695,19 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
3586
3695
  videoPaused: !isCameraEnabled,
3587
3696
  });
3588
3697
  }
3698
+ const screenshareStream = selectLocalScreenshareStream(getState());
3699
+ if (screenshareStream && rtcManager) {
3700
+ rtcManager.addScreenshareStream(screenshareStream);
3701
+ }
3589
3702
  dispatch(rtcManagerInitialized());
3590
3703
  });
3704
+ const doToggleAudioOnlyMode = createAppThunk(({ enabled, autoDisableLocalCamera }) => (dispatch, getState) => {
3705
+ dispatch(audioOnlyModeToggled({ enabled }));
3706
+ const state = getState();
3707
+ if (autoDisableLocalCamera && selectIsAudioOnlyModeEnabled(state) && selectIsCameraEnabled(state)) {
3708
+ dispatch(toggleCameraEnabled({ enabled: false }));
3709
+ }
3710
+ });
3591
3711
  const selectRtcConnectionRaw = (state) => state.rtcConnection;
3592
3712
  const selectRtcManagerInitialized = (state) => state.rtcConnection.rtcManagerInitialized;
3593
3713
  const selectRtcManager = (state) => state.rtcConnection.rtcManager;
@@ -3595,6 +3715,7 @@ const selectRtcDispatcherCreated = (state) => state.rtcConnection.dispatcherCrea
3595
3715
  const selectRtcIsCreatingDispatcher = (state) => state.rtcConnection.isCreatingDispatcher;
3596
3716
  const selectRtcStatus = (state) => state.rtcConnection.status;
3597
3717
  const selectIsAcceptingStreams = (state) => state.rtcConnection.isAcceptingStreams;
3718
+ const selectIsAudioOnlyModeEnabled = (state) => state.rtcConnection.isAudioOnlyModeEnabled;
3598
3719
  startAppListening({
3599
3720
  actionCreator: doSetDevice.fulfilled,
3600
3721
  effect: ({ payload }, { getState }) => {
@@ -3650,6 +3771,22 @@ startAppListening({
3650
3771
  }
3651
3772
  },
3652
3773
  });
3774
+ startAppListening({
3775
+ actionCreator: audioOnlyModeToggled,
3776
+ effect: (_, { getState }) => {
3777
+ const state = getState();
3778
+ const rtcManager = selectRtcManager(state);
3779
+ rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.setAudioOnly(selectIsAudioOnlyModeEnabled(state));
3780
+ },
3781
+ });
3782
+ startAppListening({
3783
+ actionCreator: rtcManagerCreated,
3784
+ effect: ({ payload: rtcManager }, { getState }) => {
3785
+ if (selectIsAudioOnlyModeEnabled(getState())) {
3786
+ rtcManager.setAudioOnly(true);
3787
+ }
3788
+ },
3789
+ });
3653
3790
  startAppListening({
3654
3791
  actionCreator: rtcEvents.clientConnectionStatusChanged,
3655
3792
  effect: (_, { dispatch, getState }) => {
@@ -3711,6 +3848,9 @@ createReactor([selectShouldDisconnectRtc], ({ dispatch }, shouldDisconnectRtc) =
3711
3848
  dispatch(doDisconnectRtc());
3712
3849
  }
3713
3850
  });
3851
+ createReactor([selectRtcManager, selectRemoteScreenshareVideoTrackIds], (_, rtcManager, remoteScreenshareVideoTrackIds) => {
3852
+ rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds);
3853
+ });
3714
3854
  const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemoteClients, selectBreakoutCurrentId, selectSpotlights, selectAppIgnoreBreakoutGroups, (rtcStatus, remoteParticipants, breakoutCurrentId, spotlights, ignoreBreakoutGroups) => {
3715
3855
  if (rtcStatus !== "ready") {
3716
3856
  return [];
@@ -3783,6 +3923,7 @@ const doStartConnectionMonitor = createAppThunk(() => (dispatch, getState) => {
3783
3923
  return ({
3784
3924
  id: clientView.id,
3785
3925
  clientId: clientView.clientId,
3926
+ isAudioOnlyModeEnabled: clientView.isAudioOnlyModeEnabled,
3786
3927
  isLocalClient: clientView.isLocalClient,
3787
3928
  audio: {
3788
3929
  enabled: clientView.isAudioEnabled,
@@ -4555,6 +4696,378 @@ startAppListening({
4555
4696
  },
4556
4697
  });
4557
4698
 
4699
+ function isCustomElementName(value) {
4700
+ return typeof value === "string" && value === value.toLowerCase() && value.includes("-");
4701
+ }
4702
+ function isHttpsUrl(value) {
4703
+ if (typeof value !== "string") {
4704
+ return false;
4705
+ }
4706
+ try {
4707
+ return new URL(value).protocol === "https:";
4708
+ }
4709
+ catch (_a) {
4710
+ return false;
4711
+ }
4712
+ }
4713
+ function isValidProps(value) {
4714
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
4715
+ return false;
4716
+ }
4717
+ return Object.values(value).every((entry) => entry === null || ["string", "number", "boolean"].includes(typeof entry));
4718
+ }
4719
+ function parseMatcher(matcher) {
4720
+ if (typeof matcher !== "string") {
4721
+ return null;
4722
+ }
4723
+ const parts = matcher.match(/^\/([\s\S]*)\/([a-z]*)$/);
4724
+ if (!parts) {
4725
+ return null;
4726
+ }
4727
+ const flags = (parts[2] || "").replace(/[gy]/g, "");
4728
+ try {
4729
+ return new RegExp(parts[1], flags);
4730
+ }
4731
+ catch (_a) {
4732
+ return null;
4733
+ }
4734
+ }
4735
+ function parseRoomIntegration(response) {
4736
+ const { roomIntegrationId, name, title, description, type, icons, link, entrypoint, webview, isEmbeddable } = response || {};
4737
+ const matcher = parseMatcher(response === null || response === void 0 ? void 0 : response.matcher);
4738
+ if (roomIntegrationId === undefined ||
4739
+ roomIntegrationId === null ||
4740
+ !name ||
4741
+ !title ||
4742
+ !type ||
4743
+ !(icons === null || icons === void 0 ? void 0 : icons.small) ||
4744
+ !(icons === null || icons === void 0 ? void 0 : icons.large) ||
4745
+ !entrypoint ||
4746
+ !webview ||
4747
+ !matcher) {
4748
+ console.warn(`Ignoring malformed room integration: ${name || roomIntegrationId}`);
4749
+ return null;
4750
+ }
4751
+ return {
4752
+ roomIntegrationId: String(roomIntegrationId),
4753
+ name,
4754
+ title,
4755
+ description: description || "",
4756
+ type,
4757
+ contentTagName: roomIntegrationContentTagName(name),
4758
+ icons: { small: icons.small, large: icons.large },
4759
+ link: { href: (link === null || link === void 0 ? void 0 : link.href) || "", text: (link === null || link === void 0 ? void 0 : link.text) || "" },
4760
+ entrypoint,
4761
+ webview,
4762
+ matcher,
4763
+ isEmbeddable: isEmbeddable !== null && isEmbeddable !== void 0 ? isEmbeddable : false,
4764
+ };
4765
+ }
4766
+ function parseRoomIntegrationSession(event) {
4767
+ const { roomIntegrationId, roomIntegrationSessionId, breakoutGroupId, tagName, shareUrl, props, clientId, roomIntegrationSessionStartedAt, } = event || {};
4768
+ if (typeof roomIntegrationSessionId !== "string" ||
4769
+ roomIntegrationId === undefined ||
4770
+ roomIntegrationId === null ||
4771
+ typeof clientId !== "string" ||
4772
+ !isCustomElementName(tagName) ||
4773
+ !isHttpsUrl(shareUrl) ||
4774
+ !isValidProps(props)) {
4775
+ console.warn(`Ignoring malformed room integration session: ${roomIntegrationSessionId}`);
4776
+ return null;
4777
+ }
4778
+ return {
4779
+ roomIntegrationSessionId,
4780
+ roomIntegrationId: String(roomIntegrationId),
4781
+ breakoutGroupId: breakoutGroupId || "",
4782
+ tagName,
4783
+ shareUrl,
4784
+ props,
4785
+ clientId,
4786
+ roomIntegrationSessionStartedAt: typeof roomIntegrationSessionStartedAt === "number" && isFinite(roomIntegrationSessionStartedAt)
4787
+ ? roomIntegrationSessionStartedAt
4788
+ : null,
4789
+ };
4790
+ }
4791
+ const SIGNAL_ERROR_MESSAGES = {
4792
+ 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.`,
4793
+ forbidden: (action) => `Not allowed to ${action} this room integration (forbidden)`,
4794
+ missing_parameters: (action) => `Could not ${action} the room integration: the request was missing parameters`,
4795
+ invalid_parameters: (action) => `Could not ${action} the room integration: the request had invalid parameters`,
4796
+ internal_server_error: (action) => `The server failed to ${action} the room integration`,
4797
+ };
4798
+ function roomIntegrationSignalError(error, action) {
4799
+ if (!media.isRoomIntegrationErrorCode(error)) {
4800
+ return { code: "unknown", message: `Could not ${action} the room integration: ${error}` };
4801
+ }
4802
+ return { code: error, message: SIGNAL_ERROR_MESSAGES[error](action) };
4803
+ }
4804
+ const roomIntegrationsSliceInitialState = {
4805
+ available: [],
4806
+ unavailable: [],
4807
+ enabled: [],
4808
+ running: [],
4809
+ isFetching: false,
4810
+ hasFetched: false,
4811
+ error: null,
4812
+ };
4813
+ const roomIntegrationsSlice = toolkit.createSlice({
4814
+ name: "roomIntegrations",
4815
+ initialState: roomIntegrationsSliceInitialState,
4816
+ reducers: {
4817
+ setRoomIntegrationsError: (state, action) => {
4818
+ state.error = action.payload.error;
4819
+ },
4820
+ },
4821
+ extraReducers: (builder) => {
4822
+ builder.addCase(doFetchRoomIntegrations.pending, (state) => {
4823
+ state.isFetching = true;
4824
+ });
4825
+ builder.addCase(doFetchRoomIntegrations.fulfilled, (state, action) => {
4826
+ const { enabledRoomIntegrations, disabledRoomIntegrations, unavailableRoomIntegrations } = action.payload;
4827
+ const parse = (entries) => entries.map(parseRoomIntegration).filter((entry) => entry !== null);
4828
+ state.isFetching = false;
4829
+ state.hasFetched = true;
4830
+ state.error = null;
4831
+ state.available = [...parse(enabledRoomIntegrations), ...parse(disabledRoomIntegrations)];
4832
+ state.unavailable = parse(unavailableRoomIntegrations);
4833
+ state.enabled = enabledRoomIntegrations.map(({ roomIntegrationId }) => String(roomIntegrationId));
4834
+ });
4835
+ builder.addCase(doFetchRoomIntegrations.rejected, (state, action) => {
4836
+ state.isFetching = false;
4837
+ state.hasFetched = true;
4838
+ state.error = {
4839
+ code: "unknown",
4840
+ message: action.error.message || "Failed to fetch room integrations",
4841
+ };
4842
+ });
4843
+ builder.addCase(signalEvents.roomJoined, (state, action) => {
4844
+ if ("error" in action.payload) {
4845
+ return;
4846
+ }
4847
+ state.running = (action.payload.roomIntegrationSession || [])
4848
+ .map(parseRoomIntegrationSession)
4849
+ .filter((session) => session !== null);
4850
+ });
4851
+ builder.addCase(signalEvents.roomIntegrationStarted, (state, action) => {
4852
+ if ("error" in action.payload) {
4853
+ state.error = roomIntegrationSignalError(action.payload.error, "start");
4854
+ return;
4855
+ }
4856
+ const { roomIntegrationId, roomIntegrationSessionId, breakoutGroupId, roomIntegrationSessionStartedAt } = action.payload;
4857
+ const session = parseRoomIntegrationSession(Object.assign(Object.assign({}, action.payload.state), { roomIntegrationId,
4858
+ roomIntegrationSessionId,
4859
+ breakoutGroupId,
4860
+ roomIntegrationSessionStartedAt }));
4861
+ if (!session) {
4862
+ return;
4863
+ }
4864
+ const existing = state.running.findIndex((running) => running.roomIntegrationSessionId === session.roomIntegrationSessionId);
4865
+ if (existing >= 0) {
4866
+ state.running[existing] = session;
4867
+ return;
4868
+ }
4869
+ state.running.push(session);
4870
+ });
4871
+ builder.addCase(signalEvents.roomIntegrationStopped, (state, action) => {
4872
+ if ("error" in action.payload) {
4873
+ state.error = roomIntegrationSignalError(action.payload.error, "stop");
4874
+ return;
4875
+ }
4876
+ const { roomIntegrationSessionId } = action.payload;
4877
+ state.running = state.running.filter((running) => running.roomIntegrationSessionId !== roomIntegrationSessionId);
4878
+ });
4879
+ builder.addCase(signalEvents.roomIntegrationPropsUpdated, (state, action) => {
4880
+ if ("error" in action.payload) {
4881
+ state.error = roomIntegrationSignalError(action.payload.error, "update the props of");
4882
+ return;
4883
+ }
4884
+ const { roomIntegrationSessionId, props } = action.payload;
4885
+ const session = state.running.find((running) => running.roomIntegrationSessionId === roomIntegrationSessionId);
4886
+ if (!session || !isValidProps(props)) {
4887
+ return;
4888
+ }
4889
+ session.props = Object.assign(Object.assign({}, session.props), props);
4890
+ });
4891
+ builder.addCase(signalEvents.roomIntegrationEnabled, (state, action) => {
4892
+ const roomIntegrationId = String(action.payload.roomIntegrationId);
4893
+ if (!state.enabled.includes(roomIntegrationId)) {
4894
+ state.enabled.push(roomIntegrationId);
4895
+ }
4896
+ });
4897
+ builder.addCase(signalEvents.roomIntegrationDisabled, (state, action) => {
4898
+ const roomIntegrationId = String(action.payload.roomIntegrationId);
4899
+ state.enabled = state.enabled.filter((id) => id !== roomIntegrationId);
4900
+ });
4901
+ },
4902
+ });
4903
+ const { setRoomIntegrationsError } = roomIntegrationsSlice.actions;
4904
+ const doFetchRoomIntegrations = createAppAsyncThunk("roomIntegrations/doFetchRoomIntegrations", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { extra, getState }) {
4905
+ const state = getState();
4906
+ const organizationId = selectOrganizationId(state);
4907
+ const roomName = selectAppRoomName(state);
4908
+ if (!organizationId || !roomName) {
4909
+ throw new Error("Cannot fetch room integrations before the organization and room are known");
4910
+ }
4911
+ return extra.services.roomIntegrationService.findRoomIntegrations({ organizationId, roomName });
4912
+ }));
4913
+ const doStartRoomIntegration = createRoomConnectedThunk((payload) => (dispatch, getState) => {
4914
+ var _a;
4915
+ const state = getState();
4916
+ const { roomIntegrationId, tagName, shareUrl, props = {} } = payload;
4917
+ const integration = selectRoomIntegrationsRaw(state).available.find((entry) => entry.roomIntegrationId === roomIntegrationId);
4918
+ if (!integration) {
4919
+ dispatch(setRoomIntegrationsError({
4920
+ error: {
4921
+ code: "unknown_integration",
4922
+ message: `Unknown room integration: ${roomIntegrationId}`,
4923
+ },
4924
+ }));
4925
+ return;
4926
+ }
4927
+ if (!selectRoomIntegrationsEnabled(state).includes(roomIntegrationId)) {
4928
+ dispatch(setRoomIntegrationsError({
4929
+ error: {
4930
+ code: "integration_not_enabled",
4931
+ message: `Room integration is not enabled for this room: ${integration.name}`,
4932
+ },
4933
+ }));
4934
+ return;
4935
+ }
4936
+ if (!isCustomElementName(tagName)) {
4937
+ dispatch(setRoomIntegrationsError({
4938
+ error: {
4939
+ code: "invalid_content",
4940
+ message: `tagName must be a valid custom element name, got: ${tagName}`,
4941
+ },
4942
+ }));
4943
+ return;
4944
+ }
4945
+ if (!isHttpsUrl(shareUrl)) {
4946
+ dispatch(setRoomIntegrationsError({
4947
+ error: {
4948
+ code: "invalid_content",
4949
+ message: `shareUrl must be an https url, got: ${shareUrl}`,
4950
+ },
4951
+ }));
4952
+ return;
4953
+ }
4954
+ if (!isValidProps(props)) {
4955
+ dispatch(setRoomIntegrationsError({
4956
+ error: {
4957
+ code: "invalid_content",
4958
+ message: "props must be a flat object of primitive values",
4959
+ },
4960
+ }));
4961
+ return;
4962
+ }
4963
+ const clientId = selectSelfId(state);
4964
+ if (!clientId) {
4965
+ return;
4966
+ }
4967
+ dispatch(setRoomIntegrationsError({ error: null }));
4968
+ const request = {
4969
+ roomIntegrationId: Number(roomIntegrationId),
4970
+ breakoutGroupId: selectBreakoutCurrentId(state) || null,
4971
+ state: { tagName, shareUrl, props, clientId },
4972
+ };
4973
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("start_room_integration", request);
4974
+ });
4975
+ const ROOM_INTEGRATION_PICKER_MESSAGES = {
4976
+ FORM_SUBMIT: "whereby:formSubmit",
4977
+ FORM_CLOSE: "whereby:formClose",
4978
+ ERROR: "whereby:bootstrapError",
4979
+ };
4980
+ function roomIntegrationPickerUrl({ integration, parentOrigin, featureSource, }) {
4981
+ const url = new URL("bootstrap.html", integration.webview);
4982
+ url.searchParams.set("parentOrigin", parentOrigin);
4983
+ if (featureSource) {
4984
+ url.searchParams.set("featuresource", featureSource);
4985
+ }
4986
+ return url.href;
4987
+ }
4988
+ const doStopRoomIntegration = createRoomConnectedThunk((payload) => (dispatch, getState) => {
4989
+ var _a;
4990
+ const state = getState();
4991
+ const { roomIntegrationSessionId, intent = "stop" } = payload;
4992
+ const session = selectRunningRoomIntegrations(state).find((running) => running.roomIntegrationSessionId === roomIntegrationSessionId);
4993
+ if (!session) {
4994
+ dispatch(setRoomIntegrationsError({
4995
+ error: {
4996
+ code: "unknown_integration",
4997
+ message: `No running room integration with session id: ${roomIntegrationSessionId}`,
4998
+ },
4999
+ }));
5000
+ return;
5001
+ }
5002
+ if (!session.canStop) {
5003
+ dispatch(setRoomIntegrationsError({
5004
+ error: {
5005
+ code: "not_allowed_to_stop",
5006
+ message: "Only the participant who started a room integration, or a host, can stop it",
5007
+ },
5008
+ }));
5009
+ return;
5010
+ }
5011
+ dispatch(setRoomIntegrationsError({ error: null }));
5012
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("stop_room_integration", { roomIntegrationSessionId, intent });
5013
+ });
5014
+ const doUpdateRoomIntegrationProps = createRoomConnectedThunk((payload) => (dispatch, getState) => {
5015
+ var _a;
5016
+ const state = getState();
5017
+ const { roomIntegrationSessionId, props } = payload;
5018
+ if (!isValidProps(props)) {
5019
+ dispatch(setRoomIntegrationsError({
5020
+ error: {
5021
+ code: "invalid_content",
5022
+ message: "props must be a flat object of primitive values",
5023
+ },
5024
+ }));
5025
+ return;
5026
+ }
5027
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("update_room_integration_props", {
5028
+ roomIntegrationSessionId,
5029
+ props,
5030
+ });
5031
+ });
5032
+ const selectRoomIntegrationsRaw = (state) => state.roomIntegrations;
5033
+ const selectRoomIntegrationsEnabled = (state) => state.roomIntegrations.enabled;
5034
+ const selectAvailableRoomIntegrations = (state) => state.roomIntegrations.available;
5035
+ const selectEnabledRoomIntegrations = toolkit.createSelector(selectAvailableRoomIntegrations, selectRoomIntegrationsEnabled, (available, enabled) => available.filter((integration) => enabled.includes(integration.roomIntegrationId)));
5036
+ const selectEmbeddableRoomIntegrations = toolkit.createSelector(selectEnabledRoomIntegrations, (enabled) => enabled.filter((integration) => integration.isEmbeddable));
5037
+ const selectRunningRoomIntegrations = toolkit.createSelector(selectRoomIntegrationsRaw, selectEnabledRoomIntegrations, selectBreakoutActive, selectBreakoutCurrentId, selectSelfId, selectRemoteParticipants, selectIsAuthorizedToManageRoomIntegration, (raw, enabledIntegrations, breakoutActive, breakoutCurrentId, selfId, remoteParticipants, canManageRoomIntegration) => {
5038
+ const currentGroupId = breakoutActive ? breakoutCurrentId : "";
5039
+ return raw.running.reduce((acc, session) => {
5040
+ var _a;
5041
+ if (session.breakoutGroupId !== currentGroupId) {
5042
+ return acc;
5043
+ }
5044
+ const integration = enabledIntegrations.find((entry) => entry.roomIntegrationId === session.roomIntegrationId);
5045
+ if (!integration) {
5046
+ return acc;
5047
+ }
5048
+ const isPresenter = !!selfId && session.clientId === selfId;
5049
+ acc.push(Object.assign(Object.assign({}, session), { integration,
5050
+ isPresenter, canStop: isPresenter || canManageRoomIntegration, presenterDisplayName: isPresenter
5051
+ ? null
5052
+ : ((_a = remoteParticipants.find((participant) => participant.id === session.clientId)) === null || _a === void 0 ? void 0 : _a.displayName) ||
5053
+ null }));
5054
+ return acc;
5055
+ }, []);
5056
+ });
5057
+ toolkit.createSelector(selectRunningRoomIntegrations, (running) => running.length > 0);
5058
+ toolkit.createSelector(selectEmbeddableRoomIntegrations, (integrations) => (url) => integrations.find((integration) => integration.matcher.test(url)) || null);
5059
+ const selectShouldFetchRoomIntegrations = toolkit.createSelector(selectAppIsActive, selectRoomConnectionStatus, selectOrganizationId, selectAppRoomName, selectRoomIntegrationsRaw, (appIsActive, connectionStatus, organizationId, roomName, raw) => appIsActive &&
5060
+ connectionStatus === "connected" &&
5061
+ !!organizationId &&
5062
+ !!roomName &&
5063
+ !raw.hasFetched &&
5064
+ !raw.isFetching);
5065
+ createReactor([selectShouldFetchRoomIntegrations], ({ dispatch }, shouldFetchRoomIntegrations) => {
5066
+ if (shouldFetchRoomIntegrations) {
5067
+ dispatch(doFetchRoomIntegrations());
5068
+ }
5069
+ });
5070
+
4558
5071
  function createRtcAnalyticsCustomEvent(parameters) {
4559
5072
  return parameters;
4560
5073
  }
@@ -5166,6 +5679,7 @@ const appReducer = toolkit.combineReducers({
5166
5679
  remoteParticipants: remoteParticipantsSlice.reducer,
5167
5680
  room: roomSlice.reducer,
5168
5681
  roomConnection: roomConnectionSlice.reducer,
5682
+ roomIntegrations: roomIntegrationsSlice.reducer,
5169
5683
  rtcAnalytics: rtcAnalyticsSlice.reducer,
5170
5684
  rtcConnection: rtcConnectionSlice.reducer,
5171
5685
  signalConnection: signalConnectionSlice.reducer,
@@ -5203,12 +5717,14 @@ const createStore = ({ preloadedState, injectServices, }) => {
5203
5717
  const CLIENT_VIEW_CHANGED = "grid:client-view-changed";
5204
5718
  const CLIENT_VIEW_SPOTLIGHTS_CHANGED = "grid:client-view-spotlights-changed";
5205
5719
  const NUMBER_OF_CLIENT_VIEWS_CHANGED = "grid:number-of-client-views-changed";
5720
+ const RUNNING_ROOM_INTEGRATIONS_CHANGED = "grid:running-room-integrations-changed";
5206
5721
 
5207
- const selectGridState = toolkit.createSelector(selectAllClientViews, selectSpotlightedClientViews, selectNumClients, (allClientViews, spotlightedParticipants, numClients) => {
5722
+ const selectGridState = toolkit.createSelector(selectAllClientViews, selectSpotlightedClientViews, selectNumClients, selectRunningRoomIntegrations, (allClientViews, spotlightedParticipants, numClients, runningRoomIntegrations) => {
5208
5723
  return {
5209
5724
  allClientViews,
5210
5725
  spotlightedParticipants,
5211
5726
  numParticipants: numClients,
5727
+ runningRoomIntegrations,
5212
5728
  };
5213
5729
  });
5214
5730
 
@@ -5247,6 +5763,7 @@ class GridClient extends BaseClient {
5247
5763
  this.clientViewSubscribers = new Set();
5248
5764
  this.spotlightedSubscribers = new Set();
5249
5765
  this.numberOfClientViewsSubscribers = new Set();
5766
+ this.runningRoomIntegrationsSubscribers = new Set();
5250
5767
  }
5251
5768
  handleStateChanges(state, previousState) {
5252
5769
  if (state.allClientViews !== previousState.allClientViews) {
@@ -5261,6 +5778,10 @@ class GridClient extends BaseClient {
5261
5778
  this.numberOfClientViewsSubscribers.forEach((cb) => cb(state.numParticipants));
5262
5779
  this.emit(NUMBER_OF_CLIENT_VIEWS_CHANGED, state.numParticipants);
5263
5780
  }
5781
+ if (state.runningRoomIntegrations !== previousState.runningRoomIntegrations) {
5782
+ this.runningRoomIntegrationsSubscribers.forEach((cb) => cb(state.runningRoomIntegrations));
5783
+ this.emit(RUNNING_ROOM_INTEGRATIONS_CHANGED, state.runningRoomIntegrations);
5784
+ }
5264
5785
  }
5265
5786
  getState() {
5266
5787
  return selectGridState(this.store.getState());
@@ -5277,6 +5798,10 @@ class GridClient extends BaseClient {
5277
5798
  this.numberOfClientViewsSubscribers.add(callback);
5278
5799
  return () => this.numberOfClientViewsSubscribers.delete(callback);
5279
5800
  }
5801
+ subscribeRunningRoomIntegrations(callback) {
5802
+ this.runningRoomIntegrationsSubscribers.add(callback);
5803
+ return () => this.runningRoomIntegrationsSubscribers.delete(callback);
5804
+ }
5280
5805
  spotlightParticipant(id) {
5281
5806
  this.store.dispatch(doSpotlightParticipant({ id }));
5282
5807
  }
@@ -5288,6 +5813,7 @@ class GridClient extends BaseClient {
5288
5813
  this.clientViewSubscribers.clear();
5289
5814
  this.spotlightedSubscribers.clear();
5290
5815
  this.numberOfClientViewsSubscribers.clear();
5816
+ this.runningRoomIntegrationsSubscribers.clear();
5291
5817
  this.removeAllListeners();
5292
5818
  }
5293
5819
  }
@@ -5534,6 +6060,7 @@ const CONNECTION_STATUS_CHANGED = "connection:status-changed";
5534
6060
  const LIVE_CAPTIONS_STATUS_CHANGED = "live-captions:status-changed";
5535
6061
  const LIVE_TRANSCRIPTION_STATUS_CHANGED = "live-transcription:status-changed";
5536
6062
  const CONNECTION_ERROR_CHANGED = "connection:error-changed";
6063
+ const AUDIO_ONLY_MODE_CHANGED = "audio-only-mode:changed";
5537
6064
  const LOCAL_PARTICIPANT_CHANGED = "local-participant:changed";
5538
6065
  const LOCAL_SCREENSHARE_STATUS_CHANGED = "local-screenshare:status-changed";
5539
6066
  const LOCAL_SCREENSHARE_CHANGED = "local-screenshare:state-changed";
@@ -5551,7 +6078,7 @@ const SPOTLIGHT_PARTICIPANT_REMOVED = "spotlight:participant-removed";
5551
6078
  const ROOM_JOINED = "room:joined";
5552
6079
  const ROOM_JOINED_ERROR = "room:joined:error";
5553
6080
 
5554
- const selectRoomConnectionState = toolkit.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) => {
6081
+ const selectRoomConnectionState = toolkit.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) => {
5555
6082
  const broadcastingParticipants = breakoutActive && breakoutCurrentId
5556
6083
  ? spotlightedClientViews.filter((c) => !c.breakoutGroup && c.isAudioEnabled && !c.isPresentation)
5557
6084
  : [];
@@ -5590,6 +6117,7 @@ const selectRoomConnectionState = toolkit.createSelector(selectChatMessages, sel
5590
6117
  connectionError,
5591
6118
  knockResponse,
5592
6119
  events: notificationsEmitter,
6120
+ isAudioOnlyModeEnabled,
5593
6121
  isCameraEnabled,
5594
6122
  isMicrophoneEnabled,
5595
6123
  liveStream: streaming.isStreaming
@@ -5629,6 +6157,14 @@ const selectRoomConnectionState = toolkit.createSelector(selectChatMessages, sel
5629
6157
  : undefined,
5630
6158
  localParticipant: Object.assign(Object.assign({}, localParticipant), { isScreenSharing: localScreenshare.status === "active", stream: localMediaStream }),
5631
6159
  remoteParticipants: remoteParticipants.map((participant) => (Object.assign(Object.assign({}, participant), { breakoutGroupAssigned: (breakoutAssignments === null || breakoutAssignments === void 0 ? void 0 : breakoutAssignments[participant.deviceId]) || "" }))),
6160
+ roomIntegrations: {
6161
+ hasFetched: roomIntegrationsRaw.hasFetched,
6162
+ isFetching: roomIntegrationsRaw.isFetching,
6163
+ error: roomIntegrationsRaw.error,
6164
+ embeddable: embeddableRoomIntegrations,
6165
+ enabled: enabledRoomIntegrations,
6166
+ running: runningRoomIntegrations,
6167
+ },
5632
6168
  screenshares,
5633
6169
  waitingParticipants,
5634
6170
  spotlightedParticipants: spotlightedClientViews,
@@ -5646,6 +6182,7 @@ class RoomConnectionClient extends BaseClient {
5646
6182
  this.fileUploadsSubscribers = new Set();
5647
6183
  this.cloudRecordingSubscribers = new Set();
5648
6184
  this.connectionErrorSubscribers = new Set();
6185
+ this.audioOnlyModeSubscribers = new Set();
5649
6186
  this.connectionStatusSubscribers = new Set();
5650
6187
  this.liveStreamSubscribers = new Set();
5651
6188
  this.liveCaptionsSubscribers = new Set();
@@ -5693,6 +6230,10 @@ class RoomConnectionClient extends BaseClient {
5693
6230
  this.connectionErrorSubscribers.forEach((cb) => cb(state.connectionError));
5694
6231
  this.emit(CONNECTION_ERROR_CHANGED, state.connectionError);
5695
6232
  }
6233
+ if (state.isAudioOnlyModeEnabled !== previousState.isAudioOnlyModeEnabled) {
6234
+ this.audioOnlyModeSubscribers.forEach((cb) => cb(state.isAudioOnlyModeEnabled));
6235
+ this.emit(AUDIO_ONLY_MODE_CHANGED, state.isAudioOnlyModeEnabled);
6236
+ }
5696
6237
  if (state.isCameraEnabled !== previousState.isCameraEnabled) {
5697
6238
  this.cameraStateSubscribers.forEach((cb) => cb(state.isCameraEnabled));
5698
6239
  this.emit(CAMERA_STATE_CHANGED, state.isCameraEnabled);
@@ -5815,6 +6356,10 @@ class RoomConnectionClient extends BaseClient {
5815
6356
  this.connectionErrorSubscribers.add(callback);
5816
6357
  return () => this.connectionErrorSubscribers.delete(callback);
5817
6358
  }
6359
+ subscribeToAudioOnlyMode(callback) {
6360
+ this.audioOnlyModeSubscribers.add(callback);
6361
+ return () => this.audioOnlyModeSubscribers.delete(callback);
6362
+ }
5818
6363
  subscribeToLiveStream(callback) {
5819
6364
  this.liveStreamSubscribers.add(callback);
5820
6365
  return () => this.liveStreamSubscribers.delete(callback);
@@ -5941,6 +6486,9 @@ class RoomConnectionClient extends BaseClient {
5941
6486
  toggleLowDataMode(enabled) {
5942
6487
  this.store.dispatch(toggleLowDataModeEnabled({ enabled }));
5943
6488
  }
6489
+ toggleAudioOnlyMode(enabled, options) {
6490
+ this.store.dispatch(doToggleAudioOnlyMode(Object.assign({ enabled }, options)));
6491
+ }
5944
6492
  toggleWidescreenMode(enabled) {
5945
6493
  this.store.dispatch(toggleWidescreenModeEnabled({ enabled }));
5946
6494
  }
@@ -6013,6 +6561,15 @@ class RoomConnectionClient extends BaseClient {
6013
6561
  endMeeting(stayBehind = false) {
6014
6562
  this.store.dispatch(doEndMeeting({ stayBehind }));
6015
6563
  }
6564
+ startRoomIntegration(options) {
6565
+ this.store.dispatch(doStartRoomIntegration(options));
6566
+ }
6567
+ stopRoomIntegration(options) {
6568
+ this.store.dispatch(doStopRoomIntegration(options));
6569
+ }
6570
+ updateRoomIntegrationProps(options) {
6571
+ this.store.dispatch(doUpdateRoomIntegrationProps(options));
6572
+ }
6016
6573
  joinBreakoutGroup(group) {
6017
6574
  this.store.dispatch(doBreakoutJoin({ group }));
6018
6575
  }
@@ -6124,6 +6681,7 @@ class RoomConnectionClient extends BaseClient {
6124
6681
  this.fileUploadsSubscribers.clear();
6125
6682
  this.cloudRecordingSubscribers.clear();
6126
6683
  this.connectionErrorSubscribers.clear();
6684
+ this.audioOnlyModeSubscribers.clear();
6127
6685
  this.connectionStatusSubscribers.clear();
6128
6686
  this.liveStreamSubscribers.clear();
6129
6687
  this.localParticipantSubscribers.clear();
@@ -6165,6 +6723,7 @@ class WherebyClient {
6165
6723
  }
6166
6724
 
6167
6725
  exports.ACCEPTED_FILE_TYPES = ACCEPTED_FILE_TYPES;
6726
+ exports.AUDIO_ONLY_MODE_CHANGED = AUDIO_ONLY_MODE_CHANGED;
6168
6727
  exports.ApiClient = ApiClient;
6169
6728
  exports.BREAKOUT_CONFIG_CHANGED = BREAKOUT_CONFIG_CHANGED;
6170
6729
  exports.BREAKOUT_GROUPS_MIN_MAX = BREAKOUT_GROUPS_MIN_MAX;
@@ -6211,9 +6770,12 @@ exports.OrganizationApiClient = OrganizationApiClient;
6211
6770
  exports.OrganizationService = OrganizationService;
6212
6771
  exports.OrganizationServiceCache = OrganizationServiceCache;
6213
6772
  exports.REMOTE_PARTICIPANTS_CHANGED = REMOTE_PARTICIPANTS_CHANGED;
6773
+ exports.ROOM_INTEGRATION_PICKER_MESSAGES = ROOM_INTEGRATION_PICKER_MESSAGES;
6214
6774
  exports.ROOM_JOINED = ROOM_JOINED;
6215
6775
  exports.ROOM_JOINED_ERROR = ROOM_JOINED_ERROR;
6776
+ exports.RUNNING_ROOM_INTEGRATIONS_CHANGED = RUNNING_ROOM_INTEGRATIONS_CHANGED;
6216
6777
  exports.RoomConnectionClient = RoomConnectionClient;
6778
+ exports.RoomIntegrationService = RoomIntegrationService;
6217
6779
  exports.RoomService = RoomService;
6218
6780
  exports.SCREENSHARE_STARTED = SCREENSHARE_STARTED;
6219
6781
  exports.SCREENSHARE_STOPPED = SCREENSHARE_STOPPED;
@@ -6235,4 +6797,9 @@ exports.getUsableCameraEffectPresets = getUsableCameraEffectPresets;
6235
6797
  exports.getVideoTrack = getVideoTrack;
6236
6798
  exports.hasValue = hasValue;
6237
6799
  exports.isAudioDenoiserSupported = isAudioDenoiserSupported;
6800
+ exports.miro = miro;
6238
6801
  exports.parseUnverifiedRoomKeyData = parseUnverifiedRoomKeyData;
6802
+ exports.roomIntegrationContent = roomIntegrationContent;
6803
+ exports.roomIntegrationContentTagName = roomIntegrationContentTagName;
6804
+ exports.roomIntegrationPickerUrl = roomIntegrationPickerUrl;
6805
+ exports.youtube = youtube;