@azure/communication-react 1.16.0-alpha-202405132107 → 1.16.0-alpha-202405140014
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/communication-react.d.ts +96 -113
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DWzf8cuK.js → ChatMessageComponentAsRichTextEditBox-BZZrW3na.js} +23 -14
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-BZZrW3na.js.map +1 -0
- package/dist/dist-cjs/communication-react/{index-W6o1SuXO.js → index-m47fKkX4.js} +647 -869
- package/dist/dist-cjs/communication-react/index-m47fKkX4.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/common.d.ts +74 -0
- package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/index.d.ts +2 -0
- package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +3 -6
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +43 -26
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +0 -2
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +5 -3
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/{AttachmentCard.d.ts → Attachment/AttachmentCard.d.ts} +3 -2
- package/dist/dist-esm/react-components/src/components/{AttachmentCard.js → Attachment/AttachmentCard.js} +17 -16
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.js → Attachment/AttachmentCardGroup.js} +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.d.ts → Attachment/AttachmentDownloadCards.d.ts} +3 -2
- package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.js → Attachment/AttachmentDownloadCards.js} +2 -2
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.d.ts → Attachment/AttachmentUploadCards.d.ts} +3 -3
- package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.js → Attachment/AttachmentUploadCards.js} +3 -3
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/Caption.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +21 -12
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +25 -14
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +6 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +31 -13
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +6 -7
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +30 -23
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +43 -27
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.d.ts +4 -4
- package/dist/dist-esm/react-components/src/components/SendBox.js +42 -17
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +6 -6
- package/dist/dist-esm/react-components/src/components/index.js +3 -3
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +4 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +0 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +2 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +27 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +14 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +6 -5
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js +18 -18
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +38 -19
- package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +18 -18
- package/dist/dist-esm/react-components/src/types/Attachment.d.ts +21 -49
- package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +3 -14
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +5 -76
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -23
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +5 -11
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +22 -40
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +0 -9
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +1 -5
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +73 -15
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +3 -16
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +29 -89
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +6 -19
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts +0 -5
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +0 -31
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +66 -61
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +33 -44
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +1 -8
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +22 -10
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js.map +1 -1
- package/package.json +1 -1
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DWzf8cuK.js.map +0 -1
- package/dist/dist-cjs/communication-react/index-W6o1SuXO.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCard.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCardGroup.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentDownloadCards.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.d.ts +0 -48
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js +0 -188
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +0 -6
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js +0 -11
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.d.ts +0 -29
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +0 -15
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +0 -1
- /package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.d.ts → Attachment/AttachmentCardGroup.d.ts} +0 -0
@@ -217,13 +217,26 @@ export declare type AreParamEqual<A extends (props: any) => JSX.Element | undefi
|
|
217
217
|
*/
|
218
218
|
export declare type AreTypeEqual<A, B> = A extends B ? (B extends A ? true : false) : false;
|
219
219
|
|
220
|
+
/**
|
221
|
+
* @beta
|
222
|
+
* A callback function that defines what actions user can perform on an attachment.
|
223
|
+
* By default, the UI library would have default actions that opens attachment URL in a new tab.
|
224
|
+
* You can override the default actions or add new actions by providing this callback function.
|
225
|
+
* Moreover, you can also return dynamic actions based on the properties in {@link AttachmentMetadata} and/or {@link ChatMessage}.
|
226
|
+
*
|
227
|
+
* @param attachment - The file attachment that user is trying to perform actions on.
|
228
|
+
* @param message - The chat message that contains this attachment.
|
229
|
+
* @returns A list of {@link AttachmentMenuAction} that defines the type of actions user can perform on the attachment.
|
230
|
+
*/
|
231
|
+
export declare type AttachmentActionHandler = (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];
|
232
|
+
|
220
233
|
/**
|
221
234
|
* @beta
|
222
235
|
*
|
223
236
|
* Attachment download options defines the list of actions that can be performed on an attachment.
|
224
237
|
*/
|
225
238
|
export declare interface AttachmentDownloadOptions {
|
226
|
-
actionsForAttachment:
|
239
|
+
actionsForAttachment: AttachmentActionHandler;
|
227
240
|
}
|
228
241
|
|
229
242
|
/**
|
@@ -239,17 +252,14 @@ export declare interface AttachmentMenuAction {
|
|
239
252
|
}
|
240
253
|
|
241
254
|
/**
|
242
|
-
*
|
255
|
+
* Data model that represents a chat message attachment
|
256
|
+
* where it contains an ID to uniquely identify the attachment,
|
257
|
+
* a name that represents the name of file, and
|
258
|
+
* a URL to download the attachment.
|
243
259
|
*
|
244
260
|
* @beta
|
245
261
|
*/
|
246
262
|
export declare interface AttachmentMetadata {
|
247
|
-
/**
|
248
|
-
* Extension hint, useful for rendering a specific icon.
|
249
|
-
* An unknown or empty extension will be rendered as a generic icon.
|
250
|
-
* Example: `pdf`
|
251
|
-
*/
|
252
|
-
extension?: string;
|
253
263
|
/**
|
254
264
|
* Unique ID of the attachment.
|
255
265
|
*/
|
@@ -261,15 +271,33 @@ export declare interface AttachmentMetadata {
|
|
261
271
|
/**
|
262
272
|
* Download URL for the attachment.
|
263
273
|
*/
|
264
|
-
url
|
274
|
+
url: string;
|
265
275
|
}
|
266
276
|
|
267
277
|
/**
|
268
|
-
*
|
278
|
+
* Data model that represents a chat message attachment being uploaded
|
279
|
+
* where it contains an ID to uniquely identify the attachment,
|
280
|
+
* a name that represents the name of file,
|
281
|
+
* an optional URL to download the attachment,
|
282
|
+
* an optional progress value between 0 and 1 indicating the progress of the upload, and
|
283
|
+
* an optional error object that contains error message would be shown to the user.
|
284
|
+
*
|
269
285
|
*
|
270
286
|
* @beta
|
271
287
|
*/
|
272
|
-
export declare interface
|
288
|
+
export declare interface AttachmentMetadataInProgress {
|
289
|
+
/**
|
290
|
+
* Unique ID of the attachment.
|
291
|
+
*/
|
292
|
+
id: string;
|
293
|
+
/**
|
294
|
+
* Attachment name to be displayed.
|
295
|
+
*/
|
296
|
+
name: string;
|
297
|
+
/**
|
298
|
+
* Download URL for the attachment.
|
299
|
+
*/
|
300
|
+
url?: string;
|
273
301
|
/**
|
274
302
|
* A number between 0 and 1 indicating the progress of the upload.
|
275
303
|
*/
|
@@ -315,19 +343,6 @@ export declare type AttachmentRemovalHandler = (attachmentId: string) => void;
|
|
315
343
|
*/
|
316
344
|
export declare type AttachmentSelectionHandler = (attachmentUploads: AttachmentUploadTask[]) => void;
|
317
345
|
|
318
|
-
/**
|
319
|
-
* @internal
|
320
|
-
*/
|
321
|
-
export declare interface _AttachmentUploadAdapter {
|
322
|
-
registerActiveUploads: (files: File[]) => AttachmentUploadTask[];
|
323
|
-
registerCompletedUploads: (metadata: AttachmentMetadata[]) => AttachmentUploadTask[];
|
324
|
-
clearUploads: () => void;
|
325
|
-
cancelUpload: (id: string) => void;
|
326
|
-
updateUploadProgress: (id: string, progress: number) => void;
|
327
|
-
updateUploadStatusMessage: (id: string, errorMessage: string) => void;
|
328
|
-
updateUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
|
329
|
-
}
|
330
|
-
|
331
346
|
/**
|
332
347
|
* @beta
|
333
348
|
*/
|
@@ -363,12 +378,6 @@ export declare interface AttachmentUploadOptions {
|
|
363
378
|
handleAttachmentRemoval?: AttachmentRemovalHandler;
|
364
379
|
}
|
365
380
|
|
366
|
-
/**
|
367
|
-
* A record containing {@link AttachmentMetadata} mapped to unique attachment upload task ids.
|
368
|
-
* @internal
|
369
|
-
*/
|
370
|
-
export declare type _AttachmentUploadsUiState = Record<string, AttachmentMetadataWithProgress>;
|
371
|
-
|
372
381
|
/**
|
373
382
|
* A upload task represents and manages an attachment that is being uploaded.
|
374
383
|
* When using the Composite, an attachment upload task is created for each file user is selected to upload.
|
@@ -3329,13 +3338,7 @@ export declare interface CallWithChatAdapterManagement {
|
|
3329
3338
|
*
|
3330
3339
|
* @public
|
3331
3340
|
*/
|
3332
|
-
sendMessage(content: string, options?: SendMessageOptions): Promise<void>;
|
3333
|
-
/**
|
3334
|
-
* Send a message with attachments in the chat thread.
|
3335
|
-
*
|
3336
|
-
* @beta
|
3337
|
-
*/
|
3338
|
-
sendMessageWithAttachments(content: string, attachments: AttachmentMetadata[]): Promise<void>;
|
3341
|
+
sendMessage(content: string, options?: SendMessageOptions | /* @conditional-compile-remove(attachment-upload) */ MessageOptions): Promise<void>;
|
3339
3342
|
/**
|
3340
3343
|
* Send a read receipt for a message.
|
3341
3344
|
*
|
@@ -3353,7 +3356,7 @@ export declare interface CallWithChatAdapterManagement {
|
|
3353
3356
|
*
|
3354
3357
|
* @public
|
3355
3358
|
*/
|
3356
|
-
updateMessage(messageId: string, content: string,
|
3359
|
+
updateMessage(messageId: string, content: string, options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions): Promise<void>;
|
3357
3360
|
/**
|
3358
3361
|
* Delete a message in the thread.
|
3359
3362
|
*
|
@@ -3369,20 +3372,6 @@ export declare interface CallWithChatAdapterManagement {
|
|
3369
3372
|
* @public
|
3370
3373
|
*/
|
3371
3374
|
loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>;
|
3372
|
-
/** @internal */
|
3373
|
-
registerActiveUploads: (files: File[]) => AttachmentUploadTask[];
|
3374
|
-
/** @internal */
|
3375
|
-
registerCompletedUploads: (metadata: AttachmentMetadata[]) => AttachmentUploadTask[];
|
3376
|
-
/** @internal */
|
3377
|
-
clearUploads: () => void;
|
3378
|
-
/** @internal */
|
3379
|
-
cancelUpload: (id: string) => void;
|
3380
|
-
/** @internal */
|
3381
|
-
updateUploadProgress: (id: string, progress: number) => void;
|
3382
|
-
/** @internal */
|
3383
|
-
updateUploadStatusMessage: (id: string, errorMessage: string) => void;
|
3384
|
-
/** @internal */
|
3385
|
-
updateUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
|
3386
3375
|
/** @public */
|
3387
3376
|
downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;
|
3388
3377
|
/** @public */
|
@@ -3567,14 +3556,6 @@ export declare interface CallWithChatAdapterUiState {
|
|
3567
3556
|
* @public
|
3568
3557
|
*/
|
3569
3558
|
page: CallCompositePage;
|
3570
|
-
/**
|
3571
|
-
* Files being uploaded by a user in the current thread.
|
3572
|
-
* Should be set to null once the upload is complete.
|
3573
|
-
* Array of type {@link _AttachmentUploadsUiState}
|
3574
|
-
*
|
3575
|
-
* @internal
|
3576
|
-
*/
|
3577
|
-
_attachmentUploads?: _AttachmentUploadsUiState;
|
3578
3559
|
/**
|
3579
3560
|
* State to track whether the end user has opted in to using a
|
3580
3561
|
* out of date version of a supported browser. Allows the user
|
@@ -4551,7 +4532,7 @@ export declare type CaptionsReceivedListener = (event: {
|
|
4551
4532
|
*
|
4552
4533
|
* @public
|
4553
4534
|
*/
|
4554
|
-
export declare type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable_2 & ChatAdapterSubscribers
|
4535
|
+
export declare type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable_2 & ChatAdapterSubscribers;
|
4555
4536
|
|
4556
4537
|
/**
|
4557
4538
|
* {@link ChatAdapter} state.
|
@@ -4654,12 +4635,9 @@ export declare interface ChatAdapterThreadManagement {
|
|
4654
4635
|
fetchInitialData(): Promise<void>;
|
4655
4636
|
/**
|
4656
4637
|
* Send a message in the thread.
|
4638
|
+
* Please note that SendMessageOptions is being deprecated, please use MessageOptions instead.
|
4657
4639
|
*/
|
4658
|
-
sendMessage(content: string, options?: SendMessageOptions): Promise<void>;
|
4659
|
-
/**
|
4660
|
-
* Send a message with attachments in the chat thread.
|
4661
|
-
*/
|
4662
|
-
sendMessageWithAttachments(content: string, attachments: AttachmentMetadata[]): Promise<void>;
|
4640
|
+
sendMessage(content: string, options?: SendMessageOptions | /* @conditional-compile-remove(attachment-upload) */ MessageOptions): Promise<void>;
|
4663
4641
|
/**
|
4664
4642
|
* Send a read receipt for a message.
|
4665
4643
|
*/
|
@@ -4678,10 +4656,9 @@ export declare interface ChatAdapterThreadManagement {
|
|
4678
4656
|
setTopic(topicName: string): Promise<void>;
|
4679
4657
|
/**
|
4680
4658
|
* Update a message content.
|
4659
|
+
* Please note that metadata is being deprecated, please use MessageOptions.metadata instead.
|
4681
4660
|
*/
|
4682
|
-
updateMessage(messageId: string, content: string,
|
4683
|
-
attachmentMetadata?: AttachmentMetadata[];
|
4684
|
-
}): Promise<void>;
|
4661
|
+
updateMessage(messageId: string, content: string, options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions): Promise<void>;
|
4685
4662
|
/**
|
4686
4663
|
* Delete a message in the thread.
|
4687
4664
|
*/
|
@@ -4711,14 +4688,6 @@ export declare interface ChatAdapterThreadManagement {
|
|
4711
4688
|
*/
|
4712
4689
|
export declare type ChatAdapterUiState = {
|
4713
4690
|
error?: Error;
|
4714
|
-
/**
|
4715
|
-
* Attachments being uploaded by a user in the current thread.
|
4716
|
-
* Should be set to null once the upload is complete.
|
4717
|
-
* Array of type {@link _AttachmentUploadsUiState}
|
4718
|
-
*
|
4719
|
-
* @internal
|
4720
|
-
*/
|
4721
|
-
_attachmentUploads?: _AttachmentUploadsUiState;
|
4722
4691
|
};
|
4723
4692
|
|
4724
4693
|
/**
|
@@ -4975,16 +4944,13 @@ export declare type ChatErrorTarget = 'ChatClient.createChatThread' | 'ChatClien
|
|
4975
4944
|
* @public
|
4976
4945
|
*/
|
4977
4946
|
export declare type ChatHandlers = {
|
4978
|
-
onSendMessage: (content: string, options?: SendMessageOptions) => Promise<void>;
|
4947
|
+
onSendMessage: (content: string, options?: SendMessageOptions | /* @conditional-compile-remove(attachment-upload) */ MessageOptions) => Promise<void>;
|
4979
4948
|
onMessageSeen: (chatMessageId: string) => Promise<void>;
|
4980
4949
|
onTyping: () => Promise<void>;
|
4981
4950
|
onRemoveParticipant: (userId: string) => Promise<void>;
|
4982
4951
|
updateThreadTopicName: (topicName: string) => Promise<void>;
|
4983
4952
|
onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;
|
4984
|
-
onUpdateMessage: (messageId: string, content: string, options?:
|
4985
|
-
metadata?: Record<string, string>;
|
4986
|
-
attachmentMetadata?: AttachmentMetadata[];
|
4987
|
-
}) => Promise<void>;
|
4953
|
+
onUpdateMessage: (messageId: string, content: string, options?: MessageOptions) => Promise<void>;
|
4988
4954
|
onDeleteMessage: (messageId: string) => Promise<void>;
|
4989
4955
|
};
|
4990
4956
|
|
@@ -8107,6 +8073,18 @@ export declare type MessageDeletedListener = MessageReceivedListener;
|
|
8107
8073
|
*/
|
8108
8074
|
export declare type MessageEditedListener = MessageReceivedListener;
|
8109
8075
|
|
8076
|
+
/**
|
8077
|
+
* @beta
|
8078
|
+
* Message option that defines properties that can be set when
|
8079
|
+
* sending or updating a chat message.
|
8080
|
+
* @property metadata - Metadata that contains additional information about the message to be passed betrween 2 users.
|
8081
|
+
* @property attachments - Attachments that contains file attachments attached to the message.
|
8082
|
+
*/
|
8083
|
+
export declare type MessageOptions = {
|
8084
|
+
metadata?: Record<string, string>;
|
8085
|
+
attachments?: AttachmentMetadata[];
|
8086
|
+
};
|
8087
|
+
|
8110
8088
|
/**
|
8111
8089
|
* Props to render a single message.
|
8112
8090
|
*
|
@@ -8122,7 +8100,7 @@ export declare type MessageProps = {
|
|
8122
8100
|
/**
|
8123
8101
|
* Strings from parent MessageThread component
|
8124
8102
|
*/
|
8125
|
-
strings: MessageThreadStrings
|
8103
|
+
strings: MessageThreadStrings & /* @conditional-compile-remove(rich-text-editor) */ Partial<RichTextStrings>;
|
8126
8104
|
/**
|
8127
8105
|
* Custom CSS styles for chat message container.
|
8128
8106
|
*/
|
@@ -8384,7 +8362,7 @@ export declare type MessageThreadProps = {
|
|
8384
8362
|
* Optional callback to render attachments in the message component.
|
8385
8363
|
* @beta
|
8386
8364
|
*/
|
8387
|
-
onRenderAttachmentDownloads?: (
|
8365
|
+
onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;
|
8388
8366
|
/**
|
8389
8367
|
* Optional callback to edit a message.
|
8390
8368
|
*
|
@@ -9700,11 +9678,11 @@ export declare interface RichTextSendBoxProps {
|
|
9700
9678
|
*/
|
9701
9679
|
systemMessage?: string;
|
9702
9680
|
/**
|
9703
|
-
* Optional array of type {@link
|
9681
|
+
* Optional array of type {@link AttachmentMetadataInProgress}
|
9704
9682
|
* to render attachments being uploaded in the SendBox.
|
9705
9683
|
* @beta
|
9706
9684
|
*/
|
9707
|
-
|
9685
|
+
attachments?: AttachmentMetadataInProgress[];
|
9708
9686
|
/**
|
9709
9687
|
* enumerable to determine if the input box has focus on render or not.
|
9710
9688
|
* When undefined nothing has focus on render
|
@@ -9719,7 +9697,7 @@ export declare interface RichTextSendBoxProps {
|
|
9719
9697
|
/**
|
9720
9698
|
* Callback function used when the send button is clicked.
|
9721
9699
|
*/
|
9722
|
-
onSendMessage: (content: string) => Promise<void>;
|
9700
|
+
onSendMessage: (content: string, options?: MessageOptions) => Promise<void>;
|
9723
9701
|
/**
|
9724
9702
|
* Optional callback called when user is typing
|
9725
9703
|
*/
|
@@ -9731,39 +9709,47 @@ export declare interface RichTextSendBoxProps {
|
|
9731
9709
|
*
|
9732
9710
|
* @beta
|
9733
9711
|
*/
|
9734
|
-
export declare interface RichTextSendBoxStrings extends SendBoxStrings {
|
9712
|
+
export declare interface RichTextSendBoxStrings extends RichTextStrings, SendBoxStrings {
|
9713
|
+
}
|
9714
|
+
|
9715
|
+
/**
|
9716
|
+
* Strings of RichText that can be overridden.
|
9717
|
+
*
|
9718
|
+
* @beta
|
9719
|
+
*/
|
9720
|
+
export declare interface RichTextStrings {
|
9735
9721
|
/**
|
9736
9722
|
* Tooltip text for the bold button.
|
9737
9723
|
*/
|
9738
|
-
|
9724
|
+
richTextBoldTooltip: string;
|
9739
9725
|
/**
|
9740
9726
|
* Tooltip text for the italic button.
|
9741
9727
|
*/
|
9742
|
-
|
9728
|
+
richTextItalicTooltip: string;
|
9743
9729
|
/**
|
9744
9730
|
* Tooltip text for the underline button.
|
9745
9731
|
*/
|
9746
|
-
|
9732
|
+
richTextUnderlineTooltip: string;
|
9747
9733
|
/**
|
9748
9734
|
* Tooltip text for the bullet list button.
|
9749
9735
|
*/
|
9750
|
-
|
9736
|
+
richTextBulletListTooltip: string;
|
9751
9737
|
/**
|
9752
9738
|
* Tooltip text for the number list button.
|
9753
9739
|
*/
|
9754
|
-
|
9740
|
+
richTextNumberListTooltip: string;
|
9755
9741
|
/**
|
9756
9742
|
* Tooltip text for the increase indent button.
|
9757
9743
|
*/
|
9758
|
-
|
9744
|
+
richTextIncreaseIndentTooltip: string;
|
9759
9745
|
/**
|
9760
9746
|
* Tooltip text for the decrease indent button.
|
9761
9747
|
*/
|
9762
|
-
|
9748
|
+
richTextDecreaseIndentTooltip: string;
|
9763
9749
|
/**
|
9764
9750
|
* Tooltip text insert table button.
|
9765
9751
|
*/
|
9766
|
-
|
9752
|
+
richTextInsertTableTooltip: string;
|
9767
9753
|
/**
|
9768
9754
|
* Tooltip text for the rich text format button button.
|
9769
9755
|
*/
|
@@ -9771,43 +9757,43 @@ export declare interface RichTextSendBoxStrings extends SendBoxStrings {
|
|
9771
9757
|
/**
|
9772
9758
|
* Text for the insert menu item.
|
9773
9759
|
*/
|
9774
|
-
|
9760
|
+
richTextInsertRowOrColumnMenu: string;
|
9775
9761
|
/**
|
9776
9762
|
* Title for the insert table menu.
|
9777
9763
|
*/
|
9778
|
-
|
9764
|
+
richTextInsertTableMenuTitle: string;
|
9779
9765
|
/**
|
9780
9766
|
* Text for the insert menu item to insert row above the current selection.
|
9781
9767
|
*/
|
9782
|
-
|
9768
|
+
richTextInsertRowAboveMenu: string;
|
9783
9769
|
/**
|
9784
9770
|
* Text for the insert menu item to insert row below the current selection.
|
9785
9771
|
*/
|
9786
|
-
|
9772
|
+
richTextInsertRowBelowMenu: string;
|
9787
9773
|
/**
|
9788
9774
|
* Text for the insert menu item to insert column to the left from the current selection.
|
9789
9775
|
*/
|
9790
|
-
|
9776
|
+
richTextInsertColumnLeftMenu: string;
|
9791
9777
|
/**
|
9792
9778
|
* Text for the insert menu item to insert column to the right from the current selection.
|
9793
9779
|
*/
|
9794
|
-
|
9780
|
+
richTextInsertColumnRightMenu: string;
|
9795
9781
|
/**
|
9796
9782
|
* Text for the delete row or column menu.
|
9797
9783
|
*/
|
9798
|
-
|
9784
|
+
richTextDeleteRowOrColumnMenu: string;
|
9799
9785
|
/**
|
9800
9786
|
* Text for the delete column menu.
|
9801
9787
|
*/
|
9802
|
-
|
9788
|
+
richTextDeleteColumnMenu: string;
|
9803
9789
|
/**
|
9804
9790
|
* Text for the delete row menu.
|
9805
9791
|
*/
|
9806
|
-
|
9792
|
+
richTextDeleteRowMenu: string;
|
9807
9793
|
/**
|
9808
9794
|
* Text for the delete table menu.
|
9809
9795
|
*/
|
9810
|
-
|
9796
|
+
richTextDeleteTableMenu: string;
|
9811
9797
|
}
|
9812
9798
|
|
9813
9799
|
/**
|
@@ -9912,7 +9898,7 @@ export declare interface SendBoxProps {
|
|
9912
9898
|
/**
|
9913
9899
|
* Optional override behavior on send button click
|
9914
9900
|
*/
|
9915
|
-
onSendMessage?: (content: string) => Promise<void>;
|
9901
|
+
onSendMessage?: (content: string, options?: MessageOptions) => Promise<void>;
|
9916
9902
|
/**
|
9917
9903
|
* Optional props needed to lookup suggestions in the mention scenario.
|
9918
9904
|
* @beta
|
@@ -9962,11 +9948,11 @@ export declare interface SendBoxProps {
|
|
9962
9948
|
*/
|
9963
9949
|
onRenderAttachmentUploads?: () => JSX.Element;
|
9964
9950
|
/**
|
9965
|
-
* Optional array of type {@link
|
9951
|
+
* Optional array of type {@link AttachmentMetadataInProgress}
|
9966
9952
|
* to render attachments being uploaded in the SendBox.
|
9967
9953
|
* @beta
|
9968
9954
|
*/
|
9969
|
-
|
9955
|
+
attachments?: AttachmentMetadataInProgress[];
|
9970
9956
|
/**
|
9971
9957
|
* Optional callback to remove the attachment upload before sending by clicking on
|
9972
9958
|
* cancel icon.
|
@@ -11016,10 +11002,7 @@ export declare interface UnsupportedOperatingSystemStrings {
|
|
11016
11002
|
* @public
|
11017
11003
|
* Callback function run when a message is updated.
|
11018
11004
|
*/
|
11019
|
-
export declare type UpdateMessageCallback = (messageId: string, content: string, options?:
|
11020
|
-
metadata?: Record<string, string>;
|
11021
|
-
attachmentMetadata?: AttachmentMetadata[];
|
11022
|
-
}) => Promise<void>;
|
11005
|
+
export declare type UpdateMessageCallback = (messageId: string, content: string, options?: MessageOptions) => Promise<void>;
|
11023
11006
|
|
11024
11007
|
/**
|
11025
11008
|
* A custom React hook to simplify the creation of {@link CallAdapter}.
|
@@ -4,7 +4,7 @@ var react = require('@fluentui/react');
|
|
4
4
|
var reactChat = require('@fluentui-contrib/react-chat');
|
5
5
|
var reactComponents = require('@fluentui/react-components');
|
6
6
|
require('@azure/communication-common');
|
7
|
-
var index = require('./index-
|
7
|
+
var index = require('./index-m47fKkX4.js');
|
8
8
|
var React = require('react');
|
9
9
|
require('reselect');
|
10
10
|
require('@azure/communication-calling');
|
@@ -41,10 +41,11 @@ require('@azure/communication-calling-effects');
|
|
41
41
|
* @private
|
42
42
|
*/
|
43
43
|
const ChatMessageComponentAsRichTextEditBox = (props) => {
|
44
|
+
var _a;
|
44
45
|
const { onCancel, onSubmit, strings, message } = props;
|
45
46
|
const [textValue, setTextValue] = React.useState(message.content || '');
|
46
47
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
47
|
-
const [attachmentMetadata,
|
48
|
+
const [attachmentMetadata, handleAttachmentAction] = React.useReducer(index.attachmentMetadataReducer, (_a = index.getMessageWithAttachmentMetadata(message)) !== null && _a !== void 0 ? _a : []);
|
48
49
|
const editTextFieldRef = React.useRef(null);
|
49
50
|
const theme = index.useTheme();
|
50
51
|
const messageState = index.getMessageState(textValue,
|
@@ -75,17 +76,18 @@ const ChatMessageComponentAsRichTextEditBox = (props) => {
|
|
75
76
|
onCancel && onCancel(message.messageId);
|
76
77
|
}, id: 'dismissIconWrapper', "data-testId": strings.editBoxCancelButton }),
|
77
78
|
React.createElement(index.InputBoxButton, { className: index.richTextActionButtonsStyle, ariaLabel: strings.editBoxSubmitButton, tooltipContent: strings.editBoxSubmitButton, onRenderIcon: onRenderThemedSubmitIcon, onClick: (e) => {
|
79
|
+
// it's very important to pass an empty attachment here
|
80
|
+
// so when user remvoes all attachments, UI can reflect it instantly
|
81
|
+
// if you set it to undefined, the attachments pre-edited would still be there
|
82
|
+
// until edit message event is received
|
78
83
|
submitEnabled &&
|
79
|
-
onSubmit(textValue,
|
80
|
-
/* @conditional-compile-remove(attachment-upload) */ {
|
81
|
-
attachmentMetadata
|
82
|
-
});
|
84
|
+
onSubmit(textValue, /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata);
|
83
85
|
e.stopPropagation();
|
84
86
|
}, id: 'submitIconWrapper', "data-testId": strings.editBoxSubmitButton })));
|
85
87
|
}, [
|
86
|
-
/* @conditional-compile-remove(attachment-upload) */
|
88
|
+
/* @conditional-compile-remove(attachment-upload) */
|
89
|
+
attachmentMetadata,
|
87
90
|
message.messageId,
|
88
|
-
message.metadata,
|
89
91
|
onCancel,
|
90
92
|
onRenderThemedCancelIcon,
|
91
93
|
onRenderThemedSubmitIcon,
|
@@ -97,17 +99,24 @@ const ChatMessageComponentAsRichTextEditBox = (props) => {
|
|
97
99
|
]);
|
98
100
|
const richTextLocaleStrings = React.useMemo(() => {
|
99
101
|
/* @conditional-compile-remove(rich-text-editor) */
|
100
|
-
return locale.richTextSendBox;
|
101
|
-
}, [
|
102
|
+
return Object.assign(Object.assign({}, locale.richTextSendBox), strings);
|
103
|
+
}, [
|
104
|
+
/* @conditional-compile-remove(rich-text-editor) */ locale.richTextSendBox,
|
105
|
+
/* @conditional-compile-remove(rich-text-editor) */ strings,
|
106
|
+
locale.sendBox
|
107
|
+
]);
|
102
108
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
103
109
|
const onCancelAttachmentUpload = React.useCallback((attachmentId) => {
|
104
|
-
|
105
|
-
|
110
|
+
// edit box only capable of removing attachments
|
111
|
+
// we need to expand attachment actions
|
112
|
+
// if we want to support more actions e.g. add
|
113
|
+
handleAttachmentAction({ type: 'remove', id: attachmentId });
|
114
|
+
}, []);
|
106
115
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
107
116
|
const onRenderAttachmentUploads = React.useCallback(() => {
|
108
117
|
return (React.createElement(react.Stack, { className: index.attachmentUploadCardsStyles },
|
109
118
|
React.createElement(index.FluentV9ThemeProvider, { v8Theme: theme },
|
110
|
-
React.createElement(index._AttachmentUploadCards, {
|
119
|
+
React.createElement(index._AttachmentUploadCards, { attachments: attachmentMetadata, onCancelAttachmentUpload: onCancelAttachmentUpload }))));
|
111
120
|
}, [attachmentMetadata, onCancelAttachmentUpload, theme]);
|
112
121
|
const getContent = () => {
|
113
122
|
return (React.createElement(react.Stack, { className: react.mergeStyles(index.editBoxWidthStyles) },
|
@@ -126,4 +135,4 @@ const ChatMessageComponentAsRichTextEditBox = (props) => {
|
|
126
135
|
|
127
136
|
exports.ChatMessageComponentAsRichTextEditBox = ChatMessageComponentAsRichTextEditBox;
|
128
137
|
exports.default = ChatMessageComponentAsRichTextEditBox;
|
129
|
-
//# sourceMappingURL=ChatMessageComponentAsRichTextEditBox-
|
138
|
+
//# sourceMappingURL=ChatMessageComponentAsRichTextEditBox-BZZrW3na.js.map
|
package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-BZZrW3na.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ChatMessageComponentAsRichTextEditBox-BZZrW3na.js","sources":["../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.tsx"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../../theming';\nimport React, { useCallback, useMemo, useState } from 'react';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useReducer } from 'react';\nimport { editBoxWidthStyles, richTextEditBoxActionButtonIcon } from '../../styles/EditBox.styles';\nimport { InputBoxButton } from '../../InputBoxButton';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { useChatMyMessageStyles } from '../../styles/MessageThread.styles';\nimport { ChatMessage } from '../../../types';\nimport { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { useChatMessageRichTextEditContainerStyles } from '../../styles/ChatMessageComponent.styles';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';\nimport {\n getMessageState,\n onRenderCancelIcon,\n onRenderSubmitIcon\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(attachment-upload) */\nimport {\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport { RichTextEditorComponentRef } from '../../RichTextEditor/RichTextEditor';\nimport { RichTextInputBoxComponent } from '../../RichTextEditor/RichTextInputBoxComponent';\nimport { editBoxRichTextEditorStyle, richTextActionButtonsStyle } from '../../styles/RichTextEditor.styles';\nimport { RichTextSendBoxErrors } from '../../RichTextEditor/RichTextSendBoxErrors';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { FluentV9ThemeProvider } from '../../../theming/FluentV9ThemeProvider';\n/* @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadCardsStyles } from '../../styles/SendBox.styles';\n\n/** @private */\nexport type ChatMessageComponentAsRichTextEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsRichTextEditBox = (\n props: ChatMessageComponentAsRichTextEditBoxProps\n): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentMetadata, handleAttachmentAction] = useReducer(\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata(message) ?? []\n );\n const editTextFieldRef = React.useRef<RichTextEditorComponentRef>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata ?? []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageRichTextEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n const locale = useLocale().strings;\n\n const setText = (newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(richTextEditBoxActionButtonIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const actionButtons = useMemo(() => {\n return (\n <Stack horizontal>\n <InputBoxButton\n className={richTextActionButtonsStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n data-testId={strings.editBoxCancelButton}\n />\n <InputBoxButton\n className={richTextActionButtonsStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n // it's very important to pass an empty attachment here\n // so when user remvoes all attachments, UI can reflect it instantly\n // if you set it to undefined, the attachments pre-edited would still be there\n // until edit message event is received\n submitEnabled &&\n onSubmit(textValue, /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata);\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n data-testId={strings.editBoxSubmitButton}\n />\n </Stack>\n );\n }, [\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata,\n message.messageId,\n onCancel,\n onRenderThemedCancelIcon,\n onRenderThemedSubmitIcon,\n onSubmit,\n strings.editBoxCancelButton,\n strings.editBoxSubmitButton,\n submitEnabled,\n textValue\n ]);\n const richTextLocaleStrings = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor) */\n return { ...locale.richTextSendBox, ...strings };\n return locale.sendBox;\n }, [\n /* @conditional-compile-remove(rich-text-editor) */ locale.richTextSendBox,\n /* @conditional-compile-remove(rich-text-editor) */ strings,\n locale.sendBox\n ]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onCancelAttachmentUpload = useCallback((attachmentId: string) => {\n // edit box only capable of removing attachments\n // we need to expand attachment actions\n // if we want to support more actions e.g. add\n handleAttachmentAction({ type: 'remove', id: attachmentId });\n }, []);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards\n attachments={attachmentMetadata}\n onCancelAttachmentUpload={onCancelAttachmentUpload}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [attachmentMetadata, onCancelAttachmentUpload, theme]);\n\n const getContent = (): JSX.Element => {\n return (\n <Stack className={mergeStyles(editBoxWidthStyles)}>\n <RichTextSendBoxErrors textTooLongMessage={textTooLongMessage} systemMessage={message.failureReason} />\n <RichTextInputBoxComponent\n placeholderText={strings.editBoxPlaceholderText}\n onChange={setText}\n editorComponentRef={editTextFieldRef}\n initialContent={message.content}\n content={textValue}\n strings={richTextLocaleStrings}\n disabled={false}\n actionComponents={actionButtons}\n richTextEditorStyleProps={editBoxRichTextEditorStyle}\n isHorizontalLayoutDisabled={true}\n /* @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentUploads={onRenderAttachmentUploads}\n />\n </Stack>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: chatMyMessageStyles.root\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n\nexport default ChatMessageComponentAsRichTextEditBox;\n"],"names":["useState","useReducer","attachmentMetadataReducer","getMessageWithAttachmentMetadata","useTheme","getMessageState","useChatMessageRichTextEditContainerStyles","useChatMyMessageStyles","useLocale","_formatString","MAXIMUM_LENGTH_OF_MESSAGE","useCallback","mergeStyles","richTextEditBoxActionButtonIcon","onRenderCancelIcon","onRenderSubmitIcon","useMemo","Stack","InputBoxButton","richTextActionButtonsStyle","attachmentUploadCardsStyles","FluentV9ThemeProvider","_AttachmentUploadCards","editBoxWidthStyles","RichTextSendBoxErrors","RichTextInputBoxComponent","editBoxRichTextEditorStyle","ChatMyMessage","mergeClasses"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAoDA;;AAEG;AACU,MAAA,qCAAqC,GAAG,CACnD,KAAiD,KAClC;;IACf,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAA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