@azure/communication-react 1.5.1-alpha-202304050012 → 1.5.1-alpha-202304070012

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 (38) hide show
  1. package/dist/communication-react.d.ts +33 -2
  2. package/dist/dist-cjs/communication-react/index.js +123 -97
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  5. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  6. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +1 -1
  7. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  8. package/dist/dist-esm/communication-react/src/index.d.ts +1 -1
  9. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  10. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.d.ts +7 -0
  11. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js +3 -2
  12. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +1 -1
  13. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.d.ts +3 -1
  14. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +4 -2
  15. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
  16. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +19 -0
  17. package/dist/dist-esm/react-components/src/components/MessageThread.js +6 -4
  18. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  19. package/dist/dist-esm/react-components/src/components/index.d.ts +1 -1
  20. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  21. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -0
  22. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  23. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +1 -1
  24. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  25. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +13 -2
  26. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +28 -7
  27. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  28. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -0
  29. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  30. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +2 -2
  31. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  32. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js +1 -1
  33. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js.map +1 -1
  34. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js +1 -0
  35. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
  36. package/dist/dist-esm/react-composites/src/composites/common/MoreButton.js +1 -1
  37. package/dist/dist-esm/react-composites/src/composites/common/MoreButton.js.map +1 -1
  38. package/package.json +10 -10
