@whereby.com/browser-sdk 3.31.2 → 3.33.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.
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
- import { LocalMediaState, LocalMediaOptions, InitialMuteStates, RoomJoinedSuccess, SendFilesOptions, ChatFileShare, StartBreakoutSessionOptions, UpdateBreakoutSessionOptions, RoomConnectionState, NotificationsEventEmitter, ClientView } from '@whereby.com/core';
3
- export { ACCEPTED_FILE_TYPES, BreakoutState as Breakout, ChatFileShare, ChatMessageState as ChatMessage, CloudRecordingState as CloudRecording, FileShareError, FileUpload, KnockResponse, LiveStreamState as LiveStreaming, LocalParticipantState as LocalParticipant, MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, RemoteParticipantState as RemoteParticipant, RoomConnectionState as RoomConnection, ScreenshareState as Screenshare, SendFilesOptions, WaitingParticipantState as WaitingParticipant, getUsableCameraEffectPresets, isAudioDenoiserSupported } from '@whereby.com/core';
2
+ import * as _whereby_com_core from '@whereby.com/core';
3
+ import { LocalMediaState, LocalMediaOptions, InitialMuteStates, RoomJoinedSuccess, SendFilesOptions, ChatFileShare, ToggleAudioOnlyModeOptions, RoomIntegrationProps, StartBreakoutSessionOptions, UpdateBreakoutSessionOptions, RoomConnectionState, NotificationsEventEmitter, ClientView, RoomIntegrationSessionView, RoomIntegration, RoomIntegrationPickerResult } from '@whereby.com/core';
4
+ export { ACCEPTED_FILE_TYPES, BreakoutState as Breakout, ChatFileShare, ChatMessageState as ChatMessage, CloudRecordingState as CloudRecording, FileShareError, FileUpload, KnockResponse, LiveStreamState as LiveStreaming, LocalParticipantState as LocalParticipant, MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, ROOM_INTEGRATION_PICKER_MESSAGES, RemoteParticipantState as RemoteParticipant, RoomConnectionState as RoomConnection, RoomIntegration, RoomIntegrationContent, RoomIntegrationError, RoomIntegrationErrorDetail, RoomIntegrationPickerResult, RoomIntegrationProps, RoomIntegrationSession, RoomIntegrationSessionView, RoomIntegrationsState as RoomIntegrations, ScreenshareState as Screenshare, SendFilesOptions, ToggleAudioOnlyModeOptions, WaitingParticipantState as WaitingParticipant, YouTubeContentMetadata, getUsableCameraEffectPresets, isAudioDenoiserSupported, roomIntegrationContent, roomIntegrationContentTagName, roomIntegrationPickerUrl } from '@whereby.com/core';
4
5
  import * as _radix_ui_react_popover from '@radix-ui/react-popover';
5
6
  import { PopoverProps } from '@radix-ui/react-popover';
6
7
 
