@azure/communication-react 1.2.3-alpha-202204290013.0 → 1.2.3-alpha-202205040013.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 (26) hide show
  1. package/dist/dist-cjs/communication-react/index.js +62 -26
  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/chat-component-bindings/src/messageThreadSelector.js +11 -1
  5. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  6. package/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.d.ts.map +1 -1
  7. package/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.js +4 -2
  8. package/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.js.map +1 -1
  9. package/dist/dist-esm/react-components/src/components/ParticipantItem.d.ts.map +1 -1
  10. package/dist/dist-esm/react-components/src/components/ParticipantItem.js +3 -3
  11. package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
  12. package/dist/dist-esm/react-components/src/components/SendBox.d.ts.map +1 -1
  13. package/dist/dist-esm/react-components/src/components/SendBox.js +20 -4
  14. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  15. package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts.map +1 -1
  16. package/dist/dist-esm/react-components/src/components/VideoGallery.js +23 -14
  17. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  18. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.d.ts +4 -1
  19. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.d.ts.map +1 -1
  20. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js +2 -2
  21. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js.map +1 -1
  22. package/dist/dist-esm/react-composites/src/composites/common/CustomDataModelUtils.d.ts +12 -0
  23. package/dist/dist-esm/react-composites/src/composites/common/CustomDataModelUtils.d.ts.map +1 -1
  24. package/dist/dist-esm/react-composites/src/composites/common/CustomDataModelUtils.js +2 -2
  25. package/dist/dist-esm/react-composites/src/composites/common/CustomDataModelUtils.js.map +1 -1
  26. package/package.json +7 -7
