@azure/communication-react 1.18.0-alpha-202407050014 → 1.18.0-alpha-202407090014
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 +131 -28
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DeZQ3bKG.js → ChatMessageComponentAsRichTextEditBox-RrIa2t97.js} +62 -17
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-RrIa2t97.js.map +1 -0
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D63MoVhd.js → RichTextSendBoxWrapper-Bz_1ebsD.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D63MoVhd.js.map → RichTextSendBoxWrapper-Bz_1ebsD.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-xFes8-H4.js → index-DGXoGo4W.js} +1041 -579
- package/dist/dist-cjs/communication-react/index-DGXoGo4W.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 +13 -0
- package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/dataConversion.d.ts +6 -0
- package/dist/dist-esm/acs-ui-common/src/dataConversion.js +17 -0
- package/dist/dist-esm/acs-ui-common/src/dataConversion.js.map +1 -0
- package/dist/dist-esm/acs-ui-common/src/index.d.ts +2 -0
- package/dist/dist-esm/acs-ui-common/src/index.js +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/calling-stateful-client/src/CallClientState.d.ts +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +3 -0
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +57 -4
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +34 -8
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +3 -0
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +1 -0
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +7 -1
- 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 +4 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +62 -15
- 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.js +1 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.js +1 -1
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +18 -0
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/NotificationStack.d.ts +58 -26
- package/dist/dist-esm/react-components/src/components/NotificationStack.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.d.ts +6 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js +27 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js +27 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.d.ts +2 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +24 -12
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +2 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +6 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +13 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +57 -27
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/Common.style.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/styles/Common.style.js +4 -0
- package/dist/dist-esm/react-components/src/components/styles/Common.style.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +18 -0
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +6 -3
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +20 -0
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +81 -0
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils.js +16 -1
- package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +42 -1
- package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -0
- package/dist/dist-esm/react-components/src/theming/icons.js +4 -0
- package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/Attachment.d.ts +4 -0
- package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +65 -13
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +8 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +6 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +3 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +3 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js +5 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.d.ts +6 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.js +22 -20
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +47 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +104 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +5 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +22 -0
- 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 +13 -0
- 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 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +16 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +47 -18
- 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 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +20 -0
- 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 +9 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +1 -1
- 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/hooks/useHandlers.js +4 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/image-upload/useImageUpload.d.ts +12 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/image-upload/useImageUpload.js +129 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/image-upload/useImageUpload.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +3 -0
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js +4 -3
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -0
- package/package.json +2 -2
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DeZQ3bKG.js.map +0 -1
- package/dist/dist-cjs/communication-react/index-xFes8-H4.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"messageThreadSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/messageThreadSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAEL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,gCA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,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,aAAa,KAAK,MAAM,IAAI,aAAa,KAAK,MAAM,IAAI,aAAa,KAAK,eAAe;QAC9F,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AACF,MAAM,sBAAsB,GAAG,CAAC,OAA8B,EAAW,EAAE;;IACzE,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,mBAAmB,MAAI,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,0CAAE,MAAM,CAAA,EAAE,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,uDAAuD;IACvD,IAAI,CAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,MAAM,MAAK,gBAAgB,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,MAAK,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,+BAA+B,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n ChatBaseSelectorProps,\n getChatMessages,\n getIsLargeGroup,\n getLatestReadTime,\n getParticipants,\n getReadReceipts,\n getUserId\n} from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatClientState, ChatMessageWithStatus, ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport {\n ChatMessage,\n Message,\n CommunicationParticipant,\n SystemMessage,\n MessageContentType,\n ReadReceiptsBySenderId\n} from '@internal/react-components';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '@internal/react-components';\nimport { createSelector } from 'reselect';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';\nimport { ACSKnownMessageType } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatAttachment } from '@azure/communication-chat';\nimport type { ChatParticipant } from '@azure/communication-chat';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachmentType } from '@internal/react-components';\n\nconst memoizedAllConvertChatMessage = memoizeFnAll(\n (\n _key: string,\n chatMessage: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n ): Message => {\n const messageType = chatMessage.type.toLowerCase();\n /* @conditional-compile-remove(data-loss-prevention) */\n if (chatMessage.policyViolation?.result === 'contentBlocked') {\n return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);\n }\n if (\n messageType === ACSKnownMessageType.text ||\n messageType === ACSKnownMessageType.richtextHtml ||\n messageType === ACSKnownMessageType.html\n ) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n }\n);\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentMetadata = (metadata: Record<string, string>): AttachmentMetadata[] => {\n const attachmentMetadata = metadata.fileSharingMetadata;\n if (!attachmentMetadata) {\n return [];\n }\n try {\n return JSON.parse(attachmentMetadata);\n } catch (e) {\n console.error(e);\n return [];\n }\n};\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractTeamsAttachmentsMetadata = (\n rawAttachments: ChatAttachment[]\n): {\n attachments: AttachmentMetadata[];\n} => {\n const attachments: AttachmentMetadata[] = [];\n rawAttachments.forEach((rawAttachment) => {\n const attachmentType = rawAttachment.attachmentType as ChatAttachmentType;\n if (attachmentType === 'file') {\n attachments.push({\n id: rawAttachment.id,\n name: rawAttachment.name ?? '',\n url: extractAttachmentUrl(rawAttachment)\n });\n }\n });\n return {\n attachments\n };\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\nconst convertToUiBlockedMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): BlockedMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n return {\n messageType: 'blocked',\n createdOn: message.createdOn,\n warningText: undefined,\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL\n };\n};\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentUrl = (attachment: ChatAttachment): string => {\n return attachment.previewUrl ? attachment.previewUrl : attachment.url || '';\n};\nconst processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {\n let content = message.content?.message;\n if (\n message.content?.attachments &&\n message.content?.attachments.length > 0 &&\n sanitizedMessageContentType(message.type).includes('html')\n ) {\n const attachments: ChatAttachment[] = message.content?.attachments;\n // Fill in the src here\n if (content) {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach((img) => {\n const attachmentPreviewUrl = attachments.find((attachment) => attachment.id === img.id)?.previewUrl;\n if (attachmentPreviewUrl) {\n const resourceCache = message.resourceCache?.[attachmentPreviewUrl];\n img.src = getResourceSourceUrl(resourceCache);\n }\n });\n content = document.body.innerHTML;\n }\n\n const teamsImageHtmlContent = attachments\n .filter(\n (attachment) =>\n attachment.attachmentType === 'image' &&\n attachment.previewUrl !== undefined &&\n !message.content?.message?.includes(attachment.id)\n )\n .map((attachment) => generateImageAttachmentImgHtml(message, attachment))\n .join('');\n if (teamsImageHtmlContent) {\n return (content ?? '') + teamsImageHtmlContent;\n }\n }\n return content;\n};\n\nconst generateImageAttachmentImgHtml = (message: ChatMessageWithStatus, attachment: ChatAttachment): string => {\n if (attachment.previewUrl !== undefined) {\n const contentType = extractAttachmentContentTypeFromName(attachment.name);\n const resourceCache = message.resourceCache?.[attachment.previewUrl];\n const src = getResourceSourceUrl(resourceCache);\n\n return `\\r\\n<p><img alt=\"image\" src=\"${src}\" itemscope=\"${contentType}\" id=\"${attachment.id}\"></p>`;\n }\n\n return '';\n};\n\nconst getResourceSourceUrl = (result?: ResourceFetchResult): string => {\n let src = '';\n if (result) {\n if (result.error || !result.sourceUrl) {\n // In case of an error we set src to some invalid value to show broken image\n src = 'blob://';\n } else {\n src = result.sourceUrl;\n }\n }\n return src;\n};\n\nconst extractAttachmentContentTypeFromName = (name?: string): string => {\n if (name === undefined) {\n return '';\n }\n const indexOfLastDot = name.lastIndexOf('.');\n if (indexOfLastDot === undefined || indexOfLastDot < 0) {\n return '';\n }\n const contentType = name.substring(indexOfLastDot + 1);\n return contentType;\n};\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentsMetadata = (message: ChatMessageWithStatus): { attachments?: AttachmentMetadata[] } => {\n let attachments: AttachmentMetadata[] = [];\n if (message.metadata) {\n attachments = attachments.concat(extractAttachmentMetadata(message.metadata));\n }\n if (message.content?.attachments) {\n const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);\n attachments = attachments.concat(teamsAttachments.attachments);\n }\n return { attachments: attachments.length > 0 ? attachments : undefined };\n};\nconst convertToUiChatMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): ChatMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n const { attachments } = extractAttachmentsMetadata(message);\n return {\n messageType: 'chat',\n createdOn: message.createdOn,\n content: processChatMessageContent(message),\n contentType: sanitizedMessageContentType(message.type),\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n clientMessageId: message.clientMessageId,\n editedOn: message.editedOn,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n metadata: message.metadata,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n attachments\n };\n};\nconst convertToUiSystemMessage = (message: ChatMessageWithStatus): SystemMessage => {\n const systemMessageType = message.type;\n if (systemMessageType === 'participantAdded' || systemMessageType === 'participantRemoved') {\n return {\n messageType: 'system',\n systemMessageType,\n createdOn: message.createdOn,\n participants:\n message.content?.participants\n // TODO: In our moderator logic, we use undefined name as our displayName for moderator, which should be filtered out\n // Once we have a better solution to identify the moderator, remove this line\n ?.filter((participant: ChatParticipant) => participant.displayName && participant.displayName !== '')\n .map(\n (participant: ChatParticipant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })\n ) ?? [],\n messageId: message.id,\n iconName: systemMessageType === 'participantAdded' ? 'PeopleAdd' : 'PeopleBlock'\n };\n } else {\n // Only topic updated type left, according to ACSKnown type\n return {\n messageType: 'system',\n systemMessageType: 'topicUpdated',\n createdOn: message.createdOn,\n topic: message.content?.topic ?? '',\n messageId: message.id,\n iconName: 'Edit'\n };\n }\n};\n\n/**\n * Selector type for {@link MessageThread} component.\n *\n * @public\n */\nexport type MessageThreadSelector = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\n userId: string;\n showMessageStatus: boolean;\n messages: Message[];\n};\n\n/** Returns `true` if the message has participants and at least one participant has a display name. */\nconst hasValidParticipant = (chatMessage: ChatMessageWithStatus): boolean =>\n !!chatMessage.content?.participants && chatMessage.content.participants.some((p: ChatParticipant) => !!p.displayName);\n\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread: () => MessageThreadSelector = () =>\n createSelector(\n [getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants],\n (userId, chatMessages, latestReadTime, isLargeGroup, readReceipts, participants) => {\n // We can't get displayName in teams meeting interop for now, disable rr feature when it is teams interop\n const isTeamsInterop = Object.values(participants).find((p) => 'microsoftTeamsUserId' in p.id) !== undefined;\n\n // get number of participants\n // filter out the non valid participants (no display name)\n // Read Receipt details will be disabled when participant count is 0\n const participantCount = isTeamsInterop\n ? undefined\n : Object.values(participants).filter((p) => p.displayName && p.displayName !== '').length;\n\n // creating key value pairs of senderID: last read message information\n\n const readReceiptsBySenderId: ReadReceiptsBySenderId = {};\n\n // readReceiptsBySenderId[senderID] gets updated every time a new message is read by this sender\n // in this way we can make sure that we are only saving the latest read message id and read on time for each sender\n readReceipts\n .filter((r) => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId)\n .forEach((r) => {\n readReceiptsBySenderId[toFlatCommunicationIdentifier(r.sender)] = {\n lastReadMessage: r.chatMessageId,\n displayName: participants[toFlatCommunicationIdentifier(r.sender)]?.displayName ?? ''\n };\n });\n\n // A function takes parameter above and generate return value\n const convertedMessages = memoizedAllConvertChatMessage((memoizedFn) =>\n Object.values(chatMessages)\n .filter(\n (message) =>\n message.type.toLowerCase() === ACSKnownMessageType.text ||\n message.type.toLowerCase() === ACSKnownMessageType.richtextHtml ||\n message.type.toLowerCase() === ACSKnownMessageType.html ||\n (message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message)) ||\n (message.type === ACSKnownMessageType.participantRemoved && hasValidParticipant(message)) ||\n // TODO: Add support for topicUpdated system messages in MessageThread component.\n // message.type === ACSKnownMessageType.topicUpdated ||\n message.clientMessageId !== undefined\n )\n .filter(isMessageValidToRender)\n .map((message) => {\n return memoizedFn(\n message.id ?? message.clientMessageId,\n message,\n userId,\n message.createdOn <= latestReadTime,\n isLargeGroup\n );\n })\n );\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n }\n );\nconst sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html'\n ? lowerCaseType\n : 'unknown';\n};\nconst isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {\n if (message.deletedOn) {\n return false;\n }\n if (message.metadata?.fileSharingMetadata || message.content?.attachments?.length) {\n return true;\n }\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.policyViolation?.result === 'contentBlocked') {\n return true;\n }\n return !!(message.content && message.content?.message !== '');\n};\n\n/**\n * Selector for {@link MessageThread} component.\n *\n * @public\n */\nexport const messageThreadSelector: MessageThreadSelector = messageThreadSelectorWithThread();\n"]}
|
1
|
+
{"version":3,"file":"messageThreadSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/messageThreadSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAEL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,YAAY,EAAE,gCAAgC;AAWvD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,uDAAuD;AACvD,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAQhF,MAAM,6BA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OAAO,CAAC,eAAe,0CAAE,MAAM,MAAK,gBAAgB,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,MAAK,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,+BAA+B,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n ChatBaseSelectorProps,\n getChatMessages,\n getIsLargeGroup,\n getLatestReadTime,\n getParticipants,\n getReadReceipts,\n getUserId\n} from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatClientState, ChatMessageWithStatus, ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport {\n ChatMessage,\n Message,\n CommunicationParticipant,\n SystemMessage,\n MessageContentType,\n ReadReceiptsBySenderId\n} from '@internal/react-components';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '@internal/react-components';\nimport { createSelector } from 'reselect';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';\nimport { ACSKnownMessageType } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatAttachment } from '@azure/communication-chat';\nimport type { ChatParticipant } from '@azure/communication-chat';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachmentType } from '@internal/react-components';\n\nconst memoizedAllConvertChatMessage = memoizeFnAll(\n (\n _key: string,\n chatMessage: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n ): Message => {\n const messageType = chatMessage.type.toLowerCase();\n /* @conditional-compile-remove(data-loss-prevention) */\n if (chatMessage.policyViolation?.result === 'contentBlocked') {\n return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);\n }\n if (\n messageType === ACSKnownMessageType.text ||\n messageType === ACSKnownMessageType.richtextHtml ||\n messageType === ACSKnownMessageType.html\n ) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n }\n);\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentMetadata = (metadata: Record<string, string>): AttachmentMetadata[] => {\n const attachmentMetadata = metadata.fileSharingMetadata;\n if (!attachmentMetadata) {\n return [];\n }\n try {\n return JSON.parse(attachmentMetadata);\n } catch (e) {\n console.error(e);\n return [];\n }\n};\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractTeamsAttachmentsMetadata = (\n rawAttachments: ChatAttachment[]\n): {\n attachments: AttachmentMetadata[];\n} => {\n const attachments: AttachmentMetadata[] = [];\n rawAttachments.forEach((rawAttachment) => {\n const attachmentType = rawAttachment.attachmentType as ChatAttachmentType;\n if (attachmentType === 'file') {\n attachments.push({\n id: rawAttachment.id,\n name: rawAttachment.name ?? '',\n url: extractAttachmentUrl(rawAttachment)\n });\n }\n });\n return {\n attachments\n };\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\nconst convertToUiBlockedMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): BlockedMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n return {\n messageType: 'blocked',\n createdOn: message.createdOn,\n warningText: undefined,\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL\n };\n};\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentUrl = (attachment: ChatAttachment): string => {\n return attachment.previewUrl ? attachment.previewUrl : attachment.url || '';\n};\nconst processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {\n let content = message.content?.message;\n if (\n message.content?.attachments &&\n message.content?.attachments.length > 0 &&\n sanitizedMessageContentType(message.type).includes('html')\n ) {\n const attachments: ChatAttachment[] = message.content?.attachments;\n // Fill in the src here\n if (content) {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach((img) => {\n const attachmentPreviewUrl = attachments.find((attachment) => attachment.id === img.id)?.previewUrl;\n if (attachmentPreviewUrl) {\n const resourceCache = message.resourceCache?.[attachmentPreviewUrl];\n const src = getResourceSourceUrl(resourceCache);\n // if in error state\n if (src === undefined) {\n const brokenImageView = getBrokenImageViewNode(img);\n img.parentElement?.replaceChild(brokenImageView, img);\n } else {\n // else in loading or success state\n img.setAttribute('src', src);\n }\n }\n });\n content = document.body.innerHTML;\n }\n\n const teamsImageHtmlContent = attachments\n .filter(\n (attachment) =>\n attachment.attachmentType === 'image' &&\n attachment.previewUrl !== undefined &&\n !message.content?.message?.includes(attachment.id)\n )\n .map((attachment) => generateImageAttachmentImgHtml(message, attachment))\n .join('');\n if (teamsImageHtmlContent) {\n return (content ?? '') + teamsImageHtmlContent;\n }\n }\n return content;\n};\n\nconst generateImageAttachmentImgHtml = (message: ChatMessageWithStatus, attachment: ChatAttachment): string => {\n if (attachment.previewUrl !== undefined) {\n const contentType = extractAttachmentContentTypeFromName(attachment.name);\n const resourceCache = message.resourceCache?.[attachment.previewUrl];\n const src = getResourceSourceUrl(resourceCache);\n // if in error state\n if (src === undefined) {\n return `\\r\\n<p>${getBrokenImageViewNode()}</p>`;\n }\n // else in loading or success state\n return `\\r\\n<p><img alt=\"image\" src=\"${src}\" itemscope=\"${contentType}\" id=\"${attachment.id}\"></p>`;\n }\n\n return '';\n};\n\nconst getResourceSourceUrl = (result?: ResourceFetchResult): string | undefined => {\n if (result) {\n if (!result.error && result.sourceUrl) {\n // return sourceUrl for success state\n return result.sourceUrl;\n } else {\n // return undefined for error state\n return undefined;\n }\n }\n // return empty string for loading state\n return '';\n};\n\nconst extractAttachmentContentTypeFromName = (name?: string): string => {\n if (name === undefined) {\n return '';\n }\n const indexOfLastDot = name.lastIndexOf('.');\n if (indexOfLastDot === undefined || indexOfLastDot < 0) {\n return '';\n }\n const contentType = name.substring(indexOfLastDot + 1);\n return contentType;\n};\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentsMetadata = (message: ChatMessageWithStatus): { attachments?: AttachmentMetadata[] } => {\n let attachments: AttachmentMetadata[] = [];\n if (message.metadata) {\n attachments = attachments.concat(extractAttachmentMetadata(message.metadata));\n }\n if (message.content?.attachments) {\n const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);\n attachments = attachments.concat(teamsAttachments.attachments);\n }\n return { attachments: attachments.length > 0 ? attachments : undefined };\n};\nconst convertToUiChatMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): ChatMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n const { attachments } = extractAttachmentsMetadata(message);\n return {\n messageType: 'chat',\n createdOn: message.createdOn,\n content: processChatMessageContent(message),\n contentType: sanitizedMessageContentType(message.type),\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n clientMessageId: message.clientMessageId,\n editedOn: message.editedOn,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n metadata: message.metadata,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n attachments\n };\n};\nconst convertToUiSystemMessage = (message: ChatMessageWithStatus): SystemMessage => {\n const systemMessageType = message.type;\n if (systemMessageType === 'participantAdded' || systemMessageType === 'participantRemoved') {\n return {\n messageType: 'system',\n systemMessageType,\n createdOn: message.createdOn,\n participants:\n message.content?.participants\n // TODO: In our moderator logic, we use undefined name as our displayName for moderator, which should be filtered out\n // Once we have a better solution to identify the moderator, remove this line\n ?.filter((participant: ChatParticipant) => participant.displayName && participant.displayName !== '')\n .map(\n (participant: ChatParticipant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })\n ) ?? [],\n messageId: message.id,\n iconName: systemMessageType === 'participantAdded' ? 'PeopleAdd' : 'PeopleBlock'\n };\n } else {\n // Only topic updated type left, according to ACSKnown type\n return {\n messageType: 'system',\n systemMessageType: 'topicUpdated',\n createdOn: message.createdOn,\n topic: message.content?.topic ?? '',\n messageId: message.id,\n iconName: 'Edit'\n };\n }\n};\n\n/**\n * Selector type for {@link MessageThread} component.\n *\n * @public\n */\nexport type MessageThreadSelector = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\n userId: string;\n showMessageStatus: boolean;\n messages: Message[];\n};\n\n/** Returns `true` if the message has participants and at least one participant has a display name. */\nconst hasValidParticipant = (chatMessage: ChatMessageWithStatus): boolean =>\n !!chatMessage.content?.participants && chatMessage.content.participants.some((p: ChatParticipant) => !!p.displayName);\n\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread: () => MessageThreadSelector = () =>\n createSelector(\n [getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants],\n (userId, chatMessages, latestReadTime, isLargeGroup, readReceipts, participants) => {\n // We can't get displayName in teams meeting interop for now, disable rr feature when it is teams interop\n const isTeamsInterop = Object.values(participants).find((p) => 'microsoftTeamsUserId' in p.id) !== undefined;\n\n // get number of participants\n // filter out the non valid participants (no display name)\n // Read Receipt details will be disabled when participant count is 0\n const participantCount = isTeamsInterop\n ? undefined\n : Object.values(participants).filter((p) => p.displayName && p.displayName !== '').length;\n\n // creating key value pairs of senderID: last read message information\n\n const readReceiptsBySenderId: ReadReceiptsBySenderId = {};\n\n // readReceiptsBySenderId[senderID] gets updated every time a new message is read by this sender\n // in this way we can make sure that we are only saving the latest read message id and read on time for each sender\n readReceipts\n .filter((r) => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId)\n .forEach((r) => {\n readReceiptsBySenderId[toFlatCommunicationIdentifier(r.sender)] = {\n lastReadMessage: r.chatMessageId,\n displayName: participants[toFlatCommunicationIdentifier(r.sender)]?.displayName ?? ''\n };\n });\n\n // A function takes parameter above and generate return value\n const convertedMessages = memoizedAllConvertChatMessage((memoizedFn) =>\n Object.values(chatMessages)\n .filter(\n (message) =>\n message.type.toLowerCase() === ACSKnownMessageType.text ||\n message.type.toLowerCase() === ACSKnownMessageType.richtextHtml ||\n message.type.toLowerCase() === ACSKnownMessageType.html ||\n (message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message)) ||\n (message.type === ACSKnownMessageType.participantRemoved && hasValidParticipant(message)) ||\n // TODO: Add support for topicUpdated system messages in MessageThread component.\n // message.type === ACSKnownMessageType.topicUpdated ||\n message.clientMessageId !== undefined\n )\n .filter(isMessageValidToRender)\n .map((message) => {\n return memoizedFn(\n message.id ?? message.clientMessageId,\n message,\n userId,\n message.createdOn <= latestReadTime,\n isLargeGroup\n );\n })\n );\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n }\n );\nconst sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html'\n ? lowerCaseType\n : 'unknown';\n};\n\nconst getBrokenImageViewNode = (img?: HTMLDivElement): HTMLDivElement => {\n const wrapper = document.createElement('div');\n Array.from(img?.attributes ?? []).forEach((attr) => {\n wrapper.setAttribute(attr.nodeName, attr.nodeValue ?? '');\n });\n wrapper.setAttribute('class', 'broken-image-wrapper');\n wrapper.setAttribute('data-ui-id', 'broken-image-icon');\n return wrapper;\n};\n\nconst isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {\n if (message.deletedOn) {\n return false;\n }\n if (message.metadata?.fileSharingMetadata || message.content?.attachments?.length) {\n return true;\n }\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.policyViolation?.result === 'contentBlocked') {\n return true;\n }\n return !!(message.content && message.content?.message !== '');\n};\n\n/**\n * Selector for {@link MessageThread} component.\n *\n * @public\n */\nexport const messageThreadSelector: MessageThreadSelector = messageThreadSelectorWithThread();\n"]}
|
@@ -161,6 +161,9 @@ export const fetchImageSource = (src, authentication, options) => __awaiter(void
|
|
161
161
|
token = (yield authentication.credential.getToken()).token;
|
162
162
|
}
|
163
163
|
const response = yield fetchWithAuthentication(src, token, options);
|
164
|
+
if (response.status >= 400) {
|
165
|
+
throw new Error(`Failed to fetch image source. Status code: ${response.status}`);
|
166
|
+
}
|
164
167
|
const blob = yield response.blob();
|
165
168
|
return URL.createObjectURL(blob);
|
166
169
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAOA;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAQhC,YAAY,OAAoB,EAAE,cAA8E;QAPxG,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAGjB,sBAAiB,GAAwC,EAAE,CAAC;QAGlE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAA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E,CAAC;YAC1B,CAAC,EAAE,OAAO,CAAC,CAAC;YAEZ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,kCAChC,OAAO,KACV,MAAM,EAAE,eAAe,CAAC,MAAM,IAC9B,CAAC;YACH,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IACD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAElD,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9E,KAAK,GAAG,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;IAC7D,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ChatContext } from './ChatContext';\nimport { ChatMessageWithStatus, ResourceFetchResult } from './types/ChatMessageWithStatus';\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\ndeclare type CancellationDetails = { src: string; abortController: AbortController };\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n private _endpoint: string;\n private _requestsToCancel: Record<string, CancellationDetails> = {};\n\n constructor(context: ChatContext, authentication: { credential: CommunicationTokenCredential; endpoint: string }) {\n this._context = context;\n this._credential = authentication.credential;\n this._endpoint = authentication.endpoint;\n }\n\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n\n return contains;\n }\n\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = { ...message };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n\n public async startQueue(threadId: string, operation: ImageRequest, options?: { singleUrl: string }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n\n public cancelAllRequests(): void {\n for (const key in this._requestsToCancel) {\n this._requestsToCancel[key].abortController.abort();\n }\n this._requestsToCancel = {};\n }\n\n public cancelRequest(url: string): void {\n if (this._requestsToCancel[url]) {\n this._requestsToCancel[url].abortController.abort();\n delete this._requestsToCancel[url];\n }\n }\n\n private async downloadSingleUrl(\n message: ChatMessageWithStatus,\n resourceUrl: string,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, resourceUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[resourceUrl];\n }\n\n message = { ...message, resourceCache: { ...message.resourceCache, [resourceUrl]: response } };\n return message;\n }\n\n private async downloadAllPreviewUrls(\n message: ChatMessageWithStatus,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[attachment.previewUrl];\n }\n message.resourceCache[attachment.previewUrl] = response;\n }\n }\n }\n\n return message;\n }\n\n private async downloadResource(\n operation: ImageRequest,\n url: string,\n abortController: AbortController\n ): Promise<string> {\n this._requestsToCancel[url] = { src: url, abortController };\n const blobUrl = await operation(\n url,\n { credential: this._credential, endpoint: this._endpoint },\n { abortController }\n );\n delete this._requestsToCancel[url];\n return blobUrl;\n }\n}\n\n/**\n * @private\n */\nexport const fetchImageSource = async (\n src: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n): Promise<string> => {\n async function fetchWithAuthentication(\n url: string,\n token: string,\n options: { abortController: AbortController; timeout?: number }\n ): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n return await fetchWithTimeout(url, {\n timeout: options.timeout,\n headers,\n abortController: options.abortController\n });\n }\n async function fetchWithTimeout(\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers; abortController: AbortController }\n ): Promise<Response> {\n // default timeout is 30 seconds\n const { timeout = 30000, abortController } = options;\n\n const id = setTimeout(() => {\n abortController.abort();\n }, timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: abortController.signal\n });\n clearTimeout(id);\n return response;\n }\n const fetchUrl = new URL(src);\n const endpoint = new URL(authentication.endpoint);\n\n let token = '';\n if (fetchUrl.hostname === endpoint.hostname && fetchUrl.protocol === 'https:') {\n token = (await authentication.credential.getToken()).token;\n }\n\n const response = await fetchWithAuthentication(src, token, options);\n const blob = await response.blob();\n\n return URL.createObjectURL(blob);\n};\ninterface ImageRequest {\n (\n request: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n ): Promise<string>;\n}\n"]}
|
1
|
+
{"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAOA;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAQhC,YAAY,OAAoB,EAAE,cAA8E;QAPxG,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAGjB,sBAAiB,GAAwC,EAAE,CAAC;QAGlE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAEM,kCAAkC,CAAC,OAA8B;;QACtE,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAC;QACxD,IAAI,kBAAkB,EAAE,CAAC;YACvB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,iCAAiC,EAAE,CAAC;gBACvD,MAAM,kBAAkB,GAAG,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAE,WAAW,mCAAI,EAAE,CAAC;gBACxD,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC/F,IAAI,QAAQ,EAAE,CAAC;oBACb,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAA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,QAAQ,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAEpE,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,8CAA8C,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ChatContext } from './ChatContext';\nimport { ChatMessageWithStatus, ResourceFetchResult } from './types/ChatMessageWithStatus';\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\ndeclare type CancellationDetails = { src: string; abortController: AbortController };\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n private _endpoint: string;\n private _requestsToCancel: Record<string, CancellationDetails> = {};\n\n constructor(context: ChatContext, authentication: { credential: CommunicationTokenCredential; endpoint: string }) {\n this._context = context;\n this._credential = authentication.credential;\n this._endpoint = authentication.endpoint;\n }\n\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n\n return contains;\n }\n\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = { ...message };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n\n public async startQueue(threadId: string, operation: ImageRequest, options?: { singleUrl: string }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n\n public cancelAllRequests(): void {\n for (const key in this._requestsToCancel) {\n this._requestsToCancel[key].abortController.abort();\n }\n this._requestsToCancel = {};\n }\n\n public cancelRequest(url: string): void {\n if (this._requestsToCancel[url]) {\n this._requestsToCancel[url].abortController.abort();\n delete this._requestsToCancel[url];\n }\n }\n\n private async downloadSingleUrl(\n message: ChatMessageWithStatus,\n resourceUrl: string,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, resourceUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[resourceUrl];\n }\n\n message = { ...message, resourceCache: { ...message.resourceCache, [resourceUrl]: response } };\n return message;\n }\n\n private async downloadAllPreviewUrls(\n message: ChatMessageWithStatus,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[attachment.previewUrl];\n }\n message.resourceCache[attachment.previewUrl] = response;\n }\n }\n }\n\n return message;\n }\n\n private async downloadResource(\n operation: ImageRequest,\n url: string,\n abortController: AbortController\n ): Promise<string> {\n this._requestsToCancel[url] = { src: url, abortController };\n const blobUrl = await operation(\n url,\n { credential: this._credential, endpoint: this._endpoint },\n { abortController }\n );\n delete this._requestsToCancel[url];\n return blobUrl;\n }\n}\n\n/**\n * @private\n */\nexport const fetchImageSource = async (\n src: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n): Promise<string> => {\n async function fetchWithAuthentication(\n url: string,\n token: string,\n options: { abortController: AbortController; timeout?: number }\n ): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n return await fetchWithTimeout(url, {\n timeout: options.timeout,\n headers,\n abortController: options.abortController\n });\n }\n async function fetchWithTimeout(\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers; abortController: AbortController }\n ): Promise<Response> {\n // default timeout is 30 seconds\n const { timeout = 30000, abortController } = options;\n\n const id = setTimeout(() => {\n abortController.abort();\n }, timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: abortController.signal\n });\n clearTimeout(id);\n return response;\n }\n const fetchUrl = new URL(src);\n const endpoint = new URL(authentication.endpoint);\n\n let token = '';\n if (fetchUrl.hostname === endpoint.hostname && fetchUrl.protocol === 'https:') {\n token = (await authentication.credential.getToken()).token;\n }\n\n const response = await fetchWithAuthentication(src, token, options);\n\n if (response.status >= 400) {\n throw new Error(`Failed to fetch image source. Status code: ${response.status}`);\n }\n\n const blob = await response.blob();\n\n return URL.createObjectURL(blob);\n};\ninterface ImageRequest {\n (\n request: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n ): Promise<string>;\n}\n"]}
|
@@ -21,6 +21,7 @@ export type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '.
|
|
21
21
|
export type { CaptionsOptions } from '../../calling-component-bindings/src';
|
22
22
|
export type { ChatClientProviderProps, ChatThreadClientProviderProps, GetChatSelector, ChatHandlers, ChatBaseSelectorProps } from '../../chat-component-bindings/src';
|
23
23
|
export type { MessageOptions, ChatMessageType } from '../../acs-ui-common/src';
|
24
|
+
export type { UploadChatImageResult } from '../../acs-ui-common/src';
|
24
25
|
export { CallClientProvider, CallAgentProvider, CallProvider, useCallClient, useCallAgent, useCall, useDeviceManager, getCallingSelector, createDefaultCallingHandlers } from '../../calling-component-bindings/src';
|
25
26
|
export { useTeamsCallAgent, useTeamsCall, createDefaultTeamsCallingHandlers } from '../../calling-component-bindings/src';
|
26
27
|
export type { TeamsCallingHandlers } from '../../calling-component-bindings/src';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAoCzG,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,yDAAyD;AACzD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAwB9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,eAAe,EACf,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,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ft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { MessageOptions, ChatMessageType } from '../../acs-ui-common/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(notifications) */\nexport type { NotificationStackSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\nexport { RaiseHandButton } from '../../react-components/src';\n\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps,\n VideoTilesOptions\n} from '../../react-components/src';\n\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings, RichTextStrings } from '../../react-components/src';\nexport type { Spotlight } from '../../react-components/src';\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentOptions } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { SendBoxErrorBarError } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentActionHandler } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type {\n AttachmentSelectionHandler,\n AttachmentRemovalHandler,\n AttachmentUploadOptions,\n AttachmentUploadTask\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentMetadata } from '../../acs-ui-common/src';\n\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentMetadataInProgress, AttachmentProgressError } from '../../acs-ui-common/src';\n\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentMenuAction, AttachmentDownloadOptions } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport { defaultAttachmentMenuAction } from '../../react-components/src';\nexport type { ChatAttachmentType } from '../../react-components/src';\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextEditorOptions } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings } from '../../react-components/src';\nexport type { VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\nexport type { OverflowGalleryPosition } from '../../react-components/src';\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n\nexport type { SurveyIssues } from '../../react-components/src';\n\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n/* @conditional-compile-remove(notifications) */\nexport { NotificationStack, Notification } from '../../react-components/src';\n/* @conditional-compile-remove(notifications) */\nexport type {\n NotificationStackProps,\n NotificationProps,\n NotificationStrings,\n NotificationStackStrings,\n NotificationType,\n ActiveNotification\n} from '../../react-components/src';\n/* @conditional-compile-remove(teams-meeting-conference) */\nexport type { MeetingConferencePhoneInfoModalStrings } from '../../react-components/src';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAsCzG,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,yDAAyD;AACzD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAwB9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,E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AAC;AAe1E,cAAc,yCAAyC,CAAC;AACxD,cAAc,eAAe,CAAC;AAE9B,sDAAsD;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,sDAAsD;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAgBxE,gDAAgD;AAChD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { MessageOptions, ChatMessageType } from '../../acs-ui-common/src';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nexport type { UploadChatImageResult } from '../../acs-ui-common/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(notifications) */\nexport type { NotificationStackSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\nexport { RaiseHandButton } from '../../react-components/src';\n\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps,\n VideoTilesOptions\n} from '../../react-components/src';\n\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings, RichTextStrings } from '../../react-components/src';\nexport type { Spotlight } from '../../react-components/src';\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentOptions } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { SendBoxErrorBarError } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentActionHandler } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type {\n AttachmentSelectionHandler,\n AttachmentRemovalHandler,\n AttachmentUploadOptions,\n AttachmentUploadTask\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentMetadata } from '../../acs-ui-common/src';\n\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentMetadataInProgress, AttachmentProgressError } from '../../acs-ui-common/src';\n\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type { AttachmentMenuAction, AttachmentDownloadOptions } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing-acs) */\nexport { defaultAttachmentMenuAction } from '../../react-components/src';\nexport type { ChatAttachmentType } from '../../react-components/src';\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextEditorOptions } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings } from '../../react-components/src';\nexport type { VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\nexport type { OverflowGalleryPosition } from '../../react-components/src';\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n\nexport type { SurveyIssues } from '../../react-components/src';\n\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n/* @conditional-compile-remove(notifications) */\nexport { NotificationStack, Notification } from '../../react-components/src';\n/* @conditional-compile-remove(notifications) */\nexport type {\n NotificationStackProps,\n NotificationProps,\n NotificationStrings,\n NotificationStackStrings,\n NotificationType,\n ActiveNotification\n} from '../../react-components/src';\n/* @conditional-compile-remove(teams-meeting-conference) */\nexport type { MeetingConferencePhoneInfoModalStrings } from '../../react-components/src';\n"]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ChatMessage } from '../../../types';
|
3
3
|
import { AttachmentMetadata } from "../../../../../acs-ui-common/src";
|
4
|
+
import { AttachmentMetadataInProgress } from "../../../../../acs-ui-common/src";
|
4
5
|
import { MessageThreadStrings } from '../../MessageThread';
|
5
6
|
import { RichTextEditorOptions } from '../../MessageThread';
|
6
7
|
import { MentionLookupOptions } from '../../MentionPopover';
|
@@ -25,6 +26,9 @@ export type ChatMessageComponentAsEditBoxPickerProps = {
|
|
25
26
|
strings: MessageThreadStrings;
|
26
27
|
mentionLookupOptions?: MentionLookupOptions;
|
27
28
|
richTextEditorOptions?: RichTextEditorOptions;
|
29
|
+
onCancelInlineImageUpload?: (imageId: string) => void;
|
30
|
+
onUploadInlineImage?: (imageUrl: string, imageFileName: string) => void;
|
31
|
+
imageUploadsInProgress?: AttachmentMetadataInProgress[];
|
28
32
|
};
|
29
33
|
/**
|
30
34
|
* @private
|
@@ -31,7 +31,13 @@ export const ChatMessageComponentAsEditBoxPicker = (props) => {
|
|
31
31
|
React.createElement(Suspense, { fallback: simpleEditBox },
|
32
32
|
React.createElement(ChatMessageComponentAsRichTextEditBox, Object.assign({}, props, {
|
33
33
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
34
|
-
onPaste: richTextEditorOptions === null || richTextEditorOptions === void 0 ? void 0 : richTextEditorOptions.onPaste
|
34
|
+
onPaste: richTextEditorOptions === null || richTextEditorOptions === void 0 ? void 0 : richTextEditorOptions.onPaste,
|
35
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
36
|
+
onUploadInlineImage: richTextEditorOptions === null || richTextEditorOptions === void 0 ? void 0 : richTextEditorOptions.onUploadInlineImage,
|
37
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
38
|
+
imageUploadsInProgress: richTextEditorOptions === null || richTextEditorOptions === void 0 ? void 0 : richTextEditorOptions.imageUploadsInProgress,
|
39
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
40
|
+
onCancelInlineImageUpload: richTextEditorOptions === null || richTextEditorOptions === void 0 ? void 0 : richTextEditorOptions.onCancelInlineImageUpload })))));
|
35
41
|
}
|
36
42
|
return simpleEditBox;
|
37
43
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponentAsEditBoxPicker.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"ChatMessageComponentAsEditBoxPicker.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AASjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,mDAAmD;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,mDAAmD;AACnD,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC,CAAC;AAElH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,GAEtD,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC;AA0BxD;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,KAA+C,EAAe,EAAE;IAClH,mDAAmD;IACnD,MAAM,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO,oBAAC,6BAA6B,oBAAK,KAAK,EAAI,CAAC;IACtD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,mDAAmD;IACnD,IAAI,qBAAqB,EAAE,CAAC;QAC1B,OAAO,CACL,oBAAC,cAAc,IAAC,QAAQ,EAAE,aAAa;YACrC,oBAAC,QAAQ,IAAC,QAAQ,EAAE,aAAa;gBAC/B,oBAAC,qCAAqC,oBAChC,KAAK;oBACT,gEAAgE;oBAChE,OAAO,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,OAAO;oBACvC,gEAAgE;oBAChE,mBAAmB,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,mBAAmB;oBAC/D,gEAAgE;oBAChE,sBAAsB,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,sBAAsB;oBACrE,gEAAgE;oBAChE,yBAAyB,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,yBAAyB,IAC3E,CACO,CACI,CAClB,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { Suspense } from 'react';\nimport { ChatMessage } from '../../../types';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { MessageThreadStrings } from '../../MessageThread';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { RichTextEditorOptions } from '../../MessageThread';\nimport { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../../MentionPopover';\n/* @conditional-compile-remove(rich-text-editor) */\nimport type { ChatMessageComponentAsRichTextEditBoxProps } from './ChatMessageComponentAsRichTextEditBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { _ErrorBoundary } from '../../ErrorBoundary';\n\n/* @conditional-compile-remove(rich-text-editor) */\nconst ChatMessageComponentAsRichTextEditBox = React.lazy(() => import('./ChatMessageComponentAsRichTextEditBox'));\n\n/**\n * @private\n * Use this function to load RoosterJS dependencies early in the lifecycle.\n * It should be the same import as used for lazy loading.\n *\n * @conditional-compile-remove(rich-text-editor)\n */\nexport const loadChatMessageComponentAsRichTextEditBox = (): Promise<{\n default: React.ComponentType<ChatMessageComponentAsRichTextEditBoxProps>;\n}> => import('./ChatMessageComponentAsRichTextEditBox');\n\n/**\n * @private\n */\nexport type ChatMessageComponentAsEditBoxPickerProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n /* @conditional-compile-remove(rich-text-editor) */\n richTextEditorOptions?: RichTextEditorOptions;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onCancelInlineImageUpload?: (imageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadInlineImage?: (imageUrl: string, imageFileName: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n imageUploadsInProgress?: AttachmentMetadataInProgress[];\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBoxPicker = (props: ChatMessageComponentAsEditBoxPickerProps): JSX.Element => {\n /* @conditional-compile-remove(rich-text-editor) */\n const { richTextEditorOptions } = props;\n\n const simpleEditBox = useMemo(() => {\n return <ChatMessageComponentAsEditBox {...props} />;\n }, [props]);\n\n /* @conditional-compile-remove(rich-text-editor) */\n if (richTextEditorOptions) {\n return (\n <_ErrorBoundary fallback={simpleEditBox}>\n <Suspense fallback={simpleEditBox}>\n <ChatMessageComponentAsRichTextEditBox\n {...props}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={richTextEditorOptions?.onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadInlineImage={richTextEditorOptions?.onUploadInlineImage}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n imageUploadsInProgress={richTextEditorOptions?.imageUploadsInProgress}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onCancelInlineImageUpload={richTextEditorOptions?.onCancelInlineImageUpload}\n />\n </Suspense>\n </_ErrorBoundary>\n );\n }\n\n return simpleEditBox;\n};\n"]}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
+
import { AttachmentMetadataInProgress } from "../../../../../acs-ui-common/src";
|
2
3
|
import { MessageThreadStrings } from '../../MessageThread';
|
3
4
|
import { ChatMessage } from '../../../types';
|
4
5
|
import { AttachmentMetadata } from "../../../../../acs-ui-common/src";
|
@@ -11,6 +12,9 @@ export type ChatMessageComponentAsRichTextEditBoxProps = {
|
|
11
12
|
onPaste?: (event: {
|
12
13
|
content: DocumentFragment;
|
13
14
|
}) => void;
|
15
|
+
onCancelInlineImageUpload?: (imageId: string) => void;
|
16
|
+
onUploadInlineImage?: (imageUrl: string, imageFileName: string) => void;
|
17
|
+
imageUploadsInProgress?: AttachmentMetadataInProgress[];
|
14
18
|
};
|
15
19
|
/**
|
16
20
|
* @private
|
@@ -14,6 +14,8 @@ import { useChatMyMessageStyles } from '../../styles/MessageThread.styles';
|
|
14
14
|
import { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';
|
15
15
|
import { useChatMessageRichTextEditContainerStyles } from '../../styles/ChatMessageComponent.styles';
|
16
16
|
import { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';
|
17
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
18
|
+
import { cancelInlineImageUpload, hasIncompleteAttachmentUploads, insertAttachmentsAndImages, isAttachmentUploadCompleted } from '../../utils/SendBoxUtils';
|
17
19
|
import { getMessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../../utils/ChatMessageComponentAsEditBoxUtils';
|
18
20
|
/* @conditional-compile-remove(file-sharing-acs) */
|
19
21
|
import { attachmentMetadataReducer, getMessageWithAttachmentMetadata, doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';
|
@@ -32,10 +34,18 @@ export const ChatMessageComponentAsRichTextEditBox = (props) => {
|
|
32
34
|
var _a;
|
33
35
|
const { onCancel, onSubmit, strings, message,
|
34
36
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
35
|
-
onPaste
|
37
|
+
onPaste,
|
38
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
39
|
+
onUploadInlineImage,
|
40
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
41
|
+
imageUploadsInProgress,
|
42
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
43
|
+
onCancelInlineImageUpload } = props;
|
36
44
|
const [textValue, setTextValue] = useState(message.content || '');
|
37
45
|
/* @conditional-compile-remove(file-sharing-acs) */
|
38
46
|
const [attachmentMetadata, handleAttachmentAction] = useReducer(attachmentMetadataReducer, (_a = getMessageWithAttachmentMetadata(message)) !== null && _a !== void 0 ? _a : []);
|
47
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
48
|
+
const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState(undefined);
|
39
49
|
const editTextFieldRef = React.useRef(null);
|
40
50
|
const theme = useTheme();
|
41
51
|
const messageState = useMemo(() => {
|
@@ -71,32 +81,56 @@ export const ChatMessageComponentAsRichTextEditBox = (props) => {
|
|
71
81
|
const hasMultipleAttachments = useMemo(() => {
|
72
82
|
return doesMessageContainMultipleAttachments(message);
|
73
83
|
}, [message]);
|
84
|
+
const onSubmitHandler = useCallback(() => {
|
85
|
+
if (!submitEnabled) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
// Don't send message until all attachments have been uploaded successfully
|
89
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
90
|
+
setAttachmentUploadsPendingError(undefined);
|
91
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
92
|
+
if (hasIncompleteAttachmentUploads(imageUploadsInProgress)) {
|
93
|
+
setAttachmentUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
let content = textValue;
|
97
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
98
|
+
if (imageUploadsInProgress && isAttachmentUploadCompleted(imageUploadsInProgress)) {
|
99
|
+
content = insertAttachmentsAndImages(textValue, undefined, imageUploadsInProgress).content;
|
100
|
+
}
|
101
|
+
// it's very important to pass an empty attachment here
|
102
|
+
// so when user removes all attachments, UI can reflect it instantly
|
103
|
+
// if you set it to undefined, the attachments pre-edited would still be there
|
104
|
+
// until edit message event is received
|
105
|
+
onSubmit(content, /* @conditional-compile-remove(file-sharing-acs) */ attachmentMetadata || []);
|
106
|
+
}, [
|
107
|
+
submitEnabled,
|
108
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
109
|
+
imageUploadsInProgress,
|
110
|
+
textValue,
|
111
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
112
|
+
strings.attachmentUploadsPendingError,
|
113
|
+
onSubmit,
|
114
|
+
/* @conditional-compile-remove(file-sharing-acs) */
|
115
|
+
attachmentMetadata
|
116
|
+
]);
|
74
117
|
const actionButtons = useMemo(() => {
|
75
118
|
return (React.createElement(Stack, { horizontal: true },
|
76
119
|
React.createElement(InputBoxButton, { className: richTextActionButtonsStyle, ariaLabel: strings.editBoxCancelButton, tooltipContent: strings.editBoxCancelButton, onRenderIcon: onRenderThemedCancelIcon, onClick: () => {
|
77
120
|
onCancel && onCancel(message.messageId);
|
78
121
|
}, id: 'dismissIconWrapper', "data-testId": strings.editBoxCancelButton }),
|
79
122
|
React.createElement(InputBoxButton, { className: richTextActionButtonsStyle, ariaLabel: strings.editBoxSubmitButton, tooltipContent: strings.editBoxSubmitButton, onRenderIcon: onRenderThemedSubmitIcon, onClick: (e) => {
|
80
|
-
|
81
|
-
// so when user removes all attachments, UI can reflect it instantly
|
82
|
-
// if you set it to undefined, the attachments pre-edited would still be there
|
83
|
-
// until edit message event is received
|
84
|
-
submitEnabled &&
|
85
|
-
onSubmit(textValue, /* @conditional-compile-remove(file-sharing-acs) */ attachmentMetadata);
|
123
|
+
onSubmitHandler();
|
86
124
|
e.stopPropagation();
|
87
125
|
}, id: 'submitIconWrapper', "data-testId": strings.editBoxSubmitButton })));
|
88
126
|
}, [
|
89
|
-
/* @conditional-compile-remove(file-sharing-acs) */
|
90
|
-
attachmentMetadata,
|
91
127
|
message.messageId,
|
92
128
|
onCancel,
|
93
129
|
onRenderThemedCancelIcon,
|
94
130
|
onRenderThemedSubmitIcon,
|
95
|
-
onSubmit,
|
96
131
|
strings.editBoxCancelButton,
|
97
132
|
strings.editBoxSubmitButton,
|
98
|
-
|
99
|
-
textValue
|
133
|
+
onSubmitHandler
|
100
134
|
]);
|
101
135
|
const richTextLocaleStrings = useMemo(() => {
|
102
136
|
/* @conditional-compile-remove(rich-text-editor) */
|
@@ -120,14 +154,27 @@ export const ChatMessageComponentAsRichTextEditBox = (props) => {
|
|
120
154
|
React.createElement(FluentV9ThemeProvider, { v8Theme: theme },
|
121
155
|
React.createElement(_AttachmentUploadCards, { attachments: attachmentMetadata, onCancelAttachmentUpload: onCancelAttachmentUpload }))));
|
122
156
|
}, [attachmentMetadata, onCancelAttachmentUpload, theme]);
|
157
|
+
const onChangeHandler = useCallback((content,
|
158
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */ imageSrcArray) => {
|
159
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
160
|
+
cancelInlineImageUpload(imageSrcArray, imageUploadsInProgress, onCancelInlineImageUpload);
|
161
|
+
setText(content);
|
162
|
+
}, [
|
163
|
+
setText,
|
164
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */ imageUploadsInProgress,
|
165
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */ onCancelInlineImageUpload
|
166
|
+
]);
|
123
167
|
const getContent = () => {
|
124
168
|
return (React.createElement(Stack, { className: mergeStyles(editBoxWidthStyles) },
|
125
|
-
React.createElement(RichTextSendBoxErrors, { textTooLongMessage: textTooLongMessage, systemMessage: message.failureReason
|
126
|
-
|
169
|
+
React.createElement(RichTextSendBoxErrors, { textTooLongMessage: textTooLongMessage, systemMessage: message.failureReason,
|
170
|
+
/* @conditional-compile-remove(file-sharing-acs) */ attachmentUploadsPendingError: attachmentUploadsPendingError }),
|
171
|
+
React.createElement(RichTextInputBoxComponent, { placeholderText: strings.editBoxPlaceholderText, onChange: onChangeHandler, editorComponentRef: editTextFieldRef, initialContent: message.content, strings: richTextLocaleStrings, disabled: false, actionComponents: actionButtons, richTextEditorStyleProps: editBoxRichTextEditorStyle, isHorizontalLayoutDisabled: true,
|
127
172
|
/* @conditional-compile-remove(file-sharing-acs) */
|
128
173
|
onRenderAttachmentUploads: onRenderAttachmentUploads,
|
129
174
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
130
|
-
onPaste: onPaste
|
175
|
+
onPaste: onPaste,
|
176
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
177
|
+
onUploadInlineImage: onUploadInlineImage })));
|
131
178
|
};
|
132
179
|
const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';
|
133
180
|
return (React.createElement(ChatMyMessage, { attached: attached, root: {
|