@@ -1801,7 +1801,7 @@ export declare type CallErrors = {
1801
1801
  *
1802
1802
  * @public
1803
1803
  */
1804
- export declare type CallErrorTarget = 'Call.addParticipant' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.dispose' | 'Call.feature' | 'Call.hangUp' | 'Call.hold' | 'Call.mute' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.muteIncomingAudio' | 'Call.off' | 'Call.on' | 'Call.removeParticipant' | 'Call.resume' | 'Call.sendDtmf' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.startAudio' | 'Call.startScreenSharing' | 'Call.startVideo' | 'Call.stopScreenSharing' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.stopAudio' | 'Call.stopVideo' | 'Call.unmute' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.unmuteIncomingAudio' | 'CallAgent.dispose' | 'CallAgent.feature' | 'CallAgent.join' | 'CallAgent.off' | 'CallAgent.on' | 'CallAgent.startCall' | 'CallClient.createCallAgent' | /* @conditional-compile-remove(calling-beta-sdk) */ /* @conditional-compile-remove(teams-identity-support) */ 'CallClient.createTeamsCallAgent' | 'CallClient.feature' | 'CallClient.getDeviceManager' | /* @conditional-compile-remove(calling-beta-sdk) */ 'CallClient.getEnvironmentInfo' | 'DeviceManager.askDevicePermission' | 'DeviceManager.getCameras' | 'DeviceManager.getMicrophones' | 'DeviceManager.getSpeakers' | 'DeviceManager.off' | 'DeviceManager.on' | 'DeviceManager.selectMicrophone' | 'DeviceManager.selectSpeaker' | 'IncomingCall.accept' | 'IncomingCall.reject' | /* @conditional-compile-remove(calling-beta-sdk) */ /* @conditional-compile-remove(teams-identity-support) */ 'TeamsCall.addParticipant' | /* @conditional-compile-remove(video-background-effects) */ 'VideoEffectsFeature.startEffects' | /* @conditional-compile-remove(calling-beta-sdk) */ 'CallAgent.handlePushNotification';
1804
+ export declare type CallErrorTarget = 'Call.addParticipant' | 'Call.dispose' | 'Call.feature' | 'Call.hangUp' | 'Call.hold' | 'Call.mute' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.muteIncomingAudio' | 'Call.off' | 'Call.on' | 'Call.removeParticipant' | 'Call.resume' | 'Call.sendDtmf' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.startAudio' | 'Call.startScreenSharing' | 'Call.startVideo' | 'Call.stopScreenSharing' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.stopAudio' | 'Call.stopVideo' | 'Call.unmute' | /* @conditional-compile-remove(calling-beta-sdk) */ 'Call.unmuteIncomingAudio' | 'CallAgent.dispose' | 'CallAgent.feature' | 'CallAgent.join' | 'CallAgent.off' | 'CallAgent.on' | 'CallAgent.startCall' | 'CallClient.createCallAgent' | 'CallClient.createTeamsCallAgent' | 'CallClient.feature' | 'CallClient.getDeviceManager' | /* @conditional-compile-remove(calling-beta-sdk) */ 'CallClient.getEnvironmentInfo' | 'DeviceManager.askDevicePermission' | 'DeviceManager.getCameras' | 'DeviceManager.getMicrophones' | 'DeviceManager.getSpeakers' | 'DeviceManager.off' | 'DeviceManager.on' | 'DeviceManager.selectMicrophone' | 'DeviceManager.selectSpeaker' | 'IncomingCall.accept' | 'IncomingCall.reject' | /* @conditional-compile-remove(calling-beta-sdk) */ /* @conditional-compile-remove(teams-identity-support) */ 'TeamsCall.addParticipant' | /* @conditional-compile-remove(video-background-effects) */ 'VideoEffectsFeature.startEffects' | /* @conditional-compile-remove(calling-beta-sdk) */ 'CallAgent.handlePushNotification';
1805
1805
 
1806
1806
  /**
1807
1807
  * Callback for {@link CallAdapterSubscribers} 'callIdChanged' event.
@@ -2994,6 +2994,14 @@ export declare interface CameraSitePermissionsProps extends CommonSitePermission
2994
2994
  */
2995
2995
  export declare type CameraSitePermissionsStrings = SitePermissionsStrings;
2996
2996
 
2997
+ /**
2998
+ * @public
2999
+ * Callback function run when a message edit is cancelled.
3000
+ */
3001
+ export declare type CancelEditCallback = (messageId: string, metadata?: Record<string, string>, options?: {
3002
+ attachedFilesMetadata?: FileMetadata[];
3003
+ }) => void;
3004
+
2997
3005
  /**
2998
3006
  * {@link ChatComposite} Adapter interface.
2999
3007
  *
@@ -3001,6 +3009,14 @@ export declare type CameraSitePermissionsStrings = SitePermissionsStrings;
3001
3009
  */
3002
3010
  export declare type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers & FileUploadAdapter;
3003
3011
 
3012
+ /**
3013
+ * Configuration options to include when creating AzureCommunicationChatAdapter.
3014
+ * @beta
3015
+ */
3016
+ export declare type ChatAdapterOptions = {
3017
+ credential?: CommunicationTokenCredential;
3018
+ };
3019
+
3004
3020
  /**
3005
3021
  * {@link ChatAdapter} state.
3006
3022
  *
@@ -3413,6 +3429,7 @@ export declare interface ChatMessage extends MessageCommon {
3413
3429
  senderId?: string;
3414
3430
  senderDisplayName?: string;
3415
3431
  status?: MessageStatus;
3432
+ failureReason?: string;
3416
3433
  attached?: MessageAttachedStatus;
3417
3434
  mine?: boolean;
3418
3435
  clientMessageId?: string;
@@ -4311,7 +4328,9 @@ export declare const createAzureCommunicationChatAdapter: ({ endpoint: endpointU
4311
4328
  *
4312
4329
  * @public
4313
4330
  */
4314
- export declare const createAzureCommunicationChatAdapterFromClient: (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) => Promise<ChatAdapter>;
4331
+ export declare function createAzureCommunicationChatAdapterFromClient(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient, options?: {
4332
+ credential?: CommunicationTokenCredential;
4333
+ }): Promise<ChatAdapter>;
4315
4334
 
4316
4335
  /**
4317
4336
  * Create the default implementation of {@link CallingHandlers} for teams call.
@@ -6091,6 +6110,12 @@ export declare type MessageProps = {
6091
6110
  * @param content - new content of the message
6092
6111
  */
6093
6112
  onUpdateMessage?: UpdateMessageCallback;
6113
+ /**
6114
+ * Optional callback for when a message edit is cancelled.
6115
+ *
6116
+ * @param messageId - message id from chatClient
6117
+ */
6118
+ onCancelMessageEdit?: CancelEditCallback;
6094
6119
  /**
6095
6120
  * Optional callback to delete a message.
6096
6121
  *
@@ -6331,6 +6356,12 @@ export declare type MessageThreadProps = {
6331
6356
  *
6332
6357
  */
6333
6358
  onUpdateMessage?: UpdateMessageCallback;
6359
+ /**
6360
+ * Optional callback for when a message edit is cancelled.
6361
+ *
6362
+ * @param messageId - message id from chatClient
6363
+ */
6364
+ onCancelMessageEdit?: CancelEditCallback;
6334
6365
  /**
6335
6366
  * Optional callback to delete a message.
6336
6367
  *
@@ -162,7 +162,7 @@ const _toCommunicationIdentifier = (id) => {
162
162
  // Copyright (c) Microsoft Corporation.
163
163
  // Licensed under the MIT license.
164
164
  // GENERATED FILE. DO NOT EDIT MANUALLY.
165
- var telemetryVersion = '1.5.1-alpha-202304050012';
165
+ var telemetryVersion = '1.5.1-alpha-202304070012';
166
166
 
167
167
  // Copyright (c) Microsoft Corporation.
168
168
  /**
@@ -6348,84 +6348,6 @@ const editBoxStyleSet = {
6348
6348
  }
6349
6349
  };
6350
6350
 
6351
- // Copyright (c) Microsoft Corporation.
6352
- const MAXIMUM_LENGTH_OF_MESSAGE = 8000;
6353
- const onRenderCancelIcon = (color) => {
6354
- const className = react.mergeStyles(inputBoxIcon, { color });
6355
- return React__default['default'].createElement(react.Icon, { iconName: 'EditBoxCancel', className: className });
6356
- };
6357
- const onRenderSubmitIcon = (color) => {
6358
- const className = react.mergeStyles(inputBoxIcon, { color });
6359
- return React__default['default'].createElement(react.Icon, { iconName: 'EditBoxSubmit', className: className });
6360
- };
6361
- /**
6362
- * @private
6363
- */
6364
- const ChatMessageComponentAsEditBox = (props) => {
6365
- const { onCancel, onSubmit, strings, message } = props;
6366
- const [textValue, setTextValue] = React.useState(message.content || '');
6367
- const [attachedFilesMetadata, setAttachedFilesMetadata] = React__default['default'].useState(getMessageAttachedFilesMetadata(message));
6368
- const editTextFieldRef = React__default['default'].useRef(null);
6369
- const theme = useTheme();
6370
- const messageState = getMessageState(textValue, attachedFilesMetadata !== null && attachedFilesMetadata !== void 0 ? attachedFilesMetadata : []);
6371
- const submitEnabled = messageState === 'OK';
6372
- React.useEffect(() => {
6373
- var _a;
6374
- (_a = editTextFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
6375
- }, []);
6376
- const setText = (event, newValue) => {
6377
- setTextValue(newValue !== null && newValue !== void 0 ? newValue : '');
6378
- };
6379
- const textTooLongMessage = messageState === 'too long'
6380
- ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })
6381
- : undefined;
6382
- const onRenderThemedCancelIcon = React.useCallback(() => onRenderCancelIcon(theme.palette.neutralSecondary), [theme.palette.neutralSecondary]);
6383
- const onRenderThemedSubmitIcon = React.useCallback(() => onRenderSubmitIcon(theme.palette.neutralSecondary), [theme.palette.neutralSecondary]);
6384
- const editBoxStyles = React.useMemo(() => {
6385
- return react.concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });
6386
- }, [theme.palette.themePrimary]);
6387
- const onRenderFileUploads = React.useCallback(() => {
6388
- return ((attachedFilesMetadata === null || attachedFilesMetadata === void 0 ? void 0 : attachedFilesMetadata.length) && (React__default['default'].createElement("div", { style: { margin: '0.25rem' } },
6389
- React__default['default'].createElement(_FileUploadCards, { activeFileUploads: attachedFilesMetadata === null || attachedFilesMetadata === void 0 ? void 0 : attachedFilesMetadata.map((file) => ({
6390
- id: file.name,
6391
- filename: file.name,
6392
- progress: 1
6393
- })), onCancelFileUpload: (fileId) => {
6394
- setAttachedFilesMetadata(attachedFilesMetadata === null || attachedFilesMetadata === void 0 ? void 0 : attachedFilesMetadata.filter((file) => file.name !== fileId));
6395
- } }))));
6396
- }, [attachedFilesMetadata]);
6397
- return (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(borderAndBoxShadowStyle({
6398
- theme,
6399
- hasErrorMessage: false,
6400
- disabled: false
6401
- })) },
6402
- React__default['default'].createElement(InputBoxComponent, { inlineChildren: props.inlineEditButtons, id: 'editbox', textFieldRef: editTextFieldRef, inputClassName: editBoxStyle(props.inlineEditButtons), placeholderText: strings.editBoxPlaceholderText, textValue: textValue, onChange: setText, onEnterKeyDown: () => {
6403
- submitEnabled &&
6404
- onSubmit(textValue, message.metadata, {
6405
- attachedFilesMetadata
6406
- });
6407
- }, supportNewline: false, maxLength: MAXIMUM_LENGTH_OF_MESSAGE, errorMessage: textTooLongMessage, styles: editBoxStyles },
6408
- React__default['default'].createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxCancelButton, tooltipContent: strings.editBoxCancelButton, onRenderIcon: onRenderThemedCancelIcon, onClick: () => {
6409
- onCancel && onCancel();
6410
- }, id: 'dismissIconWrapper' }),
6411
- React__default['default'].createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxSubmitButton, tooltipContent: strings.editBoxSubmitButton, onRenderIcon: onRenderThemedSubmitIcon, onClick: (e) => {
6412
- submitEnabled &&
6413
- onSubmit(textValue, message.metadata, {
6414
- attachedFilesMetadata
6415
- });
6416
- e.stopPropagation();
6417
- }, id: 'submitIconWrapper' })),
6418
- onRenderFileUploads()));
6419
- };
6420
- const isMessageTooLong = (messageText) => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;
6421
- const isMessageEmpty = (messageText, attachedFilesMetadata) => messageText.trim().length === 0 && attachedFilesMetadata.length === 0;
6422
- const getMessageState = (messageText, attachedFilesMetadata) => isMessageEmpty(messageText, attachedFilesMetadata) ? 'too short' : isMessageTooLong(messageText) ? 'too long' : 'OK';
6423
- // @TODO: Remove when file-sharing feature becomes stable.
6424
- const getMessageAttachedFilesMetadata = (message) => {
6425
- /* @conditional-compile-remove(file-sharing) */
6426
- return message.attachedFilesMetadata;
6427
- };
6428
-
6429
6351
  // Copyright (c) Microsoft Corporation.
