@whereby.com/browser-sdk 3.33.4 → 3.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/dist/cdn/v3-react.js +2 -2
- package/dist/react/index.cjs +39 -25
- package/dist/react/index.d.ts +25 -1
- package/dist/react/index.esm.js +39 -26
- package/package.json +3 -3
package/dist/react/index.cjs
CHANGED
|
@@ -172,7 +172,7 @@ const VideoView = React__namespace.forwardRef((_a, ref) => {
|
|
|
172
172
|
});
|
|
173
173
|
VideoView.displayName = "VideoView";
|
|
174
174
|
|
|
175
|
-
const browserSdkVersion = "3.
|
|
175
|
+
const browserSdkVersion = "3.34.0";
|
|
176
176
|
|
|
177
177
|
const initialState$1 = {
|
|
178
178
|
chatMessages: [],
|
|
@@ -552,18 +552,20 @@ function getGridSizeForCount({ count, width, height, aspectRatio, }) {
|
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
function VideoCell(_a) {
|
|
555
|
-
var { aspectRatio, children, className, height, style, width, withRoundedCorners = false, withShadow = true } = _a, rest = __rest(_a, ["aspectRatio", "children", "className", "height", "style", "width", "withRoundedCorners", "withShadow"]);
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
let
|
|
559
|
-
let
|
|
560
|
-
|
|
555
|
+
var { aspectRatio, children, className, height, paddings, style, width, withRoundedCorners = false, withShadow = true } = _a, rest = __rest(_a, ["aspectRatio", "children", "className", "height", "paddings", "style", "width", "withRoundedCorners", "withShadow"]);
|
|
556
|
+
const innerWidth = Math.max(0, width - ((paddings === null || paddings === void 0 ? void 0 : paddings.left) || 0) - ((paddings === null || paddings === void 0 ? void 0 : paddings.right) || 0));
|
|
557
|
+
const innerHeight = Math.max(0, height - ((paddings === null || paddings === void 0 ? void 0 : paddings.top) || 0) - ((paddings === null || paddings === void 0 ? void 0 : paddings.bottom) || 0));
|
|
558
|
+
let contentWidth = innerWidth;
|
|
559
|
+
let contentHeight = innerHeight;
|
|
560
|
+
let leftOffset = (paddings === null || paddings === void 0 ? void 0 : paddings.left) || 0;
|
|
561
|
+
let topOffset = (paddings === null || paddings === void 0 ? void 0 : paddings.top) || 0;
|
|
562
|
+
if (aspectRatio && innerWidth && innerHeight) {
|
|
561
563
|
({ width: contentWidth, height: contentHeight } = fitToBounds(aspectRatio, {
|
|
562
|
-
width,
|
|
563
|
-
height,
|
|
564
|
+
width: innerWidth,
|
|
565
|
+
height: innerHeight,
|
|
564
566
|
}));
|
|
565
|
-
leftOffset
|
|
566
|
-
topOffset
|
|
567
|
+
leftOffset += (innerWidth - contentWidth) / 2;
|
|
568
|
+
topOffset += (innerHeight - contentHeight) / 2;
|
|
567
569
|
}
|
|
568
570
|
const contentStyle = Object.assign({ width: `${Math.round(contentWidth)}px`, height: `${Math.round(contentHeight)}px` }, (leftOffset || topOffset
|
|
569
571
|
? { transform: `translate3d(${Math.round(leftOffset)}px, ${Math.round(topOffset)}px, 0)` }
|
|
@@ -585,7 +587,7 @@ function generateStylesFromFrame({ origin, bounds }) {
|
|
|
585
587
|
}
|
|
586
588
|
function renderVideoCell({ cell, child, clientId, style = {}, withRoundedCorners = false, withShadow = false, }) {
|
|
587
589
|
const isHidden = !hasBounds(cell.bounds);
|
|
588
|
-
return (React__namespace.createElement(VideoCell, { width: cell.bounds.width, height: cell.bounds.height, aspectRatio: cell.aspectRatio, style: isHidden ? { width: 0, height: 0 } : style, withRoundedCorners: withRoundedCorners, withShadow: withShadow, key: clientId }, child));
|
|
590
|
+
return (React__namespace.createElement(VideoCell, { width: cell.bounds.width, height: cell.bounds.height, aspectRatio: cell.aspectRatio, paddings: cell.paddings, style: isHidden ? { width: 0, height: 0 } : style, withRoundedCorners: withRoundedCorners, withShadow: withShadow, key: clientId }, child));
|
|
589
591
|
}
|
|
590
592
|
function renderSubgridVideoCells({ content, stageLayout, withRoundedCorners, withShadow, }) {
|
|
591
593
|
const cells = stageLayout.subgrid.cells;
|
|
@@ -1592,8 +1594,8 @@ function calculateStageLayout({ cellPaddings, cellSizeOptions, containerBounds,
|
|
|
1592
1594
|
isPortrait,
|
|
1593
1595
|
videosContainer: makeFrame(Object.assign(Object.assign({}, videosContainerBounds), videosContainerOrigin)),
|
|
1594
1596
|
subgrid: Object.assign(Object.assign({}, makeFrame(Object.assign(Object.assign({}, subgridBounds), subgridOrigin))), { cells: subgridLayout.videoCells.map((cell, index) => {
|
|
1595
|
-
var _a
|
|
1596
|
-
return (Object.assign({ aspectRatio:
|
|
1597
|
+
var _a;
|
|
1598
|
+
return (Object.assign({ aspectRatio: 1, type: "video", clientId: (_a = subgridVideos[index]) === null || _a === void 0 ? void 0 : _a.clientId }, cell));
|
|
1597
1599
|
}), contentBounds: subgridLayout.contentBounds }),
|
|
1598
1600
|
hasOverflow: hasOverflow || shouldOverflowSubgrid || hasConstrainedOverflow,
|
|
1599
1601
|
overflowNeedBounds: shouldOverflowSubgrid ? makeBounds() : overflowNeedBounds,
|
|
@@ -2262,6 +2264,16 @@ function useGrid({ activeVideosSubgridTrigger, forceSubgrid, stageParticipantLim
|
|
|
2262
2264
|
isConstrained: !!enableConstrainedGrid && !!isConstrained,
|
|
2263
2265
|
includeIntegrations,
|
|
2264
2266
|
});
|
|
2267
|
+
React__namespace.useEffect(() => {
|
|
2268
|
+
if (maximizedCellId && !maximizedClientView) {
|
|
2269
|
+
setMaximizedCellId(null);
|
|
2270
|
+
}
|
|
2271
|
+
}, [maximizedCellId, maximizedClientView]);
|
|
2272
|
+
React__namespace.useEffect(() => {
|
|
2273
|
+
if (floatingCellId && !floatingClientView) {
|
|
2274
|
+
setFloatingCellId(null);
|
|
2275
|
+
}
|
|
2276
|
+
}, [floatingCellId, floatingClientView]);
|
|
2265
2277
|
const cellViewsFloating = React__namespace.useMemo(() => {
|
|
2266
2278
|
return floatingClientView
|
|
2267
2279
|
? [
|
|
@@ -2401,8 +2413,9 @@ function Avatar(_a) {
|
|
|
2401
2413
|
} }))));
|
|
2402
2414
|
}
|
|
2403
2415
|
|
|
2404
|
-
function VideoMutedIndicator({ avatarUrl, displayName, isSmallCell, withRoundedCorners, stream, muted }) {
|
|
2416
|
+
function VideoMutedIndicator({ avatarSize, avatarUrl, displayName, isSmallCell, withRoundedCorners, stream, muted, }) {
|
|
2405
2417
|
const audioElRef = useAudioElement({ stream, muted });
|
|
2418
|
+
const size = avatarSize !== null && avatarSize !== void 0 ? avatarSize : (isSmallCell ? 60 : 80);
|
|
2406
2419
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2407
2420
|
React__namespace.createElement("div", { style: {
|
|
2408
2421
|
display: "flex",
|
|
@@ -2417,12 +2430,12 @@ function VideoMutedIndicator({ avatarUrl, displayName, isSmallCell, withRoundedC
|
|
|
2417
2430
|
borderRadius: withRoundedCorners ? "8px" : "0",
|
|
2418
2431
|
} },
|
|
2419
2432
|
React__namespace.createElement("div", { style: {
|
|
2420
|
-
height:
|
|
2421
|
-
width:
|
|
2433
|
+
height: size,
|
|
2434
|
+
width: size,
|
|
2422
2435
|
pointerEvents: "none",
|
|
2423
2436
|
position: "relative",
|
|
2424
2437
|
} },
|
|
2425
|
-
React__namespace.createElement(Avatar, { variant: "square", avatarUrl: avatarUrl, name: displayName, size:
|
|
2438
|
+
React__namespace.createElement(Avatar, { variant: "square", avatarUrl: avatarUrl, name: displayName, size: size }))),
|
|
2426
2439
|
React__namespace.createElement("audio", { ref: audioElRef, autoPlay: true, playsInline: true })));
|
|
2427
2440
|
}
|
|
2428
2441
|
|
|
@@ -2436,7 +2449,7 @@ const PopoverContent = React__namespace.forwardRef((_a, ref) => {
|
|
|
2436
2449
|
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
2437
2450
|
|
|
2438
2451
|
const GridContext = React__namespace.createContext({});
|
|
2439
|
-
const GridCellContext = React__namespace.createContext(
|
|
2452
|
+
const GridCellContext = React__namespace.createContext(null);
|
|
2440
2453
|
const useGridCell = () => {
|
|
2441
2454
|
const gridContext = React__namespace.useContext(GridContext);
|
|
2442
2455
|
const gridCellContext = React__namespace.useContext(GridCellContext);
|
|
@@ -2583,7 +2596,7 @@ function DefaultParticipantMenu({ participant }) {
|
|
|
2583
2596
|
isSpotlighted ? "Remove spotlight" : "Spotlight"))));
|
|
2584
2597
|
}
|
|
2585
2598
|
|
|
2586
|
-
const GridCell = React__namespace.forwardRef(({ className, participant, children }, ref) => {
|
|
2599
|
+
const GridCell = React__namespace.forwardRef(({ className, participant, cellId, avatarSize, children }, ref) => {
|
|
2587
2600
|
const [isHovered, setIsHovered] = React__namespace.useState(false);
|
|
2588
2601
|
const handleMouseEnter = React__namespace.useCallback(() => {
|
|
2589
2602
|
setIsHovered(true);
|
|
@@ -2591,14 +2604,14 @@ const GridCell = React__namespace.forwardRef(({ className, participant, children
|
|
|
2591
2604
|
const handleMouseLeave = React__namespace.useCallback(() => {
|
|
2592
2605
|
setIsHovered(false);
|
|
2593
2606
|
}, []);
|
|
2594
|
-
return (React__namespace.createElement(GridCellContext.Provider, { value: { participant, isHovered } },
|
|
2595
|
-
React__namespace.createElement("div", { ref: ref, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { height: "100%", width: "100%" } }, children)));
|
|
2607
|
+
return (React__namespace.createElement(GridCellContext.Provider, { value: { participant, isHovered, avatarSize } },
|
|
2608
|
+
React__namespace.createElement("div", { ref: ref, "data-cell-id": cellId, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { height: "100%", width: "100%" } }, children)));
|
|
2596
2609
|
});
|
|
2597
2610
|
GridCell.displayName = "GridCell";
|
|
2598
2611
|
const GridVideoView = React__namespace.forwardRef((_a, ref) => {
|
|
2599
2612
|
var { stream, style } = _a, rest = __rest(_a, ["stream", "style"]);
|
|
2600
2613
|
const videoEl = React__namespace.useRef(null);
|
|
2601
|
-
const { onSetClientAspectRatio, clientAspectRatios, participant, isConstrained } = useGridCell();
|
|
2614
|
+
const { onSetClientAspectRatio, clientAspectRatios, participant, isConstrained, avatarSize } = useGridCell();
|
|
2602
2615
|
if (!participant)
|
|
2603
2616
|
return null;
|
|
2604
2617
|
const aspectRatio = clientAspectRatios[participant.id];
|
|
@@ -2613,9 +2626,9 @@ const GridVideoView = React__namespace.forwardRef((_a, ref) => {
|
|
|
2613
2626
|
}, [clientAspectRatios, participant.id, onSetClientAspectRatio]);
|
|
2614
2627
|
const s = stream || participant.stream;
|
|
2615
2628
|
if (!s || !participant.isVideoEnabled) {
|
|
2616
|
-
return (React__namespace.createElement(VideoMutedIndicator, { isSmallCell: false, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true, muted: participant.isLocalClient, stream: participant.stream }));
|
|
2629
|
+
return (React__namespace.createElement(VideoMutedIndicator, { isSmallCell: false, avatarSize: avatarSize, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true, muted: participant.isLocalClient, stream: participant.stream }));
|
|
2617
2630
|
}
|
|
2618
|
-
return (React__namespace.createElement(VideoView, Object.assign({ ref: videoEl, style: Object.assign(Object.assign({ borderRadius: isConstrained ? 0 : "8px" }, (isConstrained ? { objectFit: "cover" } : {})), style), muted: participant.isLocalClient }, rest, { stream: s, onVideoResize: handleResize })));
|
|
2631
|
+
return (React__namespace.createElement(VideoView, Object.assign({ ref: videoEl, style: Object.assign(Object.assign({ borderRadius: isConstrained ? 0 : "8px" }, (isConstrained || avatarSize ? { objectFit: "cover" } : {})), style), muted: participant.isLocalClient }, rest, { stream: s, onVideoResize: handleResize })));
|
|
2619
2632
|
});
|
|
2620
2633
|
GridVideoView.displayName = "GridVideoView";
|
|
2621
2634
|
function renderCellView({ cellView, enableParticipantMenu, render, renderIntegration }) {
|
|
@@ -2847,6 +2860,7 @@ exports.VideoView = VideoView;
|
|
|
2847
2860
|
exports.WherebyProvider = Provider;
|
|
2848
2861
|
exports.subscribeToRoomIntegrationPicker = subscribeToRoomIntegrationPicker;
|
|
2849
2862
|
exports.useGrid = useGrid;
|
|
2863
|
+
exports.useGridCell = useGridCell;
|
|
2850
2864
|
exports.useLocalMedia = useLocalMedia;
|
|
2851
2865
|
exports.useRoomConnection = useRoomConnection;
|
|
2852
2866
|
exports.useRoomIntegrationPicker = useRoomIntegrationPicker;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -229,9 +229,33 @@ type StageLayout = {
|
|
|
229
229
|
overflowNeedBounds?: Bounds;
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
+
declare const useGridCell: () => {
|
|
233
|
+
participant: ClientView;
|
|
234
|
+
isHovered: boolean;
|
|
235
|
+
avatarSize?: number;
|
|
236
|
+
onSetClientAspectRatio: ({ aspectRatio, clientId }: {
|
|
237
|
+
aspectRatio: number;
|
|
238
|
+
clientId: string;
|
|
239
|
+
}) => void;
|
|
240
|
+
cellViewsVideoGrid: CellView[];
|
|
241
|
+
cellViewsInPresentationGrid: CellView[];
|
|
242
|
+
cellViewsInSubgrid: CellView[];
|
|
243
|
+
clientAspectRatios: {
|
|
244
|
+
[key: string]: number;
|
|
245
|
+
};
|
|
246
|
+
maximizedCellId: string | null;
|
|
247
|
+
setMaximizedCellId: React.Dispatch<React.SetStateAction<string | null>>;
|
|
248
|
+
maximizedParticipant: ClientView | null;
|
|
249
|
+
floatingCellId: string | null;
|
|
250
|
+
setFloatingCellId: React.Dispatch<React.SetStateAction<string | null>>;
|
|
251
|
+
floatingParticipant: ClientView | null;
|
|
252
|
+
isConstrained?: boolean;
|
|
253
|
+
};
|
|
254
|
+
|
|
232
255
|
type GridCellSelfProps = {
|
|
233
256
|
participant: ClientView;
|
|
234
257
|
cellId?: string;
|
|
258
|
+
avatarSize?: number;
|
|
235
259
|
};
|
|
236
260
|
type GridCellProps = GridCellSelfProps & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
237
261
|
declare const GridCell: React.ForwardRefExoticComponent<Omit<GridCellProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -354,5 +378,5 @@ declare function subscribeToRoomIntegrationPicker({ pickerOrigin, getSource, onO
|
|
|
354
378
|
onOutcome: (outcome: RoomIntegrationPickerOutcome) => void;
|
|
355
379
|
}): () => void;
|
|
356
380
|
|
|
357
|
-
export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
|
|
381
|
+
export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useGridCell, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
|
|
358
382
|
export type { CellView, IntegrationCellView, RoomConnectionActions, RoomConnectionOptions, RoomIntegrationIframeProps, RoomIntegrationPickerOutcome, UseLocalMediaResult, UseRoomIntegrationPickerOptions, UseRoomIntegrationPickerResult, UseRoomIntegrationViewOptions, UseRoomIntegrationViewResult, VideoCellView };
|
package/dist/react/index.esm.js
CHANGED
|
@@ -151,7 +151,7 @@ const VideoView = React.forwardRef((_a, ref) => {
|
|
|
151
151
|
});
|
|
152
152
|
VideoView.displayName = "VideoView";
|
|
153
153
|
|
|
154
|
-
const browserSdkVersion = "3.
|
|
154
|
+
const browserSdkVersion = "3.34.0";
|
|
155
155
|
|
|
156
156
|
const initialState$1 = {
|
|
157
157
|
chatMessages: [],
|
|
@@ -531,18 +531,20 @@ function getGridSizeForCount({ count, width, height, aspectRatio, }) {
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function VideoCell(_a) {
|
|
534
|
-
var { aspectRatio, children, className, height, style, width, withRoundedCorners = false, withShadow = true } = _a, rest = __rest(_a, ["aspectRatio", "children", "className", "height", "style", "width", "withRoundedCorners", "withShadow"]);
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
let
|
|
538
|
-
let
|
|
539
|
-
|
|
534
|
+
var { aspectRatio, children, className, height, paddings, style, width, withRoundedCorners = false, withShadow = true } = _a, rest = __rest(_a, ["aspectRatio", "children", "className", "height", "paddings", "style", "width", "withRoundedCorners", "withShadow"]);
|
|
535
|
+
const innerWidth = Math.max(0, width - ((paddings === null || paddings === void 0 ? void 0 : paddings.left) || 0) - ((paddings === null || paddings === void 0 ? void 0 : paddings.right) || 0));
|
|
536
|
+
const innerHeight = Math.max(0, height - ((paddings === null || paddings === void 0 ? void 0 : paddings.top) || 0) - ((paddings === null || paddings === void 0 ? void 0 : paddings.bottom) || 0));
|
|
537
|
+
let contentWidth = innerWidth;
|
|
538
|
+
let contentHeight = innerHeight;
|
|
539
|
+
let leftOffset = (paddings === null || paddings === void 0 ? void 0 : paddings.left) || 0;
|
|
540
|
+
let topOffset = (paddings === null || paddings === void 0 ? void 0 : paddings.top) || 0;
|
|
541
|
+
if (aspectRatio && innerWidth && innerHeight) {
|
|
540
542
|
({ width: contentWidth, height: contentHeight } = fitToBounds(aspectRatio, {
|
|
541
|
-
width,
|
|
542
|
-
height,
|
|
543
|
+
width: innerWidth,
|
|
544
|
+
height: innerHeight,
|
|
543
545
|
}));
|
|
544
|
-
leftOffset
|
|
545
|
-
topOffset
|
|
546
|
+
leftOffset += (innerWidth - contentWidth) / 2;
|
|
547
|
+
topOffset += (innerHeight - contentHeight) / 2;
|
|
546
548
|
}
|
|
547
549
|
const contentStyle = Object.assign({ width: `${Math.round(contentWidth)}px`, height: `${Math.round(contentHeight)}px` }, (leftOffset || topOffset
|
|
548
550
|
? { transform: `translate3d(${Math.round(leftOffset)}px, ${Math.round(topOffset)}px, 0)` }
|
|
@@ -564,7 +566,7 @@ function generateStylesFromFrame({ origin, bounds }) {
|
|
|
564
566
|
}
|
|
565
567
|
function renderVideoCell({ cell, child, clientId, style = {}, withRoundedCorners = false, withShadow = false, }) {
|
|
566
568
|
const isHidden = !hasBounds(cell.bounds);
|
|
567
|
-
return (React.createElement(VideoCell, { width: cell.bounds.width, height: cell.bounds.height, aspectRatio: cell.aspectRatio, style: isHidden ? { width: 0, height: 0 } : style, withRoundedCorners: withRoundedCorners, withShadow: withShadow, key: clientId }, child));
|
|
569
|
+
return (React.createElement(VideoCell, { width: cell.bounds.width, height: cell.bounds.height, aspectRatio: cell.aspectRatio, paddings: cell.paddings, style: isHidden ? { width: 0, height: 0 } : style, withRoundedCorners: withRoundedCorners, withShadow: withShadow, key: clientId }, child));
|
|
568
570
|
}
|
|
569
571
|
function renderSubgridVideoCells({ content, stageLayout, withRoundedCorners, withShadow, }) {
|
|
570
572
|
const cells = stageLayout.subgrid.cells;
|
|
@@ -1571,8 +1573,8 @@ function calculateStageLayout({ cellPaddings, cellSizeOptions, containerBounds,
|
|
|
1571
1573
|
isPortrait,
|
|
1572
1574
|
videosContainer: makeFrame(Object.assign(Object.assign({}, videosContainerBounds), videosContainerOrigin)),
|
|
1573
1575
|
subgrid: Object.assign(Object.assign({}, makeFrame(Object.assign(Object.assign({}, subgridBounds), subgridOrigin))), { cells: subgridLayout.videoCells.map((cell, index) => {
|
|
1574
|
-
var _a
|
|
1575
|
-
return (Object.assign({ aspectRatio:
|
|
1576
|
+
var _a;
|
|
1577
|
+
return (Object.assign({ aspectRatio: 1, type: "video", clientId: (_a = subgridVideos[index]) === null || _a === void 0 ? void 0 : _a.clientId }, cell));
|
|
1576
1578
|
}), contentBounds: subgridLayout.contentBounds }),
|
|
1577
1579
|
hasOverflow: hasOverflow || shouldOverflowSubgrid || hasConstrainedOverflow,
|
|
1578
1580
|
overflowNeedBounds: shouldOverflowSubgrid ? makeBounds() : overflowNeedBounds,
|
|
@@ -2241,6 +2243,16 @@ function useGrid({ activeVideosSubgridTrigger, forceSubgrid, stageParticipantLim
|
|
|
2241
2243
|
isConstrained: !!enableConstrainedGrid && !!isConstrained,
|
|
2242
2244
|
includeIntegrations,
|
|
2243
2245
|
});
|
|
2246
|
+
React.useEffect(() => {
|
|
2247
|
+
if (maximizedCellId && !maximizedClientView) {
|
|
2248
|
+
setMaximizedCellId(null);
|
|
2249
|
+
}
|
|
2250
|
+
}, [maximizedCellId, maximizedClientView]);
|
|
2251
|
+
React.useEffect(() => {
|
|
2252
|
+
if (floatingCellId && !floatingClientView) {
|
|
2253
|
+
setFloatingCellId(null);
|
|
2254
|
+
}
|
|
2255
|
+
}, [floatingCellId, floatingClientView]);
|
|
2244
2256
|
const cellViewsFloating = React.useMemo(() => {
|
|
2245
2257
|
return floatingClientView
|
|
2246
2258
|
? [
|
|
@@ -2380,8 +2392,9 @@ function Avatar(_a) {
|
|
|
2380
2392
|
} }))));
|
|
2381
2393
|
}
|
|
2382
2394
|
|
|
2383
|
-
function VideoMutedIndicator({ avatarUrl, displayName, isSmallCell, withRoundedCorners, stream, muted }) {
|
|
2395
|
+
function VideoMutedIndicator({ avatarSize, avatarUrl, displayName, isSmallCell, withRoundedCorners, stream, muted, }) {
|
|
2384
2396
|
const audioElRef = useAudioElement({ stream, muted });
|
|
2397
|
+
const size = avatarSize !== null && avatarSize !== void 0 ? avatarSize : (isSmallCell ? 60 : 80);
|
|
2385
2398
|
return (React.createElement(React.Fragment, null,
|
|
2386
2399
|
React.createElement("div", { style: {
|
|
2387
2400
|
display: "flex",
|
|
@@ -2396,12 +2409,12 @@ function VideoMutedIndicator({ avatarUrl, displayName, isSmallCell, withRoundedC
|
|
|
2396
2409
|
borderRadius: withRoundedCorners ? "8px" : "0",
|
|
2397
2410
|
} },
|
|
2398
2411
|
React.createElement("div", { style: {
|
|
2399
|
-
height:
|
|
2400
|
-
width:
|
|
2412
|
+
height: size,
|
|
2413
|
+
width: size,
|
|
2401
2414
|
pointerEvents: "none",
|
|
2402
2415
|
position: "relative",
|
|
2403
2416
|
} },
|
|
2404
|
-
React.createElement(Avatar, { variant: "square", avatarUrl: avatarUrl, name: displayName, size:
|
|
2417
|
+
React.createElement(Avatar, { variant: "square", avatarUrl: avatarUrl, name: displayName, size: size }))),
|
|
2405
2418
|
React.createElement("audio", { ref: audioElRef, autoPlay: true, playsInline: true })));
|
|
2406
2419
|
}
|
|
2407
2420
|
|
|
@@ -2415,7 +2428,7 @@ const PopoverContent = React.forwardRef((_a, ref) => {
|
|
|
2415
2428
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2416
2429
|
|
|
2417
2430
|
const GridContext = React.createContext({});
|
|
2418
|
-
const GridCellContext = React.createContext(
|
|
2431
|
+
const GridCellContext = React.createContext(null);
|
|
2419
2432
|
const useGridCell = () => {
|
|
2420
2433
|
const gridContext = React.useContext(GridContext);
|
|
2421
2434
|
const gridCellContext = React.useContext(GridCellContext);
|
|
@@ -2562,7 +2575,7 @@ function DefaultParticipantMenu({ participant }) {
|
|
|
2562
2575
|
isSpotlighted ? "Remove spotlight" : "Spotlight"))));
|
|
2563
2576
|
}
|
|
2564
2577
|
|
|
2565
|
-
const GridCell = React.forwardRef(({ className, participant, children }, ref) => {
|
|
2578
|
+
const GridCell = React.forwardRef(({ className, participant, cellId, avatarSize, children }, ref) => {
|
|
2566
2579
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
2567
2580
|
const handleMouseEnter = React.useCallback(() => {
|
|
2568
2581
|
setIsHovered(true);
|
|
@@ -2570,14 +2583,14 @@ const GridCell = React.forwardRef(({ className, participant, children }, ref) =>
|
|
|
2570
2583
|
const handleMouseLeave = React.useCallback(() => {
|
|
2571
2584
|
setIsHovered(false);
|
|
2572
2585
|
}, []);
|
|
2573
|
-
return (React.createElement(GridCellContext.Provider, { value: { participant, isHovered } },
|
|
2574
|
-
React.createElement("div", { ref: ref, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { height: "100%", width: "100%" } }, children)));
|
|
2586
|
+
return (React.createElement(GridCellContext.Provider, { value: { participant, isHovered, avatarSize } },
|
|
2587
|
+
React.createElement("div", { ref: ref, "data-cell-id": cellId, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { height: "100%", width: "100%" } }, children)));
|
|
2575
2588
|
});
|
|
2576
2589
|
GridCell.displayName = "GridCell";
|
|
2577
2590
|
const GridVideoView = React.forwardRef((_a, ref) => {
|
|
2578
2591
|
var { stream, style } = _a, rest = __rest(_a, ["stream", "style"]);
|
|
2579
2592
|
const videoEl = React.useRef(null);
|
|
2580
|
-
const { onSetClientAspectRatio, clientAspectRatios, participant, isConstrained } = useGridCell();
|
|
2593
|
+
const { onSetClientAspectRatio, clientAspectRatios, participant, isConstrained, avatarSize } = useGridCell();
|
|
2581
2594
|
if (!participant)
|
|
2582
2595
|
return null;
|
|
2583
2596
|
const aspectRatio = clientAspectRatios[participant.id];
|
|
@@ -2592,9 +2605,9 @@ const GridVideoView = React.forwardRef((_a, ref) => {
|
|
|
2592
2605
|
}, [clientAspectRatios, participant.id, onSetClientAspectRatio]);
|
|
2593
2606
|
const s = stream || participant.stream;
|
|
2594
2607
|
if (!s || !participant.isVideoEnabled) {
|
|
2595
|
-
return (React.createElement(VideoMutedIndicator, { isSmallCell: false, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true, muted: participant.isLocalClient, stream: participant.stream }));
|
|
2608
|
+
return (React.createElement(VideoMutedIndicator, { isSmallCell: false, avatarSize: avatarSize, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true, muted: participant.isLocalClient, stream: participant.stream }));
|
|
2596
2609
|
}
|
|
2597
|
-
return (React.createElement(VideoView, Object.assign({ ref: videoEl, style: Object.assign(Object.assign({ borderRadius: isConstrained ? 0 : "8px" }, (isConstrained ? { objectFit: "cover" } : {})), style), muted: participant.isLocalClient }, rest, { stream: s, onVideoResize: handleResize })));
|
|
2610
|
+
return (React.createElement(VideoView, Object.assign({ ref: videoEl, style: Object.assign(Object.assign({ borderRadius: isConstrained ? 0 : "8px" }, (isConstrained || avatarSize ? { objectFit: "cover" } : {})), style), muted: participant.isLocalClient }, rest, { stream: s, onVideoResize: handleResize })));
|
|
2598
2611
|
});
|
|
2599
2612
|
GridVideoView.displayName = "GridVideoView";
|
|
2600
2613
|
function renderCellView({ cellView, enableParticipantMenu, render, renderIntegration }) {
|
|
@@ -2779,4 +2792,4 @@ function useRoomIntegrationPicker({ integration, onPicked, onCancel, onError, fe
|
|
|
2779
2792
|
};
|
|
2780
2793
|
}
|
|
2781
2794
|
|
|
2782
|
-
export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
|
|
2795
|
+
export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useGridCell, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/browser-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.34.0",
|
|
4
4
|
"description": "Modules for integration Whereby video in web apps",
|
|
5
5
|
"author": "Whereby AS",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@storybook/addon-docs": "^9.0.16",
|
|
68
68
|
"@whereby.com/eslint-config": "0.1.0",
|
|
69
69
|
"@whereby.com/jest-config": "0.1.0",
|
|
70
|
+
"@whereby.com/tsconfig": "0.1.0",
|
|
70
71
|
"@whereby.com/prettier-config": "0.1.0",
|
|
71
|
-
"@whereby.com/rollup-config": "0.1.1"
|
|
72
|
-
"@whereby.com/tsconfig": "0.1.0"
|
|
72
|
+
"@whereby.com/rollup-config": "0.1.1"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@radix-ui/react-popover": "^1.0.7",
|