@@ -91,11 +92,26 @@ interface RoomConnectionActions {
91
92
  toggleRaiseHand: (enabled?: boolean) => void;
92
93
  toggleHdMode: (enabled?: boolean) => void;
93
94
  toggleLowDataMode: (enabled?: boolean) => void;
95
+ toggleAudioOnlyMode: (enabled?: boolean, options?: ToggleAudioOnlyModeOptions) => void;
94
96
  toggleWidescreenMode: (enabled?: boolean) => void;
95
97
  spotlightParticipant: (clientId: string) => void;
96
98
  removeSpotlight: (clientId: string) => void;
97
99
  joinBreakoutGroup: (group: string) => void;
98
100
  joinBreakoutMainRoom: () => void;
101
+ startRoomIntegration: (options: {
102
+ roomIntegrationId: string;
103
+ tagName: string;
104
+ shareUrl: string;
105
+ props?: RoomIntegrationProps;
106
+ }) => void;
107
+ stopRoomIntegration: (options: {
108
+ roomIntegrationSessionId: string;
109
+ intent?: "stop" | "end";
110
+ }) => void;
111
+ updateRoomIntegrationProps: (options: {
112
+ roomIntegrationSessionId: string;
113
+ props: RoomIntegrationProps;
114
+ }) => void;
99
115
  startBreakoutSession: (options: StartBreakoutSessionOptions) => void;
100
116
  updateBreakoutSession: (options: UpdateBreakoutSessionOptions) => void;
101
117
  stopBreakoutSession: () => void;
@@ -127,8 +143,95 @@ declare function useRoomConnection(roomUrl: string, roomConnectionOptions?: UseR
127
143
 
128
144
  declare function useLocalMedia(optionsOrStream?: UseLocalMediaOptions | MediaStream): UseLocalMediaResult;
129
145
 
146
+ type Box = {
147
+ top: number;
148
+ left: number;
149
+ bottom: number;
150
+ right: number;
151
+ };
152
+ type Origin = {
153
+ top: number;
154
+ left: number;
155
+ };
156
+ type Bounds = {
157
+ width: number;
158
+ height: number;
159
+ };
160
+ type Frame = {
161
+ origin: Origin;
162
+ bounds: Bounds;
163
+ };
164
+ type CellViewBase = {
165
+ aspectRatio?: number;
166
+ avatarSize?: number;
167
+ cellPaddings?: {
168
+ top: number;
169
+ right: number;
170
+ };
171
+ cellId: string;
172
+ clientId: string;
173
+ isDraggable?: boolean;
174
+ isPlaceholder?: boolean;
175
+ isSubgrid?: boolean;
176
+ };
177
+ type VideoCellView = CellViewBase & {
178
+ type: "video";
179
+ client?: ClientView;
180
+ };
181
+ type IntegrationCellView = CellViewBase & {
182
+ type: "integration";
183
+ session: RoomIntegrationSessionView;
184
+ };
185
+ type CellView = VideoCellView | IntegrationCellView;
186
+ type ResultCellView = {
187
+ aspectRatio: number;
188
+ bounds: Bounds;
189
+ client?: ClientView;
190
+ clientId: string;
191
+ origin: Origin;
192
+ isDraggable?: boolean;
193
+ isSmallCell: boolean;
194
+ type: string;
195
+ paddings?: Box;
196
+ };
197
+ type StageLayout = {
198
+ isPortrait: boolean;
199
+ videosContainer: Frame;
200
+ hasOverflow: boolean;
201
+ bounds?: Bounds;
202
+ gridGap?: number;
203
+ presentationGrid?: {
204
+ bounds: Bounds;
205
+ origin: Origin;
206
+ cells: ResultCellView[];
207
+ paddings: Box;
208
+ };
209
+ videoGrid?: {
210
+ bounds: Bounds;
211
+ origin: Origin;
212
+ cells: ResultCellView[];
213
+ paddings: Box;
214
+ };
215
+ floatingContent?: {
216
+ clientId?: string;
217
+ isDraggable?: boolean;
218
+ origin: Origin;
219
+ bounds: Bounds;
220
+ aspectRatio: number;
221
+ isSmallCell?: boolean;
222
+ };
223
+ subgrid: {
224
+ bounds: Bounds;
225
+ origin: Origin;
226
+ cells: ResultCellView[];
227
+ contentBounds: Bounds;
228
+ };
229
+ overflowNeedBounds?: Bounds;
230
+ };
231
+
130
232
  type GridCellSelfProps = {
131
233
  participant: ClientView;
234
+ cellId?: string;
132
235
  };
133
236
  type GridCellProps = GridCellSelfProps & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
134
237
  declare const GridCell: React.ForwardRefExoticComponent<Omit<GridCellProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -145,14 +248,89 @@ interface GridProps {
145
248
  renderFloatingParticipant?: ({ participant }: {
146
249
  participant: ClientView;
147
250
  }) => React.ReactNode;
251
+ renderIntegration?: ({ session }: {
252
+ session: RoomIntegrationSessionView;
253
+ }) => React.ReactNode;
148
254
  gridGap?: number;
149
255
  videoGridGap?: number;
150
256
  enableSubgrid?: boolean;
151
257
  stageParticipantLimit?: number;
152
258
  enableParticipantMenu?: boolean;
153
259
  enableConstrainedGrid?: boolean;
260
+ enableIntegrations?: boolean;
261
+ }
262
+ declare function Grid({ renderParticipant, renderSubgridParticipant, renderFloatingParticipant, renderIntegration, stageParticipantLimit, gridGap, videoGridGap, enableSubgrid, enableParticipantMenu, enableConstrainedGrid, enableIntegrations, }: GridProps): React.JSX.Element;
263
+
264
+ interface Props {
265
+ activeVideosSubgridTrigger?: number;
266
+ forceSubgrid?: boolean;
267
+ stageParticipantLimit?: number;
268
+ gridGap?: number;
269
+ videoGridGap?: number;
270
+ enableSubgrid?: boolean;
271
+ enableConstrainedGrid?: boolean;
272
+ includeIntegrations?: boolean;
154
273
  }
155
- declare function Grid({ renderParticipant, renderSubgridParticipant, renderFloatingParticipant, stageParticipantLimit, gridGap, videoGridGap, enableSubgrid, enableParticipantMenu, enableConstrainedGrid, }: GridProps): React.JSX.Element;
274
+ declare function useGrid({ activeVideosSubgridTrigger, forceSubgrid, stageParticipantLimit, gridGap, videoGridGap, enableSubgrid, enableConstrainedGrid, includeIntegrations, }?: Props): {
275
+ containerFrame: Frame;
276
+ cellViewsFloating: CellView[];
277
+ cellViewsVideoGrid: CellView[];
278
+ cellViewsInPresentationGrid: CellView[];
279
+ cellViewsInSubgrid: CellView[];
280
+ cellViewsHidden: IntegrationCellView[];
281
+ clientAspectRatios: {
282
+ [key: string]: number;
283
+ };
284
+ videoStage: StageLayout;
285
+ setContainerBounds: React.Dispatch<React.SetStateAction<{
286
+ width: number;
287
+ height: number;
288
+ }>>;
289
+ setClientAspectRatios: React.Dispatch<React.SetStateAction<{
290
+ [key: string]: number;
291
+ }>>;
292
+ maximizedCellId: string | null;
293
+ setMaximizedCellId: React.Dispatch<React.SetStateAction<string | null>>;
294
+ maximizedParticipant: _whereby_com_core.ClientView | null;
295
+ floatingCellId: string | null;
296
+ setFloatingCellId: React.Dispatch<React.SetStateAction<string | null>>;
297
+ floatingParticipant: _whereby_com_core.ClientView | null;
298
+ isConstrained: boolean;
299
+ };
300
+
301
+ interface RoomIntegrationIframeProps {
302
+ ref: React.RefObject<HTMLIFrameElement | null>;
303
+ src: string;
304
+ title: string;
305
+ allow: string;
306
+ }
307
+ interface UseRoomIntegrationPickerOptions {
308
+ integration: RoomIntegration;
309
+ onPicked: (content: RoomIntegrationPickerResult) => void;
310
+ onCancel?: () => void;
311
+ onError?: (error: Error) => void;
312
+ featureSource?: string;
313
+ allow?: string;
314
+ title?: string;
315
+ }
316
+ interface UseRoomIntegrationPickerResult {
317
+ iframeProps: RoomIntegrationIframeProps | null;
318
+ }
319
+ declare function useRoomIntegrationPicker({ integration, onPicked, onCancel, onError, featureSource, allow, title, }: UseRoomIntegrationPickerOptions): UseRoomIntegrationPickerResult;
320
+
321
+ interface UseRoomIntegrationViewOptions {
322
+ session: RoomIntegrationSessionView;
323
+ onAudioOverride?: (enabled: boolean | null) => void;
324
+ onContentReady?: () => void;
325
+ allow?: string;
326
+ title?: string;
327
+ }
328
+ interface UseRoomIntegrationViewResult {
329
+ iframeProps: RoomIntegrationIframeProps | null;
330
+ getVolume: () => Promise<number>;
331
+ setVolume: (volume: number) => void;
332
+ }
333
+ declare function useRoomIntegrationView({ session, onAudioOverride, onContentReady, allow, title, }: UseRoomIntegrationViewOptions): UseRoomIntegrationViewResult;
156
334
 
157
335
  declare const ParticipantMenu: (props: PopoverProps) => React.JSX.Element;
158
336
  declare const ParticipantMenuContent: React.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_popover.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -161,5 +339,20 @@ declare const ParticipantMenuItem: React.ForwardRefExoticComponent<Omit<React.De
161
339
  participantAction?: "maximize" | "spotlight" | "float";
162
340
  } & React.RefAttributes<HTMLButtonElement>>;
163
341
 
164
- export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, useLocalMedia, useRoomConnection };
165
- export type { RoomConnectionActions, RoomConnectionOptions, UseLocalMediaResult };
342
+ type RoomIntegrationPickerOutcome = {
343
+ type: "submitted";
344
+ content: RoomIntegrationPickerResult;
345
+ } | {
346
+ type: "cancelled";
347
+ } | {
348
+ type: "error";
349
+ error: Error;
350
+ };
351
+ declare function subscribeToRoomIntegrationPicker({ pickerOrigin, getSource, onOutcome, }: {
352
+ pickerOrigin: string;
353
+ getSource: () => Window | null | undefined;
354
+ onOutcome: (outcome: RoomIntegrationPickerOutcome) => void;
355
+ }): () => void;
356
+
357
+ export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
358
+ export type { CellView, IntegrationCellView, RoomConnectionActions, RoomConnectionOptions, RoomIntegrationIframeProps, RoomIntegrationPickerOutcome, UseLocalMediaResult, UseRoomIntegrationPickerOptions, UseRoomIntegrationPickerResult, UseRoomIntegrationViewOptions, UseRoomIntegrationViewResult, VideoCellView };