@whereby.com/core 1.13.0 → 1.14.1
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 +202 -12
- package/dist/index.d.cts +33 -4
- package/dist/index.d.mts +33 -4
- package/dist/index.d.ts +33 -4
- package/dist/index.mjs +202 -15
- package/dist/legacy-esm.js +202 -15
- package/dist/redux/index.cjs +198 -11
- package/dist/redux/index.d.cts +123 -3
- package/dist/redux/index.d.mts +123 -3
- package/dist/redux/index.d.ts +123 -3
- package/dist/redux/index.js +185 -13
- package/dist/redux/index.mjs +185 -13
- package/package.json +4 -4
package/dist/redux/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createAsyncThunk, createListenerMiddleware, addListener, createSlice, createAction, createSelector, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
2
|
+
import { ServerSocket, isFileShareError, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
3
4
|
import { EventEmitter } from 'events';
|
|
4
5
|
import nodeBtoa from 'btoa';
|
|
5
6
|
import axios from 'axios';
|
|
@@ -73,7 +74,7 @@ const createReactor = (selectors, callback) => {
|
|
|
73
74
|
});
|
|
74
75
|
};
|
|
75
76
|
|
|
76
|
-
const coreVersion = "1.
|
|
77
|
+
const coreVersion = "1.14.1";
|
|
77
78
|
|
|
78
79
|
const initialState$2 = {
|
|
79
80
|
displayName: null,
|
|
@@ -128,6 +129,7 @@ const signalEvents = {
|
|
|
128
129
|
breakoutSessionUpdated: createSignalEventAction("breakoutSessionUpdated"),
|
|
129
130
|
chatMessage: createSignalEventAction("chatMessage"),
|
|
130
131
|
chatMessageRemoved: createSignalEventAction("chatMessageRemoved"),
|
|
132
|
+
fileSharingError: createSignalEventAction("fileSharingError"),
|
|
131
133
|
clientLeft: createSignalEventAction("clientLeft"),
|
|
132
134
|
clientKicked: createSignalEventAction("clientKicked"),
|
|
133
135
|
clientMetadataReceived: createSignalEventAction("clientMetadataReceived"),
|
|
@@ -305,7 +307,13 @@ function forwardSocketEvents(socket, dispatch) {
|
|
|
305
307
|
socket.on("video_enabled", (payload) => dispatch(signalEvents.videoEnabled(payload)));
|
|
306
308
|
socket.on("audio_enable_requested", (payload) => dispatch(signalEvents.audioEnableRequested(payload)));
|
|
307
309
|
socket.on("client_metadata_received", (payload) => dispatch(signalEvents.clientMetadataReceived(payload)));
|
|
308
|
-
socket.on("chat_message", (payload) =>
|
|
310
|
+
socket.on("chat_message", (payload) => {
|
|
311
|
+
if (isFileShareError(payload)) {
|
|
312
|
+
dispatch(signalEvents.fileSharingError(payload));
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
dispatch(signalEvents.chatMessage(payload));
|
|
316
|
+
});
|
|
309
317
|
socket.on("chat_message_removed", (payload) => dispatch(signalEvents.chatMessageRemoved(payload)));
|
|
310
318
|
socket.on("disconnect", () => dispatch(signalEvents.disconnect()));
|
|
311
319
|
socket.on("room_knocked", (payload) => dispatch(signalEvents.roomKnocked(payload)));
|
|
@@ -1158,15 +1166,7 @@ const chatSlice = createSlice({
|
|
|
1158
1166
|
reducers: {},
|
|
1159
1167
|
extraReducers(builder) {
|
|
1160
1168
|
builder.addCase(signalEvents.chatMessage, (state, action) => {
|
|
1161
|
-
const message = {
|
|
1162
|
-
id: action.payload.id,
|
|
1163
|
-
senderId: action.payload.senderId,
|
|
1164
|
-
parentId: action.payload.parentId,
|
|
1165
|
-
timestamp: action.payload.timestamp,
|
|
1166
|
-
text: action.payload.text,
|
|
1167
|
-
sig: action.payload.sig,
|
|
1168
|
-
removed: false,
|
|
1169
|
-
};
|
|
1169
|
+
const message = Object.assign({ id: action.payload.id, senderId: action.payload.senderId, parentId: action.payload.parentId, timestamp: action.payload.timestamp, text: action.payload.text, sig: action.payload.sig, removed: false }, (action.payload.file && { file: action.payload.file }));
|
|
1170
1170
|
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, message] });
|
|
1171
1171
|
});
|
|
1172
1172
|
builder.addCase(signalEvents.chatMessageRemoved, (state, action) => {
|
|
@@ -2275,6 +2275,177 @@ createReactor([selectShouldStopConnectionMonitor], ({ dispatch }, shouldStartCon
|
|
|
2275
2275
|
}
|
|
2276
2276
|
});
|
|
2277
2277
|
|
|
2278
|
+
const MAX_FILES_PER_UPLOAD = 10;
|
|
2279
|
+
const MAX_FILE_SIZE = 15 * 1024 * 1024;
|
|
2280
|
+
const ACCEPTED_FILE_TYPES = {
|
|
2281
|
+
"application/doc": [".doc", ".docx"],
|
|
2282
|
+
"application/msword": [".doc", ".docx"],
|
|
2283
|
+
"application/pdf": [".pdf"],
|
|
2284
|
+
"application/rtf": [".rtf"],
|
|
2285
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
|
|
2286
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
|
|
2287
|
+
"audio/mpeg": [".mp3"],
|
|
2288
|
+
"audio/wav": [".wav"],
|
|
2289
|
+
"image/gif": [".gif"],
|
|
2290
|
+
"image/jpeg": [".jpeg", ".jpg"],
|
|
2291
|
+
"image/png": [".png"],
|
|
2292
|
+
"image/webp": [".webp"],
|
|
2293
|
+
"text/csv": [".csv"],
|
|
2294
|
+
"text/plain": [".txt"],
|
|
2295
|
+
"video/mp4": [".mp4"],
|
|
2296
|
+
"video/quicktime": [".mov"],
|
|
2297
|
+
"video/webm": [".webm"],
|
|
2298
|
+
"video/x-matroska": [".mkv"],
|
|
2299
|
+
};
|
|
2300
|
+
function isAcceptedFileType(file) {
|
|
2301
|
+
if (file.type && ACCEPTED_FILE_TYPES[file.type]) {
|
|
2302
|
+
return true;
|
|
2303
|
+
}
|
|
2304
|
+
const dot = file.name.lastIndexOf(".");
|
|
2305
|
+
if (dot < 0) {
|
|
2306
|
+
return false;
|
|
2307
|
+
}
|
|
2308
|
+
const extension = file.name.slice(dot).toLowerCase();
|
|
2309
|
+
return Object.values(ACCEPTED_FILE_TYPES).some((extensions) => extensions.includes(extension));
|
|
2310
|
+
}
|
|
2311
|
+
function validateFile(file) {
|
|
2312
|
+
if (!isAcceptedFileType(file)) {
|
|
2313
|
+
return "unsupported_file_type";
|
|
2314
|
+
}
|
|
2315
|
+
if (file.size > MAX_FILE_SIZE) {
|
|
2316
|
+
return "file_too_large";
|
|
2317
|
+
}
|
|
2318
|
+
return undefined;
|
|
2319
|
+
}
|
|
2320
|
+
const fileShareSliceInitialState = {
|
|
2321
|
+
uploads: [],
|
|
2322
|
+
requestInFlight: false,
|
|
2323
|
+
};
|
|
2324
|
+
const fileShareSlice = createSlice({
|
|
2325
|
+
name: "fileShare",
|
|
2326
|
+
initialState: fileShareSliceInitialState,
|
|
2327
|
+
reducers: {
|
|
2328
|
+
fileUploadsStarted: (state, action) => {
|
|
2329
|
+
state.uploads.push(...action.payload);
|
|
2330
|
+
state.requestInFlight = true;
|
|
2331
|
+
},
|
|
2332
|
+
fileShareRequestSettled: (state) => {
|
|
2333
|
+
state.requestInFlight = false;
|
|
2334
|
+
},
|
|
2335
|
+
fileUploadSucceeded: (state, action) => {
|
|
2336
|
+
const upload = state.uploads.find((u) => u.id === action.payload.id);
|
|
2337
|
+
if (upload) {
|
|
2338
|
+
upload.status = "sent";
|
|
2339
|
+
}
|
|
2340
|
+
},
|
|
2341
|
+
fileUploadFailed: (state, action) => {
|
|
2342
|
+
const upload = state.uploads.find((u) => u.id === action.payload.id);
|
|
2343
|
+
if (upload) {
|
|
2344
|
+
upload.status = "error";
|
|
2345
|
+
upload.error = action.payload.error;
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
clearFileUploads: (state) => {
|
|
2349
|
+
state.uploads = [];
|
|
2350
|
+
},
|
|
2351
|
+
},
|
|
2352
|
+
});
|
|
2353
|
+
const { fileUploadsStarted, fileShareRequestSettled, fileUploadSucceeded, fileUploadFailed, clearFileUploads } = fileShareSlice.actions;
|
|
2354
|
+
function uploadFile(file, uploadUrl) {
|
|
2355
|
+
const form = new FormData();
|
|
2356
|
+
form.append("Content-Type", file.type);
|
|
2357
|
+
Object.entries(uploadUrl.fields).forEach(([key, value]) => form.append(key, value));
|
|
2358
|
+
form.append("file", file);
|
|
2359
|
+
return fetch(uploadUrl.url, { method: "POST", body: form });
|
|
2360
|
+
}
|
|
2361
|
+
const doSendFiles = createAsyncRoomConnectedThunk("fileShare/sendFiles", (payload_1, _a) => __awaiter(void 0, [payload_1, _a], void 0, function* (payload, { dispatch, getState }) {
|
|
2362
|
+
const state = getState();
|
|
2363
|
+
if (state.fileShare.requestInFlight) {
|
|
2364
|
+
return Promise.reject(new Error("A file upload request is already in flight"));
|
|
2365
|
+
}
|
|
2366
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
2367
|
+
if (!socket) {
|
|
2368
|
+
return Promise.reject(new Error("No signal connection"));
|
|
2369
|
+
}
|
|
2370
|
+
const breakoutCurrentId = selectBreakoutCurrentId(state);
|
|
2371
|
+
const { files } = payload;
|
|
2372
|
+
if (!files.length) {
|
|
2373
|
+
return;
|
|
2374
|
+
}
|
|
2375
|
+
const tooManyFiles = files.length > MAX_FILES_PER_UPLOAD;
|
|
2376
|
+
const entries = files.map((file) => {
|
|
2377
|
+
const error = tooManyFiles ? "too_many_files" : validateFile(file);
|
|
2378
|
+
const upload = Object.assign({ id: v4(), name: file.name, size: file.size, type: file.type, status: error ? "error" : "uploading" }, (error && { error }));
|
|
2379
|
+
return { file, upload };
|
|
2380
|
+
});
|
|
2381
|
+
dispatch(fileUploadsStarted(entries.map((entry) => entry.upload)));
|
|
2382
|
+
const accepted = entries.filter((entry) => entry.upload.status === "uploading");
|
|
2383
|
+
if (!accepted.length) {
|
|
2384
|
+
dispatch(fileShareRequestSettled());
|
|
2385
|
+
return;
|
|
2386
|
+
}
|
|
2387
|
+
const acceptedFiles = accepted.map((entry) => entry.file);
|
|
2388
|
+
const outcome = yield new Promise((resolve) => {
|
|
2389
|
+
let settled = false;
|
|
2390
|
+
const removeListener = dispatch(addAppListener({
|
|
2391
|
+
actionCreator: signalEvents.fileSharingError,
|
|
2392
|
+
effect: (action, listenerApi) => {
|
|
2393
|
+
if (settled)
|
|
2394
|
+
return;
|
|
2395
|
+
settled = true;
|
|
2396
|
+
listenerApi.unsubscribe();
|
|
2397
|
+
resolve({ error: action.payload.error });
|
|
2398
|
+
},
|
|
2399
|
+
}));
|
|
2400
|
+
socket.emit("request_file_upload_url", { files: acceptedFiles.map((f) => ({ name: f.name, size: f.size, type: f.type })) }, (urls) => {
|
|
2401
|
+
if (settled)
|
|
2402
|
+
return;
|
|
2403
|
+
settled = true;
|
|
2404
|
+
removeListener({ cancelActive: true });
|
|
2405
|
+
resolve({ urls });
|
|
2406
|
+
});
|
|
2407
|
+
});
|
|
2408
|
+
dispatch(fileShareRequestSettled());
|
|
2409
|
+
if ("error" in outcome) {
|
|
2410
|
+
accepted.forEach((entry) => dispatch(fileUploadFailed({ id: entry.upload.id, error: outcome.error })));
|
|
2411
|
+
return;
|
|
2412
|
+
}
|
|
2413
|
+
yield Promise.all(accepted.map((_a, index_1) => __awaiter(void 0, [_a, index_1], void 0, function* ({ file, upload }, index) {
|
|
2414
|
+
const urls = outcome.urls[index];
|
|
2415
|
+
if (!urls) {
|
|
2416
|
+
dispatch(fileUploadFailed({ id: upload.id, error: "upload_failed" }));
|
|
2417
|
+
return;
|
|
2418
|
+
}
|
|
2419
|
+
try {
|
|
2420
|
+
const response = yield uploadFile(file, urls.uploadUrl);
|
|
2421
|
+
if (!response.ok) {
|
|
2422
|
+
throw new Error(`S3 upload failed with status ${response.status}`);
|
|
2423
|
+
}
|
|
2424
|
+
socket.emit("chat_message", Object.assign({ text: "", file: {
|
|
2425
|
+
downloadUrl: urls.downloadUrl,
|
|
2426
|
+
name: file.name,
|
|
2427
|
+
size: file.size,
|
|
2428
|
+
type: file.type,
|
|
2429
|
+
key: urls.uploadUrl.fields.key,
|
|
2430
|
+
} }, (breakoutCurrentId && { breakoutGroup: breakoutCurrentId })));
|
|
2431
|
+
dispatch(fileUploadSucceeded({ id: upload.id }));
|
|
2432
|
+
}
|
|
2433
|
+
catch (_b) {
|
|
2434
|
+
dispatch(fileUploadFailed({ id: upload.id, error: "upload_failed" }));
|
|
2435
|
+
}
|
|
2436
|
+
})));
|
|
2437
|
+
}));
|
|
2438
|
+
const doDownloadFile = createAppAsyncThunk("fileShare/downloadFile", (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2439
|
+
const response = yield fetch(payload.file.downloadUrl, { mode: "cors", cache: "no-cache" });
|
|
2440
|
+
if (!response.ok) {
|
|
2441
|
+
throw new Error(`Failed to download file: ${response.status}`);
|
|
2442
|
+
}
|
|
2443
|
+
return response.blob();
|
|
2444
|
+
}));
|
|
2445
|
+
const selectFileShareRaw = (state) => state.fileShare;
|
|
2446
|
+
const selectFileUploads = (state) => state.fileShare.uploads;
|
|
2447
|
+
const selectFileShareRequestInFlight = (state) => state.fileShare.requestInFlight;
|
|
2448
|
+
|
|
2278
2449
|
const initialLiveTranscriptionState = {
|
|
2279
2450
|
isInitiator: false,
|
|
2280
2451
|
isTranscribing: false,
|
|
@@ -3407,6 +3578,7 @@ const appReducer = combineReducers({
|
|
|
3407
3578
|
cloudRecording: cloudRecordingSlice.reducer,
|
|
3408
3579
|
connectionMonitor: connectionMonitorSlice.reducer,
|
|
3409
3580
|
deviceCredentials: deviceCredentialsSlice.reducer,
|
|
3581
|
+
fileShare: fileShareSlice.reducer,
|
|
3410
3582
|
liveTranscription: liveTranscriptionSlice.reducer,
|
|
3411
3583
|
localMedia: localMediaSlice.reducer,
|
|
3412
3584
|
localParticipant: localParticipantSlice.reducer,
|
|
@@ -4183,4 +4355,4 @@ function createServices() {
|
|
|
4183
4355
|
};
|
|
4184
4356
|
}
|
|
4185
4357
|
|
|
4186
|
-
export { addAppListener, addSpotlight, appSlice, authorizationSlice, authorizationSliceInitialState, breakoutSlice, breakoutSliceInitialState, chatSlice, chatSliceInitialState, cloudRecordingSlice, connectionMonitorSlice, connectionMonitorSliceInitialState, connectionMonitorStarted, connectionMonitorStopped, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createAsyncRoomConnectedThunk, createAuthorizedRoomConnectedThunk, createReactor, createRemoteParticipant, createRoomConnectedThunk, createServices, createStore, createWebRtcEmitter, deviceBusy, deviceCredentialsSlice, deviceCredentialsSliceInitialState, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppStart, doAppStop, doBreakoutJoin, doCancelKnock, doClearNotifications, doConnectRoom, doConnectRtc, doDisconnectRtc, doEnableAudio, doEnableVideo, doEndMeeting, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKickParticipant, doKnockRoom, doLocalStreamEffect, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRemoveChatMessage, doRemoveSpotlight, doRequestAudioEnable, doRequestVideoEnable, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSendClientMetadata, doSetDevice, doSetDisplayName, doSetLocalStickyReaction, doSetNotification, doSignalConnect, doSignalDisconnect, doSignalIdentifyDevice, doSpotlightParticipant, doStartCloudRecording, doStartConnectionMonitor, doStartLiveTranscription, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopConnectionMonitor, doStopLiveTranscription, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doTriggerLocalStreamRefresh, doUpdateDeviceList, initialCloudRecordingState, initialLiveTranscriptionState, initialLocalMediaState, initialNotificationsState, initialState$2 as initialState, isAcceptingStreams, isClientSpotlighted, listenerMiddleware, liveTranscriptionSlice, localMediaSlice, localMediaStopped, localParticipantSlice, localParticipantSliceInitialState, localScreenshareSlice, localScreenshareSliceInitialState, localStreamMetadataUpdated, notificationsSlice, observeStore, organizationSlice, organizationSliceInitialState, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, remoteParticipantsSliceInitialState, removeSpotlight, resolutionReported, roomConnectionSlice, roomConnectionSliceInitialState, roomSlice, roomSliceInitialState, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcAnalyticsSliceInitialState, rtcClientConnectionStatusChanged, rtcConnectionSlice, rtcConnectionSliceInitialState, rtcDisconnected, rtcDispatcherCreated, rtcEvents, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAllClientViews, selectAllClientViewsInCurrentGroup, selectAppDisplayName, selectAppExternalId, selectAppIgnoreBreakoutGroups, selectAppInitialConfig, selectAppIsActive, selectAppIsAssistant, selectAppIsAudioRecorder, selectAppIsDialIn, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAssistantKey, selectAuthorizationRoleName, selectBreakoutActive, selectBreakoutAssignments, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutInitiatedBy, selectBreakoutRaw, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingIsInitiator, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectConnectionMonitorIsRunning, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToAskToSpeak, selectIsAuthorizedToEndMeeting, selectIsAuthorizedToKickClient, selectIsAuthorizedToLockRoom, selectIsAuthorizedToRequestAudioEnable, selectIsAuthorizedToRequestVideoEnable, selectIsAuthorizedToSpotlight, selectIsCameraEnabled, selectIsCloudRecording, selectIsHDModeEnabled, selectIsLiveTranscription, selectIsLocalMediaStarting, selectIsLocalParticipantSpotlighted, selectIsLowDataModeEnabled, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectIsWidescreenModeEnabled, selectLiveTranscriptionError, selectLiveTranscriptionIsInitiator, selectLiveTranscriptionRaw, selectLiveTranscriptionStartedAt, selectLiveTranscriptionStatus, selectLocalMediaBeforeEffectTracks, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantBreakoutAssigned, selectLocalParticipantBreakoutGroup, selectLocalParticipantClientClaim, selectLocalParticipantDisplayName, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantStickyReaction, selectLocalParticipantView, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectNotificationsEmitter, selectNotificationsEvents, selectNotificationsRaw, selectNumClients, selectNumParticipants, selectOrganizationId, selectOrganizationPreferences, selectOrganizationRaw, selectRemoteClientViews, selectRemoteClients, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRoomIsLocked, selectRoomKey, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectShouldStartConnectionMonitor, selectShouldStopConnectionMonitor, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectSpotlightedClientViews, selectSpotlights, selectSpotlightsRaw, selectStopCallbackFunction, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setBreakoutGroupAssigned, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, setDisplayName, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, signalConnectionSliceInitialState, signalEvents, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, spotlightsSlice, spotlightsSliceInitialState, startAppListening, stopScreenshare, streamIdForClient, streamStatusUpdated, streamingSlice, streamingSliceInitialState, toggleCameraEnabled, toggleHdModeEnabled, toggleLowDataModeEnabled, toggleMicrophoneEnabled, toggleWidescreenModeEnabled, transcribingRequestStarted, updateReportedValues, waitingParticipantsSlice, waitingParticipantsSliceInitialState };
|
|
4358
|
+
export { ACCEPTED_FILE_TYPES, MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, addAppListener, addSpotlight, appSlice, authorizationSlice, authorizationSliceInitialState, breakoutSlice, breakoutSliceInitialState, chatSlice, chatSliceInitialState, clearFileUploads, cloudRecordingSlice, connectionMonitorSlice, connectionMonitorSliceInitialState, connectionMonitorStarted, connectionMonitorStopped, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createAsyncRoomConnectedThunk, createAuthorizedRoomConnectedThunk, createReactor, createRemoteParticipant, createRoomConnectedThunk, createServices, createStore, createWebRtcEmitter, deviceBusy, deviceCredentialsSlice, deviceCredentialsSliceInitialState, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppStart, doAppStop, doBreakoutJoin, doCancelKnock, doClearNotifications, doConnectRoom, doConnectRtc, doDisconnectRtc, doDownloadFile, doEnableAudio, doEnableVideo, doEndMeeting, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKickParticipant, doKnockRoom, doLocalStreamEffect, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRemoveChatMessage, doRemoveSpotlight, doRequestAudioEnable, doRequestVideoEnable, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSendClientMetadata, doSendFiles, doSetDevice, doSetDisplayName, doSetLocalStickyReaction, doSetNotification, doSignalConnect, doSignalDisconnect, doSignalIdentifyDevice, doSpotlightParticipant, doStartCloudRecording, doStartConnectionMonitor, doStartLiveTranscription, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopConnectionMonitor, doStopLiveTranscription, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doTriggerLocalStreamRefresh, doUpdateDeviceList, fileShareRequestSettled, fileShareSlice, fileShareSliceInitialState, fileUploadFailed, fileUploadSucceeded, fileUploadsStarted, initialCloudRecordingState, initialLiveTranscriptionState, initialLocalMediaState, initialNotificationsState, initialState$2 as initialState, isAcceptingStreams, isClientSpotlighted, listenerMiddleware, liveTranscriptionSlice, localMediaSlice, localMediaStopped, localParticipantSlice, localParticipantSliceInitialState, localScreenshareSlice, localScreenshareSliceInitialState, localStreamMetadataUpdated, notificationsSlice, observeStore, organizationSlice, organizationSliceInitialState, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, remoteParticipantsSliceInitialState, removeSpotlight, resolutionReported, roomConnectionSlice, roomConnectionSliceInitialState, roomSlice, roomSliceInitialState, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcAnalyticsSliceInitialState, rtcClientConnectionStatusChanged, rtcConnectionSlice, rtcConnectionSliceInitialState, rtcDisconnected, rtcDispatcherCreated, rtcEvents, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAllClientViews, selectAllClientViewsInCurrentGroup, selectAppDisplayName, selectAppExternalId, selectAppIgnoreBreakoutGroups, selectAppInitialConfig, selectAppIsActive, selectAppIsAssistant, selectAppIsAudioRecorder, selectAppIsDialIn, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAssistantKey, selectAuthorizationRoleName, selectBreakoutActive, selectBreakoutAssignments, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutInitiatedBy, selectBreakoutRaw, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingIsInitiator, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectConnectionMonitorIsRunning, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectFileShareRaw, selectFileShareRequestInFlight, selectFileUploads, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToAskToSpeak, selectIsAuthorizedToEndMeeting, selectIsAuthorizedToKickClient, selectIsAuthorizedToLockRoom, selectIsAuthorizedToRequestAudioEnable, selectIsAuthorizedToRequestVideoEnable, selectIsAuthorizedToSpotlight, selectIsCameraEnabled, selectIsCloudRecording, selectIsHDModeEnabled, selectIsLiveTranscription, selectIsLocalMediaStarting, selectIsLocalParticipantSpotlighted, selectIsLowDataModeEnabled, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectIsWidescreenModeEnabled, selectLiveTranscriptionError, selectLiveTranscriptionIsInitiator, selectLiveTranscriptionRaw, selectLiveTranscriptionStartedAt, selectLiveTranscriptionStatus, selectLocalMediaBeforeEffectTracks, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantBreakoutAssigned, selectLocalParticipantBreakoutGroup, selectLocalParticipantClientClaim, selectLocalParticipantDisplayName, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantStickyReaction, selectLocalParticipantView, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectNotificationsEmitter, selectNotificationsEvents, selectNotificationsRaw, selectNumClients, selectNumParticipants, selectOrganizationId, selectOrganizationPreferences, selectOrganizationRaw, selectRemoteClientViews, selectRemoteClients, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRoomIsLocked, selectRoomKey, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectShouldStartConnectionMonitor, selectShouldStopConnectionMonitor, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectSpotlightedClientViews, selectSpotlights, selectSpotlightsRaw, selectStopCallbackFunction, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setBreakoutGroupAssigned, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, setDisplayName, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, signalConnectionSliceInitialState, signalEvents, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, spotlightsSlice, spotlightsSliceInitialState, startAppListening, stopScreenshare, streamIdForClient, streamStatusUpdated, streamingSlice, streamingSliceInitialState, toggleCameraEnabled, toggleHdModeEnabled, toggleLowDataModeEnabled, toggleMicrophoneEnabled, toggleWidescreenModeEnabled, transcribingRequestStarted, updateReportedValues, waitingParticipantsSlice, waitingParticipantsSliceInitialState };
|
package/dist/redux/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createAsyncThunk, createListenerMiddleware, addListener, createSlice, createAction, createSelector, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
2
|
+
import { ServerSocket, isFileShareError, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
3
4
|
import { EventEmitter } from 'events';
|
|
4
5
|
import nodeBtoa from 'btoa';
|
|
5
6
|
import axios from 'axios';
|
|
@@ -73,7 +74,7 @@ const createReactor = (selectors, callback) => {
|
|
|
73
74
|
});
|
|
74
75
|
};
|
|
75
76
|
|
|
76
|
-
const coreVersion = "1.
|
|
77
|
+
const coreVersion = "1.14.1";
|
|
77
78
|
|
|
78
79
|
const initialState$2 = {
|
|
79
80
|
displayName: null,
|
|
@@ -128,6 +129,7 @@ const signalEvents = {
|
|
|
128
129
|
breakoutSessionUpdated: createSignalEventAction("breakoutSessionUpdated"),
|
|
129
130
|
chatMessage: createSignalEventAction("chatMessage"),
|
|
130
131
|
chatMessageRemoved: createSignalEventAction("chatMessageRemoved"),
|
|
132
|
+
fileSharingError: createSignalEventAction("fileSharingError"),
|
|
131
133
|
clientLeft: createSignalEventAction("clientLeft"),
|
|
132
134
|
clientKicked: createSignalEventAction("clientKicked"),
|
|
133
135
|
clientMetadataReceived: createSignalEventAction("clientMetadataReceived"),
|
|
@@ -305,7 +307,13 @@ function forwardSocketEvents(socket, dispatch) {
|
|
|
305
307
|
socket.on("video_enabled", (payload) => dispatch(signalEvents.videoEnabled(payload)));
|
|
306
308
|
socket.on("audio_enable_requested", (payload) => dispatch(signalEvents.audioEnableRequested(payload)));
|
|
307
309
|
socket.on("client_metadata_received", (payload) => dispatch(signalEvents.clientMetadataReceived(payload)));
|
|
308
|
-
socket.on("chat_message", (payload) =>
|
|
310
|
+
socket.on("chat_message", (payload) => {
|
|
311
|
+
if (isFileShareError(payload)) {
|
|
312
|
+
dispatch(signalEvents.fileSharingError(payload));
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
dispatch(signalEvents.chatMessage(payload));
|
|
316
|
+
});
|
|
309
317
|
socket.on("chat_message_removed", (payload) => dispatch(signalEvents.chatMessageRemoved(payload)));
|
|
310
318
|
socket.on("disconnect", () => dispatch(signalEvents.disconnect()));
|
|
311
319
|
socket.on("room_knocked", (payload) => dispatch(signalEvents.roomKnocked(payload)));
|
|
@@ -1158,15 +1166,7 @@ const chatSlice = createSlice({
|
|
|
1158
1166
|
reducers: {},
|
|
1159
1167
|
extraReducers(builder) {
|
|
1160
1168
|
builder.addCase(signalEvents.chatMessage, (state, action) => {
|
|
1161
|
-
const message = {
|
|
1162
|
-
id: action.payload.id,
|
|
1163
|
-
senderId: action.payload.senderId,
|
|
1164
|
-
parentId: action.payload.parentId,
|
|
1165
|
-
timestamp: action.payload.timestamp,
|
|
1166
|
-
text: action.payload.text,
|
|
1167
|
-
sig: action.payload.sig,
|
|
1168
|
-
removed: false,
|
|
1169
|
-
};
|
|
1169
|
+
const message = Object.assign({ id: action.payload.id, senderId: action.payload.senderId, parentId: action.payload.parentId, timestamp: action.payload.timestamp, text: action.payload.text, sig: action.payload.sig, removed: false }, (action.payload.file && { file: action.payload.file }));
|
|
1170
1170
|
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, message] });
|
|
1171
1171
|
});
|
|
1172
1172
|
builder.addCase(signalEvents.chatMessageRemoved, (state, action) => {
|
|
@@ -2275,6 +2275,177 @@ createReactor([selectShouldStopConnectionMonitor], ({ dispatch }, shouldStartCon
|
|
|
2275
2275
|
}
|
|
2276
2276
|
});
|
|
2277
2277
|
|
|
2278
|
+
const MAX_FILES_PER_UPLOAD = 10;
|
|
2279
|
+
const MAX_FILE_SIZE = 15 * 1024 * 1024;
|
|
2280
|
+
const ACCEPTED_FILE_TYPES = {
|
|
2281
|
+
"application/doc": [".doc", ".docx"],
|
|
2282
|
+
"application/msword": [".doc", ".docx"],
|
|
2283
|
+
"application/pdf": [".pdf"],
|
|
2284
|
+
"application/rtf": [".rtf"],
|
|
2285
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
|
|
2286
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
|
|
2287
|
+
"audio/mpeg": [".mp3"],
|
|
2288
|
+
"audio/wav": [".wav"],
|
|
2289
|
+
"image/gif": [".gif"],
|
|
2290
|
+
"image/jpeg": [".jpeg", ".jpg"],
|
|
2291
|
+
"image/png": [".png"],
|
|
2292
|
+
"image/webp": [".webp"],
|
|
2293
|
+
"text/csv": [".csv"],
|
|
2294
|
+
"text/plain": [".txt"],
|
|
2295
|
+
"video/mp4": [".mp4"],
|
|
2296
|
+
"video/quicktime": [".mov"],
|
|
2297
|
+
"video/webm": [".webm"],
|
|
2298
|
+
"video/x-matroska": [".mkv"],
|
|
2299
|
+
};
|
|
2300
|
+
function isAcceptedFileType(file) {
|
|
2301
|
+
if (file.type && ACCEPTED_FILE_TYPES[file.type]) {
|
|
2302
|
+
return true;
|
|
2303
|
+
}
|
|
2304
|
+
const dot = file.name.lastIndexOf(".");
|
|
2305
|
+
if (dot < 0) {
|
|
2306
|
+
return false;
|
|
2307
|
+
}
|
|
2308
|
+
const extension = file.name.slice(dot).toLowerCase();
|
|
2309
|
+
return Object.values(ACCEPTED_FILE_TYPES).some((extensions) => extensions.includes(extension));
|
|
2310
|
+
}
|
|
2311
|
+
function validateFile(file) {
|
|
2312
|
+
if (!isAcceptedFileType(file)) {
|
|
2313
|
+
return "unsupported_file_type";
|
|
2314
|
+
}
|
|
2315
|
+
if (file.size > MAX_FILE_SIZE) {
|
|
2316
|
+
return "file_too_large";
|
|
2317
|
+
}
|
|
2318
|
+
return undefined;
|
|
2319
|
+
}
|
|
2320
|
+
const fileShareSliceInitialState = {
|
|
2321
|
+
uploads: [],
|
|
2322
|
+
requestInFlight: false,
|
|
2323
|
+
};
|
|
2324
|
+
const fileShareSlice = createSlice({
|
|
2325
|
+
name: "fileShare",
|
|
2326
|
+
initialState: fileShareSliceInitialState,
|
|
2327
|
+
reducers: {
|
|
2328
|
+
fileUploadsStarted: (state, action) => {
|
|
2329
|
+
state.uploads.push(...action.payload);
|
|
2330
|
+
state.requestInFlight = true;
|
|
2331
|
+
},
|
|
2332
|
+
fileShareRequestSettled: (state) => {
|
|
2333
|
+
state.requestInFlight = false;
|
|
2334
|
+
},
|
|
2335
|
+
fileUploadSucceeded: (state, action) => {
|
|
2336
|
+
const upload = state.uploads.find((u) => u.id === action.payload.id);
|
|
2337
|
+
if (upload) {
|
|
2338
|
+
upload.status = "sent";
|
|
2339
|
+
}
|
|
2340
|
+
},
|
|
2341
|
+
fileUploadFailed: (state, action) => {
|
|
2342
|
+
const upload = state.uploads.find((u) => u.id === action.payload.id);
|
|
2343
|
+
if (upload) {
|
|
2344
|
+
upload.status = "error";
|
|
2345
|
+
upload.error = action.payload.error;
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
clearFileUploads: (state) => {
|
|
2349
|
+
state.uploads = [];
|
|
2350
|
+
},
|
|
2351
|
+
},
|
|
2352
|
+
});
|
|
2353
|
+
const { fileUploadsStarted, fileShareRequestSettled, fileUploadSucceeded, fileUploadFailed, clearFileUploads } = fileShareSlice.actions;
|
|
2354
|
+
function uploadFile(file, uploadUrl) {
|
|
2355
|
+
const form = new FormData();
|
|
2356
|
+
form.append("Content-Type", file.type);
|
|
2357
|
+
Object.entries(uploadUrl.fields).forEach(([key, value]) => form.append(key, value));
|
|
2358
|
+
form.append("file", file);
|
|
2359
|
+
return fetch(uploadUrl.url, { method: "POST", body: form });
|
|
2360
|
+
}
|
|
2361
|
+
const doSendFiles = createAsyncRoomConnectedThunk("fileShare/sendFiles", (payload_1, _a) => __awaiter(void 0, [payload_1, _a], void 0, function* (payload, { dispatch, getState }) {
|
|
2362
|
+
const state = getState();
|
|
2363
|
+
if (state.fileShare.requestInFlight) {
|
|
2364
|
+
return Promise.reject(new Error("A file upload request is already in flight"));
|
|
2365
|
+
}
|
|
2366
|
+
const socket = selectSignalConnectionRaw(state).socket;
|
|
2367
|
+
if (!socket) {
|
|
2368
|
+
return Promise.reject(new Error("No signal connection"));
|
|
2369
|
+
}
|
|
2370
|
+
const breakoutCurrentId = selectBreakoutCurrentId(state);
|
|
2371
|
+
const { files } = payload;
|
|
2372
|
+
if (!files.length) {
|
|
2373
|
+
return;
|
|
2374
|
+
}
|
|
2375
|
+
const tooManyFiles = files.length > MAX_FILES_PER_UPLOAD;
|
|
2376
|
+
const entries = files.map((file) => {
|
|
2377
|
+
const error = tooManyFiles ? "too_many_files" : validateFile(file);
|
|
2378
|
+
const upload = Object.assign({ id: v4(), name: file.name, size: file.size, type: file.type, status: error ? "error" : "uploading" }, (error && { error }));
|
|
2379
|
+
return { file, upload };
|
|
2380
|
+
});
|
|
2381
|
+
dispatch(fileUploadsStarted(entries.map((entry) => entry.upload)));
|
|
2382
|
+
const accepted = entries.filter((entry) => entry.upload.status === "uploading");
|
|
2383
|
+
if (!accepted.length) {
|
|
2384
|
+
dispatch(fileShareRequestSettled());
|
|
2385
|
+
return;
|
|
2386
|
+
}
|
|
2387
|
+
const acceptedFiles = accepted.map((entry) => entry.file);
|
|
2388
|
+
const outcome = yield new Promise((resolve) => {
|
|
2389
|
+
let settled = false;
|
|
2390
|
+
const removeListener = dispatch(addAppListener({
|
|
2391
|
+
actionCreator: signalEvents.fileSharingError,
|
|
2392
|
+
effect: (action, listenerApi) => {
|
|
2393
|
+
if (settled)
|
|
2394
|
+
return;
|
|
2395
|
+
settled = true;
|
|
2396
|
+
listenerApi.unsubscribe();
|
|
2397
|
+
resolve({ error: action.payload.error });
|
|
2398
|
+
},
|
|
2399
|
+
}));
|
|
2400
|
+
socket.emit("request_file_upload_url", { files: acceptedFiles.map((f) => ({ name: f.name, size: f.size, type: f.type })) }, (urls) => {
|
|
2401
|
+
if (settled)
|
|
2402
|
+
return;
|
|
2403
|
+
settled = true;
|
|
2404
|
+
removeListener({ cancelActive: true });
|
|
2405
|
+
resolve({ urls });
|
|
2406
|
+
});
|
|
2407
|
+
});
|
|
2408
|
+
dispatch(fileShareRequestSettled());
|
|
2409
|
+
if ("error" in outcome) {
|
|
2410
|
+
accepted.forEach((entry) => dispatch(fileUploadFailed({ id: entry.upload.id, error: outcome.error })));
|
|
2411
|
+
return;
|
|
2412
|
+
}
|
|
2413
|
+
yield Promise.all(accepted.map((_a, index_1) => __awaiter(void 0, [_a, index_1], void 0, function* ({ file, upload }, index) {
|
|
2414
|
+
const urls = outcome.urls[index];
|
|
2415
|
+
if (!urls) {
|
|
2416
|
+
dispatch(fileUploadFailed({ id: upload.id, error: "upload_failed" }));
|
|
2417
|
+
return;
|
|
2418
|
+
}
|
|
2419
|
+
try {
|
|
2420
|
+
const response = yield uploadFile(file, urls.uploadUrl);
|
|
2421
|
+
if (!response.ok) {
|
|
2422
|
+
throw new Error(`S3 upload failed with status ${response.status}`);
|
|
2423
|
+
}
|
|
2424
|
+
socket.emit("chat_message", Object.assign({ text: "", file: {
|
|
2425
|
+
downloadUrl: urls.downloadUrl,
|
|
2426
|
+
name: file.name,
|
|
2427
|
+
size: file.size,
|
|
2428
|
+
type: file.type,
|
|
2429
|
+
key: urls.uploadUrl.fields.key,
|
|
2430
|
+
} }, (breakoutCurrentId && { breakoutGroup: breakoutCurrentId })));
|
|
2431
|
+
dispatch(fileUploadSucceeded({ id: upload.id }));
|
|
2432
|
+
}
|
|
2433
|
+
catch (_b) {
|
|
2434
|
+
dispatch(fileUploadFailed({ id: upload.id, error: "upload_failed" }));
|
|
2435
|
+
}
|
|
2436
|
+
})));
|
|
2437
|
+
}));
|
|
2438
|
+
const doDownloadFile = createAppAsyncThunk("fileShare/downloadFile", (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2439
|
+
const response = yield fetch(payload.file.downloadUrl, { mode: "cors", cache: "no-cache" });
|
|
2440
|
+
if (!response.ok) {
|
|
2441
|
+
throw new Error(`Failed to download file: ${response.status}`);
|
|
2442
|
+
}
|
|
2443
|
+
return response.blob();
|
|
2444
|
+
}));
|
|
2445
|
+
const selectFileShareRaw = (state) => state.fileShare;
|
|
2446
|
+
const selectFileUploads = (state) => state.fileShare.uploads;
|
|
2447
|
+
const selectFileShareRequestInFlight = (state) => state.fileShare.requestInFlight;
|
|
2448
|
+
|
|
2278
2449
|
const initialLiveTranscriptionState = {
|
|
2279
2450
|
isInitiator: false,
|
|
2280
2451
|
isTranscribing: false,
|
|
@@ -3407,6 +3578,7 @@ const appReducer = combineReducers({
|
|
|
3407
3578
|
cloudRecording: cloudRecordingSlice.reducer,
|
|
3408
3579
|
connectionMonitor: connectionMonitorSlice.reducer,
|
|
3409
3580
|
deviceCredentials: deviceCredentialsSlice.reducer,
|
|
3581
|
+
fileShare: fileShareSlice.reducer,
|
|
3410
3582
|
liveTranscription: liveTranscriptionSlice.reducer,
|
|
3411
3583
|
localMedia: localMediaSlice.reducer,
|
|
3412
3584
|
localParticipant: localParticipantSlice.reducer,
|
|
@@ -4183,4 +4355,4 @@ function createServices() {
|
|
|
4183
4355
|
};
|
|
4184
4356
|
}
|
|
4185
4357
|
|
|
4186
|
-
export { addAppListener, addSpotlight, appSlice, authorizationSlice, authorizationSliceInitialState, breakoutSlice, breakoutSliceInitialState, chatSlice, chatSliceInitialState, cloudRecordingSlice, connectionMonitorSlice, connectionMonitorSliceInitialState, connectionMonitorStarted, connectionMonitorStopped, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createAsyncRoomConnectedThunk, createAuthorizedRoomConnectedThunk, createReactor, createRemoteParticipant, createRoomConnectedThunk, createServices, createStore, createWebRtcEmitter, deviceBusy, deviceCredentialsSlice, deviceCredentialsSliceInitialState, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppStart, doAppStop, doBreakoutJoin, doCancelKnock, doClearNotifications, doConnectRoom, doConnectRtc, doDisconnectRtc, doEnableAudio, doEnableVideo, doEndMeeting, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKickParticipant, doKnockRoom, doLocalStreamEffect, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRemoveChatMessage, doRemoveSpotlight, doRequestAudioEnable, doRequestVideoEnable, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSendClientMetadata, doSetDevice, doSetDisplayName, doSetLocalStickyReaction, doSetNotification, doSignalConnect, doSignalDisconnect, doSignalIdentifyDevice, doSpotlightParticipant, doStartCloudRecording, doStartConnectionMonitor, doStartLiveTranscription, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopConnectionMonitor, doStopLiveTranscription, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doTriggerLocalStreamRefresh, doUpdateDeviceList, initialCloudRecordingState, initialLiveTranscriptionState, initialLocalMediaState, initialNotificationsState, initialState$2 as initialState, isAcceptingStreams, isClientSpotlighted, listenerMiddleware, liveTranscriptionSlice, localMediaSlice, localMediaStopped, localParticipantSlice, localParticipantSliceInitialState, localScreenshareSlice, localScreenshareSliceInitialState, localStreamMetadataUpdated, notificationsSlice, observeStore, organizationSlice, organizationSliceInitialState, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, remoteParticipantsSliceInitialState, removeSpotlight, resolutionReported, roomConnectionSlice, roomConnectionSliceInitialState, roomSlice, roomSliceInitialState, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcAnalyticsSliceInitialState, rtcClientConnectionStatusChanged, rtcConnectionSlice, rtcConnectionSliceInitialState, rtcDisconnected, rtcDispatcherCreated, rtcEvents, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAllClientViews, selectAllClientViewsInCurrentGroup, selectAppDisplayName, selectAppExternalId, selectAppIgnoreBreakoutGroups, selectAppInitialConfig, selectAppIsActive, selectAppIsAssistant, selectAppIsAudioRecorder, selectAppIsDialIn, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAssistantKey, selectAuthorizationRoleName, selectBreakoutActive, selectBreakoutAssignments, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutInitiatedBy, selectBreakoutRaw, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingIsInitiator, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectConnectionMonitorIsRunning, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToAskToSpeak, selectIsAuthorizedToEndMeeting, selectIsAuthorizedToKickClient, selectIsAuthorizedToLockRoom, selectIsAuthorizedToRequestAudioEnable, selectIsAuthorizedToRequestVideoEnable, selectIsAuthorizedToSpotlight, selectIsCameraEnabled, selectIsCloudRecording, selectIsHDModeEnabled, selectIsLiveTranscription, selectIsLocalMediaStarting, selectIsLocalParticipantSpotlighted, selectIsLowDataModeEnabled, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectIsWidescreenModeEnabled, selectLiveTranscriptionError, selectLiveTranscriptionIsInitiator, selectLiveTranscriptionRaw, selectLiveTranscriptionStartedAt, selectLiveTranscriptionStatus, selectLocalMediaBeforeEffectTracks, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantBreakoutAssigned, selectLocalParticipantBreakoutGroup, selectLocalParticipantClientClaim, selectLocalParticipantDisplayName, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantStickyReaction, selectLocalParticipantView, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectNotificationsEmitter, selectNotificationsEvents, selectNotificationsRaw, selectNumClients, selectNumParticipants, selectOrganizationId, selectOrganizationPreferences, selectOrganizationRaw, selectRemoteClientViews, selectRemoteClients, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRoomIsLocked, selectRoomKey, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectShouldStartConnectionMonitor, selectShouldStopConnectionMonitor, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectSpotlightedClientViews, selectSpotlights, selectSpotlightsRaw, selectStopCallbackFunction, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setBreakoutGroupAssigned, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, setDisplayName, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, signalConnectionSliceInitialState, signalEvents, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, spotlightsSlice, spotlightsSliceInitialState, startAppListening, stopScreenshare, streamIdForClient, streamStatusUpdated, streamingSlice, streamingSliceInitialState, toggleCameraEnabled, toggleHdModeEnabled, toggleLowDataModeEnabled, toggleMicrophoneEnabled, toggleWidescreenModeEnabled, transcribingRequestStarted, updateReportedValues, waitingParticipantsSlice, waitingParticipantsSliceInitialState };
|
|
4358
|
+
export { ACCEPTED_FILE_TYPES, MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, addAppListener, addSpotlight, appSlice, authorizationSlice, authorizationSliceInitialState, breakoutSlice, breakoutSliceInitialState, chatSlice, chatSliceInitialState, clearFileUploads, cloudRecordingSlice, connectionMonitorSlice, connectionMonitorSliceInitialState, connectionMonitorStarted, connectionMonitorStopped, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createAsyncRoomConnectedThunk, createAuthorizedRoomConnectedThunk, createReactor, createRemoteParticipant, createRoomConnectedThunk, createServices, createStore, createWebRtcEmitter, deviceBusy, deviceCredentialsSlice, deviceCredentialsSliceInitialState, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppStart, doAppStop, doBreakoutJoin, doCancelKnock, doClearNotifications, doConnectRoom, doConnectRtc, doDisconnectRtc, doDownloadFile, doEnableAudio, doEnableVideo, doEndMeeting, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKickParticipant, doKnockRoom, doLocalStreamEffect, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRemoveChatMessage, doRemoveSpotlight, doRequestAudioEnable, doRequestVideoEnable, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSendClientMetadata, doSendFiles, doSetDevice, doSetDisplayName, doSetLocalStickyReaction, doSetNotification, doSignalConnect, doSignalDisconnect, doSignalIdentifyDevice, doSpotlightParticipant, doStartCloudRecording, doStartConnectionMonitor, doStartLiveTranscription, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopConnectionMonitor, doStopLiveTranscription, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doTriggerLocalStreamRefresh, doUpdateDeviceList, fileShareRequestSettled, fileShareSlice, fileShareSliceInitialState, fileUploadFailed, fileUploadSucceeded, fileUploadsStarted, initialCloudRecordingState, initialLiveTranscriptionState, initialLocalMediaState, initialNotificationsState, initialState$2 as initialState, isAcceptingStreams, isClientSpotlighted, listenerMiddleware, liveTranscriptionSlice, localMediaSlice, localMediaStopped, localParticipantSlice, localParticipantSliceInitialState, localScreenshareSlice, localScreenshareSliceInitialState, localStreamMetadataUpdated, notificationsSlice, observeStore, organizationSlice, organizationSliceInitialState, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, remoteParticipantsSliceInitialState, removeSpotlight, resolutionReported, roomConnectionSlice, roomConnectionSliceInitialState, roomSlice, roomSliceInitialState, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcAnalyticsSliceInitialState, rtcClientConnectionStatusChanged, rtcConnectionSlice, rtcConnectionSliceInitialState, rtcDisconnected, rtcDispatcherCreated, rtcEvents, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAllClientViews, selectAllClientViewsInCurrentGroup, selectAppDisplayName, selectAppExternalId, selectAppIgnoreBreakoutGroups, selectAppInitialConfig, selectAppIsActive, selectAppIsAssistant, selectAppIsAudioRecorder, selectAppIsDialIn, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAssistantKey, selectAuthorizationRoleName, selectBreakoutActive, selectBreakoutAssignments, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutInitiatedBy, selectBreakoutRaw, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingIsInitiator, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectConnectionMonitorIsRunning, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectFileShareRaw, selectFileShareRequestInFlight, selectFileUploads, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToAskToSpeak, selectIsAuthorizedToEndMeeting, selectIsAuthorizedToKickClient, selectIsAuthorizedToLockRoom, selectIsAuthorizedToRequestAudioEnable, selectIsAuthorizedToRequestVideoEnable, selectIsAuthorizedToSpotlight, selectIsCameraEnabled, selectIsCloudRecording, selectIsHDModeEnabled, selectIsLiveTranscription, selectIsLocalMediaStarting, selectIsLocalParticipantSpotlighted, selectIsLowDataModeEnabled, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectIsWidescreenModeEnabled, selectLiveTranscriptionError, selectLiveTranscriptionIsInitiator, selectLiveTranscriptionRaw, selectLiveTranscriptionStartedAt, selectLiveTranscriptionStatus, selectLocalMediaBeforeEffectTracks, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantBreakoutAssigned, selectLocalParticipantBreakoutGroup, selectLocalParticipantClientClaim, selectLocalParticipantDisplayName, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantStickyReaction, selectLocalParticipantView, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectNotificationsEmitter, selectNotificationsEvents, selectNotificationsRaw, selectNumClients, selectNumParticipants, selectOrganizationId, selectOrganizationPreferences, selectOrganizationRaw, selectRemoteClientViews, selectRemoteClients, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRoomIsLocked, selectRoomKey, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectShouldStartConnectionMonitor, selectShouldStopConnectionMonitor, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectSpotlightedClientViews, selectSpotlights, selectSpotlightsRaw, selectStopCallbackFunction, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setBreakoutGroupAssigned, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, setDisplayName, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, signalConnectionSliceInitialState, signalEvents, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, spotlightsSlice, spotlightsSliceInitialState, startAppListening, stopScreenshare, streamIdForClient, streamStatusUpdated, streamingSlice, streamingSliceInitialState, toggleCameraEnabled, toggleHdModeEnabled, toggleLowDataModeEnabled, toggleMicrophoneEnabled, toggleWidescreenModeEnabled, transcribingRequestStarted, updateReportedValues, waitingParticipantsSlice, waitingParticipantsSliceInitialState };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@whereby.com/core",
|
|
3
3
|
"description": "Core library for whereby.com sdk",
|
|
4
4
|
"author": "Whereby AS",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.14.1",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@reduxjs/toolkit": "^2.2.3",
|
|
69
|
-
"@whereby.com/media": "9.2.
|
|
70
|
-
"@whereby.com/audio-denoiser": "1.0.
|
|
71
|
-
"@whereby.com/camera-effects": "1.1.
|
|
69
|
+
"@whereby.com/media": "9.2.5",
|
|
70
|
+
"@whereby.com/audio-denoiser": "1.0.1",
|
|
71
|
+
"@whereby.com/camera-effects": "1.1.2",
|
|
72
72
|
"axios": "^1.11.0",
|
|
73
73
|
"btoa": "^1.2.1",
|
|
74
74
|
"events": "^3.3.0"
|