@whereby.com/core 1.21.2 → 1.22.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.
@@ -76,7 +76,7 @@ const createReactor = (selectors, callback) => {
76
76
  });
77
77
  };
78
78
 
79
- const coreVersion = "1.21.2";
79
+ const coreVersion = "1.22.0";
80
80
 
81
81
  function decodeRoomName(roomName) {
82
82
  if (!roomName) {
@@ -158,6 +158,11 @@ const signalEvents = {
158
158
  knockerLeft: createSignalEventAction("knockerLeft"),
159
159
  knockHandled: createSignalEventAction("knockHandled"),
160
160
  newClient: createSignalEventAction("newClient"),
161
+ roomIntegrationStarted: createSignalEventAction("roomIntegrationStarted"),
162
+ roomIntegrationStopped: createSignalEventAction("roomIntegrationStopped"),
163
+ roomIntegrationPropsUpdated: createSignalEventAction("roomIntegrationPropsUpdated"),
164
+ roomIntegrationEnabled: createSignalEventAction("roomIntegrationEnabled"),
165
+ roomIntegrationDisabled: createSignalEventAction("roomIntegrationDisabled"),
161
166
  roomJoined: createSignalEventAction("roomJoined"),
162
167
  roomKnocked: createSignalEventAction("roomKnocked"),
163
168
  roomLeft: createSignalEventAction("roomLeft"),
@@ -188,6 +193,7 @@ const ROOM_ACTION_PERMISSIONS_BY_ROLE = {
188
193
  canAskToSpeak: ["host"],
189
194
  canSpotlight: ["host"],
190
195
  canManageBreakout: ["host"],
196
+ canManageRoomIntegration: ["host"],
191
197
  };
192
198
  const authorizationSliceInitialState = {
193
199
  roomKey: null,
@@ -232,6 +238,7 @@ const selectIsAuthorizedToEndMeeting = toolkit.createSelector(selectAuthorizatio
232
238
  const selectIsAuthorizedToAskToSpeak = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canAskToSpeak.includes(localParticipantRole));
233
239
  const selectIsAuthorizedToSpotlight = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canSpotlight.includes(localParticipantRole));
234
240
  const selectIsAuthorizedToManageBreakout = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canManageBreakout.includes(localParticipantRole));
241
+ const selectIsAuthorizedToManageRoomIntegration = toolkit.createSelector(selectAuthorizationRoleName, (localParticipantRole) => ROOM_ACTION_PERMISSIONS_BY_ROLE.canManageRoomIntegration.includes(localParticipantRole));
235
242
 
236
243
  /******************************************************************************
237
244
  Copyright (c) Microsoft Corporation.
@@ -362,6 +369,11 @@ function forwardSocketEvents(socket, dispatch) {
362
369
  socket.on("video_enable_requested", (payload) => dispatch(signalEvents.videoEnableRequested(payload)));
363
370
  socket.on("breakout_group_joined", (payload) => dispatch(signalEvents.breakoutGroupJoined(payload)));
364
371
  socket.on("breakout_session_updated", (payload) => dispatch(signalEvents.breakoutSessionUpdated(payload)));
372
+ socket.on("room_integration_started", (payload) => dispatch(signalEvents.roomIntegrationStarted(payload)));
373
+ socket.on("room_integration_stopped", (payload) => dispatch(signalEvents.roomIntegrationStopped(payload)));
374
+ socket.on("room_integration_props_updated", (payload) => dispatch(signalEvents.roomIntegrationPropsUpdated(payload)));
375
+ socket.on("room_integration_enabled", (payload) => dispatch(signalEvents.roomIntegrationEnabled(payload)));
376
+ socket.on("room_integration_disabled", (payload) => dispatch(signalEvents.roomIntegrationDisabled(payload)));
365
377
  socket.on("breakout_move_to_group", () => dispatch(signalEvents.breakoutMoveToGroup()));
366
378
  socket.on("breakout_move_to_main", () => dispatch(signalEvents.breakoutMoveToMain()));
367
379
  socket.on("breakout_ending", () => dispatch(signalEvents.breakoutEnding()));
@@ -3465,6 +3477,386 @@ startAppListening({
3465
3477
  },
3466
3478
  });
3467
3479
 
3480
+ function roomIntegrationContentTagName(integrationName) {
3481
+ return `${integrationName}-integration-contentframe`;
3482
+ }
3483
+
3484
+ function isCustomElementName(value) {
3485
+ return typeof value === "string" && value === value.toLowerCase() && value.includes("-");
3486
+ }
3487
+ function isHttpsUrl(value) {
3488
+ if (typeof value !== "string") {
3489
+ return false;
3490
+ }
3491
+ try {
3492
+ return new URL(value).protocol === "https:";
3493
+ }
3494
+ catch (_a) {
3495
+ return false;
3496
+ }
3497
+ }
3498
+ function isValidProps(value) {
3499
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
3500
+ return false;
3501
+ }
3502
+ return Object.values(value).every((entry) => entry === null || ["string", "number", "boolean"].includes(typeof entry));
3503
+ }
3504
+ function parseMatcher(matcher) {
3505
+ if (typeof matcher !== "string") {
3506
+ return null;
3507
+ }
3508
+ const parts = matcher.match(/^\/([\s\S]*)\/([a-z]*)$/);
3509
+ if (!parts) {
3510
+ return null;
3511
+ }
3512
+ const flags = (parts[2] || "").replace(/[gy]/g, "");
3513
+ try {
3514
+ return new RegExp(parts[1], flags);
3515
+ }
3516
+ catch (_a) {
3517
+ return null;
3518
+ }
3519
+ }
3520
+ function parseRoomIntegration(response) {
3521
+ const { roomIntegrationId, name, title, description, type, icons, link, entrypoint, webview, isEmbeddable } = response || {};
3522
+ const matcher = parseMatcher(response === null || response === void 0 ? void 0 : response.matcher);
3523
+ if (roomIntegrationId === undefined ||
3524
+ roomIntegrationId === null ||
3525
+ !name ||
3526
+ !title ||
3527
+ !type ||
3528
+ !(icons === null || icons === void 0 ? void 0 : icons.small) ||
3529
+ !(icons === null || icons === void 0 ? void 0 : icons.large) ||
3530
+ !entrypoint ||
3531
+ !webview ||
3532
+ !matcher) {
3533
+ console.warn(`Ignoring malformed room integration: ${name || roomIntegrationId}`);
3534
+ return null;
3535
+ }
3536
+ return {
3537
+ roomIntegrationId: String(roomIntegrationId),
3538
+ name,
3539
+ title,
3540
+ description: description || "",
3541
+ type,
3542
+ contentTagName: roomIntegrationContentTagName(name),
3543
+ icons: { small: icons.small, large: icons.large },
3544
+ link: { href: (link === null || link === void 0 ? void 0 : link.href) || "", text: (link === null || link === void 0 ? void 0 : link.text) || "" },
3545
+ entrypoint,
3546
+ webview,
3547
+ matcher,
3548
+ isEmbeddable: isEmbeddable !== null && isEmbeddable !== void 0 ? isEmbeddable : false,
3549
+ };
3550
+ }
3551
+ function parseRoomIntegrationSession(event) {
3552
+ const { roomIntegrationId, roomIntegrationSessionId, breakoutGroupId, tagName, shareUrl, props, clientId, roomIntegrationSessionStartedAt, } = event || {};
3553
+ if (typeof roomIntegrationSessionId !== "string" ||
3554
+ roomIntegrationId === undefined ||
3555
+ roomIntegrationId === null ||
3556
+ typeof clientId !== "string" ||
3557
+ !isCustomElementName(tagName) ||
3558
+ !isHttpsUrl(shareUrl) ||
3559
+ !isValidProps(props)) {
3560
+ console.warn(`Ignoring malformed room integration session: ${roomIntegrationSessionId}`);
3561
+ return null;
3562
+ }
3563
+ return {
3564
+ roomIntegrationSessionId,
3565
+ roomIntegrationId: String(roomIntegrationId),
3566
+ breakoutGroupId: breakoutGroupId || "",
3567
+ tagName,
3568
+ shareUrl,
3569
+ props,
3570
+ clientId,
3571
+ roomIntegrationSessionStartedAt: typeof roomIntegrationSessionStartedAt === "number" && isFinite(roomIntegrationSessionStartedAt)
3572
+ ? roomIntegrationSessionStartedAt
3573
+ : null,
3574
+ };
3575
+ }
3576
+ const SIGNAL_ERROR_MESSAGES = {
3577
+ 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.`,
3578
+ forbidden: (action) => `Not allowed to ${action} this room integration (forbidden)`,
3579
+ missing_parameters: (action) => `Could not ${action} the room integration: the request was missing parameters`,
3580
+ invalid_parameters: (action) => `Could not ${action} the room integration: the request had invalid parameters`,
3581
+ internal_server_error: (action) => `The server failed to ${action} the room integration`,
3582
+ };
3583
+ function roomIntegrationSignalError(error, action) {
3584
+ if (!media.isRoomIntegrationErrorCode(error)) {
3585
+ return { code: "unknown", message: `Could not ${action} the room integration: ${error}` };
3586
+ }
3587
+ return { code: error, message: SIGNAL_ERROR_MESSAGES[error](action) };
3588
+ }
3589
+ const roomIntegrationsSliceInitialState = {
3590
+ available: [],
3591
+ unavailable: [],
3592
+ enabled: [],
3593
+ running: [],
3594
+ isFetching: false,
3595
+ hasFetched: false,
3596
+ error: null,
3597
+ };
3598
+ const roomIntegrationsSlice = toolkit.createSlice({
3599
+ name: "roomIntegrations",
3600
+ initialState: roomIntegrationsSliceInitialState,
3601
+ reducers: {
3602
+ setRoomIntegrationsError: (state, action) => {
3603
+ state.error = action.payload.error;
3604
+ },
3605
+ },
3606
+ extraReducers: (builder) => {
3607
+ builder.addCase(doFetchRoomIntegrations.pending, (state) => {
3608
+ state.isFetching = true;
3609
+ });
3610
+ builder.addCase(doFetchRoomIntegrations.fulfilled, (state, action) => {
3611
+ const { enabledRoomIntegrations, disabledRoomIntegrations, unavailableRoomIntegrations } = action.payload;
3612
+ const parse = (entries) => entries.map(parseRoomIntegration).filter((entry) => entry !== null);
3613
+ state.isFetching = false;
3614
+ state.hasFetched = true;
3615
+ state.error = null;
3616
+ state.available = [...parse(enabledRoomIntegrations), ...parse(disabledRoomIntegrations)];
3617
+ state.unavailable = parse(unavailableRoomIntegrations);
3618
+ state.enabled = enabledRoomIntegrations.map(({ roomIntegrationId }) => String(roomIntegrationId));
3619
+ });
3620
+ builder.addCase(doFetchRoomIntegrations.rejected, (state, action) => {
3621
+ state.isFetching = false;
3622
+ state.hasFetched = true;
3623
+ state.error = {
3624
+ code: "unknown",
3625
+ message: action.error.message || "Failed to fetch room integrations",
3626
+ };
3627
+ });
3628
+ builder.addCase(signalEvents.roomJoined, (state, action) => {
3629
+ if ("error" in action.payload) {
3630
+ return;
3631
+ }
3632
+ state.running = (action.payload.roomIntegrationSession || [])
3633
+ .map(parseRoomIntegrationSession)
3634
+ .filter((session) => session !== null);
3635
+ });
3636
+ builder.addCase(signalEvents.roomIntegrationStarted, (state, action) => {
3637
+ if ("error" in action.payload) {
3638
+ state.error = roomIntegrationSignalError(action.payload.error, "start");
3639
+ return;
3640
+ }
3641
+ const { roomIntegrationId, roomIntegrationSessionId, breakoutGroupId, roomIntegrationSessionStartedAt } = action.payload;
3642
+ const session = parseRoomIntegrationSession(Object.assign(Object.assign({}, action.payload.state), { roomIntegrationId,
3643
+ roomIntegrationSessionId,
3644
+ breakoutGroupId,
3645
+ roomIntegrationSessionStartedAt }));
3646
+ if (!session) {
3647
+ return;
3648
+ }
3649
+ const existing = state.running.findIndex((running) => running.roomIntegrationSessionId === session.roomIntegrationSessionId);
3650
+ if (existing >= 0) {
3651
+ state.running[existing] = session;
3652
+ return;
3653
+ }
3654
+ state.running.push(session);
3655
+ });
3656
+ builder.addCase(signalEvents.roomIntegrationStopped, (state, action) => {
3657
+ if ("error" in action.payload) {
3658
+ state.error = roomIntegrationSignalError(action.payload.error, "stop");
3659
+ return;
3660
+ }
3661
+ const { roomIntegrationSessionId } = action.payload;
3662
+ state.running = state.running.filter((running) => running.roomIntegrationSessionId !== roomIntegrationSessionId);
3663
+ });
3664
+ builder.addCase(signalEvents.roomIntegrationPropsUpdated, (state, action) => {
3665
+ if ("error" in action.payload) {
3666
+ state.error = roomIntegrationSignalError(action.payload.error, "update the props of");
3667
+ return;
3668
+ }
3669
+ const { roomIntegrationSessionId, props } = action.payload;
3670
+ const session = state.running.find((running) => running.roomIntegrationSessionId === roomIntegrationSessionId);
3671
+ if (!session || !isValidProps(props)) {
3672
+ return;
3673
+ }
3674
+ session.props = Object.assign(Object.assign({}, session.props), props);
3675
+ });
3676
+ builder.addCase(signalEvents.roomIntegrationEnabled, (state, action) => {
3677
+ const roomIntegrationId = String(action.payload.roomIntegrationId);
3678
+ if (!state.enabled.includes(roomIntegrationId)) {
3679
+ state.enabled.push(roomIntegrationId);
3680
+ }
3681
+ });
3682
+ builder.addCase(signalEvents.roomIntegrationDisabled, (state, action) => {
3683
+ const roomIntegrationId = String(action.payload.roomIntegrationId);
3684
+ state.enabled = state.enabled.filter((id) => id !== roomIntegrationId);
3685
+ });
3686
+ },
3687
+ });
3688
+ const { setRoomIntegrationsError } = roomIntegrationsSlice.actions;
3689
+ const doFetchRoomIntegrations = createAppAsyncThunk("roomIntegrations/doFetchRoomIntegrations", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { extra, getState }) {
3690
+ const state = getState();
3691
+ const organizationId = selectOrganizationId(state);
3692
+ const roomName = selectAppRoomName(state);
3693
+ if (!organizationId || !roomName) {
3694
+ throw new Error("Cannot fetch room integrations before the organization and room are known");
3695
+ }
3696
+ return extra.services.roomIntegrationService.findRoomIntegrations({ organizationId, roomName });
3697
+ }));
3698
+ const doStartRoomIntegration = createRoomConnectedThunk((payload) => (dispatch, getState) => {
3699
+ var _a;
3700
+ const state = getState();
3701
+ const { roomIntegrationId, tagName, shareUrl, props = {} } = payload;
3702
+ const integration = selectRoomIntegrationsRaw(state).available.find((entry) => entry.roomIntegrationId === roomIntegrationId);
3703
+ if (!integration) {
3704
+ dispatch(setRoomIntegrationsError({
3705
+ error: {
3706
+ code: "unknown_integration",
3707
+ message: `Unknown room integration: ${roomIntegrationId}`,
3708
+ },
3709
+ }));
3710
+ return;
3711
+ }
3712
+ if (!selectRoomIntegrationsEnabled(state).includes(roomIntegrationId)) {
3713
+ dispatch(setRoomIntegrationsError({
3714
+ error: {
3715
+ code: "integration_not_enabled",
3716
+ message: `Room integration is not enabled for this room: ${integration.name}`,
3717
+ },
3718
+ }));
3719
+ return;
3720
+ }
3721
+ if (!isCustomElementName(tagName)) {
3722
+ dispatch(setRoomIntegrationsError({
3723
+ error: {
3724
+ code: "invalid_content",
3725
+ message: `tagName must be a valid custom element name, got: ${tagName}`,
3726
+ },
3727
+ }));
3728
+ return;
3729
+ }
3730
+ if (!isHttpsUrl(shareUrl)) {
3731
+ dispatch(setRoomIntegrationsError({
3732
+ error: {
3733
+ code: "invalid_content",
3734
+ message: `shareUrl must be an https url, got: ${shareUrl}`,
3735
+ },
3736
+ }));
3737
+ return;
3738
+ }
3739
+ if (!isValidProps(props)) {
3740
+ dispatch(setRoomIntegrationsError({
3741
+ error: {
3742
+ code: "invalid_content",
3743
+ message: "props must be a flat object of primitive values",
3744
+ },
3745
+ }));
3746
+ return;
3747
+ }
3748
+ const clientId = selectSelfId(state);
3749
+ if (!clientId) {
3750
+ return;
3751
+ }
3752
+ dispatch(setRoomIntegrationsError({ error: null }));
3753
+ const request = {
3754
+ roomIntegrationId: Number(roomIntegrationId),
3755
+ breakoutGroupId: selectBreakoutCurrentId(state) || null,
3756
+ state: { tagName, shareUrl, props, clientId },
3757
+ };
3758
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("start_room_integration", request);
3759
+ });
3760
+ const ROOM_INTEGRATION_PICKER_MESSAGES = {
3761
+ FORM_SUBMIT: "whereby:formSubmit",
3762
+ FORM_CLOSE: "whereby:formClose",
3763
+ ERROR: "whereby:bootstrapError",
3764
+ };
3765
+ function roomIntegrationPickerUrl({ integration, parentOrigin, featureSource, }) {
3766
+ const url = new URL("bootstrap.html", integration.webview);
3767
+ url.searchParams.set("parentOrigin", parentOrigin);
3768
+ if (featureSource) {
3769
+ url.searchParams.set("featuresource", featureSource);
3770
+ }
3771
+ return url.href;
3772
+ }
3773
+ const doStopRoomIntegration = createRoomConnectedThunk((payload) => (dispatch, getState) => {
3774
+ var _a;
3775
+ const state = getState();
3776
+ const { roomIntegrationSessionId, intent = "stop" } = payload;
3777
+ const session = selectRunningRoomIntegrations(state).find((running) => running.roomIntegrationSessionId === roomIntegrationSessionId);
3778
+ if (!session) {
3779
+ dispatch(setRoomIntegrationsError({
3780
+ error: {
3781
+ code: "unknown_integration",
3782
+ message: `No running room integration with session id: ${roomIntegrationSessionId}`,
3783
+ },
3784
+ }));
3785
+ return;
3786
+ }
3787
+ if (!session.canStop) {
3788
+ dispatch(setRoomIntegrationsError({
3789
+ error: {
3790
+ code: "not_allowed_to_stop",
3791
+ message: "Only the participant who started a room integration, or a host, can stop it",
3792
+ },
3793
+ }));
3794
+ return;
3795
+ }
3796
+ dispatch(setRoomIntegrationsError({ error: null }));
3797
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("stop_room_integration", { roomIntegrationSessionId, intent });
3798
+ });
3799
+ const doUpdateRoomIntegrationProps = createRoomConnectedThunk((payload) => (dispatch, getState) => {
3800
+ var _a;
3801
+ const state = getState();
3802
+ const { roomIntegrationSessionId, props } = payload;
3803
+ if (!isValidProps(props)) {
3804
+ dispatch(setRoomIntegrationsError({
3805
+ error: {
3806
+ code: "invalid_content",
3807
+ message: "props must be a flat object of primitive values",
3808
+ },
3809
+ }));
3810
+ return;
3811
+ }
3812
+ (_a = selectSignalConnectionRaw(state).socket) === null || _a === void 0 ? void 0 : _a.emit("update_room_integration_props", {
3813
+ roomIntegrationSessionId,
3814
+ props,
3815
+ });
3816
+ });
3817
+ const selectRoomIntegrationsRaw = (state) => state.roomIntegrations;
3818
+ const selectRoomIntegrationsError = (state) => state.roomIntegrations.error;
3819
+ const selectRoomIntegrationsIsFetching = (state) => state.roomIntegrations.isFetching;
3820
+ const selectRoomIntegrationsHasFetched = (state) => state.roomIntegrations.hasFetched;
3821
+ const selectRoomIntegrationsEnabled = (state) => state.roomIntegrations.enabled;
3822
+ const selectAvailableRoomIntegrations = (state) => state.roomIntegrations.available;
3823
+ const selectUnavailableRoomIntegrations = (state) => state.roomIntegrations.unavailable;
3824
+ const selectEnabledRoomIntegrations = toolkit.createSelector(selectAvailableRoomIntegrations, selectRoomIntegrationsEnabled, (available, enabled) => available.filter((integration) => enabled.includes(integration.roomIntegrationId)));
3825
+ const selectEmbeddableRoomIntegrations = toolkit.createSelector(selectEnabledRoomIntegrations, (enabled) => enabled.filter((integration) => integration.isEmbeddable));
3826
+ const selectRunningRoomIntegrations = toolkit.createSelector(selectRoomIntegrationsRaw, selectEnabledRoomIntegrations, selectBreakoutActive, selectBreakoutCurrentId, selectSelfId, selectRemoteParticipants, selectIsAuthorizedToManageRoomIntegration, (raw, enabledIntegrations, breakoutActive, breakoutCurrentId, selfId, remoteParticipants, canManageRoomIntegration) => {
3827
+ const currentGroupId = breakoutActive ? breakoutCurrentId : "";
3828
+ return raw.running.reduce((acc, session) => {
3829
+ var _a;
3830
+ if (session.breakoutGroupId !== currentGroupId) {
3831
+ return acc;
3832
+ }
3833
+ const integration = enabledIntegrations.find((entry) => entry.roomIntegrationId === session.roomIntegrationId);
3834
+ if (!integration) {
3835
+ return acc;
3836
+ }
3837
+ const isPresenter = !!selfId && session.clientId === selfId;
3838
+ acc.push(Object.assign(Object.assign({}, session), { integration,
3839
+ isPresenter, canStop: isPresenter || canManageRoomIntegration, presenterDisplayName: isPresenter
3840
+ ? null
3841
+ : ((_a = remoteParticipants.find((participant) => participant.id === session.clientId)) === null || _a === void 0 ? void 0 : _a.displayName) ||
3842
+ null }));
3843
+ return acc;
3844
+ }, []);
3845
+ });
3846
+ const selectIsRoomIntegrationRunning = toolkit.createSelector(selectRunningRoomIntegrations, (running) => running.length > 0);
3847
+ const selectRoomIntegrationForUrl = toolkit.createSelector(selectEmbeddableRoomIntegrations, (integrations) => (url) => integrations.find((integration) => integration.matcher.test(url)) || null);
3848
+ const selectShouldFetchRoomIntegrations = toolkit.createSelector(selectAppIsActive, selectRoomConnectionStatus, selectOrganizationId, selectAppRoomName, selectRoomIntegrationsRaw, (appIsActive, connectionStatus, organizationId, roomName, raw) => appIsActive &&
3849
+ connectionStatus === "connected" &&
3850
+ !!organizationId &&
3851
+ !!roomName &&
3852
+ !raw.hasFetched &&
3853
+ !raw.isFetching);
3854
+ createReactor([selectShouldFetchRoomIntegrations], ({ dispatch }, shouldFetchRoomIntegrations) => {
3855
+ if (shouldFetchRoomIntegrations) {
3856
+ dispatch(doFetchRoomIntegrations());
3857
+ }
3858
+ });
3859
+
3468
3860
  function createRtcAnalyticsCustomEvent(parameters) {
3469
3861
  return parameters;
3470
3862
  }
@@ -4077,6 +4469,7 @@ const appReducer = toolkit.combineReducers({
4077
4469
  remoteParticipants: remoteParticipantsSlice.reducer,
4078
4470
  room: roomSlice.reducer,
4079
4471
  roomConnection: roomConnectionSlice.reducer,
4472
+ roomIntegrations: roomIntegrationsSlice.reducer,
4080
4473
  rtcAnalytics: rtcAnalyticsSlice.reducer,
4081
4474
  rtcConnection: rtcConnectionSlice.reducer,
4082
4475
  signalConnection: signalConnectionSlice.reducer,
@@ -4817,6 +5210,40 @@ class OrganizationServiceCache {
4817
5210
  }
4818
5211
  }
4819
5212
 
5213
+ function roomPath(organizationId, roomName, suffix = "") {
5214
+ const encodedRoomName = encodeURIComponent(roomName.replace(/^\//, ""));
5215
+ return `/organizations/${encodeURIComponent(organizationId)}/room/${encodedRoomName}${suffix}`;
5216
+ }
5217
+ function asArray(value) {
5218
+ return Array.isArray(value) ? value : [];
5219
+ }
5220
+ class RoomIntegrationService {
5221
+ constructor({ apiClient }) {
5222
+ this._apiClient = apiClient;
5223
+ }
5224
+ findRoomIntegrations(_a) {
5225
+ return __awaiter(this, arguments, void 0, function* ({ organizationId, roomName, }) {
5226
+ const response = yield this._apiClient.request(roomPath(organizationId, roomName, "/room-integrations"), {
5227
+ method: "GET",
5228
+ });
5229
+ const data = (response.data || {});
5230
+ return {
5231
+ enabledRoomIntegrations: asArray(data.enabledRoomIntegrations),
5232
+ disabledRoomIntegrations: asArray(data.disabledRoomIntegrations),
5233
+ unavailableRoomIntegrations: asArray(data.unavailableRoomIntegrations),
5234
+ };
5235
+ });
5236
+ }
5237
+ toggleRoomIntegration(_a) {
5238
+ return __awaiter(this, arguments, void 0, function* ({ organizationId, roomName, roomIntegrationId, enable, }) {
5239
+ yield this._apiClient.request(roomPath(organizationId, roomName, `/room-integrations/${roomIntegrationId}`), {
5240
+ method: "PUT",
5241
+ data: { enable },
5242
+ });
5243
+ });
5244
+ }
5245
+ }
5246
+
4820
5247
  const API_BASE_URL = "https://api.whereby.dev";
4821
5248
  function createServices() {
4822
5249
  const credentialsService = CredentialsService.create({
@@ -4827,6 +5254,7 @@ function createServices() {
4827
5254
  baseUrl: API_BASE_URL,
4828
5255
  });
4829
5256
  const organizationService = new OrganizationService({ apiClient });
5257
+ const roomIntegrationService = new RoomIntegrationService({ apiClient });
4830
5258
  const fetchOrganizationFromRoomUrl = (roomUrl) => {
4831
5259
  const roomUrlObj = new URL(roomUrl);
4832
5260
  const urls = media.fromLocation({ host: roomUrlObj.host });
@@ -4840,6 +5268,7 @@ function createServices() {
4840
5268
  credentialsService,
4841
5269
  apiClient,
4842
5270
  organizationService,
5271
+ roomIntegrationService,
4843
5272
  fetchOrganizationFromRoomUrl,
4844
5273
  };
4845
5274
  }
@@ -4850,6 +5279,7 @@ exports.BREAKOUT_UNAVAILABLE_ERROR = BREAKOUT_UNAVAILABLE_ERROR;
4850
5279
  exports.DEFAULT_BREAKOUT_TIMER_DURATION = DEFAULT_BREAKOUT_TIMER_DURATION;
4851
5280
  exports.MAX_FILES_PER_UPLOAD = MAX_FILES_PER_UPLOAD;
4852
5281
  exports.MAX_FILE_SIZE = MAX_FILE_SIZE;
5282
+ exports.ROOM_INTEGRATION_PICKER_MESSAGES = ROOM_INTEGRATION_PICKER_MESSAGES;
4853
5283
  exports.addAppListener = addAppListener;
4854
5284
  exports.addSpotlight = addSpotlight;
4855
5285
  exports.appSlice = appSlice;
@@ -4902,6 +5332,7 @@ exports.doEnableAudio = doEnableAudio;
4902
5332
  exports.doEnableVideo = doEnableVideo;
4903
5333
  exports.doEndMeeting = doEndMeeting;
4904
5334
  exports.doExtendBreakoutTimer = doExtendBreakoutTimer;
5335
+ exports.doFetchRoomIntegrations = doFetchRoomIntegrations;
4905
5336
  exports.doGetDeviceCredentials = doGetDeviceCredentials;
4906
5337
  exports.doHandleAcceptStreams = doHandleAcceptStreams;
4907
5338
  exports.doHandleStreamingStarted = doHandleStreamingStarted;
@@ -4940,6 +5371,7 @@ exports.doStartConnectionMonitor = doStartConnectionMonitor;
4940
5371
  exports.doStartLiveCaptions = doStartLiveCaptions;
4941
5372
  exports.doStartLiveTranscription = doStartLiveTranscription;
4942
5373
  exports.doStartLocalMedia = doStartLocalMedia;
5374
+ exports.doStartRoomIntegration = doStartRoomIntegration;
4943
5375
  exports.doStartScreenshare = doStartScreenshare;
4944
5376
  exports.doStopBreakoutSession = doStopBreakoutSession;
4945
5377
  exports.doStopBreakoutTimer = doStopBreakoutTimer;
@@ -4948,6 +5380,7 @@ exports.doStopConnectionMonitor = doStopConnectionMonitor;
4948
5380
  exports.doStopLiveCaptions = doStopLiveCaptions;
4949
5381
  exports.doStopLiveTranscription = doStopLiveTranscription;
4950
5382
  exports.doStopLocalMedia = doStopLocalMedia;
5383
+ exports.doStopRoomIntegration = doStopRoomIntegration;
4951
5384
  exports.doStopScreenshare = doStopScreenshare;
4952
5385
  exports.doSwitchLocalStream = doSwitchLocalStream;
4953
5386
  exports.doToggleCamera = doToggleCamera;
@@ -4955,6 +5388,7 @@ exports.doTriggerLocalStreamRefresh = doTriggerLocalStreamRefresh;
4955
5388
  exports.doUnassignAllBreakoutParticipants = doUnassignAllBreakoutParticipants;
4956
5389
  exports.doUpdateBreakoutSession = doUpdateBreakoutSession;
4957
5390
  exports.doUpdateDeviceList = doUpdateDeviceList;
5391
+ exports.doUpdateRoomIntegrationProps = doUpdateRoomIntegrationProps;
4958
5392
  exports.fileShareRequestSettled = fileShareRequestSettled;
4959
5393
  exports.fileShareSlice = fileShareSlice;
4960
5394
  exports.fileShareSliceInitialState = fileShareSliceInitialState;
@@ -4983,6 +5417,8 @@ exports.notificationsSlice = notificationsSlice;
4983
5417
  exports.observeStore = observeStore;
4984
5418
  exports.organizationSlice = organizationSlice;
4985
5419
  exports.organizationSliceInitialState = organizationSliceInitialState;
5420
+ exports.parseRoomIntegration = parseRoomIntegration;
5421
+ exports.parseRoomIntegrationSession = parseRoomIntegrationSession;
4986
5422
  exports.participantStreamAdded = participantStreamAdded;
4987
5423
  exports.participantStreamIdAdded = participantStreamIdAdded;
4988
5424
  exports.recordingRequestStarted = recordingRequestStarted;
@@ -4992,6 +5428,10 @@ exports.removeSpotlight = removeSpotlight;
4992
5428
  exports.resolutionReported = resolutionReported;
4993
5429
  exports.roomConnectionSlice = roomConnectionSlice;
4994
5430
  exports.roomConnectionSliceInitialState = roomConnectionSliceInitialState;
5431
+ exports.roomIntegrationPickerUrl = roomIntegrationPickerUrl;
5432
+ exports.roomIntegrationSignalError = roomIntegrationSignalError;
5433
+ exports.roomIntegrationsSlice = roomIntegrationsSlice;
5434
+ exports.roomIntegrationsSliceInitialState = roomIntegrationsSliceInitialState;
4995
5435
  exports.roomSlice = roomSlice;
4996
5436
  exports.roomSliceInitialState = roomSliceInitialState;
4997
5437
  exports.rootReducer = rootReducer;
@@ -5025,6 +5465,7 @@ exports.selectAppRoomUrl = selectAppRoomUrl;
5025
5465
  exports.selectAppUserAgent = selectAppUserAgent;
5026
5466
  exports.selectAssistantKey = selectAssistantKey;
5027
5467
  exports.selectAuthorizationRoleName = selectAuthorizationRoleName;
5468
+ exports.selectAvailableRoomIntegrations = selectAvailableRoomIntegrations;
5028
5469
  exports.selectBreakoutActive = selectBreakoutActive;
5029
5470
  exports.selectBreakoutAssignments = selectBreakoutAssignments;
5030
5471
  exports.selectBreakoutAutoMoveToGroup = selectBreakoutAutoMoveToGroup;
@@ -5062,6 +5503,8 @@ exports.selectCurrentMicrophoneDeviceId = selectCurrentMicrophoneDeviceId;
5062
5503
  exports.selectCurrentSpeakerDeviceId = selectCurrentSpeakerDeviceId;
5063
5504
  exports.selectDeviceCredentialsRaw = selectDeviceCredentialsRaw;
5064
5505
  exports.selectDeviceId = selectDeviceId;
5506
+ exports.selectEmbeddableRoomIntegrations = selectEmbeddableRoomIntegrations;
5507
+ exports.selectEnabledRoomIntegrations = selectEnabledRoomIntegrations;
5065
5508
  exports.selectFileShareRaw = selectFileShareRaw;
5066
5509
  exports.selectFileShareRequestInFlight = selectFileShareRequestInFlight;
5067
5510
  exports.selectFileUploads = selectFileUploads;
@@ -5072,6 +5515,7 @@ exports.selectIsAuthorizedToEndMeeting = selectIsAuthorizedToEndMeeting;
5072
5515
  exports.selectIsAuthorizedToKickClient = selectIsAuthorizedToKickClient;
5073
5516
  exports.selectIsAuthorizedToLockRoom = selectIsAuthorizedToLockRoom;
5074
5517
  exports.selectIsAuthorizedToManageBreakout = selectIsAuthorizedToManageBreakout;
5518
+ exports.selectIsAuthorizedToManageRoomIntegration = selectIsAuthorizedToManageRoomIntegration;
5075
5519
  exports.selectIsAuthorizedToRequestAudioEnable = selectIsAuthorizedToRequestAudioEnable;
5076
5520
  exports.selectIsAuthorizedToRequestScreenshareEnable = selectIsAuthorizedToRequestScreenshareEnable;
5077
5521
  exports.selectIsAuthorizedToRequestVideoEnable = selectIsAuthorizedToRequestVideoEnable;
@@ -5085,6 +5529,7 @@ exports.selectIsLocalMediaStarting = selectIsLocalMediaStarting;
5085
5529
  exports.selectIsLocalParticipantSpotlighted = selectIsLocalParticipantSpotlighted;
5086
5530
  exports.selectIsLowDataModeEnabled = selectIsLowDataModeEnabled;
5087
5531
  exports.selectIsMicrophoneEnabled = selectIsMicrophoneEnabled;
5532
+ exports.selectIsRoomIntegrationRunning = selectIsRoomIntegrationRunning;
5088
5533
  exports.selectIsSettingCameraDevice = selectIsSettingCameraDevice;
5089
5534
  exports.selectIsSettingMicrophoneDevice = selectIsSettingMicrophoneDevice;
5090
5535
  exports.selectIsToggleCamera = selectIsToggleCamera;
@@ -5143,6 +5588,12 @@ exports.selectRoomConnectionRaw = selectRoomConnectionRaw;
5143
5588
  exports.selectRoomConnectionSession = selectRoomConnectionSession;
5144
5589
  exports.selectRoomConnectionSessionId = selectRoomConnectionSessionId;
5145
5590
  exports.selectRoomConnectionStatus = selectRoomConnectionStatus;
5591
+ exports.selectRoomIntegrationForUrl = selectRoomIntegrationForUrl;
5592
+ exports.selectRoomIntegrationsEnabled = selectRoomIntegrationsEnabled;
5593
+ exports.selectRoomIntegrationsError = selectRoomIntegrationsError;
5594
+ exports.selectRoomIntegrationsHasFetched = selectRoomIntegrationsHasFetched;
5595
+ exports.selectRoomIntegrationsIsFetching = selectRoomIntegrationsIsFetching;
5596
+ exports.selectRoomIntegrationsRaw = selectRoomIntegrationsRaw;
5146
5597
  exports.selectRoomIsLocked = selectRoomIsLocked;
5147
5598
  exports.selectRoomKey = selectRoomKey;
5148
5599
  exports.selectRoomMode = selectRoomMode;
@@ -5152,6 +5603,7 @@ exports.selectRtcIsCreatingDispatcher = selectRtcIsCreatingDispatcher;
5152
5603
  exports.selectRtcManager = selectRtcManager;
5153
5604
  exports.selectRtcManagerInitialized = selectRtcManagerInitialized;
5154
5605
  exports.selectRtcStatus = selectRtcStatus;
5606
+ exports.selectRunningRoomIntegrations = selectRunningRoomIntegrations;
5155
5607
  exports.selectScreenshares = selectScreenshares;
5156
5608
  exports.selectSelfId = selectSelfId;
5157
5609
  exports.selectShouldApplyInitialMuteStates = selectShouldApplyInitialMuteStates;
@@ -5161,6 +5613,7 @@ exports.selectShouldConnectSignal = selectShouldConnectSignal;
5161
5613
  exports.selectShouldDisconnectRtc = selectShouldDisconnectRtc;
5162
5614
  exports.selectShouldFetchDeviceCredentials = selectShouldFetchDeviceCredentials;
5163
5615
  exports.selectShouldFetchOrganization = selectShouldFetchOrganization;
5616
+ exports.selectShouldFetchRoomIntegrations = selectShouldFetchRoomIntegrations;
5164
5617
  exports.selectShouldIdentifyDevice = selectShouldIdentifyDevice;
5165
5618
  exports.selectShouldInitializeRtc = selectShouldInitializeRtc;
5166
5619
  exports.selectShouldStartConnectionMonitor = selectShouldStartConnectionMonitor;
@@ -5177,6 +5630,7 @@ exports.selectSpotlightsRaw = selectSpotlightsRaw;
5177
5630
  exports.selectStopCallbackFunction = selectStopCallbackFunction;
5178
5631
  exports.selectStreamingRaw = selectStreamingRaw;
5179
5632
  exports.selectStreamsToAccept = selectStreamsToAccept;
5633
+ exports.selectUnavailableRoomIntegrations = selectUnavailableRoomIntegrations;
5180
5634
  exports.selectWaitingParticipants = selectWaitingParticipants;
5181
5635
  exports.selectWaitingParticipantsRaw = selectWaitingParticipantsRaw;
5182
5636
  exports.setBreakoutError = setBreakoutError;
@@ -5187,6 +5641,7 @@ exports.setCurrentSpeakerDeviceId = setCurrentSpeakerDeviceId;
5187
5641
  exports.setDisplayName = setDisplayName;
5188
5642
  exports.setLocalMediaOptions = setLocalMediaOptions;
5189
5643
  exports.setLocalMediaStream = setLocalMediaStream;
5644
+ exports.setRoomIntegrationsError = setRoomIntegrationsError;
5190
5645
  exports.setRoomKey = setRoomKey;
5191
5646
  exports.signalConnectionSlice = signalConnectionSlice;
5192
5647
  exports.signalConnectionSliceInitialState = signalConnectionSliceInitialState;