@whereby.com/core 1.23.4 → 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 +309 -254
- 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 +309 -255
- package/dist/legacy-esm.js +309 -255
- 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 +3 -3
package/dist/redux/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ const createReactor = (selectors, callback) => {
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
const coreVersion = "1.
|
|
79
|
+
const coreVersion = "1.25.0";
|
|
80
80
|
|
|
81
81
|
function decodeRoomName(roomName) {
|
|
82
82
|
if (!roomName) {
|
|
@@ -132,6 +132,12 @@ const selectAppInitialConfig = (state) => state.app.initialConfig;
|
|
|
132
132
|
const selectAppInitialMuteStates = (state) => state.app.initialMuteStates;
|
|
133
133
|
const selectAppIgnoreBreakoutGroups = (state) => state.app.ignoreBreakoutGroups;
|
|
134
134
|
|
|
135
|
+
const NON_RECONNECTING_DISCONNECT_REASONS = ["io server disconnect", "io client disconnect"];
|
|
136
|
+
function createSignalDisconnectEvent(reason) {
|
|
137
|
+
return {
|
|
138
|
+
willReconnect: !!reason && !NON_RECONNECTING_DISCONNECT_REASONS.includes(reason),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
135
141
|
function createSignalEventAction(name) {
|
|
136
142
|
return toolkit.createAction(`signalConnection/event/${name}`);
|
|
137
143
|
}
|
|
@@ -346,7 +352,7 @@ function forwardSocketEvents(socket, dispatch) {
|
|
|
346
352
|
dispatch(signalEvents.chatMessage(payload));
|
|
347
353
|
});
|
|
348
354
|
socket.on("chat_message_removed", (payload) => dispatch(signalEvents.chatMessageRemoved(payload)));
|
|
349
|
-
socket.on("disconnect", () => dispatch(signalEvents.disconnect()));
|
|
355
|
+
socket.on("disconnect", (reason) => dispatch(signalEvents.disconnect(createSignalDisconnectEvent(reason))));
|
|
350
356
|
socket.on("room_knocked", (payload) => dispatch(signalEvents.roomKnocked(payload)));
|
|
351
357
|
socket.on("room_left", () => dispatch(signalEvents.roomLeft()));
|
|
352
358
|
socket.on("room_locked", (payload) => dispatch(signalEvents.roomLocked(payload)));
|
|
@@ -1346,6 +1352,271 @@ const selectRoomConnectionSessionId = (state) => { var _a; return (_a = state.ro
|
|
|
1346
1352
|
const selectRoomConnectionStatus = (state) => state.roomConnection.status;
|
|
1347
1353
|
const selectRoomConnectionError = (state) => state.roomConnection.error;
|
|
1348
1354
|
const selectRoomConnectionKnockResponse = (state) => state.roomConnection.knockResponse;
|
|
1355
|
+
const selectRoomConnectionIsRejoining = (state) => state.roomConnection.isRejoining;
|
|
1356
|
+
|
|
1357
|
+
const organizationSliceInitialState = {
|
|
1358
|
+
data: null,
|
|
1359
|
+
isFetching: false,
|
|
1360
|
+
error: null,
|
|
1361
|
+
};
|
|
1362
|
+
const organizationSlice = toolkit.createSlice({
|
|
1363
|
+
name: "organization",
|
|
1364
|
+
initialState: organizationSliceInitialState,
|
|
1365
|
+
reducers: {},
|
|
1366
|
+
extraReducers: (builder) => {
|
|
1367
|
+
builder.addCase(doOrganizationFetch.pending, (state) => {
|
|
1368
|
+
return Object.assign(Object.assign({}, state), { isFetching: true });
|
|
1369
|
+
});
|
|
1370
|
+
builder.addCase(doOrganizationFetch.fulfilled, (state, action) => {
|
|
1371
|
+
if (!action.payload)
|
|
1372
|
+
return Object.assign(Object.assign({}, state), { isFetching: true });
|
|
1373
|
+
return Object.assign(Object.assign({}, state), { isFetching: false, data: action.payload });
|
|
1374
|
+
});
|
|
1375
|
+
builder.addCase(doOrganizationFetch.rejected, (state) => {
|
|
1376
|
+
return Object.assign(Object.assign({}, state), { isFetching: false, error: true });
|
|
1377
|
+
});
|
|
1378
|
+
},
|
|
1379
|
+
});
|
|
1380
|
+
const doOrganizationFetch = createAppAsyncThunk("organization/doOrganizationFetch", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { extra, getState }) {
|
|
1381
|
+
try {
|
|
1382
|
+
const roomUrl = selectAppRoomUrl(getState());
|
|
1383
|
+
const organization = yield extra.services.fetchOrganizationFromRoomUrl(roomUrl || "");
|
|
1384
|
+
if (!organization) {
|
|
1385
|
+
throw new Error("Invalid room url");
|
|
1386
|
+
}
|
|
1387
|
+
return organization;
|
|
1388
|
+
}
|
|
1389
|
+
catch (error) {
|
|
1390
|
+
console.error(error);
|
|
1391
|
+
}
|
|
1392
|
+
}));
|
|
1393
|
+
const selectOrganizationRaw = (state) => state.organization;
|
|
1394
|
+
const selectOrganizationId = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.organizationId; };
|
|
1395
|
+
const selectOrganizationPreferences = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.preferences; };
|
|
1396
|
+
const selectShouldFetchOrganization = toolkit.createSelector(selectAppIsActive, selectOrganizationRaw, selectDeviceCredentialsRaw, (appIsActive, organization, deviceCredentials) => {
|
|
1397
|
+
if (appIsActive &&
|
|
1398
|
+
!organization.data &&
|
|
1399
|
+
!organization.isFetching &&
|
|
1400
|
+
!organization.error &&
|
|
1401
|
+
!deviceCredentials.isFetching) {
|
|
1402
|
+
return true;
|
|
1403
|
+
}
|
|
1404
|
+
return false;
|
|
1405
|
+
});
|
|
1406
|
+
createReactor([selectShouldFetchOrganization], ({ dispatch }, shouldFetchOrganization) => {
|
|
1407
|
+
if (shouldFetchOrganization) {
|
|
1408
|
+
dispatch(doOrganizationFetch());
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
const roomConnectionSliceInitialState = {
|
|
1413
|
+
session: null,
|
|
1414
|
+
status: "ready",
|
|
1415
|
+
error: null,
|
|
1416
|
+
knockResponse: null,
|
|
1417
|
+
isRejoining: false,
|
|
1418
|
+
};
|
|
1419
|
+
const roomConnectionSlice = toolkit.createSlice({
|
|
1420
|
+
name: "roomConnection",
|
|
1421
|
+
initialState: roomConnectionSliceInitialState,
|
|
1422
|
+
reducers: {
|
|
1423
|
+
connectionStatusChanged: (state, action) => {
|
|
1424
|
+
return Object.assign(Object.assign({}, state), { status: action.payload });
|
|
1425
|
+
},
|
|
1426
|
+
knockResponseReceived: (state, action) => {
|
|
1427
|
+
return Object.assign(Object.assign({}, state), { knockResponse: action.payload });
|
|
1428
|
+
},
|
|
1429
|
+
roomRejoined: (state, action) => {
|
|
1430
|
+
return state;
|
|
1431
|
+
},
|
|
1432
|
+
},
|
|
1433
|
+
extraReducers: (builder) => {
|
|
1434
|
+
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
1435
|
+
var _a;
|
|
1436
|
+
if ("error" in action.payload) {
|
|
1437
|
+
if (action.payload.error === "room_locked" && action.payload.isLocked) {
|
|
1438
|
+
return Object.assign(Object.assign({}, state), { status: "room_locked" });
|
|
1439
|
+
}
|
|
1440
|
+
return Object.assign(Object.assign({}, state), { status: "disconnected", error: action.payload.error, isRejoining: false });
|
|
1441
|
+
}
|
|
1442
|
+
const { room } = action.payload;
|
|
1443
|
+
return Object.assign(Object.assign({}, state), { status: "connected", session: (_a = room.session) !== null && _a !== void 0 ? _a : null, isRejoining: false });
|
|
1444
|
+
});
|
|
1445
|
+
builder.addCase(signalEvents.disconnect, (state, action) => {
|
|
1446
|
+
if (["kicked", "left"].includes(state.status)) {
|
|
1447
|
+
return Object.assign({}, state);
|
|
1448
|
+
}
|
|
1449
|
+
const { willReconnect } = action.payload;
|
|
1450
|
+
return Object.assign(Object.assign({}, state), { status: willReconnect ? "reconnecting" : "disconnected", isRejoining: willReconnect && (state.isRejoining || state.status === "connected") });
|
|
1451
|
+
});
|
|
1452
|
+
builder.addCase(signalEvents.newClient, (state, action) => {
|
|
1453
|
+
var _a, _b;
|
|
1454
|
+
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 });
|
|
1455
|
+
});
|
|
1456
|
+
builder.addCase(signalEvents.roomSessionEnded, (state, action) => {
|
|
1457
|
+
var _a;
|
|
1458
|
+
if (((_a = state.session) === null || _a === void 0 ? void 0 : _a.id) !== action.payload.roomSessionId) {
|
|
1459
|
+
return state;
|
|
1460
|
+
}
|
|
1461
|
+
return Object.assign(Object.assign({}, state), { session: null });
|
|
1462
|
+
});
|
|
1463
|
+
builder.addCase(signalEvents.clientKicked, (state) => {
|
|
1464
|
+
return Object.assign(Object.assign({}, state), { status: "kicked" });
|
|
1465
|
+
});
|
|
1466
|
+
builder.addCase(signalEvents.roomLeft, (state) => {
|
|
1467
|
+
return Object.assign(Object.assign({}, state), { status: "left" });
|
|
1468
|
+
});
|
|
1469
|
+
},
|
|
1470
|
+
});
|
|
1471
|
+
const { connectionStatusChanged, knockResponseReceived } = roomConnectionSlice.actions;
|
|
1472
|
+
const { roomRejoined } = roomConnectionSlice.actions;
|
|
1473
|
+
const doKnockRoom = createAppThunk(() => (dispatch, getState) => {
|
|
1474
|
+
const state = getState();
|
|
1475
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1476
|
+
const roomName = selectAppRoomName(state);
|
|
1477
|
+
const roomKey = selectRoomKey(state);
|
|
1478
|
+
const displayName = selectAppDisplayName(state);
|
|
1479
|
+
const isDialIn = selectAppIsDialIn(state);
|
|
1480
|
+
const isAudioRecorder = selectAppIsAudioRecorder(state);
|
|
1481
|
+
const userAgent = selectAppUserAgent(state);
|
|
1482
|
+
const externalId = selectAppExternalId(state);
|
|
1483
|
+
const organizationId = selectOrganizationId(state);
|
|
1484
|
+
const connectionStatus = selectRoomConnectionStatus(state);
|
|
1485
|
+
const clientClaim = selectLocalParticipantClientClaim(state);
|
|
1486
|
+
if (connectionStatus !== "room_locked") {
|
|
1487
|
+
console.warn("Room is not locked, knock aborted");
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("knock_room", Object.assign({ avatarUrl: null, config: {
|
|
1491
|
+
isAudioEnabled: true,
|
|
1492
|
+
isVideoEnabled: true,
|
|
1493
|
+
}, deviceCapabilities: { canScreenshare: true }, displayName, isCoLocated: false, isDialIn,
|
|
1494
|
+
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
1495
|
+
roomKey,
|
|
1496
|
+
roomName,
|
|
1497
|
+
userAgent,
|
|
1498
|
+
externalId }, (clientClaim && { clientClaim })));
|
|
1499
|
+
dispatch(connectionStatusChanged("knocking"));
|
|
1500
|
+
});
|
|
1501
|
+
const doCancelKnock = createAppThunk(() => (dispatch, getState) => {
|
|
1502
|
+
const state = getState();
|
|
1503
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1504
|
+
const connectionStatus = selectRoomConnectionStatus(state);
|
|
1505
|
+
if (connectionStatus !== "knocking") {
|
|
1506
|
+
console.warn("Not knocking, cancel knock aborted");
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("cancel_room_knock");
|
|
1510
|
+
dispatch(connectionStatusChanged("ready"));
|
|
1511
|
+
});
|
|
1512
|
+
const doConnectRoom = createAppThunk(() => (dispatch, getState) => {
|
|
1513
|
+
const state = getState();
|
|
1514
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1515
|
+
const roomName = selectAppRoomName(state);
|
|
1516
|
+
const roomKey = selectRoomKey(state);
|
|
1517
|
+
const assistantKey = selectAssistantKey(state);
|
|
1518
|
+
const displayName = selectAppDisplayName(state);
|
|
1519
|
+
const userAgent = selectAppUserAgent(state);
|
|
1520
|
+
const externalId = selectAppExternalId(state);
|
|
1521
|
+
const isDialIn = selectAppIsDialIn(state);
|
|
1522
|
+
const isAudioRecorder = selectAppIsAudioRecorder(state);
|
|
1523
|
+
const organizationId = selectOrganizationId(state);
|
|
1524
|
+
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
1525
|
+
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
1526
|
+
const clientClaim = selectLocalParticipantClientClaim(getState());
|
|
1527
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("join_room", Object.assign({ avatarUrl: null, config: {
|
|
1528
|
+
isAudioEnabled: isMicrophoneEnabled,
|
|
1529
|
+
isVideoEnabled: isCameraEnabled,
|
|
1530
|
+
}, deviceCapabilities: { canScreenshare: true }, displayName, isCoLocated: false, isDialIn,
|
|
1531
|
+
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
1532
|
+
roomKey,
|
|
1533
|
+
assistantKey,
|
|
1534
|
+
roomName,
|
|
1535
|
+
userAgent,
|
|
1536
|
+
externalId }, (clientClaim && { clientClaim })));
|
|
1537
|
+
dispatch(connectionStatusChanged("connecting"));
|
|
1538
|
+
});
|
|
1539
|
+
const selectShouldConnectRoom = toolkit.createSelector([
|
|
1540
|
+
selectAppIsActive,
|
|
1541
|
+
selectOrganizationId,
|
|
1542
|
+
selectRoomConnectionStatus,
|
|
1543
|
+
selectSignalConnectionDeviceIdentified,
|
|
1544
|
+
selectLocalMediaStatus,
|
|
1545
|
+
selectRoomConnectionError,
|
|
1546
|
+
], (appIsActive, hasOrganizationIdFetched, roomConnectionStatus, signalConnectionDeviceIdentified, localMediaStatus, roomConnectionError) => {
|
|
1547
|
+
if (appIsActive &&
|
|
1548
|
+
localMediaStatus === "started" &&
|
|
1549
|
+
signalConnectionDeviceIdentified &&
|
|
1550
|
+
!!hasOrganizationIdFetched &&
|
|
1551
|
+
["ready", "reconnecting", "disconnected"].includes(roomConnectionStatus) &&
|
|
1552
|
+
!roomConnectionError) {
|
|
1553
|
+
return true;
|
|
1554
|
+
}
|
|
1555
|
+
return false;
|
|
1556
|
+
});
|
|
1557
|
+
createReactor([selectShouldConnectRoom], ({ dispatch }, shouldConnectRoom) => {
|
|
1558
|
+
if (shouldConnectRoom) {
|
|
1559
|
+
dispatch(doConnectRoom());
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
startAppListening({
|
|
1563
|
+
actionCreator: signalEvents.roomJoined,
|
|
1564
|
+
effect: ({ payload }, { dispatch, getOriginalState }) => {
|
|
1565
|
+
if ("error" in payload) {
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
const originalState = getOriginalState();
|
|
1569
|
+
if (!selectRoomConnectionIsRejoining(originalState)) {
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
dispatch(roomRejoined({ selfId: payload.selfId, previousSelfId: selectSelfId(originalState) }));
|
|
1573
|
+
},
|
|
1574
|
+
});
|
|
1575
|
+
startAppListening({
|
|
1576
|
+
actionCreator: signalEvents.knockHandled,
|
|
1577
|
+
effect: ({ payload }, { dispatch, getState }) => {
|
|
1578
|
+
var _a, _b;
|
|
1579
|
+
const { clientId, resolution } = payload;
|
|
1580
|
+
const state = getState();
|
|
1581
|
+
const selfId = selectSelfId(state);
|
|
1582
|
+
if (clientId !== selfId) {
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
if (resolution === "accepted") {
|
|
1586
|
+
dispatch(setRoomKey(payload.metadata.roomKey));
|
|
1587
|
+
dispatch(doConnectRoom());
|
|
1588
|
+
}
|
|
1589
|
+
else if (resolution === "on_hold") {
|
|
1590
|
+
dispatch(knockResponseReceived((_a = payload.knockResponse) !== null && _a !== void 0 ? _a : null));
|
|
1591
|
+
dispatch(connectionStatusChanged("knock_on_hold"));
|
|
1592
|
+
}
|
|
1593
|
+
else if (resolution === "rejected") {
|
|
1594
|
+
dispatch(knockResponseReceived((_b = payload.knockResponse) !== null && _b !== void 0 ? _b : null));
|
|
1595
|
+
dispatch(connectionStatusChanged("knock_rejected"));
|
|
1596
|
+
}
|
|
1597
|
+
},
|
|
1598
|
+
});
|
|
1599
|
+
startAppListening({
|
|
1600
|
+
actionCreator: signalEvents.clientKicked,
|
|
1601
|
+
effect: (_, { dispatch }) => {
|
|
1602
|
+
dispatch(doAppStop());
|
|
1603
|
+
},
|
|
1604
|
+
});
|
|
1605
|
+
startAppListening({
|
|
1606
|
+
actionCreator: doAppStop,
|
|
1607
|
+
effect: (_, { dispatch, getState }) => {
|
|
1608
|
+
const state = getState();
|
|
1609
|
+
const roomConnectionStatus = selectRoomConnectionStatus(state);
|
|
1610
|
+
if (roomConnectionStatus === "connected") {
|
|
1611
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
1612
|
+
socket === null || socket === void 0 ? void 0 : socket.emit("leave_room");
|
|
1613
|
+
dispatch(connectionStatusChanged("leaving"));
|
|
1614
|
+
}
|
|
1615
|
+
else {
|
|
1616
|
+
dispatch(doSignalDisconnect());
|
|
1617
|
+
}
|
|
1618
|
+
},
|
|
1619
|
+
});
|
|
1349
1620
|
|
|
1350
1621
|
const emitter = new events$1.EventEmitter();
|
|
1351
1622
|
function createNotificationEvent(payload) {
|
|
@@ -1532,6 +1803,25 @@ createReactor([selectSignalStatus], ({ dispatch, getState }, signalStatus) => {
|
|
|
1532
1803
|
})));
|
|
1533
1804
|
}
|
|
1534
1805
|
});
|
|
1806
|
+
createReactor([selectRoomConnectionIsRejoining], ({ dispatch }, isRejoining) => {
|
|
1807
|
+
if (isRejoining) {
|
|
1808
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1809
|
+
type: "reconnecting",
|
|
1810
|
+
message: `Reconnecting to the room...`,
|
|
1811
|
+
props: {},
|
|
1812
|
+
})));
|
|
1813
|
+
}
|
|
1814
|
+
});
|
|
1815
|
+
startAppListening({
|
|
1816
|
+
actionCreator: roomRejoined,
|
|
1817
|
+
effect: (_, { dispatch }) => {
|
|
1818
|
+
dispatch(doSetNotification(createNotificationEvent({
|
|
1819
|
+
type: "reconnected",
|
|
1820
|
+
message: `Reconnected to the room`,
|
|
1821
|
+
props: {},
|
|
1822
|
+
})));
|
|
1823
|
+
},
|
|
1824
|
+
});
|
|
1535
1825
|
startAppListening({
|
|
1536
1826
|
actionCreator: signalEvents.clientUnableToJoin,
|
|
1537
1827
|
effect: (action, { dispatch }) => {
|
|
@@ -3274,254 +3564,6 @@ createReactor([selectBreakoutAssignments, selectDeviceId, selectLocalParticipant
|
|
|
3274
3564
|
}
|
|
3275
3565
|
});
|
|
3276
3566
|
|
|
3277
|
-
const organizationSliceInitialState = {
|
|
3278
|
-
data: null,
|
|
3279
|
-
isFetching: false,
|
|
3280
|
-
error: null,
|
|
3281
|
-
};
|
|
3282
|
-
const organizationSlice = toolkit.createSlice({
|
|
3283
|
-
name: "organization",
|
|
3284
|
-
initialState: organizationSliceInitialState,
|
|
3285
|
-
reducers: {},
|
|
3286
|
-
extraReducers: (builder) => {
|
|
3287
|
-
builder.addCase(doOrganizationFetch.pending, (state) => {
|
|
3288
|
-
return Object.assign(Object.assign({}, state), { isFetching: true });
|
|
3289
|
-
});
|
|
3290
|
-
builder.addCase(doOrganizationFetch.fulfilled, (state, action) => {
|
|
3291
|
-
if (!action.payload)
|
|
3292
|
-
return Object.assign(Object.assign({}, state), { isFetching: true });
|
|
3293
|
-
return Object.assign(Object.assign({}, state), { isFetching: false, data: action.payload });
|
|
3294
|
-
});
|
|
3295
|
-
builder.addCase(doOrganizationFetch.rejected, (state) => {
|
|
3296
|
-
return Object.assign(Object.assign({}, state), { isFetching: false, error: true });
|
|
3297
|
-
});
|
|
3298
|
-
},
|
|
3299
|
-
});
|
|
3300
|
-
const doOrganizationFetch = createAppAsyncThunk("organization/doOrganizationFetch", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { extra, getState }) {
|
|
3301
|
-
try {
|
|
3302
|
-
const roomUrl = selectAppRoomUrl(getState());
|
|
3303
|
-
const organization = yield extra.services.fetchOrganizationFromRoomUrl(roomUrl || "");
|
|
3304
|
-
if (!organization) {
|
|
3305
|
-
throw new Error("Invalid room url");
|
|
3306
|
-
}
|
|
3307
|
-
return organization;
|
|
3308
|
-
}
|
|
3309
|
-
catch (error) {
|
|
3310
|
-
console.error(error);
|
|
3311
|
-
}
|
|
3312
|
-
}));
|
|
3313
|
-
const selectOrganizationRaw = (state) => state.organization;
|
|
3314
|
-
const selectOrganizationId = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.organizationId; };
|
|
3315
|
-
const selectOrganizationPreferences = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.preferences; };
|
|
3316
|
-
const selectShouldFetchOrganization = toolkit.createSelector(selectAppIsActive, selectOrganizationRaw, selectDeviceCredentialsRaw, (appIsActive, organization, deviceCredentials) => {
|
|
3317
|
-
if (appIsActive &&
|
|
3318
|
-
!organization.data &&
|
|
3319
|
-
!organization.isFetching &&
|
|
3320
|
-
!organization.error &&
|
|
3321
|
-
!deviceCredentials.isFetching) {
|
|
3322
|
-
return true;
|
|
3323
|
-
}
|
|
3324
|
-
return false;
|
|
3325
|
-
});
|
|
3326
|
-
createReactor([selectShouldFetchOrganization], ({ dispatch }, shouldFetchOrganization) => {
|
|
3327
|
-
if (shouldFetchOrganization) {
|
|
3328
|
-
dispatch(doOrganizationFetch());
|
|
3329
|
-
}
|
|
3330
|
-
});
|
|
3331
|
-
|
|
3332
|
-
const roomConnectionSliceInitialState = {
|
|
3333
|
-
session: null,
|
|
3334
|
-
status: "ready",
|
|
3335
|
-
error: null,
|
|
3336
|
-
knockResponse: null,
|
|
3337
|
-
};
|
|
3338
|
-
const roomConnectionSlice = toolkit.createSlice({
|
|
3339
|
-
name: "roomConnection",
|
|
3340
|
-
initialState: roomConnectionSliceInitialState,
|
|
3341
|
-
reducers: {
|
|
3342
|
-
connectionStatusChanged: (state, action) => {
|
|
3343
|
-
return Object.assign(Object.assign({}, state), { status: action.payload });
|
|
3344
|
-
},
|
|
3345
|
-
knockResponseReceived: (state, action) => {
|
|
3346
|
-
return Object.assign(Object.assign({}, state), { knockResponse: action.payload });
|
|
3347
|
-
},
|
|
3348
|
-
},
|
|
3349
|
-
extraReducers: (builder) => {
|
|
3350
|
-
builder.addCase(signalEvents.roomJoined, (state, action) => {
|
|
3351
|
-
var _a;
|
|
3352
|
-
if ("error" in action.payload) {
|
|
3353
|
-
if (action.payload.error === "room_locked" && action.payload.isLocked) {
|
|
3354
|
-
return Object.assign(Object.assign({}, state), { status: "room_locked" });
|
|
3355
|
-
}
|
|
3356
|
-
return Object.assign(Object.assign({}, state), { status: "disconnected", error: action.payload.error });
|
|
3357
|
-
}
|
|
3358
|
-
const { room } = action.payload;
|
|
3359
|
-
return Object.assign(Object.assign({}, state), { status: "connected", session: (_a = room.session) !== null && _a !== void 0 ? _a : null });
|
|
3360
|
-
});
|
|
3361
|
-
builder.addCase(signalEvents.disconnect, (state) => {
|
|
3362
|
-
if (["kicked", "left"].includes(state.status)) {
|
|
3363
|
-
return Object.assign({}, state);
|
|
3364
|
-
}
|
|
3365
|
-
return Object.assign(Object.assign({}, state), { status: "disconnected" });
|
|
3366
|
-
});
|
|
3367
|
-
builder.addCase(signalEvents.newClient, (state, action) => {
|
|
3368
|
-
var _a, _b;
|
|
3369
|
-
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 });
|
|
3370
|
-
});
|
|
3371
|
-
builder.addCase(signalEvents.roomSessionEnded, (state, action) => {
|
|
3372
|
-
var _a;
|
|
3373
|
-
if (((_a = state.session) === null || _a === void 0 ? void 0 : _a.id) !== action.payload.roomSessionId) {
|
|
3374
|
-
return state;
|
|
3375
|
-
}
|
|
3376
|
-
return Object.assign(Object.assign({}, state), { session: null });
|
|
3377
|
-
});
|
|
3378
|
-
builder.addCase(signalEvents.clientKicked, (state) => {
|
|
3379
|
-
return Object.assign(Object.assign({}, state), { status: "kicked" });
|
|
3380
|
-
});
|
|
3381
|
-
builder.addCase(signalEvents.roomLeft, (state) => {
|
|
3382
|
-
return Object.assign(Object.assign({}, state), { status: "left" });
|
|
3383
|
-
});
|
|
3384
|
-
builder.addCase(socketReconnecting, (state) => {
|
|
3385
|
-
return Object.assign(Object.assign({}, state), { status: "reconnecting" });
|
|
3386
|
-
});
|
|
3387
|
-
},
|
|
3388
|
-
});
|
|
3389
|
-
const { connectionStatusChanged, knockResponseReceived } = roomConnectionSlice.actions;
|
|
3390
|
-
const doKnockRoom = createAppThunk(() => (dispatch, getState) => {
|
|
3391
|
-
const state = getState();
|
|
3392
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
3393
|
-
const roomName = selectAppRoomName(state);
|
|
3394
|
-
const roomKey = selectRoomKey(state);
|
|
3395
|
-
const displayName = selectAppDisplayName(state);
|
|
3396
|
-
const isDialIn = selectAppIsDialIn(state);
|
|
3397
|
-
const isAudioRecorder = selectAppIsAudioRecorder(state);
|
|
3398
|
-
const userAgent = selectAppUserAgent(state);
|
|
3399
|
-
const externalId = selectAppExternalId(state);
|
|
3400
|
-
const organizationId = selectOrganizationId(state);
|
|
3401
|
-
const connectionStatus = selectRoomConnectionStatus(state);
|
|
3402
|
-
const clientClaim = selectLocalParticipantClientClaim(state);
|
|
3403
|
-
if (connectionStatus !== "room_locked") {
|
|
3404
|
-
console.warn("Room is not locked, knock aborted");
|
|
3405
|
-
return;
|
|
3406
|
-
}
|
|
3407
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("knock_room", Object.assign({ avatarUrl: null, config: {
|
|
3408
|
-
isAudioEnabled: true,
|
|
3409
|
-
isVideoEnabled: true,
|
|
3410
|
-
}, deviceCapabilities: { canScreenshare: true }, displayName, isCoLocated: false, isDialIn,
|
|
3411
|
-
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
3412
|
-
roomKey,
|
|
3413
|
-
roomName,
|
|
3414
|
-
userAgent,
|
|
3415
|
-
externalId }, (clientClaim && { clientClaim })));
|
|
3416
|
-
dispatch(connectionStatusChanged("knocking"));
|
|
3417
|
-
});
|
|
3418
|
-
const doCancelKnock = createAppThunk(() => (dispatch, getState) => {
|
|
3419
|
-
const state = getState();
|
|
3420
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
3421
|
-
const connectionStatus = selectRoomConnectionStatus(state);
|
|
3422
|
-
if (connectionStatus !== "knocking") {
|
|
3423
|
-
console.warn("Not knocking, cancel knock aborted");
|
|
3424
|
-
return;
|
|
3425
|
-
}
|
|
3426
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("cancel_room_knock");
|
|
3427
|
-
dispatch(connectionStatusChanged("ready"));
|
|
3428
|
-
});
|
|
3429
|
-
const doConnectRoom = createAppThunk(() => (dispatch, getState) => {
|
|
3430
|
-
const state = getState();
|
|
3431
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
3432
|
-
const roomName = selectAppRoomName(state);
|
|
3433
|
-
const roomKey = selectRoomKey(state);
|
|
3434
|
-
const assistantKey = selectAssistantKey(state);
|
|
3435
|
-
const displayName = selectAppDisplayName(state);
|
|
3436
|
-
const userAgent = selectAppUserAgent(state);
|
|
3437
|
-
const externalId = selectAppExternalId(state);
|
|
3438
|
-
const isDialIn = selectAppIsDialIn(state);
|
|
3439
|
-
const isAudioRecorder = selectAppIsAudioRecorder(state);
|
|
3440
|
-
const organizationId = selectOrganizationId(state);
|
|
3441
|
-
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
3442
|
-
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
3443
|
-
const clientClaim = selectLocalParticipantClientClaim(getState());
|
|
3444
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("join_room", Object.assign({ avatarUrl: null, config: {
|
|
3445
|
-
isAudioEnabled: isMicrophoneEnabled,
|
|
3446
|
-
isVideoEnabled: isCameraEnabled,
|
|
3447
|
-
}, deviceCapabilities: { canScreenshare: true }, displayName, isCoLocated: false, isDialIn,
|
|
3448
|
-
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
3449
|
-
roomKey,
|
|
3450
|
-
assistantKey,
|
|
3451
|
-
roomName,
|
|
3452
|
-
userAgent,
|
|
3453
|
-
externalId }, (clientClaim && { clientClaim })));
|
|
3454
|
-
dispatch(connectionStatusChanged("connecting"));
|
|
3455
|
-
});
|
|
3456
|
-
const selectShouldConnectRoom = toolkit.createSelector([
|
|
3457
|
-
selectAppIsActive,
|
|
3458
|
-
selectOrganizationId,
|
|
3459
|
-
selectRoomConnectionStatus,
|
|
3460
|
-
selectSignalConnectionDeviceIdentified,
|
|
3461
|
-
selectLocalMediaStatus,
|
|
3462
|
-
selectRoomConnectionError,
|
|
3463
|
-
], (appIsActive, hasOrganizationIdFetched, roomConnectionStatus, signalConnectionDeviceIdentified, localMediaStatus, roomConnectionError) => {
|
|
3464
|
-
if (appIsActive &&
|
|
3465
|
-
localMediaStatus === "started" &&
|
|
3466
|
-
signalConnectionDeviceIdentified &&
|
|
3467
|
-
!!hasOrganizationIdFetched &&
|
|
3468
|
-
["ready", "reconnecting", "disconnected"].includes(roomConnectionStatus) &&
|
|
3469
|
-
!roomConnectionError) {
|
|
3470
|
-
return true;
|
|
3471
|
-
}
|
|
3472
|
-
return false;
|
|
3473
|
-
});
|
|
3474
|
-
createReactor([selectShouldConnectRoom], ({ dispatch }, shouldConnectRoom) => {
|
|
3475
|
-
if (shouldConnectRoom) {
|
|
3476
|
-
dispatch(doConnectRoom());
|
|
3477
|
-
}
|
|
3478
|
-
});
|
|
3479
|
-
startAppListening({
|
|
3480
|
-
actionCreator: signalEvents.knockHandled,
|
|
3481
|
-
effect: ({ payload }, { dispatch, getState }) => {
|
|
3482
|
-
var _a, _b;
|
|
3483
|
-
const { clientId, resolution } = payload;
|
|
3484
|
-
const state = getState();
|
|
3485
|
-
const selfId = selectSelfId(state);
|
|
3486
|
-
if (clientId !== selfId) {
|
|
3487
|
-
return;
|
|
3488
|
-
}
|
|
3489
|
-
if (resolution === "accepted") {
|
|
3490
|
-
dispatch(setRoomKey(payload.metadata.roomKey));
|
|
3491
|
-
dispatch(doConnectRoom());
|
|
3492
|
-
}
|
|
3493
|
-
else if (resolution === "on_hold") {
|
|
3494
|
-
dispatch(knockResponseReceived((_a = payload.knockResponse) !== null && _a !== void 0 ? _a : null));
|
|
3495
|
-
dispatch(connectionStatusChanged("knock_on_hold"));
|
|
3496
|
-
}
|
|
3497
|
-
else if (resolution === "rejected") {
|
|
3498
|
-
dispatch(knockResponseReceived((_b = payload.knockResponse) !== null && _b !== void 0 ? _b : null));
|
|
3499
|
-
dispatch(connectionStatusChanged("knock_rejected"));
|
|
3500
|
-
}
|
|
3501
|
-
},
|
|
3502
|
-
});
|
|
3503
|
-
startAppListening({
|
|
3504
|
-
actionCreator: signalEvents.clientKicked,
|
|
3505
|
-
effect: (_, { dispatch }) => {
|
|
3506
|
-
dispatch(doAppStop());
|
|
3507
|
-
},
|
|
3508
|
-
});
|
|
3509
|
-
startAppListening({
|
|
3510
|
-
actionCreator: doAppStop,
|
|
3511
|
-
effect: (_, { dispatch, getState }) => {
|
|
3512
|
-
const state = getState();
|
|
3513
|
-
const roomConnectionStatus = selectRoomConnectionStatus(state);
|
|
3514
|
-
if (roomConnectionStatus === "connected") {
|
|
3515
|
-
const socket = selectSignalConnectionRaw(state).socket;
|
|
3516
|
-
socket === null || socket === void 0 ? void 0 : socket.emit("leave_room");
|
|
3517
|
-
dispatch(connectionStatusChanged("leaving"));
|
|
3518
|
-
}
|
|
3519
|
-
else {
|
|
3520
|
-
doSignalDisconnect();
|
|
3521
|
-
}
|
|
3522
|
-
},
|
|
3523
|
-
});
|
|
3524
|
-
|
|
3525
3567
|
function roomIntegrationContentTagName(integrationName) {
|
|
3526
3568
|
return `${integrationName}-integration-contentframe`;
|
|
3527
3569
|
}
|
|
@@ -5479,6 +5521,7 @@ exports.roomIntegrationPickerUrl = roomIntegrationPickerUrl;
|
|
|
5479
5521
|
exports.roomIntegrationSignalError = roomIntegrationSignalError;
|
|
5480
5522
|
exports.roomIntegrationsSlice = roomIntegrationsSlice;
|
|
5481
5523
|
exports.roomIntegrationsSliceInitialState = roomIntegrationsSliceInitialState;
|
|
5524
|
+
exports.roomRejoined = roomRejoined;
|
|
5482
5525
|
exports.roomSlice = roomSlice;
|
|
5483
5526
|
exports.roomSliceInitialState = roomSliceInitialState;
|
|
5484
5527
|
exports.rootReducer = rootReducer;
|
|
@@ -5632,6 +5675,7 @@ exports.selectRemoteParticipants = selectRemoteParticipants;
|
|
|
5632
5675
|
exports.selectRemoteParticipantsRaw = selectRemoteParticipantsRaw;
|
|
5633
5676
|
exports.selectRemoteScreenshareVideoTrackIds = selectRemoteScreenshareVideoTrackIds;
|
|
5634
5677
|
exports.selectRoomConnectionError = selectRoomConnectionError;
|
|
5678
|
+
exports.selectRoomConnectionIsRejoining = selectRoomConnectionIsRejoining;
|
|
5635
5679
|
exports.selectRoomConnectionKnockResponse = selectRoomConnectionKnockResponse;
|
|
5636
5680
|
exports.selectRoomConnectionRaw = selectRoomConnectionRaw;
|
|
5637
5681
|
exports.selectRoomConnectionSession = selectRoomConnectionSession;
|