@whereby.com/core 1.24.0 → 1.25.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 +308 -253
- package/dist/index.d.cts +18 -2
- package/dist/index.d.mts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.mjs +308 -254
- package/dist/legacy-esm.js +308 -254
- package/dist/redux/index.cjs +294 -250
- package/dist/redux/index.d.cts +41 -20
- package/dist/redux/index.d.mts +41 -20
- package/dist/redux/index.d.ts +41 -20
- package/dist/redux/index.js +293 -251
- package/dist/redux/index.mjs +293 -251
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1310,7 +1310,7 @@ const createReactor = (selectors, callback) => {
|
|
|
1310
1310
|
});
|
|
1311
1311
|
};
|
|
1312
1312
|
|
|
1313
|
-
const coreVersion = "1.
|
|
1313
|
+
const coreVersion = "1.25.0";
|
|
1314
1314
|
|
|
1315
1315
|
function decodeRoomName(roomName) {
|
|
1316
1316
|
if (!roomName) {
|
|
@@ -1364,6 +1364,12 @@ const selectAppIsNodeSdk = (state) => state.app.isNodeSdk;
|
|
|
1364
1364
|
const selectAppInitialMuteStates = (state) => state.app.initialMuteStates;
|
|
1365
1365
|
const selectAppIgnoreBreakoutGroups = (state) => state.app.ignoreBreakoutGroups;
|
|
1366
1366
|
|
|
1367
|
+
const NON_RECONNECTING_DISCONNECT_REASONS = ["io server disconnect", "io client disconnect"];
|
|
1368
|
+
function createSignalDisconnectEvent(reason) {
|
|
1369
|
+
return {
|
|
1370
|
+
willReconnect: !!reason && !NON_RECONNECTING_DISCONNECT_REASONS.includes(reason),
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1367
1373
|
function createSignalEventAction(name) {
|
|
1368
1374
|
return toolkit.createAction(`signalConnection/event/${name}`);
|
|
1369
1375
|
}
|
|
@@ -1581,7 +1587,7 @@ function forwardSocketEvents(socket, dispatch) {
|
|
|
1581
1587
|
dispatch(signalEvents.chatMessage(payload));
|
|
1582
1588
|
});
|
|
1583
1589
|
socket.on("chat_message_removed", (payload) => dispatch(signalEvents.chatMessageRemoved(payload)));
|
|
1584
|
-
socket.on("disconnect", () => dispatch(signalEvents.disconnect()));
|
|
1590
|
+
socket.on("disconnect", (reason) => dispatch(signalEvents.disconnect(createSignalDisconnectEvent(reason))));
|
|
1585
1591
|
socket.on("room_knocked", (payload) => dispatch(signalEvents.roomKnocked(payload)));
|
|
1586
1592
|
socket.on("room_left", () => dispatch(signalEvents.roomLeft()));
|
|
1587
1593
|
socket.on("room_locked", (payload) => dispatch(signalEvents.roomLocked(payload)));
|
|
@@ -2558,6 +2564,271 @@ const selectRoomConnectionSessionId = (state) => { var _a; return (_a = state.ro
|
|
|
2558
2564
|
const selectRoomConnectionStatus = (state) => state.roomConnection.status;
|
|
2559
2565
|
const selectRoomConnectionError = (state) => state.roomConnection.error;
|
|
2560
2566
|
const selectRoomConnectionKnockResponse = (state) => state.roomConnection.knockResponse;
|
|
2567
|
+
const selectRoomConnectionIsRejoining = (state) => state.roomConnection.isRejoining;
|
|
2568
|
+
|
|
2569
|
+
const organizationSliceInitialState = {
|
|
2570
|
+
data: null,
|
|
2571
|
+
isFetching: false,
|
|
2572
|
+
error: null,
|
|
2573
|
+
};
|
|
2574
|
+
const organizationSlice = toolkit.createSlice({
|
|
2575
|
+
name: "organization",
|
|
2576
|
+
initialState: organizationSliceInitialState,
|
|
2577
|
+
reducers: {},
|
|
2578
|
+
extraReducers: (builder) => {
|
|
2579
|
+
builder.addCase(doOrganizationFetch.pending, (state) => {
|
|
2580
|
+
return Object.assign(Object.assign({}, state), { isFetching: true });
|
|
2581
|
+
});
|
|
2582
|
+
builder.addCase(doOrganizationFetch.fulfilled, (state, action) => {
|
|
2583
|
+
if (!action.payload)
|
|
2584
|
+
return Object.assign(Object.assign({}, state), { isFetching: true });
|
|
2585
|
+
return Object.assign(Object.assign({}, state), { isFetching: false, data: action.payload });
|
|
2586
|
+
});
|
|
2587
|
+
builder.addCase(doOrganizationFetch.rejected, (state) => {
|
|
2588
|
+
return Object.assign(Object.assign({}, state), { isFetching: false, error: true });
|
|
2589
|
+
});
|
|
2590
|
+
},
|
|
2591
|
+
});
|
|
2592
|
+
const doOrganizationFetch = createAppAsyncThunk("organization/doOrganizationFetch", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { extra, getState }) {
|
|
2593
|
+
try {
|
|
2594
|
+
const roomUrl = selectAppRoomUrl(getState());
|
|
2595
|
+
const organization = yield extra.services.fetchOrganizationFromRoomUrl(roomUrl || "");
|
|
2596
|
+
if (!organization) {
|
|
2597
|
+
throw new Error("Invalid room url");
|
|
2598
|
+
}
|
|
2599
|
+
return organization;
|
|
2600
|
+
}
|
|
2601
|
+
catch (error) {
|
|
2602
|
+
console.error(error);
|
|
2603
|
+
}
|
|
2604
|
+
}));
|
|
2605
|
+
const selectOrganizationRaw = (state) => state.organization;
|
|
2606
|
+
const selectOrganizationId = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.organizationId; };
|
|
2607
|
+
const selectOrganizationPreferences = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.preferences; };
|
|
2608
|
+
const selectShouldFetchOrganization = toolkit.createSelector(selectAppIsActive, selectOrganizationRaw, selectDeviceCredentialsRaw, (appIsActive, organization, deviceCredentials) => {
|
|
2609
|
+
if (appIsActive &&
|
|
2610
|
+
!organization.data &&
|
|
2611
|
+
!organization.isFetching &&
|
|
2612
|
+
!organization.error &&
|
|
2613
|
+
!deviceCredentials.isFetching) {
|
|
2614
|
+
return true;
|
|
2615
|
+
}
|
|
2616
|
+
return false;
|
|
2617
|
+
});
|
|
2618
|
+
createReactor([selectShouldFetchOrganization], ({ dispatch }, shouldFetchOrganization) => {
|
|
2619
|
+
if (shouldFetchOrganization) {
|
|
2620
|
+
dispatch(doOrganizationFetch());
|
|
2621
|
+
}
|
|
2622
|
+
});
|
|
2623
|
+
|
|
2624
|
+
const roomConnectionSliceInitialState = {
|
|
2625
|
+
session: null,
|
|
2626
|
+
status: "ready",
|
|
2627
|
+
error: null,
|
|
2628
|
+
knockResponse: null,
|
|
2629
|
+
isRejoining: false,
|
|
2630
|
+
};
|
|
2631
|
+
const roomConnectionSlice = toolkit.createSlice({
|
|
2632
|
+
name: "roomConnection",
|
|
2633
|
+
initialState: roomConnectionSliceInitialState,
|
|
2634
|
+
reducers: {
|
|
2635
|
+
connectionStatusChanged: (state, action) => {
|
|
2636
|
+
return Object.assign(Object.assign({}, state), { status: action.payload });
|
|
2637
|
+
},
|
|
2638
|
+
knockResponseReceived: (state, action) => {
|
|
2639
|
+
return Object.assign(Object.assign({}, state), { knockResponse: action.payload });
|
|
2640
|
+
},
|
|
2641
|
+
roomRejoined: (state, action) => {
|
|
2642
|
+
return state;
|
|
2643
|
+
},
|
|
2644
|
+
},
|
|
2645
|
+
extraReducers: (builder) => {
|
|
2646
|
+
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
2647
|
+
var _a;
|
|
2648
|
+
if ("error" in action.payload) {
|
|
2649
|
+
if (action.payload.error === "room_locked" && action.payload.isLocked) {
|
|
2650
|
+
return Object.assign(Object.assign({}, state), { status: "room_locked" });
|
|
2651
|
+
}
|
|
2652
|
+
return Object.assign(Object.assign({}, state), { status: "disconnected", error: action.payload.error, isRejoining: false });
|
|
2653
|
+
}
|
|
2654
|
+
const { room } = action.payload;
|
|
2655
|
+
return Object.assign(Object.assign({}, state), { status: "connected", session: (_a = room.session) !== null && _a !== void 0 ? _a : null, isRejoining: false });
|
|
2656
|
+
});
|
|
2657
|
+
builder.addCase(signalEvents.disconnect, (state, action) => {
|
|
2658
|
+
if (["kicked", "left"].includes(state.status)) {
|
|
2659
|
+
return Object.assign({}, state);
|
|
2660
|
+
}
|
|
2661
|
+
const { willReconnect } = action.payload;
|
|
2662
|
+
return Object.assign(Object.assign({}, state), { status: willReconnect ? "reconnecting" : "disconnected", isRejoining: willReconnect && (state.isRejoining || state.status === "connected") });
|
|
2663
|
+
});
|
|
2664
|
+
builder.addCase(signalEvents.newClient, (state, action) => {
|
|
2665
|
+
var _a, _b;
|
|
2666
|
+
return Object.assign(Object.assign({}, state), { session: (_b = (_a = action.payload.room) === null || _a === void 0 ? void 0 : _a.session) !== null && _b !== void 0 ? _b : null });
|
|
2667
|
+
});
|
|
2668
|
+
builder.addCase(signalEvents.roomSessionEnded, (state, action) => {
|
|
2669
|
+
var _a;
|
|
2670
|
+
if (((_a = state.session) === null || _a === void 0 ? void 0 : _a.id) !== action.payload.roomSessionId) {
|
|
2671
|
+
return state;
|
|
2672
|
+
}
|
|
2673
|
+
return Object.assign(Object.assign({}, state), { session: null });
|
|
2674
|
+
});
|
|
2675
|
+
builder.addCase(signalEvents.clientKicked, (state) => {
|
|
2676
|
+
return Object.assign(Object.assign({}, state), { status: "kicked" });
|
|
2677
|
+
});
|
|
2678
|
+
builder.addCase(signalEvents.roomLeft, (state) => {
|
|
2679
|
+
return Object.assign(Object.assign({}, state), { status: "left" });
|
|
2680
|
+
});
|
|
2681
|
+
},
|
|
2682
|
+
});
|
|
2683
|
+
const { connectionStatusChanged, knockResponseReceived } = roomConnectionSlice.actions;
|
|
2684
|
+
const { roomRejoined } = roomConnectionSlice.actions;
|
|
2685
|
+
const doKnockRoom = createAppThunk(() => (dispatch, getState) => {
|
|
2686
|
+
const state = getState();
|
|
2687
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
2688
|
+
const roomName = selectAppRoomName(state);
|
|
2689
|
+
const roomKey = selectRoomKey(state);
|
|
2690
|
+
const displayName = selectAppDisplayName(state);
|
|
2691
|
+
const isDialIn = selectAppIsDialIn(state);
|
|
2692
|
+
const isAudioRecorder = selectAppIsAudioRecorder(state);
|
|
2693
|
+
const userAgent = selectAppUserAgent(state);
|
|
2694
|
+
const externalId = selectAppExternalId(state);
|
|
2695
|
+
const organizationId = selectOrganizationId(state);
|
|
2696
|
+
const connectionStatus = selectRoomConnectionStatus(state);
|
|
2697
|
+
const clientClaim = selectLocalParticipantClientClaim(state);
|
|
2698
|
+
if (connectionStatus !== "room_locked") {
|
|
2699
|
+
console.warn("Room is not locked, knock aborted");
|
|
2700
|
+
return;
|
|
2701
|
+
}
|
|
2702
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("knock_room", Object.assign({ avatarUrl: null, config: {
|
|
2703
|
+
isAudioEnabled: true,
|
|
2704
|
+
isVideoEnabled: true,
|
|
2705
|
+
}, deviceCapabilities: { canScreenshare: true }, displayName, isCoLocated: false, isDialIn,
|
|
2706
|
+
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
2707
|
+
roomKey,
|
|
2708
|
+
roomName,
|
|
2709
|
+
userAgent,
|
|
2710
|
+
externalId }, (clientClaim && { clientClaim })));
|
|
2711
|
+
dispatch(connectionStatusChanged("knocking"));
|
|
2712
|
+
});
|
|
2713
|
+
const doCancelKnock = createAppThunk(() => (dispatch, getState) => {
|
|
2714
|
+
const state = getState();
|
|
2715
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
2716
|
+
const connectionStatus = selectRoomConnectionStatus(state);
|
|
2717
|
+
if (connectionStatus !== "knocking") {
|
|
2718
|
+
console.warn("Not knocking, cancel knock aborted");
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2721
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("cancel_room_knock");
|
|
2722
|
+
dispatch(connectionStatusChanged("ready"));
|
|
2723
|
+
});
|
|
2724
|
+
const doConnectRoom = createAppThunk(() => (dispatch, getState) => {
|
|
2725
|
+
const state = getState();
|
|
2726
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
2727
|
+
const roomName = selectAppRoomName(state);
|
|
2728
|
+
const roomKey = selectRoomKey(state);
|
|
2729
|
+
const assistantKey = selectAssistantKey(state);
|
|
2730
|
+
const displayName = selectAppDisplayName(state);
|
|
2731
|
+
const userAgent = selectAppUserAgent(state);
|
|
2732
|
+
const externalId = selectAppExternalId(state);
|
|
2733
|
+
const isDialIn = selectAppIsDialIn(state);
|
|
2734
|
+
const isAudioRecorder = selectAppIsAudioRecorder(state);
|
|
2735
|
+
const organizationId = selectOrganizationId(state);
|
|
2736
|
+
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
2737
|
+
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
2738
|
+
const clientClaim = selectLocalParticipantClientClaim(getState());
|
|
2739
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("join_room", Object.assign({ avatarUrl: null, config: {
|
|
2740
|
+
isAudioEnabled: isMicrophoneEnabled,
|
|
2741
|
+
isVideoEnabled: isCameraEnabled,
|
|
2742
|
+
}, deviceCapabilities: { canScreenshare: true }, displayName, isCoLocated: false, isDialIn,
|
|
2743
|
+
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
2744
|
+
roomKey,
|
|
2745
|
+
assistantKey,
|
|
2746
|
+
roomName,
|
|
2747
|
+
userAgent,
|
|
2748
|
+
externalId }, (clientClaim && { clientClaim })));
|
|
2749
|
+
dispatch(connectionStatusChanged("connecting"));
|
|
2750
|
+
});
|
|
2751
|
+
const selectShouldConnectRoom = toolkit.createSelector([
|
|
2752
|
+
selectAppIsActive,
|
|
2753
|
+
selectOrganizationId,
|
|
2754
|
+
selectRoomConnectionStatus,
|
|
2755
|
+
selectSignalConnectionDeviceIdentified,
|
|
2756
|
+
selectLocalMediaStatus,
|
|
2757
|
+
selectRoomConnectionError,
|
|
2758
|
+
], (appIsActive, hasOrganizationIdFetched, roomConnectionStatus, signalConnectionDeviceIdentified, localMediaStatus, roomConnectionError) => {
|
|
2759
|
+
if (appIsActive &&
|
|
2760
|
+
localMediaStatus === "started" &&
|
|
2761
|
+
signalConnectionDeviceIdentified &&
|
|
2762
|
+
!!hasOrganizationIdFetched &&
|
|
2763
|
+
["ready", "reconnecting", "disconnected"].includes(roomConnectionStatus) &&
|
|
2764
|
+
!roomConnectionError) {
|
|
2765
|
+
return true;
|
|
2766
|
+
}
|
|
2767
|
+
return false;
|
|
2768
|
+
});
|
|
2769
|
+
createReactor([selectShouldConnectRoom], ({ dispatch }, shouldConnectRoom) => {
|
|
2770
|
+
if (shouldConnectRoom) {
|
|
2771
|
+
dispatch(doConnectRoom());
|
|
2772
|
+
}
|
|
2773
|
+
});
|
|
2774
|
+
startAppListening({
|
|
2775
|
+
actionCreator: signalEvents.roomJoined,
|
|
2776
|
+
effect: ({ payload }, { dispatch, getOriginalState }) => {
|
|
2777
|
+
if ("error" in payload) {
|
|
2778
|
+
return;
|
|
2779
|
+
}
|
|
2780
|
+
const originalState = getOriginalState();
|
|
2781
|
+
if (!selectRoomConnectionIsRejoining(originalState)) {
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
dispatch(roomRejoined({ selfId: payload.selfId, previousSelfId: selectSelfId(originalState) }));
|
|
2785
|
+
},
|
|
2786
|
+
});
|
|
2787
|
+
startAppListening({
|
|
2788
|
+
actionCreator: signalEvents.knockHandled,
|
|
2789
|
+
effect: ({ payload }, { dispatch, getState }) => {
|
|
2790
|
+
var _a, _b;
|
|
2791
|
+
const { clientId, resolution } = payload;
|
|
2792
|
+
const state = getState();
|
|
2793
|
+
const selfId = selectSelfId(state);
|
|
2794
|
+
if (clientId !== selfId) {
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2797
|
+
if (resolution === "accepted") {
|
|
2798
|
+
dispatch(setRoomKey(payload.metadata.roomKey));
|
|
2799
|
+
dispatch(doConnectRoom());
|
|
2800
|
+
}
|
|
2801
|
+
else if (resolution === "on_hold") {
|
|
2802
|
+
dispatch(knockResponseReceived((_a = payload.knockResponse) !== null && _a !== void 0 ? _a : null));
|
|
2803
|
+
dispatch(connectionStatusChanged("knock_on_hold"));
|
|
2804
|
+
}
|
|
2805
|
+
else if (resolution === "rejected") {
|
|
2806
|
+
dispatch(knockResponseReceived((_b = payload.knockResponse) !== null && _b !== void 0 ? _b : null));
|
|
2807
|
+
dispatch(connectionStatusChanged("knock_rejected"));
|
|
2808
|
+
}
|
|
2809
|
+
},
|
|
2810
|
+
});
|
|
2811
|
+
startAppListening({
|
|
2812
|
+
actionCreator: signalEvents.clientKicked,
|
|
2813
|
+
effect: (_, { dispatch }) => {
|
|
2814
|
+
dispatch(doAppStop());
|
|
2815
|
+
},
|
|
2816
|
+
});
|
|
2817
|
+
startAppListening({
|
|
2818
|
+
actionCreator: doAppStop,
|
|
2819
|
+
effect: (_, { dispatch, getState }) => {
|
|
2820
|
+
const state = getState();
|
|
2821
|
+
const roomConnectionStatus = selectRoomConnectionStatus(state);
|
|
2822
|
+
if (roomConnectionStatus === "connected") {
|
|
2823
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
2824
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("leave_room");
|
|
2825
|
+
dispatch(connectionStatusChanged("leaving"));
|
|
2826
|
+
}
|
|
2827
|
+
else {
|
|
2828
|
+
dispatch(doSignalDisconnect());
|
|
2829
|
+
}
|
|
2830
|
+
},
|
|
2831
|
+
});
|
|
2561
2832
|
|
|
2562
2833
|
const emitter = new events$1.EventEmitter();
|
|
2563
2834
|
function createNotificationEvent(payload) {
|
|
@@ -2736,11 +3007,30 @@ createReactor([selectSignalStatus], ({ dispatch, getState }, signalStatus) => {
|
|
|
2736
3007
|
}
|
|
2737
3008
|
else if (signalStatus === "connected") {
|
|
2738
3009
|
dispatch(doSetNotification(createNotificationEvent({
|
|
2739
|
-
type: "signalOk",
|
|
2740
|
-
message: `Network connection available`,
|
|
3010
|
+
type: "signalOk",
|
|
3011
|
+
message: `Network connection available`,
|
|
3012
|
+
props: {},
|
|
3013
|
+
})));
|
|
3014
|
+
}
|
|
3015
|
+
});
|
|
3016
|
+
createReactor([selectRoomConnectionIsRejoining], ({ dispatch }, isRejoining) => {
|
|
3017
|
+
if (isRejoining) {
|
|
3018
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
3019
|
+
type: "reconnecting",
|
|
3020
|
+
message: `Reconnecting to the room...`,
|
|
3021
|
+
props: {},
|
|
3022
|
+
})));
|
|
3023
|
+
}
|
|
3024
|
+
});
|
|
3025
|
+
startAppListening({
|
|
3026
|
+
actionCreator: roomRejoined,
|
|
3027
|
+
effect: (_, { dispatch }) => {
|
|
3028
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
3029
|
+
type: "reconnected",
|
|
3030
|
+
message: `Reconnected to the room`,
|
|
2741
3031
|
props: {},
|
|
2742
3032
|
})));
|
|
2743
|
-
}
|
|
3033
|
+
},
|
|
2744
3034
|
});
|
|
2745
3035
|
startAppListening({
|
|
2746
3036
|
actionCreator: signalEvents.clientUnableToJoin,
|
|
@@ -4448,254 +4738,6 @@ createReactor([selectBreakoutAssignments, selectDeviceId, selectLocalParticipant
|
|
|
4448
4738
|
}
|
|
4449
4739
|
});
|
|
4450
4740
|
|
|
4451
|
-
const organizationSliceInitialState = {
|
|
4452
|
-
data: null,
|
|
4453
|
-
isFetching: false,
|
|
4454
|
-
error: null,
|
|
4455
|
-
};
|
|
4456
|
-
const organizationSlice = toolkit.createSlice({
|
|
4457
|
-
name: "organization",
|
|
4458
|
-
initialState: organizationSliceInitialState,
|
|
4459
|
-
reducers: {},
|
|
4460
|
-
extraReducers: (builder) => {
|
|
4461
|
-
builder.addCase(doOrganizationFetch.pending, (state) => {
|
|
4462
|
-
return Object.assign(Object.assign({}, state), { isFetching: true });
|
|
4463
|
-
});
|
|
4464
|
-
builder.addCase(doOrganizationFetch.fulfilled, (state, action) => {
|
|
4465
|
-
if (!action.payload)
|
|
4466
|
-
return Object.assign(Object.assign({}, state), { isFetching: true });
|
|
4467
|
-
return Object.assign(Object.assign({}, state), { isFetching: false, data: action.payload });
|
|
4468
|
-
});
|
|
4469
|
-
builder.addCase(doOrganizationFetch.rejected, (state) => {
|
|
4470
|
-
return Object.assign(Object.assign({}, state), { isFetching: false, error: true });
|
|
4471
|
-
});
|
|
4472
|
-
},
|
|
4473
|
-
});
|
|
4474
|
-
const doOrganizationFetch = createAppAsyncThunk("organization/doOrganizationFetch", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { extra, getState }) {
|
|
4475
|
-
try {
|
|
4476
|
-
const roomUrl = selectAppRoomUrl(getState());
|
|
4477
|
-
const organization = yield extra.services.fetchOrganizationFromRoomUrl(roomUrl || "");
|
|
4478
|
-
if (!organization) {
|
|
4479
|
-
throw new Error("Invalid room url");
|
|
4480
|
-
}
|
|
4481
|
-
return organization;
|
|
4482
|
-
}
|
|
4483
|
-
catch (error) {
|
|
4484
|
-
console.error(error);
|
|
4485
|
-
}
|
|
4486
|
-
}));
|
|
4487
|
-
const selectOrganizationRaw = (state) => state.organization;
|
|
4488
|
-
const selectOrganizationId = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.organizationId; };
|
|
4489
|
-
const selectOrganizationPreferences = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.preferences; };
|
|
4490
|
-
const selectShouldFetchOrganization = toolkit.createSelector(selectAppIsActive, selectOrganizationRaw, selectDeviceCredentialsRaw, (appIsActive, organization, deviceCredentials) => {
|
|
4491
|
-
if (appIsActive &&
|
|
4492
|
-
!organization.data &&
|
|
4493
|
-
!organization.isFetching &&
|
|
4494
|
-
!organization.error &&
|
|
4495
|
-
!deviceCredentials.isFetching) {
|
|
4496
|
-
return true;
|
|
4497
|
-
}
|
|
4498
|
-
return false;
|
|
4499
|
-
});
|
|
4500
|
-
createReactor([selectShouldFetchOrganization], ({ dispatch }, shouldFetchOrganization) => {
|
|
4501
|
-
if (shouldFetchOrganization) {
|
|
4502
|
-
dispatch(doOrganizationFetch());
|
|
4503
|
-
}
|
|
4504
|
-
});
|
|
4505
|
-
|
|
4506
|
-
const roomConnectionSliceInitialState = {
|
|
4507
|
-
session: null,
|
|
4508
|
-
status: "ready",
|
|
4509
|
-
error: null,
|
|
4510
|
-
knockResponse: null,
|
|
4511
|
-
};
|
|
4512
|
-
const roomConnectionSlice = toolkit.createSlice({
|
|
4513
|
-
name: "roomConnection",
|
|
4514
|
-
initialState: roomConnectionSliceInitialState,
|
|
4515
|
-
reducers: {
|
|
4516
|
-
connectionStatusChanged: (state, action) => {
|
|
4517
|
-
return Object.assign(Object.assign({}, state), { status: action.payload });
|
|
4518
|
-
},
|
|
4519
|
-
knockResponseReceived: (state, action) => {
|
|
4520
|
-
return Object.assign(Object.assign({}, state), { knockResponse: action.payload });
|
|
4521
|
-
},
|
|
4522
|
-
},
|
|
4523
|
-
extraReducers: (builder) => {
|
|
4524
|
-
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
4525
|
-
var _a;
|
|
4526
|
-
if ("error" in action.payload) {
|
|
4527
|
-
if (action.payload.error === "room_locked" && action.payload.isLocked) {
|
|
4528
|
-
return Object.assign(Object.assign({}, state), { status: "room_locked" });
|
|
4529
|
-
}
|
|
4530
|
-
return Object.assign(Object.assign({}, state), { status: "disconnected", error: action.payload.error });
|
|
4531
|
-
}
|
|
4532
|
-
const { room } = action.payload;
|
|
4533
|
-
return Object.assign(Object.assign({}, state), { status: "connected", session: (_a = room.session) !== null && _a !== void 0 ? _a : null });
|
|
4534
|
-
});
|
|
4535
|
-
builder.addCase(signalEvents.disconnect, (state) => {
|
|
4536
|
-
if (["kicked", "left"].includes(state.status)) {
|
|
4537
|
-
return Object.assign({}, state);
|
|
4538
|
-
}
|
|
4539
|
-
return Object.assign(Object.assign({}, state), { status: "disconnected" });
|
|
4540
|
-
});
|
|
4541
|
-
builder.addCase(signalEvents.newClient, (state, action) => {
|
|
4542
|
-
var _a, _b;
|
|
4543
|
-
return Object.assign(Object.assign({}, state), { session: (_b = (_a = action.payload.room) === null || _a === void 0 ? void 0 : _a.session) !== null && _b !== void 0 ? _b : null });
|
|
4544
|
-
});
|
|
4545
|
-
builder.addCase(signalEvents.roomSessionEnded, (state, action) => {
|
|
4546
|
-
var _a;
|
|
4547
|
-
if (((_a = state.session) === null || _a === void 0 ? void 0 : _a.id) !== action.payload.roomSessionId) {
|
|
4548
|
-
return state;
|
|
4549
|
-
}
|
|
4550
|
-
return Object.assign(Object.assign({}, state), { session: null });
|
|
4551
|
-
});
|
|
4552
|
-
builder.addCase(signalEvents.clientKicked, (state) => {
|
|
4553
|
-
return Object.assign(Object.assign({}, state), { status: "kicked" });
|
|
4554
|
-
});
|
|
4555
|
-
builder.addCase(signalEvents.roomLeft, (state) => {
|
|
4556
|
-
return Object.assign(Object.assign({}, state), { status: "left" });
|
|
4557
|
-
});
|
|
4558
|
-
builder.addCase(socketReconnecting, (state) => {
|
|
4559
|
-
return Object.assign(Object.assign({}, state), { status: "reconnecting" });
|
|
4560
|
-
});
|
|
4561
|
-
},
|
|
4562
|
-
});
|
|
4563
|
-
const { connectionStatusChanged, knockResponseReceived } = roomConnectionSlice.actions;
|
|
4564
|
-
const doKnockRoom = createAppThunk(() => (dispatch, getState) => {
|
|
4565
|
-
const state = getState();
|
|
4566
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
4567
|
-
const roomName = selectAppRoomName(state);
|
|
4568
|
-
const roomKey = selectRoomKey(state);
|
|
4569
|
-
const displayName = selectAppDisplayName(state);
|
|
4570
|
-
const isDialIn = selectAppIsDialIn(state);
|
|
4571
|
-
const isAudioRecorder = selectAppIsAudioRecorder(state);
|
|
4572
|
-
const userAgent = selectAppUserAgent(state);
|
|
4573
|
-
const externalId = selectAppExternalId(state);
|
|
4574
|
-
const organizationId = selectOrganizationId(state);
|
|
4575
|
-
const connectionStatus = selectRoomConnectionStatus(state);
|
|
4576
|
-
const clientClaim = selectLocalParticipantClientClaim(state);
|
|
4577
|
-
if (connectionStatus !== "room_locked") {
|
|
4578
|
-
console.warn("Room is not locked, knock aborted");
|
|
4579
|
-
return;
|
|
4580
|
-
}
|
|
4581
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("knock_room", Object.assign({ avatarUrl: null, config: {
|
|
4582
|
-
isAudioEnabled: true,
|
|
4583
|
-
isVideoEnabled: true,
|
|
4584
|
-
}, deviceCapabilities: { canScreenshare: true }, displayName, isCoLocated: false, isDialIn,
|
|
4585
|
-
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
4586
|
-
roomKey,
|
|
4587
|
-
roomName,
|
|
4588
|
-
userAgent,
|
|
4589
|
-
externalId }, (clientClaim && { clientClaim })));
|
|
4590
|
-
dispatch(connectionStatusChanged("knocking"));
|
|
4591
|
-
});
|
|
4592
|
-
const doCancelKnock = createAppThunk(() => (dispatch, getState) => {
|
|
4593
|
-
const state = getState();
|
|
4594
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
4595
|
-
const connectionStatus = selectRoomConnectionStatus(state);
|
|
4596
|
-
if (connectionStatus !== "knocking") {
|
|
4597
|
-
console.warn("Not knocking, cancel knock aborted");
|
|
4598
|
-
return;
|
|
4599
|
-
}
|
|
4600
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("cancel_room_knock");
|
|
4601
|
-
dispatch(connectionStatusChanged("ready"));
|
|
4602
|
-
});
|
|
4603
|
-
const doConnectRoom = createAppThunk(() => (dispatch, getState) => {
|
|
4604
|
-
const state = getState();
|
|
4605
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
4606
|
-
const roomName = selectAppRoomName(state);
|
|
4607
|
-
const roomKey = selectRoomKey(state);
|
|
4608
|
-
const assistantKey = selectAssistantKey(state);
|
|
4609
|
-
const displayName = selectAppDisplayName(state);
|
|
4610
|
-
const userAgent = selectAppUserAgent(state);
|
|
4611
|
-
const externalId = selectAppExternalId(state);
|
|
4612
|
-
const isDialIn = selectAppIsDialIn(state);
|
|
4613
|
-
const isAudioRecorder = selectAppIsAudioRecorder(state);
|
|
4614
|
-
const organizationId = selectOrganizationId(state);
|
|
4615
|
-
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
4616
|
-
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
4617
|
-
const clientClaim = selectLocalParticipantClientClaim(getState());
|
|
4618
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("join_room", Object.assign({ avatarUrl: null, config: {
|
|
4619
|
-
isAudioEnabled: isMicrophoneEnabled,
|
|
4620
|
-
isVideoEnabled: isCameraEnabled,
|
|
4621
|
-
}, deviceCapabilities: { canScreenshare: true }, displayName, isCoLocated: false, isDialIn,
|
|
4622
|
-
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
4623
|
-
roomKey,
|
|
4624
|
-
assistantKey,
|
|
4625
|
-
roomName,
|
|
4626
|
-
userAgent,
|
|
4627
|
-
externalId }, (clientClaim && { clientClaim })));
|
|
4628
|
-
dispatch(connectionStatusChanged("connecting"));
|
|
4629
|
-
});
|
|
4630
|
-
const selectShouldConnectRoom = toolkit.createSelector([
|
|
4631
|
-
selectAppIsActive,
|
|
4632
|
-
selectOrganizationId,
|
|
4633
|
-
selectRoomConnectionStatus,
|
|
4634
|
-
selectSignalConnectionDeviceIdentified,
|
|
4635
|
-
selectLocalMediaStatus,
|
|
4636
|
-
selectRoomConnectionError,
|
|
4637
|
-
], (appIsActive, hasOrganizationIdFetched, roomConnectionStatus, signalConnectionDeviceIdentified, localMediaStatus, roomConnectionError) => {
|
|
4638
|
-
if (appIsActive &&
|
|
4639
|
-
localMediaStatus === "started" &&
|
|
4640
|
-
signalConnectionDeviceIdentified &&
|
|
4641
|
-
!!hasOrganizationIdFetched &&
|
|
4642
|
-
["ready", "reconnecting", "disconnected"].includes(roomConnectionStatus) &&
|
|
4643
|
-
!roomConnectionError) {
|
|
4644
|
-
return true;
|
|
4645
|
-
}
|
|
4646
|
-
return false;
|
|
4647
|
-
});
|
|
4648
|
-
createReactor([selectShouldConnectRoom], ({ dispatch }, shouldConnectRoom) => {
|
|
4649
|
-
if (shouldConnectRoom) {
|
|
4650
|
-
dispatch(doConnectRoom());
|
|
4651
|
-
}
|
|
4652
|
-
});
|
|
4653
|
-
startAppListening({
|
|
4654
|
-
actionCreator: signalEvents.knockHandled,
|
|
4655
|
-
effect: ({ payload }, { dispatch, getState }) => {
|
|
4656
|
-
var _a, _b;
|
|
4657
|
-
const { clientId, resolution } = payload;
|
|
4658
|
-
const state = getState();
|
|
4659
|
-
const selfId = selectSelfId(state);
|
|
4660
|
-
if (clientId !== selfId) {
|
|
4661
|
-
return;
|
|
4662
|
-
}
|
|
4663
|
-
if (resolution === "accepted") {
|
|
4664
|
-
dispatch(setRoomKey(payload.metadata.roomKey));
|
|
4665
|
-
dispatch(doConnectRoom());
|
|
4666
|
-
}
|
|
4667
|
-
else if (resolution === "on_hold") {
|
|
4668
|
-
dispatch(knockResponseReceived((_a = payload.knockResponse) !== null && _a !== void 0 ? _a : null));
|
|
4669
|
-
dispatch(connectionStatusChanged("knock_on_hold"));
|
|
4670
|
-
}
|
|
4671
|
-
else if (resolution === "rejected") {
|
|
4672
|
-
dispatch(knockResponseReceived((_b = payload.knockResponse) !== null && _b !== void 0 ? _b : null));
|
|
4673
|
-
dispatch(connectionStatusChanged("knock_rejected"));
|
|
4674
|
-
}
|
|
4675
|
-
},
|
|
4676
|
-
});
|
|
4677
|
-
startAppListening({
|
|
4678
|
-
actionCreator: signalEvents.clientKicked,
|
|
4679
|
-
effect: (_, { dispatch }) => {
|
|
4680
|
-
dispatch(doAppStop());
|
|
4681
|
-
},
|
|
4682
|
-
});
|
|
4683
|
-
startAppListening({
|
|
4684
|
-
actionCreator: doAppStop,
|
|
4685
|
-
effect: (_, { dispatch, getState }) => {
|
|
4686
|
-
const state = getState();
|
|
4687
|
-
const roomConnectionStatus = selectRoomConnectionStatus(state);
|
|
4688
|
-
if (roomConnectionStatus === "connected") {
|
|
4689
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
4690
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("leave_room");
|
|
4691
|
-
dispatch(connectionStatusChanged("leaving"));
|
|
4692
|
-
}
|
|
4693
|
-
else {
|
|
4694
|
-
doSignalDisconnect();
|
|
4695
|
-
}
|
|
4696
|
-
},
|
|
4697
|
-
});
|
|
4698
|
-
|
|
4699
4741
|
function isCustomElementName(value) {
|
|
4700
4742
|
return typeof value === "string" && value === value.toLowerCase() && value.includes("-");
|
|
4701
4743
|
}
|
|
@@ -6077,6 +6119,7 @@ const SPOTLIGHT_PARTICIPANT_ADDED = "spotlight:participant-added";
|
|
|
6077
6119
|
const SPOTLIGHT_PARTICIPANT_REMOVED = "spotlight:participant-removed";
|
|
6078
6120
|
const ROOM_JOINED = "room:joined";
|
|
6079
6121
|
const ROOM_JOINED_ERROR = "room:joined:error";
|
|
6122
|
+
const ROOM_REJOINED = "room:rejoined";
|
|
6080
6123
|
|
|
6081
6124
|
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) => {
|
|
6082
6125
|
const broadcastingParticipants = breakoutActive && breakoutCurrentId
|
|
@@ -6317,6 +6360,17 @@ class RoomConnectionClient extends BaseClient {
|
|
|
6317
6360
|
});
|
|
6318
6361
|
},
|
|
6319
6362
|
});
|
|
6363
|
+
startAppListening({
|
|
6364
|
+
actionCreator: roomRejoined,
|
|
6365
|
+
effect: ({ payload }) => {
|
|
6366
|
+
const { selfId, previousSelfId } = payload;
|
|
6367
|
+
this.emit(ROOM_REJOINED, {
|
|
6368
|
+
selfId,
|
|
6369
|
+
previousSelfId,
|
|
6370
|
+
selfIdChanged: selfId !== previousSelfId,
|
|
6371
|
+
});
|
|
6372
|
+
},
|
|
6373
|
+
});
|
|
6320
6374
|
startAppListening({
|
|
6321
6375
|
actionCreator: signalEvents.chatMessage,
|
|
6322
6376
|
effect: ({ payload }) => {
|
|
@@ -6773,6 +6827,7 @@ exports.REMOTE_PARTICIPANTS_CHANGED = REMOTE_PARTICIPANTS_CHANGED;
|
|
|
6773
6827
|
exports.ROOM_INTEGRATION_PICKER_MESSAGES = ROOM_INTEGRATION_PICKER_MESSAGES;
|
|
6774
6828
|
exports.ROOM_JOINED = ROOM_JOINED;
|
|
6775
6829
|
exports.ROOM_JOINED_ERROR = ROOM_JOINED_ERROR;
|
|
6830
|
+
exports.ROOM_REJOINED = ROOM_REJOINED;
|
|
6776
6831
|
exports.RUNNING_ROOM_INTEGRATIONS_CHANGED = RUNNING_ROOM_INTEGRATIONS_CHANGED;
|
|
6777
6832
|
exports.RoomConnectionClient = RoomConnectionClient;
|
|
6778
6833
|
exports.RoomIntegrationService = RoomIntegrationService;
|