6430
6352
  const MINIMUM_TOUCH_TARGET_HEIGHT_REM$1 = 3;
6431
6353
  /**
@@ -6522,6 +6444,85 @@ const menuSubIconStyleSet = {
6522
6444
  }
6523
6445
  };
6524
6446
 
6447
+ // Copyright (c) Microsoft Corporation.
6448
+ const MAXIMUM_LENGTH_OF_MESSAGE = 8000;
6449
+ const onRenderCancelIcon = (color) => {
6450
+ const className = react.mergeStyles(inputBoxIcon, { color });
6451
+ return React__default['default'].createElement(react.Icon, { iconName: 'EditBoxCancel', className: className });
6452
+ };
6453
+ const onRenderSubmitIcon = (color) => {
6454
+ const className = react.mergeStyles(inputBoxIcon, { color });
6455
+ return React__default['default'].createElement(react.Icon, { iconName: 'EditBoxSubmit', className: className });
6456
+ };
6457
+ /**
6458
+ * @private
6459
+ */
6460
+ const ChatMessageComponentAsEditBox = (props) => {
6461
+ const { onCancel, onSubmit, strings, message } = props;
6462
+ const [textValue, setTextValue] = React.useState(message.content || '');
6463
+ const [attachedFilesMetadata, setAttachedFilesMetadata] = React__default['default'].useState(getMessageAttachedFilesMetadata(message));
6464
+ const editTextFieldRef = React__default['default'].useRef(null);
6465
+ const theme = useTheme();
6466
+ const messageState = getMessageState(textValue, attachedFilesMetadata !== null && attachedFilesMetadata !== void 0 ? attachedFilesMetadata : []);
6467
+ const submitEnabled = messageState === 'OK';
6468
+ React.useEffect(() => {
6469
+ var _a;
6470
+ (_a = editTextFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
6471
+ }, []);
6472
+ const setText = (event, newValue) => {
6473
+ setTextValue(newValue !== null && newValue !== void 0 ? newValue : '');
6474
+ };
6475
+ const textTooLongMessage = messageState === 'too long'
6476
+ ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })
6477
+ : undefined;
6478
+ const onRenderThemedCancelIcon = React.useCallback(() => onRenderCancelIcon(theme.palette.neutralSecondary), [theme.palette.neutralSecondary]);
6479
+ const onRenderThemedSubmitIcon = React.useCallback(() => onRenderSubmitIcon(theme.palette.neutralSecondary), [theme.palette.neutralSecondary]);
6480
+ const editBoxStyles = React.useMemo(() => {
6481
+ return react.concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });
6482
+ }, [theme.palette.themePrimary]);
6483
+ const onRenderFileUploads = React.useCallback(() => {
6484
+ return ((attachedFilesMetadata === null || attachedFilesMetadata === void 0 ? void 0 : attachedFilesMetadata.length) && (React__default['default'].createElement("div", { style: { margin: '0.25rem' } },
6485
+ React__default['default'].createElement(_FileUploadCards, { activeFileUploads: attachedFilesMetadata === null || attachedFilesMetadata === void 0 ? void 0 : attachedFilesMetadata.map((file) => ({
6486
+ id: file.name,
6487
+ filename: file.name,
6488
+ progress: 1
6489
+ })), onCancelFileUpload: (fileId) => {
6490
+ setAttachedFilesMetadata(attachedFilesMetadata === null || attachedFilesMetadata === void 0 ? void 0 : attachedFilesMetadata.filter((file) => file.name !== fileId));
6491
+ } }))));
6492
+ }, [attachedFilesMetadata]);
6493
+ return (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(borderAndBoxShadowStyle({
6494
+ theme,
6495
+ hasErrorMessage: message.failureReason !== undefined,
6496
+ disabled: false
6497
+ })) },
6498
+ React__default['default'].createElement(InputBoxComponent, { inlineChildren: props.inlineEditButtons, id: 'editbox', textFieldRef: editTextFieldRef, inputClassName: editBoxStyle(props.inlineEditButtons), placeholderText: strings.editBoxPlaceholderText, textValue: textValue, onChange: setText, onEnterKeyDown: () => {
6499
+ submitEnabled &&
6500
+ onSubmit(textValue, message.metadata, {
6501
+ attachedFilesMetadata
6502
+ });
6503
+ }, supportNewline: false, maxLength: MAXIMUM_LENGTH_OF_MESSAGE, errorMessage: textTooLongMessage, styles: editBoxStyles },
6504
+ React__default['default'].createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxCancelButton, tooltipContent: strings.editBoxCancelButton, onRenderIcon: onRenderThemedCancelIcon, onClick: () => {
6505
+ onCancel && onCancel(message.messageId, message.metadata, { attachedFilesMetadata });
6506
+ }, id: 'dismissIconWrapper' }),
6507
+ React__default['default'].createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxSubmitButton, tooltipContent: strings.editBoxSubmitButton, onRenderIcon: onRenderThemedSubmitIcon, onClick: (e) => {
6508
+ submitEnabled &&
6509
+ onSubmit(textValue, message.metadata, {
6510
+ attachedFilesMetadata
6511
+ });
6512
+ e.stopPropagation();
6513
+ }, id: 'submitIconWrapper' })),
6514
+ message.failureReason && (React__default['default'].createElement("div", { className: react.mergeStyles(chatMessageFailedTagStyle(theme), { padding: '0.5rem' }) }, message.failureReason)),
6515
+ onRenderFileUploads()));
6516
+ };
6517
+ const isMessageTooLong = (messageText) => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;
6518
+ const isMessageEmpty = (messageText, attachedFilesMetadata) => messageText.trim().length === 0 && attachedFilesMetadata.length === 0;
6519
+ const getMessageState = (messageText, attachedFilesMetadata) => isMessageEmpty(messageText, attachedFilesMetadata) ? 'too short' : isMessageTooLong(messageText) ? 'too long' : 'OK';
6520
+ // @TODO: Remove when file-sharing feature becomes stable.
6521
+ const getMessageAttachedFilesMetadata = (message) => {
6522
+ /* @conditional-compile-remove(file-sharing) */
6523
+ return message.attachedFilesMetadata;
6524
+ };
6525
+
6525
6526
  // Copyright (c) Microsoft Corporation.
