@whereby.com/core 0.33.9 → 0.34.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/LICENCE.md ADDED
@@ -0,0 +1,23 @@
1
+ ## MIT License
2
+
3
+ Copyright (c) 2024 Whereby AS (https://www.whereby.com)
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation
6
+ files (the "Software"), to deal in the Software without
7
+ restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -13,3 +13,9 @@ or
13
13
  ```shell
14
14
  yarn add @whereby.com/browser-core
15
15
  ```
16
+
17
+ or
18
+
19
+ ```shell
20
+ pnpm add @whereby.com/browser-core
21
+ ```
package/dist/index.cjs CHANGED
@@ -75,7 +75,7 @@ const createReactor = (selectors, callback) => {
75
75
  });
76
76
  };
77
77
 
78
- const coreVersion = "0.33.9";
78
+ const coreVersion = "0.34.0";
79
79
 
80
80
  const initialState = {
81
81
  isNodeSdk: false,
@@ -214,7 +214,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
214
214
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
215
215
  PERFORMANCE OF THIS SOFTWARE.
216
216
  ***************************************************************************** */
217
- /* global Reflect, Promise, SuppressedError, Symbol */
217
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
218
218
 
219
219
 
220
220
  function __rest(s, e) {
@@ -264,7 +264,7 @@ const deviceCredentialsSlice = toolkit.createSlice({
264
264
  });
265
265
  },
266
266
  });
