@whereby.com/browser-sdk 3.12.24 → 3.13.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.
@@ -1,19 +1,17 @@
1
1
  import * as React from 'react';
2
- import { useRef, useEffect } from 'react';
3
- import { createStoreHook, createDispatchHook, createSelectorHook, Provider as Provider$1 } from 'react-redux';
4
- import { createServices, createStore, selectCurrentSpeakerDeviceId, debounce, doRtcReportStreamResolution, selectChatMessages, selectCloudRecordingRaw, selectBreakoutCurrentGroup, selectBreakoutActive, selectBreakoutGroupedParticipants, selectAllClientViewsInCurrentGroup, selectLocalParticipantRaw, selectLocalMediaStream, selectRemoteParticipants, selectScreenshares, selectRoomConnectionStatus, selectStreamingRaw, selectWaitingParticipants, selectNotificationsEmitter, selectSpotlightedClientViews, doAppStop, doSendChatMessage, doKnockRoom, doSetDisplayName, toggleCameraEnabled, toggleMicrophoneEnabled, toggleLowDataModeEnabled, doSetLocalStickyReaction, doRequestAudioEnable, doRequestVideoEnable, doAcceptWaitingParticipant, doRejectWaitingParticipant, doStartCloudRecording, doStartScreenshare, doStopCloudRecording, doStopScreenshare, doAppStart, doLockRoom, doSpotlightParticipant, doRemoveSpotlight, doKickParticipant, doEndMeeting, doBreakoutJoin, selectCameraDeviceError, selectCameraDevices, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsLocalMediaStarting, selectMicrophoneDeviceError, selectMicrophoneDevices, selectSpeakerDevices, selectLocalMediaStartError, doStartLocalMedia, doStopLocalMedia, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, selectAllClientViews, selectNumParticipants } from '@whereby.com/core';
5
- import { createSelector } from '@reduxjs/toolkit';
2
+ import { WherebyClient, CURRENT_SPEAKER_CHANGED, debounce } from '@whereby.com/core';
6
3
  import runes from 'runes';
7
4
  import * as PopoverPrimitive from '@radix-ui/react-popover';
8
5
 
9
6
  const WherebyContext = React.createContext(null);
10
- createStoreHook(WherebyContext);
11
- const useDispatch = createDispatchHook(WherebyContext);
12
- const useSelector = createSelectorHook(WherebyContext);
13
7
  function Provider({ children }) {
14
- const services = createServices();
15
- const store = createStore({ injectServices: services });
16
- return (React.createElement(Provider$1, { context: WherebyContext, store: store }, children));
8
+ const client = React.useMemo(() => new WherebyClient(), []);
9
+ React.useEffect(() => {
10
+ return () => {
11
+ client.destroy();
12
+ };
13
+ }, [client]);
14
+ return React.createElement(WherebyContext.Provider, { value: client }, children);
17
15
  }
18
16
 
