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