267
- const doGetDeviceCredentials = createAppAsyncThunk("deviceCredentials/doGetDeviceCredentials", (payload, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
267
+ const doGetDeviceCredentials = createAppAsyncThunk("deviceCredentials/doGetDeviceCredentials", (payload_1, _a) => __awaiter(void 0, [payload_1, _a], void 0, function* (payload, { extra }) {
268
268
  try {
269
269
  const deviceCredentials = yield extra.services.credentialsService.getCredentials();
270
270
  return deviceCredentials;
@@ -545,7 +545,7 @@ function parseUnverifiedRoomKeyData(roomKey) {
545
545
  const base64DecodedJwtData = atob(roomKeyData);
546
546
  return JSON.parse(base64DecodedJwtData);
547
547
  }
548
- catch (e) {
548
+ catch (_a) {
549
549
  return {};
550
550
  }
551
551
  }
@@ -677,7 +677,7 @@ const localMediaSlice = toolkit.createSlice({
677
677
  },
678
678
  });
679
679
  const { deviceBusy, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, toggleCameraEnabled, toggleMicrophoneEnabled, toggleLowDataModeEnabled, setLocalMediaOptions, setLocalMediaStream, localMediaStopped, localStreamMetadataUpdated, } = localMediaSlice.actions;
680
- const doToggleCamera = createAppAsyncThunk("localMedia/doToggleCamera", (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
680
+ const doToggleCamera = createAppAsyncThunk("localMedia/doToggleCamera", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { getState, rejectWithValue }) {
681
681
  const state = getState();
682
682
  const stream = selectLocalMediaStream(state);
683
683
  if (!stream) {
@@ -735,7 +735,7 @@ const doToggleLowDataMode = createAppThunk(() => (dispatch, getState) => {
735
735
  const audioId = selectCurrentMicrophoneDeviceId(state);
736
736
  dispatch(doSwitchLocalStream({ audioId, videoId }));
737
737
  });
738
- const doSetDevice = createAppAsyncThunk("localMedia/reactSetDevice", ({ audio, video }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
738
+ const doSetDevice = createAppAsyncThunk("localMedia/reactSetDevice", (_a, _b) => __awaiter(void 0, [_a, _b], void 0, function* ({ audio, video }, { getState, rejectWithValue }) {
739
739
  try {
740
740
  const state = getState();
741
741
  const stream = selectLocalMediaStream(state);
@@ -757,8 +757,8 @@ const doSetDevice = createAppAsyncThunk("localMedia/reactSetDevice", ({ audio, v
757
757
  return rejectWithValue(error);
758
758
  }
759
759
  }));
760
- const doUpdateDeviceList = createAppAsyncThunk("localMedia/doUpdateDeviceList", (_, { getState, dispatch, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
761
- var _a, _b, _c, _d;
760
+ const doUpdateDeviceList = createAppAsyncThunk("localMedia/doUpdateDeviceList", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { getState, dispatch, rejectWithValue }) {
761
+ var _b, _c, _d, _e;
762
762
  const state = getState();
763
763
  let newDevices = [];
764
764
  let oldDevices = [];
@@ -778,13 +778,13 @@ const doUpdateDeviceList = createAppAsyncThunk("localMedia/doUpdateDeviceList",
778
778
  oldDevices,
779
779
  newDevices,
780
780
  });
781
- let autoSwitchAudioId = (_a = changedDevices.audioinput) === null || _a === void 0 ? void 0 : _a.deviceId;
782
- let autoSwitchVideoId = (_b = changedDevices.videoinput) === null || _b === void 0 ? void 0 : _b.deviceId;
781
+ let autoSwitchAudioId = (_b = changedDevices.audioinput) === null || _b === void 0 ? void 0 : _b.deviceId;
782
+ let autoSwitchVideoId = (_c = changedDevices.videoinput) === null || _c === void 0 ? void 0 : _c.deviceId;
783
783
  if (autoSwitchAudioId === undefined) {
784
- autoSwitchAudioId = (_c = addedDevices.audioinput) === null || _c === void 0 ? void 0 : _c.deviceId;
784
+ autoSwitchAudioId = (_d = addedDevices.audioinput) === null || _d === void 0 ? void 0 : _d.deviceId;
785
785
  }
786
786
  if (autoSwitchVideoId === undefined) {
787
- autoSwitchVideoId = (_d = addedDevices.videoinput) === null || _d === void 0 ? void 0 : _d.deviceId;
787
+ autoSwitchVideoId = (_e = addedDevices.videoinput) === null || _e === void 0 ? void 0 : _e.deviceId;
788
788
  }
789
789
  if (autoSwitchAudioId !== undefined || autoSwitchVideoId !== undefined) {
790
790
  dispatch(doSwitchLocalStream({ audioId: autoSwitchAudioId, videoId: autoSwitchVideoId }));
@@ -795,7 +795,7 @@ const doUpdateDeviceList = createAppAsyncThunk("localMedia/doUpdateDeviceList",
795
795
  return rejectWithValue(error);
796
796
  }
797
797
  }));
798
- const doSwitchLocalStream = createAppAsyncThunk("localMedia/doSwitchLocalStream", ({ audioId, videoId }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
798
+ const doSwitchLocalStream = createAppAsyncThunk("localMedia/doSwitchLocalStream", (_a, _b) => __awaiter(void 0, [_a, _b], void 0, function* ({ audioId, videoId }, { dispatch, getState, rejectWithValue }) {
799
799
  const state = getState();
800
800
  const replaceStream = selectLocalMediaStream(state);
801
801
  const constraintsOptions = selectLocalMediaConstraintsOptions(state);
@@ -824,7 +824,7 @@ const doSwitchLocalStream = createAppAsyncThunk("localMedia/doSwitchLocalStream"
824
824
  return rejectWithValue(error);
825
825
  }
826
826
  }));
827
- const doStartLocalMedia = createAppAsyncThunk("localMedia/doStartLocalMedia", (payload, { getState, dispatch, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
827
+ const doStartLocalMedia = createAppAsyncThunk("localMedia/doStartLocalMedia", (payload_1, _a) => __awaiter(void 0, [payload_1, _a], void 0, function* (payload, { getState, dispatch, rejectWithValue }) {
828
828
  const onDeviceChange = debounce(() => {
829
829
  dispatch(doUpdateDeviceList());
830
830
  }, { delay: 500 });
@@ -1481,8 +1481,8 @@ const localScreenshareSlice = toolkit.createSlice({
1481
1481
  },
1482
1482
  });
1483
1483
  const { stopScreenshare } = localScreenshareSlice.actions;
1484
- const doStartScreenshare = createAsyncRoomConnectedThunk("localScreenshare/doStartScreenshare", (_, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
1485
- var _a;
1484
+ const doStartScreenshare = createAsyncRoomConnectedThunk("localScreenshare/doStartScreenshare", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch, getState, rejectWithValue }) {
1485
+ var _b;
1486
1486
  try {
1487
1487
  const state = getState();
1488
1488
  const screenshareStream = selectLocalScreenshareStream(state);
@@ -1497,7 +1497,7 @@ const doStartScreenshare = createAsyncRoomConnectedThunk("localScreenshare/doSta
1497
1497
  stream.addEventListener("inactive", onEnded);
1498
1498
  }
1499
1499
  else {
1500
- (_a = stream.getVideoTracks()[0]) === null || _a === void 0 ? void 0 : _a.addEventListener("ended", onEnded);
1500
+ (_b = stream.getVideoTracks()[0]) === null || _b === void 0 ? void 0 : _b.addEventListener("ended", onEnded);
1501
1501
  }
1502
1502
  return { stream };
1503
1503
  }
@@ -2319,7 +2319,7 @@ const doSetDisplayName = createRoomConnectedThunk((payload) => (dispatch, getSta
2319
2319
  });
2320
2320
  dispatch(setDisplayName({ displayName: payload.displayName }));
2321
2321
  });
2322
- const doEnableAudio = createAsyncRoomConnectedThunk("localParticipant/doEnableAudio", (payload, { dispatch, getState }) => __awaiter(void 0, void 0, void 0, function* () {
2322
+ const doEnableAudio = createAsyncRoomConnectedThunk("localParticipant/doEnableAudio", (payload_1, _a) => __awaiter(void 0, [payload_1, _a], void 0, function* (payload, { dispatch, getState }) {
2323
2323
  const state = getState();
2324
2324
  const socket = selectSignalConnectionRaw(state).socket;
2325
2325
  socket === null || socket === void 0 ? void 0 : socket.emit("enable_audio", { enabled: payload.enabled });
@@ -2328,18 +2328,18 @@ const doEnableAudio = createAsyncRoomConnectedThunk("localParticipant/doEnableAu
2328
2328
  }
2329
2329
  return payload.enabled;
2330
2330
  }));
2331
- const doEnableVideo = createAsyncRoomConnectedThunk("localParticipant/doEnableVideo", (payload, { getState }) => __awaiter(void 0, void 0, void 0, function* () {
2331
+ const doEnableVideo = createAsyncRoomConnectedThunk("localParticipant/doEnableVideo", (payload_1, _a) => __awaiter(void 0, [payload_1, _a], void 0, function* (payload, { getState }) {
2332
2332
  const state = getState();
2333
2333
  const socket = selectSignalConnectionRaw(state).socket;
2334
2334
  socket === null || socket === void 0 ? void 0 : socket.emit("enable_video", { enabled: payload.enabled });
2335
2335
  return payload.enabled;
2336
2336
  }));
2337
- const doSetLocalStickyReaction = createAsyncRoomConnectedThunk("localParticipant/doSetLocalStickyReaction", (payload, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
2338
- var _a;
2337
+ const doSetLocalStickyReaction = createAsyncRoomConnectedThunk("localParticipant/doSetLocalStickyReaction", (payload_1, _a) => __awaiter(void 0, [payload_1, _a], void 0, function* (payload, { getState, rejectWithValue }) {
2338
+ var _b;
2339
2339
  const state = getState();
2340
2340
  const currentStickyReaction = selectLocalParticipantStickyReaction(state);
2341
2341
  const stickyReactionCurrentlyEnabled = Boolean(currentStickyReaction);
2342
- const enabled = (_a = payload.enabled) !== null && _a !== void 0 ? _a : !stickyReactionCurrentlyEnabled;
2342
+ const enabled = (_b = payload.enabled) !== null && _b !== void 0 ? _b : !stickyReactionCurrentlyEnabled;
2343
2343
  if (enabled === stickyReactionCurrentlyEnabled) {
2344
2344
  return rejectWithValue(currentStickyReaction);
2345
2345
  }
@@ -2587,7 +2587,7 @@ const organizationSlice = toolkit.createSlice({
2587
2587
  });
2588
2588
  },
2589
2589
  });
2590
- const doOrganizationFetch = createAppAsyncThunk("organization/doOrganizationFetch", (_, { extra, getState }) => __awaiter(void 0, void 0, void 0, function* () {
2590
+ const doOrganizationFetch = createAppAsyncThunk("organization/doOrganizationFetch", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { extra, getState }) {
2591
2591
  try {
2592
2592
  const roomUrl = selectAppRoomUrl(getState());
2593
2593
  const organization = yield extra.services.fetchOrganizationFromRoomUrl(roomUrl || "");
@@ -2602,6 +2602,7 @@ const doOrganizationFetch = createAppAsyncThunk("organization/doOrganizationFetc
2602
2602
  }));
2603
2603
  const selectOrganizationRaw = (state) => state.organization;
2604
2604
  const selectOrganizationId = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.organizationId; };
2605
+ const selectOrganizationPreferences = (state) => { var _a; return (_a = state.organization.data) === null || _a === void 0 ? void 0 : _a.preferences; };
2605
2606
  const selectShouldFetchOrganization = toolkit.createSelector(selectAppIsActive, selectOrganizationRaw, selectDeviceCredentialsRaw, (appIsActive, organization, deviceCredentials) => {
2606
2607
  if (appIsActive &&
2607
2608
  !organization.data &&
@@ -2827,7 +2828,11 @@ const rtcAnalyticsCustomEvents = {
2827
2828
  displayName: {
2828
2829
  actions: [setDisplayName],
2829
2830
  rtcEventName: "displayName",
2830
- getValue: (state) => selectAppDisplayName(state),
2831
+ getValue: (state) => {
2832
+ const displayName = selectLocalParticipantDisplayName(state);
2833
+ const prefs = selectOrganizationPreferences(state);
2834
+ return (prefs === null || prefs === void 0 ? void 0 : prefs.hideInsightsDisplayNames) ? "[[redacted]]" : displayName;
2835
+ },
2831
2836
  getOutput: (value) => ({ displayName: value }),
2832
2837
  },
2833
2838
  clientId: {
@@ -3030,8 +3035,7 @@ const doRejectWaitingParticipant = createRoomConnectedThunk((payload) => (dispat
3030
3035
  const selectWaitingParticipantsRaw = (state) => state.waitingParticipants;
3031
3036
  const selectWaitingParticipants = (state) => state.waitingParticipants.waitingParticipants;
3032
3037
 
3033
- var _a;
3034
- const IS_DEV = (_a = undefined === "true") !== null && _a !== void 0 ? _a : false;
3038
+ const IS_DEV = undefined === "true";
3035
3039
  const appReducer = toolkit.combineReducers({
3036
3040
  app: appSlice.reducer,
3037
3041
  authorization: authorizationSlice.reducer,
@@ -3396,7 +3400,7 @@ class LocalStorageStore {
3396
3400
  try {
3397
3401
  return Promise.resolve(JSON.parse(value));
3398
3402
  }
3399
- catch (e) {
3403
+ catch (_a) {
3400
3404
  }
3401
3405
  }
3402
3406
  return Promise.resolve(defaultValue);
@@ -3422,7 +3426,7 @@ let localStorage;
3422
3426
  try {
3423
3427
  localStorage = self.localStorage;
3424
3428
  }
3425
- catch (e) {
3429
+ catch (_a) {
3426
3430
  localStorage = {
3427
3431
  getItem: () => undefined,
3428
3432
  key: () => undefined,
@@ -4080,7 +4084,9 @@ class LocalParticipant extends RoomParticipant {
4080
4084
 
4081
4085
  const API_BASE_URL = "https://api.whereby.dev";
4082
4086
  function createServices() {
4083
- const credentialsService = CredentialsService.create({ baseUrl: API_BASE_URL });
4087
+ const credentialsService = CredentialsService.create({
4088
+ baseUrl: API_BASE_URL,
4089
+ });
4084
4090
  const apiClient = new ApiClient({
4085
4091
  fetchDeviceCredentials: credentialsService.getCredentials.bind(credentialsService),
4086
4092
  baseUrl: API_BASE_URL,
@@ -4323,6 +4329,7 @@ exports.selectNotificationsRaw = selectNotificationsRaw;
4323
4329
  exports.selectNumClients = selectNumClients;
4324
4330
  exports.selectNumParticipants = selectNumParticipants;
4325
4331
  exports.selectOrganizationId = selectOrganizationId;
4332
+ exports.selectOrganizationPreferences = selectOrganizationPreferences;
4326
4333
  exports.selectOrganizationRaw = selectOrganizationRaw;
4327
4334
  exports.selectRemoteClientViews = selectRemoteClientViews;
4328
4335
  exports.selectRemoteClients = selectRemoteClients;