@azure/communication-react 1.4.3-alpha-202301150014.0 → 1.4.3-alpha-202301180013.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.
Files changed (19) hide show
  1. package/dist/dist-cjs/communication-react/index.js +35 -84
  2. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  3. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  5. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +8 -6
  6. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
  7. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +8 -6
  8. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
  9. package/dist/dist-esm/react-components/src/components/VideoGallery/Layout.d.ts +4 -0
  10. package/dist/dist-esm/react-components/src/components/VideoGallery/Layout.js.map +1 -1
  11. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +7 -16
  12. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +20 -15
  13. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  14. package/dist/dist-esm/react-components/src/components/VideoGallery.js +1 -9
  15. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  16. package/package.json +8 -8
  17. package/dist/dist-esm/react-components/src/components/VideoGallery/PinnedParticipantsLayout.d.ts +0 -25
  18. package/dist/dist-esm/react-components/src/components/VideoGallery/PinnedParticipantsLayout.js +0 -65
  19. package/dist/dist-esm/react-components/src/components/VideoGallery/PinnedParticipantsLayout.js.map +0 -1
@@ -159,7 +159,7 @@ const _toCommunicationIdentifier = (id) => {
159
159
  // Copyright (c) Microsoft Corporation.
160
160
  // Licensed under the MIT license.
161
161
  // GENERATED FILE. DO NOT EDIT MANUALLY.
162
- var telemetryVersion = '1.4.3-alpha-202301150014.0';
162
+ var telemetryVersion = '1.4.3-alpha-202301180013.0';
163
163
 
164
164
  // Copyright (c) Microsoft Corporation.
165
165
  /**
@@ -9169,10 +9169,7 @@ const participantsById = (participants) => {
9169
9169
  // Copyright (c) Microsoft Corporation.
9170
9170
  const DEFAULT_MAX_REMOTE_VIDEOSTREAMS = 4;
9171
9171
  const DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS = 6;
9172
- /**
9173
- * @private
9174
- */
9175
- const useFloatingLocalVideoLayout = (props) => {
9172
+ const _useOrganizedParticipants = (props) => {
9176
9173
  var _a, _b;
9177
9174
  const visibleVideoParticipants = React.useRef([]);
9178
9175
  const visibleAudioParticipants = React.useRef([]);
@@ -9229,10 +9226,9 @@ const useFloatingLocalVideoLayout = (props) => {
9229
9226
  const horizontalGalleryParticipants = getHorizontalGalleryRemoteParticipants();
9230
9227
  return { gridParticipants, horizontalGalleryParticipants };
9231
9228
  };
9232
- /**
9233
- * @private
9234
- */
9235
- const usePinnedParticipantLayout = (props) => {
9229
+ /* @conditional-compile-remove(pinned-participants) */
9230
+ const _useOrganizedParticipantsWithPinnedParticipants = (props) => {
9231
+ var _a;
9236
9232
  // map remote participants by userId
9237
9233
  const remoteParticipantMap = props.remoteParticipants.reduce((map, remoteParticipant) => {
9238
9234
  map[remoteParticipant.userId] = remoteParticipant;
@@ -9242,7 +9238,7 @@ const usePinnedParticipantLayout = (props) => {
9242
9238
  let pinnedParticipantsWithVideoOnCount = 0;
9243
9239
  // get pinned participants in the same order of pinned participant user ids using remoteParticipantMap
9244
9240
  const pinnedParticipants = [];
9245
- props.pinnedParticipantUserIds.forEach((id) => {
9241
+ (_a = props.pinnedParticipantUserIds) === null || _a === void 0 ? void 0 : _a.forEach((id) => {
9246
9242
  var _a;
9247
9243
  const pinnedParticipant = remoteParticipantMap[id];
9248
9244
  if (pinnedParticipant) {
@@ -9255,24 +9251,32 @@ const usePinnedParticipantLayout = (props) => {
9255
9251
  // get unpinned participants by filtering all remote participants using a set of pinned participant user ids
9256
9252
  const pinnedParticipantUserIdSet = new Set(props.pinnedParticipantUserIds);
9257
9253
  const unpinnedParticipants = props.remoteParticipants.filter((p) => !pinnedParticipantUserIdSet.has(p.userId));
9258
- const floatingLocalVideoLayoutProps = Object.assign(Object.assign({}, props), {
9254
+ const useOrganizedParticipantsProps = Object.assign(Object.assign({}, props), {
9259
9255
  // if there are pinned participants then we should only consider unpinned participants
9260
9256
  remoteParticipants: unpinnedParticipants,
9261
9257
  // if there is a maximum of remote video streams we need to subtract pinned participants with video
9262
9258
  maxRemoteVideoStreams: props.maxRemoteVideoStreams
9263
9259
  ? props.maxRemoteVideoStreams - pinnedParticipantsWithVideoOnCount
9264
9260
  : undefined });
9265
- const floatingLocalVideoLayout = useFloatingLocalVideoLayout(floatingLocalVideoLayoutProps);
9266
- if (props.pinnedParticipantUserIds.length === 0) {
9267
- return floatingLocalVideoLayout;
9261
+ const useOrganizedParticipantsResult = _useOrganizedParticipants(useOrganizedParticipantsProps);
9262
+ if (pinnedParticipants.length === 0) {
9263
+ return useOrganizedParticipantsResult;
9268
9264
  }
9269
9265
  return {
9270
9266
  gridParticipants: props.isScreenShareActive ? [] : pinnedParticipants,
9271
9267
  horizontalGalleryParticipants: props.isScreenShareActive
9272
- ? pinnedParticipants.concat(floatingLocalVideoLayout.horizontalGalleryParticipants)
9273
- : floatingLocalVideoLayout.gridParticipants.concat(floatingLocalVideoLayout.horizontalGalleryParticipants)
9268
+ ? pinnedParticipants.concat(useOrganizedParticipantsResult.horizontalGalleryParticipants)
9269
+ : useOrganizedParticipantsResult.gridParticipants.concat(useOrganizedParticipantsResult.horizontalGalleryParticipants)
9274
9270
  };
9275
9271
  };
9272
+ /**
9273
+ * Hook to determine which participants should be in grid and horizontal gallery and their order respectively
9274
+ * @private
9275
+ */
9276
+ const useOrganizedParticipants = (args) => {
9277
+ /* @conditional-compile-remove(pinned-participants) */
9278
+ return _useOrganizedParticipantsWithPinnedParticipants(args);
9279
+ };
9276
9280
 
9277
9281
  // Copyright (c) Microsoft Corporation.
9278
9282
  // Licensed under the MIT license.
@@ -9443,22 +9447,24 @@ const VideoGalleryResponsiveHorizontalGallery = (props) => {
9443
9447
  * @private
9444
9448
  */
9445
9449
  const DefaultLayout = (props) => {
9446
- const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, parentWidth } = props;
9450
+ const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, parentWidth,
9451
+ /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds } = props;
9447
9452
  const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
9448
- const floatingLocalVideoLayout = useFloatingLocalVideoLayout({
9453
+ const { gridParticipants, horizontalGalleryParticipants } = useOrganizedParticipants({
9449
9454
  remoteParticipants,
9450
9455
  dominantSpeakers,
9451
9456
  maxRemoteVideoStreams,
9452
- isScreenShareActive: !!screenShareComponent
9457
+ isScreenShareActive: !!screenShareComponent,
9458
+ /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds
9453
9459
  });
9454
9460
  let activeVideoStreams = 0;
9455
- const gridTiles = floatingLocalVideoLayout.gridParticipants.map((p) => {
9461
+ const gridTiles = gridParticipants.map((p) => {
9456
9462
  var _a, _b;
9457
9463
  return onRenderRemoteParticipant(p, maxRemoteVideoStreams && maxRemoteVideoStreams >= 0
9458
9464
  ? ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) && activeVideoStreams++ < maxRemoteVideoStreams
9459
9465
  : (_b = p.videoStream) === null || _b === void 0 ? void 0 : _b.isAvailable);
9460
9466
  });
9461
- const horizontalGalleryTiles = floatingLocalVideoLayout.horizontalGalleryParticipants.map((p) => {
9467
+ const horizontalGalleryTiles = horizontalGalleryParticipants.map((p) => {
9462
9468
  var _a, _b;
9463
9469
  return onRenderRemoteParticipant(p, maxRemoteVideoStreams && maxRemoteVideoStreams >= 0
9464
9470
  ? ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) && activeVideoStreams++ < maxRemoteVideoStreams
@@ -10225,17 +10231,19 @@ const layerHostStyle = {
10225
10231
  * @private
10226
10232
  */
10227
10233
  const FloatingLocalVideoLayout = (props) => {
10228
- const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, showCameraSwitcherInLocalPreview, parentWidth, parentHeight } = props;
10234
+ const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, showCameraSwitcherInLocalPreview, parentWidth, parentHeight,
10235
+ /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds } = props;
10229
10236
  const theme = useTheme();
10230
10237
  const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
10231
- const floatingLocalVideoLayout = useFloatingLocalVideoLayout({
10238
+ const { gridParticipants, horizontalGalleryParticipants } = useOrganizedParticipants({
10232
10239
  remoteParticipants,
10233
10240
  dominantSpeakers,
10234
10241
  maxRemoteVideoStreams,
10235
- isScreenShareActive: !!screenShareComponent
10242
+ isScreenShareActive: !!screenShareComponent,
10243
+ /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds
10236
10244
  });
10237
10245
  let activeVideoStreams = 0;
10238
- const gridTiles = floatingLocalVideoLayout.gridParticipants.map((p) => {
10246
+ const gridTiles = gridParticipants.map((p) => {
10239
10247
  var _a, _b;
10240
10248
  return onRenderRemoteParticipant(p, maxRemoteVideoStreams && maxRemoteVideoStreams >= 0
10241
10249
  ? ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) && activeVideoStreams++ < maxRemoteVideoStreams
@@ -10245,7 +10253,7 @@ const FloatingLocalVideoLayout = (props) => {
10245
10253
  if (!shouldFloatLocalVideo && localVideoComponent) {
10246
10254
  gridTiles.push(localVideoComponent);
10247
10255
  }
10248
- const horizontalGalleryTiles = floatingLocalVideoLayout.horizontalGalleryParticipants.map((p) => {
10256
+ const horizontalGalleryTiles = horizontalGalleryParticipants.map((p) => {
10249
10257
  var _a, _b;
10250
10258
  return onRenderRemoteParticipant(p, maxRemoteVideoStreams && maxRemoteVideoStreams >= 0
10251
10259
  ? ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) && activeVideoStreams++ < maxRemoteVideoStreams
@@ -10276,57 +10284,6 @@ const FloatingLocalVideoLayout = (props) => {
10276
10284
  React__default['default'].createElement(react.LayerHost, { id: layerHostId, className: react.mergeStyles(layerHostStyle) })));
10277
10285
  };
10278
10286
 
10279
- // Copyright (c) Microsoft Corporation.
10280
- /**
10281
- * PinnedParticipantsLayout displays remote participants and a screen sharing component in
10282
- * a grid and horizontal gallery while floating the local video
10283
- *
10284
- * @private
10285
- */
10286
- const PinnedParticipantsLayout = (props) => {
10287
- const { remoteParticipants = [], pinnedParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, showCameraSwitcherInLocalPreview, parentWidth, parentHeight, isLocalVideoFloating } = props;
10288
- const theme = useTheme();
10289
- const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
10290
- const pinnedParticipantsLayout = usePinnedParticipantLayout({
10291
- remoteParticipants,
10292
- pinnedParticipantUserIds: pinnedParticipants,
10293
- dominantSpeakers,
10294
- maxRemoteVideoStreams,
10295
- isScreenShareActive: !!screenShareComponent
10296
- });
10297
- let activeVideoStreams = 0;
10298
- const shouldFloatLocalVideo = isLocalVideoFloating && remoteParticipants.length > 0;
10299
- const gridTiles = pinnedParticipantsLayout.gridParticipants.map((p) => {
10300
- var _a, _b;
10301
- return onRenderRemoteParticipant(p, maxRemoteVideoStreams && maxRemoteVideoStreams >= 0
10302
- ? ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) && activeVideoStreams++ < maxRemoteVideoStreams
10303
- : (_b = p.videoStream) === null || _b === void 0 ? void 0 : _b.isAvailable);
10304
- });
10305
- if (localVideoComponent && !shouldFloatLocalVideo) {
10306
- gridTiles.push(localVideoComponent);
10307
- }
10308
- const horizontalGalleryTiles = pinnedParticipantsLayout.horizontalGalleryParticipants.map((p) => {
10309
- var _a, _b;
10310
- return onRenderRemoteParticipant(p, maxRemoteVideoStreams && maxRemoteVideoStreams >= 0
10311
- ? ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) && activeVideoStreams++ < maxRemoteVideoStreams
10312
- : (_b = p.videoStream) === null || _b === void 0 ? void 0 : _b.isAvailable);
10313
- });
10314
- const layerHostId = reactHooks.useId('layerhost');
10315
- const wrappedLocalVideoComponent = localVideoComponent && shouldFloatLocalVideo ? (
10316
- // When we use showCameraSwitcherInLocalPreview it disables dragging to allow keyboard navigation.
10317
- showCameraSwitcherInLocalPreview ? (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(localVideoTileWithControlsContainerStyle(theme, isNarrow), {
10318
- boxShadow: theme.effects.elevation8,
10319
- zIndex: LOCAL_VIDEO_TILE_ZINDEX
10320
- }) }, localVideoComponent)) : horizontalGalleryTiles.length > 0 ? (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(localVideoTileContainerStyle(theme, isNarrow)) }, localVideoComponent)) : (React__default['default'].createElement(FloatingLocalVideo, { localVideoComponent: localVideoComponent, layerHostId: layerHostId, isNarrow: isNarrow, parentWidth: parentWidth, parentHeight: parentHeight }))) : undefined;
10321
- return (React__default['default'].createElement(react.Stack, { styles: rootLayoutStyle },
10322
- React__default['default'].createElement(react.Stack, { horizontal: false, styles: innerLayoutStyle, tokens: videoGalleryLayoutGap },
10323
- screenShareComponent ? (screenShareComponent) : (React__default['default'].createElement(GridLayout, { key: "grid-layout", styles: styles === null || styles === void 0 ? void 0 : styles.gridLayout }, gridTiles)),
10324
- horizontalGalleryTiles.length > 0 &&
10325
- (isNarrow ? (React__default['default'].createElement(ScrollableHorizontalGallery, { horizontalGalleryElements: horizontalGalleryTiles })) : (React__default['default'].createElement(VideoGalleryResponsiveHorizontalGallery, { isNarrow: isNarrow, shouldFloatLocalVideo: true, horizontalGalleryElements: horizontalGalleryTiles, styles: styles === null || styles === void 0 ? void 0 : styles.horizontalGallery })))),
10326
- wrappedLocalVideoComponent,
10327
- React__default['default'].createElement(react.LayerHost, { id: layerHostId, className: react.mergeStyles(layerHostStyle) })));
10328
- };
10329
-
10330
10287
  // Copyright (c) Microsoft Corporation.
10331
10288
  /**
10332
10289
  * @private
@@ -10482,7 +10439,6 @@ const VideoGallery = (props) => {
10482
10439
  : undefined;
10483
10440
  const layoutProps = React.useMemo(() => ({
10484
10441
  remoteParticipants,
10485
- /* @conditional-compile-remove(pinned-participants) */ pinnedParticipants,
10486
10442
  screenShareComponent,
10487
10443
  showCameraSwitcherInLocalPreview,
10488
10444
  maxRemoteVideoStreams,
@@ -10492,7 +10448,7 @@ const VideoGallery = (props) => {
10492
10448
  localVideoComponent: localVideoTile,
10493
10449
  parentWidth: containerWidth,
10494
10450
  parentHeight: containerHeight,
10495
- isLocalVideoFloating: layout === 'floatingLocalVideo'
10451
+ /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds: pinnedParticipants
10496
10452
  }), [
10497
10453
  remoteParticipants,
10498
10454
  screenShareComponent,
@@ -10505,14 +10461,9 @@ const VideoGallery = (props) => {
10505
10461
  containerHeight,
10506
10462
  onRenderRemoteVideoTile,
10507
10463
  defaultOnRenderVideoTile,
10508
- layout,
10509
10464
  /* @conditional-compile-remove(pinned-participants) */ pinnedParticipants
10510
10465
  ]);
10511
10466
  const videoGalleryLayout = React.useMemo(() => {
10512
- /* @conditional-compile-remove(pinned-participants) */
10513
- if (layoutProps.pinnedParticipants.length > 0) {
10514
- return React__default['default'].createElement(PinnedParticipantsLayout, Object.assign({}, layoutProps));
10515
- }
10516
10467
  if (layout === 'floatingLocalVideo') {
10517
10468
  return React__default['default'].createElement(FloatingLocalVideoLayout, Object.assign({}, layoutProps));
10518
10469
  }