19
17
  /******************************************************************************
@@ -50,13 +48,21 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
50
48
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
51
49
  };
52
50
 
53
- const useAppDispatch = useDispatch.withTypes();
54
- const useAppSelector = useSelector.withTypes();
55
-
56
51
  const useAudioElement = ({ stream, muted }) => {
57
- const audioEl = useRef(null);
58
- const currentSpeakerId = useAppSelector(selectCurrentSpeakerDeviceId);
59
- useEffect(() => {
52
+ var _a;
53
+ const audioEl = React.useRef(null);
54
+ const client = (_a = React.useContext(WherebyContext)) === null || _a === void 0 ? void 0 : _a.getLocalMedia();
55
+ const [currentSpeakerId, setCurrentSpeakerId] = React.useState();
56
+ const listener = React.useCallback((speakerId) => {
57
+ setCurrentSpeakerId(speakerId);
58
+ }, []);
59
+ React.useEffect(() => {
60
+ client === null || client === void 0 ? void 0 : client.addListener(CURRENT_SPEAKER_CHANGED, listener);
61
+ return () => {
62
+ client === null || client === void 0 ? void 0 : client.removeListener(CURRENT_SPEAKER_CHANGED, listener);
63
+ };
64
+ }, [client]);
65
+ React.useEffect(() => {
60
66
  if (!audioEl.current || muted || !stream || !currentSpeakerId) {
61
67
  return;
62
68
  }
@@ -71,8 +77,9 @@ const useAudioElement = ({ stream, muted }) => {
71
77
  };
72
78
 
73
79
  const VideoView = React.forwardRef((_a, ref) => {
80
+ var _b;
74
81
  var { muted, mirror = false, stream, onVideoResize } = _a, rest = __rest(_a, ["muted", "mirror", "stream", "onVideoResize"]);
75
- const dispatch = useAppDispatch();
82
+ const client = (_b = React.useContext(WherebyContext)) === null || _b === void 0 ? void 0 : _b.getRoomConnection();
76
83
  const videoEl = React.useRef(null);
77
84
  const audioEl = useAudioElement({ muted, stream });
78
85
  React.useImperativeHandle(ref, () => {
@@ -98,11 +105,7 @@ const VideoView = React.forwardRef((_a, ref) => {
98
105
  if (videoEl.current && (stream === null || stream === void 0 ? void 0 : stream.id)) {
99
106
  const width = videoEl.current.clientWidth;
100
107
  const height = videoEl.current.clientHeight;
101
- dispatch(doRtcReportStreamResolution({
102
- streamId: stream.id,
103
- width,
104
- height,
105
- }));
108
+ client === null || client === void 0 ? void 0 : client.reportStreamResolution(stream.id, width, height);
106
109
  if (onVideoResize) {
107
110
  onVideoResize({
108
111
  width,
@@ -134,35 +137,24 @@ const VideoView = React.forwardRef((_a, ref) => {
134
137
  });
135
138
  VideoView.displayName = "VideoView";
136
139
 
137
- const selectRoomConnectionState = createSelector(selectChatMessages, selectCloudRecordingRaw, selectBreakoutCurrentGroup, selectBreakoutActive, selectBreakoutGroupedParticipants, selectAllClientViewsInCurrentGroup, selectLocalParticipantRaw, selectLocalMediaStream, selectRemoteParticipants, selectScreenshares, selectRoomConnectionStatus, selectStreamingRaw, selectWaitingParticipants, selectNotificationsEmitter, selectSpotlightedClientViews, (chatMessages, cloudRecording, breakoutCurrentGroup, breakoutActive, breakoutGroupedParticipants, clientViewsInCurrentGroup, localParticipant, localMediaStream, remoteParticipants, screenshares, connectionStatus, streaming, waitingParticipants, notificationsEmitter, spotlightedClientViews) => {
138
- const state = {
139
- chatMessages,
140
- cloudRecording: cloudRecording.isRecording ? { status: "recording" } : undefined,
141
- breakout: {
142
- isActive: breakoutActive,
143
- currentGroup: breakoutCurrentGroup,
144
- groupedParticipants: breakoutGroupedParticipants,
145
- participantsInCurrentGroup: clientViewsInCurrentGroup,
146
- },
147
- connectionStatus,
148
- events: notificationsEmitter,
149
- liveStream: streaming.isStreaming
150
- ? {
151
- status: "streaming",
152
- startedAt: streaming.startedAt,
153
- }
154
- : undefined,
155
- localScreenshareStatus: localParticipant.isScreenSharing ? "active" : undefined,
156
- localParticipant: Object.assign(Object.assign({}, localParticipant), { stream: localMediaStream }),
157
- remoteParticipants,
158
- screenshares,
159
- waitingParticipants,
160
- spotlightedParticipants: spotlightedClientViews,
161
- };
162
- return state;
163
- });
140
+ const browserSdkVersion = "3.13.1";
164
141
 
165
- const browserSdkVersion = "3.12.24";
142
+ const initialState$1 = {
143
+ chatMessages: [],
144
+ cloudRecording: undefined,
145
+ breakout: {
146
+ isActive: false,
147
+ currentGroup: null,
148
+ groupedParticipants: [],
149
+ participantsInCurrentGroup: [],
150
+ },
151
+ localParticipant: undefined,
152
+ remoteParticipants: [],
153
+ screenshares: [],
154
+ connectionStatus: "ready",
155
+ waitingParticipants: [],
156
+ spotlightedParticipants: [],
157
+ };
166
158
 
167
159
  const defaultRoomConnectionOptions = {
168
160
  localMediaOptions: {
@@ -171,8 +163,12 @@ const defaultRoomConnectionOptions = {
171
163
  },
172
164
  };
173
165
  function useRoomConnection(roomUrl, roomConnectionOptions = defaultRoomConnectionOptions) {
174
- const dispatch = useAppDispatch();
175
- const roomConnectionState = useAppSelector(selectRoomConnectionState);
166
+ var _a;
167
+ const client = (_a = React.useContext(WherebyContext)) === null || _a === void 0 ? void 0 : _a.getRoomConnection();
168
+ const [roomConnectionState, setRoomConnectionState] = React.useState(() => initialState$1);
169
+ if (!client) {
170
+ throw new Error("WherebyClient is not initialized. Please wrap your component with WherebyProvider.");
171
+ }
176
172
  const roomConfig = React.useMemo(() => {
177
173
  const url = new URL(roomUrl);
178
174
  const searchParams = new URLSearchParams(url.search);
@@ -187,36 +183,45 @@ function useRoomConnection(roomUrl, roomConnectionOptions = defaultRoomConnectio
187
183
  };
188
184
  }, [roomUrl, roomConnectionOptions]);
189
185
  React.useEffect(() => {
186
+ const unsubscribe = client.subscribe((state) => {
187
+ setRoomConnectionState((prev) => (Object.assign(Object.assign({}, prev), state)));
188
+ });
189
+ const eventEmitter = client.getNotificationsEventEmitter();
190
+ setRoomConnectionState((prev) => (Object.assign(Object.assign({}, prev), { events: eventEmitter })));
190
191
  return () => {
191
- dispatch(doAppStop());
192
+ unsubscribe();
193
+ client.leaveRoom();
192
194
  };
193
195
  }, []);
194
- const sendChatMessage = React.useCallback((text) => dispatch(doSendChatMessage({ text })), [dispatch]);
195
- const knock = React.useCallback(() => dispatch(doKnockRoom()), [dispatch]);
196
- const setDisplayName = React.useCallback((displayName) => dispatch(doSetDisplayName({ displayName })), [dispatch]);
197
- const toggleCamera = React.useCallback((enabled) => dispatch(toggleCameraEnabled({ enabled })), [dispatch]);
198
- const toggleMicrophone = React.useCallback((enabled) => dispatch(toggleMicrophoneEnabled({ enabled })), [dispatch]);
199
- const toggleLowDataMode = React.useCallback((enabled) => dispatch(toggleLowDataModeEnabled({ enabled })), [dispatch]);
200
- const toggleRaiseHand = React.useCallback((enabled) => dispatch(doSetLocalStickyReaction({ enabled })), [dispatch]);
201
- const askToSpeak = React.useCallback((participantId) => dispatch(doRequestAudioEnable({ clientIds: [participantId], enable: true })), [dispatch]);
202
- const askToTurnOnCamera = React.useCallback((participantId) => dispatch(doRequestVideoEnable({ clientIds: [participantId], enable: true })), [dispatch]);
203
- const acceptWaitingParticipant = React.useCallback((participantId) => dispatch(doAcceptWaitingParticipant({ participantId })), [dispatch]);
204
- const rejectWaitingParticipant = React.useCallback((participantId) => dispatch(doRejectWaitingParticipant({ participantId })), [dispatch]);
205
- const startCloudRecording = React.useCallback(() => dispatch(doStartCloudRecording()), [dispatch]);
206
- const startScreenshare = React.useCallback(() => dispatch(doStartScreenshare()), [dispatch]);
207
- const stopCloudRecording = React.useCallback(() => dispatch(doStopCloudRecording()), [dispatch]);
208
- const stopScreenshare = React.useCallback(() => dispatch(doStopScreenshare()), [dispatch]);
209
- const joinRoom = React.useCallback(() => dispatch(doAppStart(roomConfig)), [dispatch]);
210
- const leaveRoom = React.useCallback(() => dispatch(doAppStop()), [dispatch]);
211
- const lockRoom = React.useCallback((locked) => dispatch(doLockRoom({ locked })), [dispatch]);
212
- const muteParticipants = React.useCallback((participantIds) => dispatch(doRequestAudioEnable({ clientIds: participantIds, enable: false })), [dispatch]);
213
- const turnOffParticipantCameras = React.useCallback((participantIds) => dispatch(doRequestVideoEnable({ clientIds: participantIds, enable: false })), [dispatch]);
214
- const spotlightParticipant = React.useCallback((participantId) => dispatch(doSpotlightParticipant({ id: participantId })), [dispatch]);
215
- const removeSpotlight = React.useCallback((participantId) => dispatch(doRemoveSpotlight({ id: participantId })), [dispatch]);
216
- const kickParticipant = React.useCallback((participantId) => dispatch(doKickParticipant({ clientId: participantId })), [dispatch]);
217
- const endMeeting = React.useCallback((stayBehind) => dispatch(doEndMeeting({ stayBehind })), [dispatch]);
218
- const joinBreakoutGroup = React.useCallback((group) => dispatch(doBreakoutJoin({ group })), [dispatch]);
219
- const joinBreakoutMainRoom = React.useCallback(() => dispatch(doBreakoutJoin({ group: "" })), [dispatch]);
196
+ const joinRoom = React.useCallback(() => {
197
+ client.initialize(roomConfig);
198
+ client.joinRoom();
199
+ }, [client]);
200
+ const sendChatMessage = React.useCallback((text) => client.sendChatMessage(text), [client]);
201
+ const knock = React.useCallback(() => client.knock(), [client]);
202
+ const setDisplayName = React.useCallback((displayName) => client.setDisplayName(displayName), [client]);
203
+ const toggleCamera = React.useCallback((enabled) => client.toggleCamera(enabled), [client]);
204
+ const toggleMicrophone = React.useCallback((enabled) => client.toggleMicrophone(enabled), [client]);
205
+ const toggleLowDataMode = React.useCallback((enabled) => client.toggleLowDataMode(enabled), [client]);
206
+ const toggleRaiseHand = React.useCallback((enabled) => client.toggleRaiseHand(enabled), [client]);
207
+ const askToSpeak = React.useCallback((participantId) => client.askToSpeak(participantId), [client]);
208
+ const askToTurnOnCamera = React.useCallback((participantId) => client.askToTurnOnCamera(participantId), [client]);
209
+ const acceptWaitingParticipant = React.useCallback((participantId) => client.acceptWaitingParticipant(participantId), [client]);
210
+ const rejectWaitingParticipant = React.useCallback((participantId) => client.rejectWaitingParticipant(participantId), [client]);
211
+ const startCloudRecording = React.useCallback(() => client.startCloudRecording(), [client]);
212
+ const startScreenshare = React.useCallback(() => client.startScreenshare(), [client]);
213
+ const stopCloudRecording = React.useCallback(() => client.stopCloudRecording(), [client]);
214
+ const stopScreenshare = React.useCallback(() => client.stopScreenshare(), [client]);
215
+ const leaveRoom = React.useCallback(() => client.leaveRoom(), [client]);
216
+ const lockRoom = React.useCallback((locked) => client.lockRoom(locked), [client]);
217
+ const muteParticipants = React.useCallback((participantIds) => client.muteParticipants(participantIds), [client]);
218
+ const turnOffParticipantCameras = React.useCallback((participantIds) => client.turnOffParticipantCameras(participantIds), [client]);
219
+ const spotlightParticipant = React.useCallback((participantId) => client.spotlightParticipant(participantId), [client]);
220
+ const removeSpotlight = React.useCallback((participantId) => client.removeSpotlight(participantId), [client]);
221
+ const kickParticipant = React.useCallback((participantId) => client.kickParticipant(participantId), [client]);
222
+ const endMeeting = React.useCallback((stayBehind) => client.endMeeting(stayBehind), [client]);
223
+ const joinBreakoutGroup = React.useCallback((group) => client.joinBreakoutGroup(group), [client]);
224
+ const joinBreakoutMainRoom = React.useCallback(() => client.joinBreakoutMainRoom(), [client]);
220
225
  const { events } = roomConnectionState, state = __rest(roomConnectionState, ["events"]);
221
226
  return {
222
227
  state,
@@ -252,40 +257,41 @@ function useRoomConnection(roomUrl, roomConnectionOptions = defaultRoomConnectio
252
257
  };
253
258
  }
254
259
 
255
- const selectLocalMediaState = createSelector(selectCameraDeviceError, selectCameraDevices, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsLocalMediaStarting, selectLocalMediaStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectSpeakerDevices, selectLocalMediaStartError, (cameraDeviceError, cameraDevices, currentCameraDeviceId, currentMicrophoneDeviceId, currentSpeakerDeviceId, isSettingCameraDevice, isSettingMicrophoneDevice, isStarting, localStream, microphoneDeviceError, microphoneDevices, speakerDevices, startError) => {
256
- const state = {
257
- cameraDeviceError,
258
- cameraDevices,
259
- currentCameraDeviceId,
260
- currentMicrophoneDeviceId,
261
- currentSpeakerDeviceId,
262
- isSettingCameraDevice,
263
- isSettingMicrophoneDevice,
264
- isStarting,
265
- localStream,
266
- microphoneDeviceError,
267
- microphoneDevices,
268
- speakerDevices,
269
- startError,
270
- };
271
- return state;
272
- });
260
+ const initialState = {
261
+ cameraDeviceError: null,
262
+ isStarting: false,
263
+ isSettingCameraDevice: false,
264
+ isSettingMicrophoneDevice: false,
265
+ microphoneDeviceError: null,
266
+ startError: null,
267
+ cameraDevices: [],
268
+ microphoneDevices: [],
269
+ speakerDevices: [],
270
+ };
273
271
 
274
272
  function useLocalMedia(optionsOrStream = { audio: true, video: true }) {
275
- const dispatch = useAppDispatch();
276
- const localMediaState = useAppSelector(selectLocalMediaState);
273
+ var _a;
274
+ const client = (_a = React.useContext(WherebyContext)) === null || _a === void 0 ? void 0 : _a.getLocalMedia();
275
+ const [localMediaState, setLocalMediaState] = React.useState(() => initialState);
276
+ if (!client) {
277
+ throw new Error("WherebyClient is not initialized. Please wrap your component with WherebyProvider.");
278
+ }
277
279
  React.useEffect(() => {
278
- dispatch(doStartLocalMedia(optionsOrStream));
280
+ client.startMedia(optionsOrStream);
281
+ const unsubscribe = client.subscribe((state) => {
282
+ setLocalMediaState((prevState) => (Object.assign(Object.assign({}, prevState), state)));
283
+ });
279
284
  return () => {
280
- dispatch(doStopLocalMedia());
285
+ unsubscribe();
286
+ client.stopMedia();
281
287
  };
282
288
  }, []);
283
- const setCameraDevice = React.useCallback((deviceId) => dispatch(setCurrentCameraDeviceId({ deviceId })), [dispatch]);
284
- const setMicrophoneDevice = React.useCallback((deviceId) => dispatch(setCurrentMicrophoneDeviceId({ deviceId })), [dispatch]);
285
- const setSpeakerDevice = React.useCallback((deviceId) => dispatch(setCurrentSpeakerDeviceId({ deviceId })), [dispatch]);
286
- const toggleCamera = React.useCallback((enabled) => dispatch(toggleCameraEnabled({ enabled })), [dispatch]);
287
- const toggleMicrophone = React.useCallback((enabled) => dispatch(toggleMicrophoneEnabled({ enabled })), [dispatch]);
288
- const toggleLowDataMode = React.useCallback((enabled) => dispatch(toggleLowDataModeEnabled({ enabled })), [dispatch]);
289
+ const setCameraDevice = React.useCallback((deviceId) => client.setCameraDevice(deviceId), [client]);
290
+ const setMicrophoneDevice = React.useCallback((deviceId) => client.setMicrophoneDevice(deviceId), [client]);
291
+ const setSpeakerDevice = React.useCallback((deviceId) => client.setSpeakerDevice(deviceId), [client]);
292
+ const toggleCamera = React.useCallback((enabled) => client.toggleCamera(enabled), [client]);
293
+ const toggleMicrophone = React.useCallback((enabled) => client.toggleMicrophone(enabled), [client]);
294
+ const toggleLowDataMode = React.useCallback((enabled) => client.toggleLowDataMode(enabled), [client]);
289
295
  return {
290
296
  state: localMediaState,
291
297
  actions: {
@@ -1724,9 +1730,38 @@ function calculateSubgridViews({ clientViews, activeVideosSubgridTrigger, should
1724
1730
  return noVideoViews;
1725
1731
  }
1726
1732
  function useGridParticipants({ activeVideosSubgridTrigger = ACTIVE_VIDEO_SUBGRID_TRIGGER, stageParticipantLimit = STAGE_PARTICIPANT_LIMIT, forceSubgrid = true, enableSubgrid = true, maximizedParticipant, floatingParticipant, isConstrained = false, } = {}) {
1727
- const allClientViews = useAppSelector(selectAllClientViews);
1728
- const spotlightedParticipants = useAppSelector(selectSpotlightedClientViews);
1729
- const numParticipants = useAppSelector(selectNumParticipants);
1733
+ var _a;
1734
+ const [state, setState] = React.useState({
1735
+ allClientViews: [],
1736
+ spotlightedParticipants: [],
1737
+ numParticipants: 0,
1738
+ });
1739
+ const client = (_a = React.useContext(WherebyContext)) === null || _a === void 0 ? void 0 : _a.getGrid();
1740
+ if (!client) {
1741
+ throw new Error("useGridParticipants must be used within a WherebyProvider");
1742
+ }
1743
+ const handleClientViewChanged = React.useCallback((clientViews) => {
1744
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { allClientViews: clientViews })));
1745
+ }, [setState]);
1746
+ const handleSpotlightedParticipantsChanged = React.useCallback((spotlighted) => {
1747
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { spotlightedParticipants: spotlighted })));
1748
+ }, [setState]);
1749
+ const handleNumParticipantsChanged = React.useCallback((num) => {
1750
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { numParticipants: num })));
1751
+ }, [setState]);
1752
+ React.useEffect(() => {
1753
+ const unsubscribeClientViews = client.subscribeClientViews(handleClientViewChanged);
1754
+ const unsubscribeSpotlighted = client.subscribeSpotlightedParticipants(handleSpotlightedParticipantsChanged);
1755
+ const unsubscribeNumParticipants = client.subscribeNumberOfClientViews(handleNumParticipantsChanged);
1756
+ return () => {
1757
+ unsubscribeClientViews();
1758
+ unsubscribeSpotlighted();
1759
+ unsubscribeNumParticipants();
1760
+ };
1761
+ }, [client]);
1762
+ const allClientViews = React.useMemo(() => state.allClientViews, [state.allClientViews]);
1763
+ const spotlightedParticipants = React.useMemo(() => state.spotlightedParticipants, [state.spotlightedParticipants]);
1764
+ const numParticipants = React.useMemo(() => state.numParticipants, [state.numParticipants]);
1730
1765
  const floatingClientView = React.useMemo(() => {
1731
1766
  return floatingParticipant;
1732
1767
  }, [floatingParticipant]);
@@ -1769,6 +1804,7 @@ function useGridParticipants({ activeVideosSubgridTrigger = ACTIVE_VIDEO_SUBGRID
1769
1804
  clientViewsInGrid,
1770
1805
  clientViewsInPresentationGrid,
1771
1806
  clientViewsInSubgrid,
1807
+ spotlightedParticipants,
1772
1808
  };
1773
1809
  }
1774
1810
 
@@ -1985,10 +2021,11 @@ const ParticipantMenuTrigger = React.forwardRef((_a, ref) => {
1985
2021
  });
1986
2022
  ParticipantMenuTrigger.displayName = PopoverTrigger.displayName;
1987
2023
  const ParticipantMenuItem = React.forwardRef((_a, ref) => {
2024
+ var _b;
1988
2025
  var { children, style, participantAction } = _a, props = __rest(_a, ["children", "style", "participantAction"]);
1989
2026
  const { participant, setOpen, maximizedParticipant, setMaximizedParticipant, setFloatingParticipant, floatingParticipant, } = useParticipantMenu();
1990
- const dispatch = useAppDispatch();
1991
- const spotlightedParticipants = useAppSelector(selectSpotlightedClientViews);
2027
+ const client = (_b = React.useContext(WherebyContext)) === null || _b === void 0 ? void 0 : _b.getGrid();
2028
+ const { spotlightedParticipants } = useGridParticipants();
1992
2029
  const isSpotlighted = spotlightedParticipants.find((p) => p.id === participant.id);
1993
2030
  const isMaximized = (maximizedParticipant === null || maximizedParticipant === void 0 ? void 0 : maximizedParticipant.id) === participant.id;
1994
2031
  const isFloating = (floatingParticipant === null || floatingParticipant === void 0 ? void 0 : floatingParticipant.id) === participant.id;
@@ -2008,10 +2045,10 @@ const ParticipantMenuItem = React.forwardRef((_a, ref) => {
2008
2045
  case "spotlight":
2009
2046
  onClick = () => {
2010
2047
  if (isSpotlighted) {
2011
- dispatch(doRemoveSpotlight({ id: participant.id }));
2048
+ client === null || client === void 0 ? void 0 : client.removeSpotlight(participant.id);
2012
2049
  }
2013
2050
  else {
2014
- dispatch(doSpotlightParticipant({ id: participant.id }));
2051
+ client === null || client === void 0 ? void 0 : client.spotlightParticipant(participant.id);
2015
2052
  }
2016
2053
  setOpen(false);
2017
2054
  };
@@ -2061,7 +2098,7 @@ function PopInIcon(props) {
2061
2098
  }
2062
2099
 
2063
2100
  function DefaultParticipantMenu({ participant }) {
2064
- const spotlightedParticipants = useAppSelector(selectSpotlightedClientViews);
2101
+ const { spotlightedParticipants } = useGridParticipants();
2065
2102
  const isSpotlighted = spotlightedParticipants.find((p) => p.id === participant.id);
2066
2103
  const { isHovered, maximizedParticipant, floatingParticipant } = useGridCell();
2067
2104
  const isMaximized = (maximizedParticipant === null || maximizedParticipant === void 0 ? void 0 : maximizedParticipant.id) === participant.id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whereby.com/browser-sdk",
3
- "version": "3.12.24",
3
+ "version": "3.13.1",
4
4
  "description": "Modules for integration Whereby video in web apps",
5
5
  "author": "Whereby AS",
6
6
  "license": "MIT",
@@ -68,17 +68,15 @@
68
68
  "@whereby.com/eslint-config": "0.1.0",
69
69
  "@whereby.com/jest-config": "0.1.0",
70
70
  "@whereby.com/prettier-config": "0.1.0",
71
- "@whereby.com/tsconfig": "0.1.0",
72
- "@whereby.com/rollup-config": "0.1.0"
71
+ "@whereby.com/rollup-config": "0.1.0",
72
+ "@whereby.com/tsconfig": "0.1.0"
73
73
  },
74
74
  "dependencies": {
75
75
  "@radix-ui/react-popover": "^1.0.7",
76
- "@reduxjs/toolkit": "^2.2.3",
77
- "@whereby.com/media": "1.32.1",
78
- "@whereby.com/core": "0.36.1",
76
+ "@whereby.com/media": "1.33.0",
77
+ "@whereby.com/core": "1.0.1",
79
78
  "clsx": "^2.1.1",
80
79
  "heresy": "^1.0.4",
81
- "react-redux": "^9.1.1",
82
80
  "runes": "^0.4.3"
83
81
  },
84
82
  "peerDependencies": {