6526
6527
  // Licensed under the MIT license.
6527
6528
  /**
@@ -7101,7 +7102,7 @@ const ChatMessageComponent = (props) => {
7101
7102
  if (onDeleteMessage && message.messageId) {
7102
7103
  onDeleteMessage(message.messageId);
7103
7104
  }
7104
- // when fail to send, message does not have message id, delete message using clientmessageid
7105
+ // when fail to send, message does not have message id, delete message using clientMessageId
7105
7106
  else if (onDeleteMessage && message.messageType === 'chat' && clientMessageId) {
7106
7107
  onDeleteMessage(clientMessageId);
7107
7108
  }
@@ -7116,7 +7117,8 @@ const ChatMessageComponent = (props) => {
7116
7117
  message.messageId &&
7117
7118
  (yield props.onUpdateMessage(message.messageId, text, metadata, options));
7118
7119
  setIsEditing(false);
7119
- }), onCancel: () => {
7120
+ }), onCancel: (messageId, metadata, options) => {
7121
+ props.onCancelMessageEdit && props.onCancelMessageEdit(messageId, metadata, options);
7120
7122
  setIsEditing(false);
7121
7123
  } }));
7122
7124
  }
@@ -7312,13 +7314,14 @@ const DefaultSystemMessage = (props) => {
7312
7314
  }
7313
7315
  return React__default['default'].createElement(React__default['default'].Fragment, null);
7314
7316
  };
7315
- const memoizeAllMessages = memoizeFnAll((_messageKey, message, showMessageDate, showMessageStatus, onRenderAvatar, shouldOverlapAvatarAndMessage, styles, onRenderMessageStatus, defaultStatusRenderer, defaultChatMessageRenderer, strings, theme, _attached, statusToRender, participantCount, readCount, onRenderMessage, onUpdateMessage, onDeleteMessage, onSendMessage, disableEditing) => {
7317
+ const memoizeAllMessages = memoizeFnAll((_messageKey, message, showMessageDate, showMessageStatus, onRenderAvatar, shouldOverlapAvatarAndMessage, styles, onRenderMessageStatus, defaultStatusRenderer, defaultChatMessageRenderer, strings, theme, _attached, statusToRender, participantCount, readCount, onRenderMessage, onUpdateMessage, onCancelMessageEdit, onDeleteMessage, onSendMessage, disableEditing) => {
7316
7318
  var _a, _b, _c, _d, _e, _f, _g, _h;
7317
7319
  const messageProps = {
7318
7320
  message,
7319
7321
  strings,
7320
7322
  showDate: showMessageDate,
7321
7323
  onUpdateMessage,
7324
+ onCancelMessageEdit,
7322
7325
  onDeleteMessage,
7323
7326
  onSendMessage,
7324
7327
  disableEditing
@@ -7412,7 +7415,7 @@ const getLastChatMessageIdWithStatus = (messages, status) => {
7412
7415
  */