@@ -191,7 +191,7 @@ const fromFlatCommunicationIdentifier = (id) => {
191
191
  // Copyright (c) Microsoft Corporation.
192
192
  // Licensed under the MIT license.
193
193
  // GENERATED FILE. DO NOT EDIT MANUALLY.
194
- var telemetryVersion = '1.2.3-alpha-202204290013.0';
194
+ var telemetryVersion = '1.2.3-alpha-202205040013.0';
195
195
 
196
196
  // Copyright (c) Microsoft Corporation.
197
197
  /**
@@ -2180,8 +2180,9 @@ const SendBox = (props) => {
2180
2180
  return;
2181
2181
  }
2182
2182
  // we dont want to send empty messages including spaces, newlines, tabs
2183
- if (!EMPTY_MESSAGE_REGEX.test(textValue)) {
2184
- onSendMessage && onSendMessage(textValue);
2183
+ // Message can be empty if there is a valid file upload
2184
+ if (!EMPTY_MESSAGE_REGEX.test(textValue) || hasFile(props)) {
2185
+ onSendMessage && onSendMessage(sanitizeText(textValue));
2185
2186
  setTextValue('');
2186
2187
  }
2187
2188
  (_a = sendTextFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -2203,9 +2204,10 @@ const SendBox = (props) => {
2203
2204
  const mergedSendButtonStyle = React.useMemo(() => react.mergeStyles(sendButtonStyle, styles === null || styles === void 0 ? void 0 : styles.sendMessageIconContainer), [styles === null || styles === void 0 ? void 0 : styles.sendMessageIconContainer]);
2204
2205
  const mergedStyles = React.useMemo(() => react.concatStyleSets(styles), [styles]);
2205
2206
  const hasText = !!textValue;
2207
+ const hasTextOrFile = hasText || hasFile(props);
2206
2208
  const mergedSendIconStyle = React.useMemo(() => react.mergeStyles(sendIconStyle, {
2207
- color: !!errorMessage || !hasText ? theme.palette.neutralTertiary : theme.palette.themePrimary
2208
- }, styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon), [errorMessage, hasText, theme, styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon]);
2209
+ color: !!errorMessage || !hasTextOrFile ? theme.palette.neutralTertiary : theme.palette.themePrimary
2210
+ }, styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon), [errorMessage, hasTextOrFile, theme, styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon]);
2209
2211
  const onRenderSendIcon = React.useCallback((isHover) => onRenderIcon ? (onRenderIcon(isHover)) : (React__default['default'].createElement(react.Icon, { iconName: isHover && textValue ? 'SendBoxSendHovered' : 'SendBoxSend', className: mergedSendIconStyle })), [mergedSendIconStyle, onRenderIcon, textValue]);
2210
2212
  /* @conditional-compile-remove(file-sharing) */
2211
2213
  // Ensure that errors are cleared when there are no files in sendbox
@@ -2264,6 +2266,19 @@ const hasIncompleteFileUploads = (props) => {
2264
2266
  return !!(((_a = props.activeFileUploads) === null || _a === void 0 ? void 0 : _a.length) &&
2265
2267
  !props.activeFileUploads.filter((fileUpload) => !fileUpload.error).every((fileUpload) => fileUpload.uploadComplete));
2266
2268
  };
2269
+ const hasFile = (props) => {
2270
+ var _a;
2271
+ /* @conditional-compile-remove(file-sharing) */
2272
+ return !!((_a = props.activeFileUploads) === null || _a === void 0 ? void 0 : _a.find((file) => !file.error));
2273
+ };
2274
+ const sanitizeText = (message) => {
2275
+ if (EMPTY_MESSAGE_REGEX.test(message)) {
2276
+ return '';
2277
+ }
2278
+ else {
2279
+ return message;
2280
+ }
2281
+ };
2267
2282
 
2268
2283
  // Copyright (c) Microsoft Corporation.
2269
2284
  /** @private */
@@ -3871,14 +3886,14 @@ const StreamMedia = (props) => {
3871
3886
  /**
3872
3887
  * @private
3873
3888
  */
3874
- const participantItemContainerStyle = (isMe) => {
3889
+ const participantItemContainerStyle = (options) => {
3875
3890
  return {
3876
3891
  paddingTop: '0.25rem',
3877
3892
  paddingBottom: '0.25rem',
3878
3893
  display: 'flex',
3879
3894
  maxWidth: '100%',
3880
3895
  minWidth: '8rem',
3881
- cursor: isMe ? 'default' : 'pointer',
3896
+ cursor: options.localparticipant || !options.clickable ? 'default' : 'pointer',
3882
3897
  alignItems: 'center'
3883
3898
  };
3884
3899
  };
@@ -3950,14 +3965,14 @@ const ParticipantItem = (props) => {
3950
3965
  setItemHovered(false);
3951
3966
  setMenuHidden(true);
3952
3967
  };
3953
- return (React__default['default'].createElement("div", { ref: containerRef, role: 'menuitem', "data-is-focusable": true, className: react.mergeStyles(participantItemContainerStyle(me), styles === null || styles === void 0 ? void 0 : styles.root), onMouseEnter: () => setItemHovered(true), onMouseLeave: () => setItemHovered(false), onClick: () => {
3968
+ return (React__default['default'].createElement("div", { ref: containerRef, role: 'menuitem', "data-is-focusable": true, className: react.mergeStyles(participantItemContainerStyle({ localparticipant: me, clickable: !!menuItems }), styles === null || styles === void 0 ? void 0 : styles.root), onMouseEnter: () => setItemHovered(true), onMouseLeave: () => setItemHovered(false), onClick: () => {
3954
3969
  setItemHovered(true);
3955
3970
  setMenuHidden(false);
3956
3971
  onClick === null || onClick === void 0 ? void 0 : onClick(props);
3957
3972
  } },
3958
3973
  React__default['default'].createElement(react.Stack, { horizontal: true, className: react.mergeStyles({ width: `calc(100% - ${menuButtonContainerStyle.width})`, alignItems: 'center' }) },
3959
3974
  avatar,
3960
- me && React__default['default'].createElement(react.Stack, { className: meTextStyle }, isMeText),
3975
+ me && React__default['default'].createElement(react.Text, { className: meTextStyle }, isMeText),
3961
3976
  React__default['default'].createElement(react.Stack, { horizontal: true, className: react.mergeStyles(infoContainerStyle) }, onRenderIcon && onRenderIcon(props))),
3962
3977
  menuItems && menuItems.length > 0 && (React__default['default'].createElement(React__default['default'].Fragment, null,
3963
3978
  menuButton,
@@ -5496,7 +5511,7 @@ const modalMaxDragPosition = { x: localVideoTileOuterPaddingPX, y: localVideoTil
5496
5511
  * @public
5497
5512
  */
5498
5513
  const VideoGallery = (props) => {
5499
- var _a, _b, _c, _d;
5514
+ var _a, _b, _c;
5500
5515
  const { localParticipant, remoteParticipants = [], localVideoViewOptions, remoteVideoViewOptions, dominantSpeakers, onRenderLocalVideoTile, onRenderRemoteVideoTile, onCreateLocalStreamView, onCreateRemoteStreamView, onDisposeRemoteStreamView, styles, layout, onRenderAvatar, showMuteIndicator, maxRemoteVideoStreams = DEFAULT_MAX_REMOTE_VIDEO_STREAMS,
5501
5516
  /* @conditional-compile-remove(call-with-chat-composite) @conditional-compile-remove(local-camera-switcher) */
5502
5517
  showCameraSwitcherInLocalPreview,
@@ -5541,16 +5556,23 @@ const VideoGallery = (props) => {
5541
5556
  lastVisibleParticipants: visibleAudioParticipants.current,
5542
5557
  maxDominantSpeakers: MAX_AUDIO_DOMINANT_SPEAKERS
5543
5558
  });
5544
- /* @conditional-compile-remove(call-with-chat-composite) @conditional-compile-remove(local-camera-switcher) */
5545
- const localCameraCycleButton = (localVideoCameraCycleButtonProps) => {
5546
- const ariaDescription = _formatString(strings.localVideoSelectedDescription, {
5547
- cameraName: localVideoCameraCycleButtonProps.selectedCamera.name
5548
- });
5559
+ const LocalCameraCycleButton = React.useCallback(() => {
5560
+ const ariaDescription = (localVideoCameraCycleButtonProps === null || localVideoCameraCycleButtonProps === void 0 ? void 0 : localVideoCameraCycleButtonProps.selectedCamera) &&
5561
+ _formatString(strings.localVideoSelectedDescription, {
5562
+ cameraName: localVideoCameraCycleButtonProps.selectedCamera.name
5563
+ });
5549
5564
  return (React__default['default'].createElement(react.Stack, { horizontalAlign: "end" }, showCameraSwitcherInLocalPreview &&
5550
5565
  (localVideoCameraCycleButtonProps === null || localVideoCameraCycleButtonProps === void 0 ? void 0 : localVideoCameraCycleButtonProps.cameras) !== undefined &&
5551
5566
  (localVideoCameraCycleButtonProps === null || localVideoCameraCycleButtonProps === void 0 ? void 0 : localVideoCameraCycleButtonProps.selectedCamera) !== undefined &&
5552
5567
  (localVideoCameraCycleButtonProps === null || localVideoCameraCycleButtonProps === void 0 ? void 0 : localVideoCameraCycleButtonProps.onSelectCamera) !== undefined && (React__default['default'].createElement(LocalVideoCameraCycleButton, { cameras: localVideoCameraCycleButtonProps.cameras, selectedCamera: localVideoCameraCycleButtonProps.selectedCamera, onSelectCamera: localVideoCameraCycleButtonProps.onSelectCamera, label: strings.localVideoCameraSwitcherLabel, ariaDescription: ariaDescription }))));
5553
- };
5568
+ }, [
5569
+ localVideoCameraCycleButtonProps === null || localVideoCameraCycleButtonProps === void 0 ? void 0 : localVideoCameraCycleButtonProps.cameras,
5570
+ localVideoCameraCycleButtonProps === null || localVideoCameraCycleButtonProps === void 0 ? void 0 : localVideoCameraCycleButtonProps.onSelectCamera,
5571
+ localVideoCameraCycleButtonProps === null || localVideoCameraCycleButtonProps === void 0 ? void 0 : localVideoCameraCycleButtonProps.selectedCamera,
5572
+ showCameraSwitcherInLocalPreview,
5573
+ strings.localVideoCameraSwitcherLabel,
5574
+ strings.localVideoSelectedDescription
5575
+ ]);
5554
5576
  /**
5555
5577
  * Utility function for memoized rendering of LocalParticipant.
5556
5578
  */
@@ -5568,18 +5590,20 @@ const VideoGallery = (props) => {
5568
5590
  }
5569
5591
  return (React__default['default'].createElement(react.Stack, { tabIndex: 0, "aria-label": strings.localVideoMovementLabel, role: 'dialog' },
5570
5592
  React__default['default'].createElement(VideoTile, { key: localParticipant.userId, userId: localParticipant.userId, renderElement: (localVideoStream === null || localVideoStream === void 0 ? void 0 : localVideoStream.renderElement) ? (React__default['default'].createElement(React__default['default'].Fragment, null,
5571
- /* @conditional-compile-remove(call-with-chat-composite) @conditional-compile-remove(local-camera-switcher) */
5572
- localCameraCycleButton(localVideoCameraCycleButtonProps),
5593
+ React__default['default'].createElement(LocalCameraCycleButton, null),
5573
5594
  React__default['default'].createElement(StreamMedia, { videoStreamElement: localVideoStream.renderElement }))) : undefined, showLabel: !(shouldFloatLocalVideo && isNarrow), displayName: isNarrow ? '' : strings.localVideoLabel, initialsName: localParticipant.displayName, styles: localVideoTileStylesThemed, onRenderPlaceholder: onRenderAvatar, isMuted: localParticipant.isMuted, showMuteIndicator: showMuteIndicator })));
5574
- // eslint-disable-next-line react-hooks/exhaustive-deps
5575
5595
  }, [
5576
5596
  localParticipant,
5577
- localParticipant.isScreenSharingOn,
5578
- localParticipant.videoStream,
5579
- (_c = localParticipant.videoStream) === null || _c === void 0 ? void 0 : _c.renderElement,
5580
5597
  isNarrow,
5581
5598
  onCreateLocalStreamView,
5582
5599
  onRenderLocalVideoTile,
5600
+ theme.effects.roundedCorner4,
5601
+ styles === null || styles === void 0 ? void 0 : styles.localVideo,
5602
+ strings.localVideoMovementLabel,
5603
+ strings.localVideoLabel,
5604
+ LocalCameraCycleButton,
5605
+ showMuteIndicator,
5606
+ localVideoViewOptions,
5583
5607
  onRenderAvatar,
5584
5608
  shouldFloatLocalVideo
5585
5609
  ]);
@@ -5617,7 +5641,7 @@ const VideoGallery = (props) => {
5617
5641
  gridTiles.push(localVideoTile);
5618
5642
  }
5619
5643
  const localScreenShareStreamComponent = React__default['default'].createElement(LocalScreenShare, { localParticipant: localParticipant });
5620
- const remoteScreenShareComponent = screenShareParticipant && (React__default['default'].createElement(RemoteScreenShare, Object.assign({}, screenShareParticipant, { renderElement: (_d = screenShareParticipant.screenShareStream) === null || _d === void 0 ? void 0 : _d.renderElement, onCreateRemoteStreamView: onCreateRemoteStreamView, onDisposeRemoteStreamView: onDisposeRemoteStreamView })));
5644
+ const remoteScreenShareComponent = screenShareParticipant && (React__default['default'].createElement(RemoteScreenShare, Object.assign({}, screenShareParticipant, { renderElement: (_c = screenShareParticipant.screenShareStream) === null || _c === void 0 ? void 0 : _c.renderElement, onCreateRemoteStreamView: onCreateRemoteStreamView, onDisposeRemoteStreamView: onDisposeRemoteStreamView })));
5621
5645
  const horizontalGalleryPresent = horizontalGalleryTiles && horizontalGalleryTiles.length > 0;
5622
5646
  const layerHostId = reactHooks.useId('layerhost');
5623
5647
  return (React__default['default'].createElement("div", { "data-ui-id": ids.videoGallery, ref: containerRef, className: react.mergeStyles(videoGalleryOuterDivStyle, styles === null || styles === void 0 ? void 0 : styles.root) },
@@ -7573,7 +7597,7 @@ const messageThreadSelector = reselect.createSelector([getUserId, getChatMessage
7573
7597
  // TODO: Add support for topicUpdated system messages in MessageThread component.
7574
7598
  // message.type === ACSKnownMessageType.topicUpdated ||
7575
7599
  message.clientMessageId !== undefined)
7576
- .filter((message) => message.content && message.content.message !== '') // TODO: deal with deleted message and remove
7600
+ .filter(messagesWithContentOrFileSharingMetadata)
7577
7601
  .map((message) => {
7578
7602
  var _a;
7579
7603
  return memoizedFn((_a = message.id) !== null && _a !== void 0 ? _a : message.clientMessageId, message, userId, message.createdOn <= latestReadTime, isLargeGroup);
@@ -7593,6 +7617,16 @@ const sanitizedMessageContentType = (type) => {
7593
7617
  ? lowerCaseType
7594
7618
  : 'unknown';
7595
7619
  };
7620
+ const messagesWithContentOrFileSharingMetadata = (message) => {
7621
+ var _a, _b;
7622
+ if (message.deletedOn) {
7623
+ return false;
7624
+ }
7625
+ if ((_a = message.metadata) === null || _a === void 0 ? void 0 : _a['fileSharingMetadata']) {
7626
+ return true;
7627
+ }
7628
+ return !!(message.content && ((_b = message.content) === null || _b === void 0 ? void 0 : _b.message) !== '');
7629
+ };
7596
7630
 
7597
7631
  // Copyright (c) Microsoft Corporation.
7598
7632
  const filterTypingIndicators = (typingIndicators, userId) => {
@@ -10657,7 +10691,8 @@ class ProxyChatThreadClient {
10657
10691
  case 'sendMessage': {
10658
10692
  return this._context.withAsyncErrorTeedToState((...args) => __awaiter$b(this, void 0, void 0, function* () {
10659
10693
  // Retry logic?
10660
- const { content } = args[0];
10694
+ const [request, options] = args;
10695
+ const { content } = request;
10661
10696
  const clientMessageId = nanoid.nanoid(); // Generate a local short uuid for message
10662
10697
  const newMessage = {
10663
10698
  content: { message: content },
@@ -10669,7 +10704,8 @@ class ProxyChatThreadClient {
10669
10704
  createdOn: new Date(),
10670
10705
  status: 'sending',
10671
10706
  senderDisplayName: this._context.getState().displayName,
10672
- sender: this._context.getState().userId
10707
+ sender: this._context.getState().userId,
10708
+ metadata: options === null || options === void 0 ? void 0 : options.metadata
10673
10709
  };
10674
10710
  this._context.setChatMessage(chatThreadClient.threadId, newMessage);
10675
10711
  let result = undefined;