7413
7416
  const MessageThread = (props) => {
7414
7417
  var _a;
7415
- const { messages: newMessages, userId, participantCount, readReceiptsBySenderId, styles, disableJumpToNewMessageButton = false, showMessageDate = false, showMessageStatus = false, numberOfChatMessagesToReload = 5, onMessageSeen, onRenderMessageStatus, onRenderAvatar, onLoadPreviousChatMessages, onRenderJumpToNewMessageButton, onRenderMessage, onUpdateMessage, onDeleteMessage, onSendMessage,
7418
+ const { messages: newMessages, userId, participantCount, readReceiptsBySenderId, styles, disableJumpToNewMessageButton = false, showMessageDate = false, showMessageStatus = false, numberOfChatMessagesToReload = 5, onMessageSeen, onRenderMessageStatus, onRenderAvatar, onLoadPreviousChatMessages, onRenderJumpToNewMessageButton, onRenderMessage, onUpdateMessage, onCancelMessageEdit, onDeleteMessage, onSendMessage,
7416
7419
  /* @conditional-compile-remove(date-time-customization) */
7417
7420
  onDisplayDateTimeString } = props;
7418
7421
  const onRenderFileDownloads = onRenderFileDownloadsTrampoline(props);
@@ -7608,7 +7611,7 @@ const MessageThread = (props) => {
7608
7611
  setLastSendingChatMessage(getLastChatMessageIdWithStatus(newMessages, 'sending'));
7609
7612
  }, [newMessages]);
7610
7613
  /**
7611
- * This needs to run after messages are rendererd so we can manipulate the scroll bar.
7614
+ * This needs to run after messages are rendered so we can manipulate the scroll bar.
7612
7615
  */
7613
7616
  React.useEffect(() => {
7614
7617
  // If user just sent the latest message then we assume we can move user to bottom of scroll.
@@ -7706,7 +7709,7 @@ const MessageThread = (props) => {
7706
7709
  message.messageType === 'chat' ||
7707
7710
  /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked'
7708
7711
  ? message.attached
7709
- : undefined, statusToRender, participantCount, readCountForHoveredIndicator, onRenderMessage, onUpdateMessage, onDeleteMessage, onSendMessage, props.disableEditing);
7712
+ : undefined, statusToRender, participantCount, readCountForHoveredIndicator, onRenderMessage, onUpdateMessage, onCancelMessageEdit, onDeleteMessage, onSendMessage, props.disableEditing);
7710
7713
  });
7711
7714
  }), [
7712
7715
  messages,
@@ -7724,6 +7727,7 @@ const MessageThread = (props) => {
7724
7727
  readCountForHoveredIndicator,
7725
7728
  onRenderMessage,
7726
7729
  onUpdateMessage,
7730
+ onCancelMessageEdit,
7727
7731
  onDeleteMessage,
7728
7732
  onSendMessage,
7729
7733
  lastSeenChatMessage,
@@ -16867,14 +16871,27 @@ class ChatContext {
16867
16871
  * @private
16868
16872
  */
16869
16873
  class AzureCommunicationChatAdapter {
16870
- constructor(chatClient, chatThreadClient) {
16874
+ constructor(chatClient, chatThreadClient,
16875
+ /* @conditional-compile-remove(teams-inline-images) */ options) {
16871
16876
  this.emitter = new EventEmitter__default['default']();
16872
16877
  this.bindAllPublicMethods();
16873
16878
  this.chatClient = chatClient;
16874
16879
  this.chatThreadClient = chatThreadClient;
16875
16880
  this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);
16876
- /* @conditional-compile-remove(file-sharing) */
16877
- this.fileUploadAdapter = new AzureCommunicationFileUploadAdapter(this.context);
16881
+ /* @conditional-compile-remove(teams-inline-images) */
16882
+ const credential = options === null || options === void 0 ? void 0 : options.credential;
16883
+ /* @conditional-compile-remove(file-sharing) */ /* @conditional-compile-remove(teams-inline-images) */
16884
+ let getAuthToken = undefined;
16885
+ /* @conditional-compile-remove(teams-inline-images) */
16886
+ if (credential) {
16887
+ /* @conditional-compile-remove(teams-inline-images) */
16888
+ getAuthToken = () => __awaiter$f(this, void 0, void 0, function* () {
16889
+ const accessToken = yield credential.getToken();
16890
+ return accessToken.token;
16891
+ });
16892
+ }
16893
+ /* @conditional-compile-remove(file-sharing) */ /* @conditional-compile-remove(teams-inline-images) */
16894
+ this.fileUploadAdapter = new AzureCommunicationFileUploadAdapter(this.context, getAuthToken);
16878
16895
  const onStateChange = (clientState) => {
16879
16896
  // unsubscribe when the instance gets disposed
16880
16897
  if (!this) {
@@ -17166,7 +17183,10 @@ const createAzureCommunicationChatAdapter = ({ endpoint: endpointUrl, userId, di
17166
17183
  });
17167
17184
  const chatThreadClient = yield chatClient.getChatThreadClient(threadId);
17168
17185
  yield chatClient.startRealtimeNotifications();
17169
- const adapter = yield createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);
17186
+ /* @conditional-compile-remove(teams-inline-images) */
17187
+ const options = { credential: credential };
17188
+ const adapter = yield createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient,
17189
+ /* @conditional-compile-remove(teams-inline-images) */ options);
17170
17190
  return adapter;
17171
17191
  });
17172
17192
  /**
@@ -17273,9 +17293,14 @@ beforeDispose) => {
17273
17293
  *
17274
17294
  * @public
17275
17295
  */
17276
- const createAzureCommunicationChatAdapterFromClient = (chatClient, chatThreadClient) => __awaiter$f(void 0, void 0, void 0, function* () {
17277
- return new AzureCommunicationChatAdapter(chatClient, chatThreadClient);
17278
- });
17296
+ function createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient,
17297
+ /* @conditional-compile-remove(teams-inline-images) */
17298
+ options) {
17299
+ return __awaiter$f(this, void 0, void 0, function* () {
17300
+ return new AzureCommunicationChatAdapter(chatClient, chatThreadClient,
17301
+ /* @conditional-compile-remove(teams-inline-images) */ options);
17302
+ });
17303
+ }
17279
17304
  const isChatError = (e) => {
17280
17305
  return e['target'] !== undefined && e['innerError'] !== undefined;
17281
17306
  };
@@ -18574,7 +18599,7 @@ const icon$1 = () => React__default['default'].createElement(reactIcons.MoreHori
18574
18599
  * @private
18575
18600
  */
18576
18601
  const MoreButton = (props) => {
18577
- return (React__default['default'].createElement(ControlBarButton, Object.assign({}, props, { labelKey: 'optionsButtonLabelKey', showLabel: props.showLabel, onRenderOnIcon: icon$1, onRenderOffIcon: icon$1, onClick: props.onClick, "data-ui-id": 'call-with-chat-composite-more-button' })));
18602
+ return (React__default['default'].createElement(ControlBarButton, Object.assign({}, props, { labelKey: 'optionsButtonLabelKey', showLabel: props.showLabel, onRenderOnIcon: icon$1, onRenderOffIcon: icon$1, onClick: props.onClick, "data-ui-id": 'common-call-composite-more-button' })));
18578
18603
  };
18579
18604
 
18580
18605
  // Copyright (c) Microsoft Corporation.
@@ -19202,7 +19227,7 @@ const DesktopMoreButton = (props) => {
19202
19227
  styles: buttonFlyoutIncreasedSizeStyles
19203
19228
  } }, element));
19204
19229
  });
19205
- return (React__default['default'].createElement(MoreButton, Object.assign({}, props, { "data-ui-id": "call-with-chat-composite-more-button",
19230
+ return (React__default['default'].createElement(MoreButton, Object.assign({}, props, { "data-ui-id": "common-call-composite-more-button",
19206
19231
  /*@conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
19207
19232
  strings: moreButtonStrings, menuIconProps: { hidden: true }, menuProps: { items: moreButtonContextualMenuItems } })));
19208
19233
  };
@@ -19368,7 +19393,7 @@ const CommonCallControlBar = (props) => {
19368
19393
  : CUSTOM_BUTTON_OPTIONS.MAX_PRIMARY_DESKTOP_CUSTOM_BUTTONS).map((CustomButton, i) => {
19369
19394
  return (React__default['default'].createElement(CustomButton, { key: `primary-custom-button-${i}`, styles: commonButtonStyles, showLabel: options.displayType !== 'compact' }));
19370
19395
  }),
19371
- props.mobileView && (React__default['default'].createElement(MoreButton, { "data-ui-id": "call-with-chat-composite-more-button", strings: moreButtonStrings, onClick: props.onMoreButtonClicked, disabled: props.disableButtonsForLobbyPage })),
19396
+ props.mobileView && (React__default['default'].createElement(MoreButton, { "data-ui-id": "common-call-composite-more-button", strings: moreButtonStrings, onClick: props.onMoreButtonClicked, disabled: props.disableButtonsForLobbyPage })),
19372
19397
  /*@conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ isEnabled$1(options === null || options === void 0 ? void 0 : options.moreButton) &&
19373
19398
  /*@conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ isEnabled$1(options === null || options === void 0 ? void 0 : options.holdButton) &&
19374
19399
  !props.mobileView && (React__default['default'].createElement(DesktopMoreButton, { disableButtonsForHoldScreen: props.disableButtonsForHoldScreen, styles: commonButtonStyles, onClickShowDialpad: props.onClickShowDialpad,
@@ -19383,7 +19408,7 @@ const CommonCallControlBar = (props) => {
19383
19408
  _c.slice(0, CUSTOM_BUTTON_OPTIONS.MAX_SECONDARY_DESKTOP_CUSTOM_BUTTONS).map((CustomButton, i) => {
19384
19409
  return (React__default['default'].createElement(CustomButton, { key: `secondary-custom-button-${i}`, styles: commonButtonStyles, showLabel: options.displayType !== 'compact' }));
19385
19410
  }),
19386
- isEnabled$1(options === null || options === void 0 ? void 0 : options.peopleButton) && (React__default['default'].createElement(PeopleButton, { checked: props.peopleButtonChecked, ariaLabel: peopleButtonStrings === null || peopleButtonStrings === void 0 ? void 0 : peopleButtonStrings.label, showLabel: options.displayType !== 'compact', onClick: props.onPeopleButtonClicked, "data-ui-id": "call-with-chat-composite-people-button", disabled: props.disableButtonsForLobbyPage || isDisabled$2(options.peopleButton), strings: peopleButtonStrings, styles: commonButtonStyles })),
19411
+ isEnabled$1(options === null || options === void 0 ? void 0 : options.peopleButton) && (React__default['default'].createElement(PeopleButton, { checked: props.peopleButtonChecked, ariaLabel: peopleButtonStrings === null || peopleButtonStrings === void 0 ? void 0 : peopleButtonStrings.label, showLabel: options.displayType !== 'compact', onClick: props.onPeopleButtonClicked, "data-ui-id": "common-call-composite-people-button", disabled: props.disableButtonsForLobbyPage || isDisabled$2(options.peopleButton), strings: peopleButtonStrings, styles: commonButtonStyles })),
19387
19412
  isEnabled$1(options === null || options === void 0 ? void 0 : options.chatButton) && chatButton)))))));
19388
19413
  };
19389
19414
  const desktopButtonContainerStyle = {
@@ -20536,6 +20561,7 @@ const MoreDrawer = (props) => {
20536
20561
  if (drawerSelectionOptions !== false && isEnabled(drawerSelectionOptions === null || drawerSelectionOptions === void 0 ? void 0 : drawerSelectionOptions.peopleButton)) {
20537
20562
  drawerMenuItems.push({
20538
20563
  itemKey: 'people',
20564
+ id: 'call-composite-drawer-people-button',
20539
20565
  text: props.strings.peopleButtonLabel,
20540
20566
  iconProps: { iconName: 'MoreDrawerPeople' },
20541
20567
  onItemClick: props.onPeopleButtonClicked,
@@ -20822,7 +20848,7 @@ const CallArrangement = (props) => {
20822
20848
  /* @conditional-compile-remove(one-to-n-calling) */
20823
20849
  peopleButtonChecked: activePane === 'people',
20824
20850
  /* @conditional-compile-remove(one-to-n-calling) */
20825
- onPeopleButtonClicked: togglePeoplePane }))) : (React__default['default'].createElement(CommonCallControlBar, Object.assign({}, props.callControlProps, { callAdapter: adapter, mobileView: props.mobileView, disableButtonsForLobbyPage: isInLobby, peopleButtonChecked: activePane === 'people', onPeopleButtonClicked: togglePeoplePane, onMoreButtonClicked: onMoreButtonClicked,
20851
+ onPeopleButtonClicked: togglePeoplePane }))) : (React__default['default'].createElement(CommonCallControlBar, Object.assign({}, props.callControlProps, { callControls: props.callControlProps.options, callAdapter: adapter, mobileView: props.mobileView, disableButtonsForLobbyPage: isInLobby, peopleButtonChecked: activePane === 'people', onPeopleButtonClicked: togglePeoplePane, onMoreButtonClicked: onMoreButtonClicked,
20826
20852
  /* @conditional-compile-remove(video-background-effects) */
20827
20853
  onShowVideoEffectsPicker: setShowVideoEffectsPane }))))),
20828
20854
  ((_d = props.callControlProps) === null || _d === void 0 ? void 0 : _d.options) !== false && showDrawer && (React__default['default'].createElement(react.Stack, { styles: drawerContainerStylesValue },