@azure/communication-react 1.5.1-beta.5 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/dist/communication-react.d.ts +147 -2691
- package/dist/dist-cjs/communication-react/index.js +3821 -10561
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/identifier.d.ts +6 -0
- package/dist/dist-esm/acs-ui-common/src/identifier.js +10 -2
- package/dist/dist-esm/acs-ui-common/src/identifier.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/index.d.ts +1 -1
- package/dist/dist-esm/acs-ui-common/src/index.js +1 -1
- 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-component-bindings/src/baseSelectors.d.ts +1 -24
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +0 -51
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.d.ts +0 -13
- package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js +2 -17
- package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js +1 -7
- package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +1 -19
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +1 -73
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.js +0 -10
- package/dist/dist-esm/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js +1 -15
- package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +1 -4
- package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js +0 -22
- package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/index.d.ts +0 -9
- package/dist/dist-esm/calling-component-bindings/src/index.js +0 -10
- package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js +3 -9
- package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.d.ts +3 -4
- package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.d.ts +2 -14
- package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.js +1 -20
- package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.d.ts +0 -7
- package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js +1 -13
- package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/participantListSelectorUtils.d.ts +0 -5
- package/dist/dist-esm/calling-component-bindings/src/utils/participantListSelectorUtils.js +0 -11
- package/dist/dist-esm/calling-component-bindings/src/utils/participantListSelectorUtils.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +4 -11
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +0 -3
- package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.d.ts +5 -6
- package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.d.ts +1 -15
- package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.d.ts +1 -2
- package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js +0 -5
- package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +1 -115
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +1 -19
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +2 -162
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +0 -51
- package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +0 -5
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +0 -57
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/Converter.d.ts +0 -10
- package/dist/dist-esm/calling-stateful-client/src/Converter.js +2 -39
- package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.d.ts +0 -9
- package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js +0 -5
- package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.d.ts +0 -1
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js +3 -25
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/ParticipantSubscriber.d.ts +0 -1
- package/dist/dist-esm/calling-stateful-client/src/ParticipantSubscriber.js +0 -8
- package/dist/dist-esm/calling-stateful-client/src/ParticipantSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.d.ts +0 -1
- package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.js +0 -8
- package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +1 -25
- package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js +2 -33
- package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/TypeGuards.d.ts +2 -9
- package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js +0 -18
- package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +0 -4
- package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/index.d.ts +0 -1
- package/dist/dist-esm/calling-stateful-client/src/index.js +0 -2
- package/dist/dist-esm/calling-stateful-client/src/index.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +1 -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 +5 -72
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js +3 -3
- package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js +1 -3
- package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js +1 -4
- package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.d.ts +0 -1
- package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +0 -28
- package/dist/dist-esm/communication-react/src/index.js +0 -14
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/CameraButton.d.ts +0 -8
- package/dist/dist-esm/react-components/src/components/CameraButton.js +0 -21
- package/dist/dist-esm/react-components/src/components/CameraButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionsFlyout.js +11 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionsFlyout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.d.ts +2 -12
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js +2 -5
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +29 -23
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.d.ts +1 -11
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +3 -22
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +0 -12
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +18 -60
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js +0 -6
- package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.d.ts +5 -0
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.js +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerSurface.d.ts +5 -0
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerSurface.js +21 -5
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerSurface.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ErrorBar.d.ts +0 -8
- package/dist/dist-esm/react-components/src/components/ErrorBar.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/FileCard.js +5 -5
- package/dist/dist-esm/react-components/src/components/FileCard.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/FileCardGroup.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/FileCardGroup.js +2 -2
- package/dist/dist-esm/react-components/src/components/FileCardGroup.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.d.ts +1 -13
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.js +17 -16
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/FileUploadCards.js +1 -3
- package/dist/dist-esm/react-components/src/components/FileUploadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +24 -26
- package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +4 -40
- package/dist/dist-esm/react-components/src/components/MessageThread.js +12 -49
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MicrophoneButton.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/MicrophoneButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantItem.d.ts +0 -13
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js +0 -3
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantList.js +1 -7
- package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantsButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js +2 -42
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.d.ts +0 -35
- package/dist/dist-esm/react-components/src/components/SendBox.js +1 -26
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/UnsupportedBrowser.js +0 -2
- package/dist/dist-esm/react-components/src/components/UnsupportedBrowser.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/UnsupportedBrowserVersion.js +0 -2
- package/dist/dist-esm/react-components/src/components/UnsupportedBrowserVersion.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/UnsupportedEnvironment.js +0 -24
- package/dist/dist-esm/react-components/src/components/UnsupportedEnvironment.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/UnsupportedOperatingSystem.js +0 -2
- package/dist/dist-esm/react-components/src/components/UnsupportedOperatingSystem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VerticalGallery.js +4 -17
- package/dist/dist-esm/react-components/src/components/VerticalGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +5 -18
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +6 -24
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/Layout.d.ts +0 -6
- package/dist/dist-esm/react-components/src/components/VideoGallery/Layout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.d.ts +0 -5
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js +3 -32
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoTileContextualMenuProps.js +1 -7
- package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoTileContextualMenuProps.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +3 -46
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +0 -81
- package/dist/dist-esm/react-components/src/components/VideoGallery.js +9 -104
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoTile.d.ts +0 -22
- package/dist/dist-esm/react-components/src/components/VideoTile.js +11 -88
- package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +0 -18
- package/dist/dist-esm/react-components/src/components/index.js +0 -16
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.d.ts +10 -0
- package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js +10 -0
- package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +0 -5
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +1 -29
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ParticipantList.styles.js +4 -1
- package/dist/dist-esm/react-components/src/components/styles/ParticipantList.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +2 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.js +0 -4
- package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.d.ts +1 -2
- package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils.d.ts +14 -0
- package/dist/dist-esm/react-components/src/components/utils.js +21 -1
- package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts +0 -4
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js +1 -5
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/index.d.ts +0 -4
- package/dist/dist-esm/react-components/src/index.js +0 -2
- package/dist/dist-esm/react-components/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +0 -59
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +331 -0
- package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +331 -0
- package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +331 -0
- package/dist/dist-esm/react-components/src/localization/locales/index.d.ts +36 -0
- package/dist/dist-esm/react-components/src/localization/locales/index.js +54 -0
- package/dist/dist-esm/react-components/src/localization/locales/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +331 -0
- package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +331 -0
- package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +331 -0
- package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +4 -4
- package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +4 -4
- package/dist/dist-esm/react-components/src/theming/icons.d.ts +0 -29
- package/dist/dist-esm/react-components/src/theming/icons.js +1 -143
- package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -27
- package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/OnRender.d.ts +0 -8
- package/dist/dist-esm/react-components/src/types/OnRender.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ParticipantListParticipant.d.ts +0 -3
- package/dist/dist-esm/react-components/src/types/ParticipantListParticipant.js +0 -2
- package/dist/dist-esm/react-components/src/types/ParticipantListParticipant.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.d.ts +0 -8
- package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js +0 -2
- package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +0 -89
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +12 -57
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +4 -221
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +7 -103
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +24 -325
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +1 -263
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.d.ts +2 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js +1 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +0 -8
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.d.ts +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +8 -90
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.d.ts +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +1 -144
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.d.ts +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js +0 -27
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js +2 -20
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.d.ts +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js +0 -27
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.d.ts +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js +5 -45
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.d.ts +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js +8 -28
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.d.ts +4 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.js +1 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Devices.js +2 -33
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Devices.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/ScreenShare.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/ScreenShare.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js +2 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.d.ts +1 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +5 -51
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +0 -10
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +1 -3
- 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/ConfigurationPage.d.ts +0 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +8 -115
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +0 -2
- 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/NoticePage.d.ts +4 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/NoticePage.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/NoticePage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.d.ts +0 -32
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +0 -57
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.js +0 -4
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallComposite.styles.d.ts +6 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallComposite.styles.js +7 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallComposite.styles.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.d.ts +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +3 -33
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +6 -109
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +1 -61
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +5 -30
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.d.ts +0 -44
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +5 -49
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +7 -198
- 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 +1 -124
- 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/CallWithChatBackedCallAdapter.d.ts +2 -22
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +1 -93
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +0 -13
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +1 -37
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/index.d.ts +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +0 -27
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +3 -19
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +0 -20
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +0 -4
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +3 -43
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.d.ts +0 -4
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +2 -28
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +6 -128
- 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/AzureCommunicationFileUploadAdapter.d.ts +0 -28
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js +1 -159
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +2 -17
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.js +1 -8
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +0 -4
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.d.ts +1 -5
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js +0 -11
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.d.ts +0 -5
- package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js +2 -3
- package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.d.ts +0 -3
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +4 -36
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.d.ts +0 -13
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js +0 -181
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.d.ts +0 -2
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js +1 -5
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ModalLocalAndRemotePIP.js +1 -14
- package/dist/dist-esm/react-composites/src/composites/common/ModalLocalAndRemotePIP.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js +2 -18
- package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/TabHeader.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/common/TabHeader.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -46
- package/dist/dist-esm/react-composites/src/composites/common/icons.js +1 -21
- package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +4 -26
- package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/index.d.ts +0 -2
- package/dist/dist-esm/react-composites/src/composites/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +199 -0
- package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +199 -0
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +199 -0
- package/dist/dist-esm/react-composites/src/composites/localization/locales/index.d.ts +36 -0
- package/dist/dist-esm/react-composites/src/composites/localization/locales/index.js +61 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +199 -0
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +199 -0
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +199 -0
- package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +7 -1
- package/package.json +17 -15
- package/CHANGELOG.beta.md +0 -929
- package/CHANGELOG.json +0 -12481
- package/CHANGELOG.stable.md +0 -373
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.d.ts +0 -48
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js +0 -69
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js.map +0 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.d.ts +0 -43
- package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js +0 -85
- package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +0 -1
- package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.d.ts +0 -18
- package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js +0 -38
- package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js.map +0 -1
- package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.d.ts +0 -28
- package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.js +0 -49
- package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.js.map +0 -1
- package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.d.ts +0 -19
- package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js +0 -89
- package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +0 -1
- package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.d.ts +0 -23
- package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js +0 -49
- package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/Caption.d.ts +0 -21
- package/dist/dist-esm/react-components/src/components/Caption.js +0 -32
- package/dist/dist-esm/react-components/src/components/Caption.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.d.ts +0 -32
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js +0 -48
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.d.ts +0 -37
- package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js +0 -86
- package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.d.ts +0 -69
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js +0 -43
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.d.ts +0 -75
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js +0 -75
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.d.ts +0 -105
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js +0 -68
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.d.ts +0 -86
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js +0 -39
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/HoldButton.d.ts +0 -49
- package/dist/dist-esm/react-components/src/components/HoldButton.js +0 -25
- package/dist/dist-esm/react-components/src/components/HoldButton.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.d.ts +0 -35
- package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js +0 -32
- package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/StartCaptionsButton.d.ts +0 -70
- package/dist/dist-esm/react-components/src/components/StartCaptionsButton.js +0 -54
- package/dist/dist-esm/react-components/src/components/StartCaptionsButton.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/ScrollableHorizontalGallery.d.ts +0 -10
- package/dist/dist-esm/react-components/src/components/VideoGallery/ScrollableHorizontalGallery.js +0 -26
- package/dist/dist-esm/react-components/src/components/VideoGallery/ScrollableHorizontalGallery.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/ScrollableHorizontalGallery.style.d.ts +0 -10
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/ScrollableHorizontalGallery.style.js +0 -31
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/ScrollableHorizontalGallery.style.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.d.ts +0 -58
- package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js +0 -144
- package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/styles/Captions.style.d.ts +0 -33
- package/dist/dist-esm/react-components/src/components/styles/Captions.style.js +0 -61
- package/dist/dist-esm/react-components/src/components/styles/Captions.style.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.d.ts +0 -34
- package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.js +0 -86
- package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/styles/Common.style.d.ts +0 -14
- package/dist/dist-esm/react-components/src/components/styles/Common.style.js +0 -16
- package/dist/dist-esm/react-components/src/components/styles/Common.style.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.d.ts +0 -38
- package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js +0 -92
- package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.d.ts +0 -26
- package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js +0 -67
- package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/utils/merge.d.ts +0 -7
- package/dist/dist-esm/react-components/src/components/utils/merge.js +0 -16
- package/dist/dist-esm/react-components/src/components/utils/merge.js.map +0 -1
- package/dist/dist-esm/react-components/src/permissions/PermissionsProvider.d.ts +0 -61
- package/dist/dist-esm/react-components/src/permissions/PermissionsProvider.js +0 -74
- package/dist/dist-esm/react-components/src/permissions/PermissionsProvider.js.map +0 -1
- package/dist/dist-esm/react-components/src/permissions/index.d.ts +0 -2
- package/dist/dist-esm/react-components/src/permissions/index.js +0 -4
- package/dist/dist-esm/react-components/src/permissions/index.js.map +0 -1
- package/dist/dist-esm/react-components/src/theming/icons.styles.d.ts +0 -6
- package/dist/dist-esm/react-components/src/theming/icons.styles.js +0 -25
- package/dist/dist-esm/react-components/src/theming/icons.styles.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.d.ts +0 -48
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js +0 -218
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.d.ts +0 -12
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js +0 -93
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.d.ts +0 -9
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.js +0 -75
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.d.ts +0 -8
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.js +0 -26
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.d.ts +0 -19
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +0 -30
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.d.ts +0 -15
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.js +0 -54
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/activeVideoBackgroundEffectSelector.d.ts +0 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/activeVideoBackgroundEffectSelector.js +0 -20
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/activeVideoBackgroundEffectSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/videoBackgroundErrorsSelector.d.ts +0 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/videoBackgroundErrorsSelector.js +0 -17
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/videoBackgroundErrorsSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.d.ts +0 -32
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.js +0 -81
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.d.ts +0 -18
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js +0 -18
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.d.ts +0 -15
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.js +0 -23
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +0 -6
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js +0 -11
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +0 -13
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.d.ts +0 -23
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.js +0 -14
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.d.ts +0 -22
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js +0 -107
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.d.ts +0 -17
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.js +0 -32
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.d.ts +0 -22
- package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js +0 -74
- package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.d.ts +0 -15
- package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js +0 -61
- package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsBanner.d.ts +0 -6
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsBanner.js +0 -61
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsBanner.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsBannerMoreButton.d.ts +0 -12
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsBannerMoreButton.js +0 -111
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsBannerMoreButton.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsSettingsModal.d.ts +0 -7
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsSettingsModal.js +0 -38
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsSettingsModal.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.d.ts +0 -17
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js +0 -215
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.styles.d.ts +0 -6
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.styles.js +0 -24
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.styles.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.d.ts +0 -20
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.js +0 -52
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.styles.d.ts +0 -7
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.styles.js +0 -25
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.styles.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.d.ts +0 -17
- package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js +0 -50
- package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.styles.d.ts +0 -11
- package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.styles.js +0 -40
- package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.styles.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.d.ts +0 -12
- package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js +0 -140
- package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js.map +0 -1
package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import { concatStyleSets, Icon, mergeStyles, Stack } from '@fluentui/react';
|
4
|
+
import { Chat } from "../../../../northstar-wrapper/src";
|
4
5
|
import { _formatString } from "../../../../acs-ui-common/src";
|
5
6
|
import { useTheme } from '../../theming/FluentThemeProvider';
|
6
7
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
@@ -8,7 +9,7 @@ import { editBoxStyle, inputBoxIcon, editingButtonStyle, editBoxStyleSet } from
|
|
8
9
|
import { InputBoxButton, InputBoxComponent } from '../InputBoxComponent';
|
9
10
|
import { borderAndBoxShadowStyle } from '../styles/SendBox.styles';
|
10
11
|
import { _FileUploadCards } from '../FileUploadCards';
|
11
|
-
import { chatMessageFailedTagStyle } from '../styles/ChatMessageComponent.styles';
|
12
|
+
import { chatMessageFailedTagStyle, chatMessageEditContainerStyle } from '../styles/ChatMessageComponent.styles';
|
12
13
|
const MAXIMUM_LENGTH_OF_MESSAGE = 8000;
|
13
14
|
const onRenderCancelIcon = (color) => {
|
14
15
|
const className = mergeStyles(inputBoxIcon, {
|
@@ -64,37 +65,42 @@ export const ChatMessageComponentAsEditBox = (props) => {
|
|
64
65
|
setAttachedFilesMetadata(attachedFilesMetadata === null || attachedFilesMetadata === void 0 ? void 0 : attachedFilesMetadata.filter(file => file.name !== fileId));
|
65
66
|
} }));
|
66
67
|
}, [attachedFilesMetadata]);
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
onCancel && onCancel(message.messageId);
|
79
|
-
}, id: 'dismissIconWrapper' }),
|
80
|
-
React.createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxSubmitButton, tooltipContent: strings.editBoxSubmitButton, onRenderIcon: onRenderThemedSubmitIcon, onClick: e => {
|
68
|
+
const getContent = () => {
|
69
|
+
return React.createElement(Stack, { className: mergeStyles(borderAndBoxShadowStyle({
|
70
|
+
theme,
|
71
|
+
hasErrorMessage: message.failureReason !== undefined,
|
72
|
+
disabled: false
|
73
|
+
})) },
|
74
|
+
React.createElement(InputBoxComponent, { inlineChildren: props.inlineEditButtons, id: 'editbox', textFieldRef: editTextFieldRef, inputClassName: editBoxStyle(props.inlineEditButtons), placeholderText: strings.editBoxPlaceholderText, textValue: textValue, onChange: setText, onKeyDown: ev => {
|
75
|
+
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {
|
76
|
+
ev.stopPropagation();
|
77
|
+
}
|
78
|
+
}, onEnterKeyDown: () => {
|
81
79
|
submitEnabled && onSubmit(textValue, message.metadata, {
|
82
80
|
attachedFilesMetadata
|
83
81
|
});
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
82
|
+
}, supportNewline: false, maxLength: MAXIMUM_LENGTH_OF_MESSAGE, errorMessage: textTooLongMessage, styles: editBoxStyles },
|
83
|
+
React.createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxCancelButton, tooltipContent: strings.editBoxCancelButton, onRenderIcon: onRenderThemedCancelIcon, onClick: () => {
|
84
|
+
onCancel && onCancel(message.messageId);
|
85
|
+
}, id: 'dismissIconWrapper' }),
|
86
|
+
React.createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxSubmitButton, tooltipContent: strings.editBoxSubmitButton, onRenderIcon: onRenderThemedSubmitIcon, onClick: e => {
|
87
|
+
submitEnabled && onSubmit(textValue, message.metadata, {
|
88
|
+
attachedFilesMetadata
|
89
|
+
});
|
90
|
+
e.stopPropagation();
|
91
|
+
}, id: 'submitIconWrapper' })),
|
92
|
+
message.failureReason && React.createElement("div", { className: mergeStyles(chatMessageFailedTagStyle(theme), {
|
93
|
+
padding: '0.5rem'
|
94
|
+
}) }, message.failureReason),
|
95
|
+
onRenderFileUploads());
|
96
|
+
};
|
97
|
+
return React.createElement(Chat.Message, { styles: chatMessageEditContainerStyle, content: getContent() });
|
90
98
|
};
|
91
99
|
const isMessageTooLong = (messageText) => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;
|
92
100
|
const isMessageEmpty = (messageText, attachedFilesMetadata) => messageText.trim().length === 0 && attachedFilesMetadata.length === 0;
|
93
101
|
const getMessageState = (messageText, attachedFilesMetadata) => isMessageEmpty(messageText, attachedFilesMetadata) ? 'too short' : isMessageTooLong(messageText) ? 'too long' : 'OK';
|
94
102
|
// @TODO: Remove when file-sharing feature becomes stable.
|
95
103
|
const getMessageAttachedFilesMetadata = (message) => {
|
96
|
-
/* @conditional-compile-remove(file-sharing) */
|
97
|
-
return message.attachedFilesMetadata;
|
98
104
|
return [];
|
99
105
|
};
|
100
106
|
//# sourceMappingURL=ChatMessageComponentAsEditBox.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponentAsEditBox.js","sourceRoot":"","sources":["../../../../../../preprocess-dist/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAE,IAAI,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AAC,IACK,OAAO,CAAC,aAAa,CAClB;QACP,mBAAmB,EAAE,CAChB,CAAC;AACb,CAAC,CAAC;AACF,MAAM,gBAAgB,GAAG,CAAC,WAAmB,EAAW,EAAE,CAAC,WAAW,CAAC,MAAM,GAAG,yBAAyB,CAAC;AAC1G,MAAM,cAAc,GAAG,CAAC,WAAmB,EAAE,qBAAqC,EAAW,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,qBAAqB,CAAC,MAAM,KAAK,CAAC,CAAC;AACtK,MAAM,eAAe,GAAG,CAAC,WAAmB,EAAE,qBAAqC,EAAgB,EAAE,CAAC,cAAc,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AAE3N,0DAA0D;AAC1D,MAAM,+BAA+B,GAAG,CAAC,OAAoB,EAA8B,EAAE;IAC3F,+CAA+C;IAC/C,OAAO,OAAO,CAAC,qBAAqB,CAAC;IACrC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { concatStyleSets, Icon, ITextField, mergeStyles, Stack } from '@fluentui/react';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { editBoxStyle, inputBoxIcon, editingButtonStyle, editBoxStyleSet } from '../styles/EditBox.styles';\nimport { InputBoxButton, InputBoxComponent } from '../InputBoxComponent';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { borderAndBoxShadowStyle } from '../styles/SendBox.styles';\nimport { ChatMessage } from '../../types';\nimport { _FileUploadCards } from '../FileUploadCards';\nimport { FileMetadata } from '../FileDownloadCards';\nimport { chatMessageFailedTagStyle } from '../styles/ChatMessageComponent.styles';\nconst MAXIMUM_LENGTH_OF_MESSAGE = 8000;\nconst onRenderCancelIcon = (color: string): JSX.Element => {\n const className = mergeStyles(inputBoxIcon, {\n color\n });\n return <Icon iconName={'EditBoxCancel'} className={className} />;\n};\nconst onRenderSubmitIcon = (color: string): JSX.Element => {\n const className = mergeStyles(inputBoxIcon, {\n color\n });\n return <Icon iconName={'EditBoxSubmit'} className={className} />;\n};\n\n/** @private */\nexport type ChatMessageComponentAsEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (text: string, metadata?: Record<string, string>, options?: {\n attachedFilesMetadata?: FileMetadata[];\n }) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /**\n * Inline the accept and reject edit buttons when editing a message.\n * Setting to false will mean they are on a new line inside the editable chat message.\n */\n inlineEditButtons: boolean;\n};\ntype MessageState = 'OK' | 'too short' | 'too long';\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditBoxProps): JSX.Element => {\n const {\n onCancel,\n onSubmit,\n strings,\n message\n } = props;\n const [textValue, setTextValue] = useState<string>(message.content || '');\n const [attachedFilesMetadata, setAttachedFilesMetadata] = React.useState(getMessageAttachedFilesMetadata(message));\n const editTextFieldRef = React.useRef<ITextField>(null);\n const theme = useTheme();\n const messageState = getMessageState(textValue, attachedFilesMetadata ?? []);\n const submitEnabled = messageState === 'OK';\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n const setText = (event?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n const textTooLongMessage = messageState === 'too long' ? _formatString(strings.editBoxTextLimit, {\n limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}`\n }) : undefined;\n const onRenderThemedCancelIcon = useCallback(() => onRenderCancelIcon(theme.palette.neutralSecondary), [theme.palette.neutralSecondary]);\n const onRenderThemedSubmitIcon = useCallback(() => onRenderSubmitIcon(theme.palette.neutralSecondary), [theme.palette.neutralSecondary]);\n const editBoxStyles = useMemo(() => {\n return concatStyleSets(editBoxStyleSet, {\n textField: {\n borderColor: theme.palette.themePrimary\n }\n });\n }, [theme.palette.themePrimary]);\n const onRenderFileUploads = useCallback(() => {\n return attachedFilesMetadata?.length && <div style={{\n margin: '0.25rem'\n }}>\n <_FileUploadCards activeFileUploads={attachedFilesMetadata?.map(file => ({\n id: file.name,\n filename: file.name,\n progress: 1\n }))} onCancelFileUpload={fileId => {\n setAttachedFilesMetadata(attachedFilesMetadata?.filter(file => file.name !== fileId));\n }} />\n </div>;\n }, [attachedFilesMetadata]);\n return <Stack className={mergeStyles(borderAndBoxShadowStyle({\n theme,\n hasErrorMessage: message.failureReason !== undefined,\n disabled: false\n }))}>\n <InputBoxComponent inlineChildren={props.inlineEditButtons} id={'editbox'} textFieldRef={editTextFieldRef} inputClassName={editBoxStyle(props.inlineEditButtons)} placeholderText={strings.editBoxPlaceholderText} textValue={textValue} onChange={setText} onEnterKeyDown={() => {\n submitEnabled && onSubmit(textValue, message.metadata, {\n attachedFilesMetadata\n });\n }} supportNewline={false} maxLength={MAXIMUM_LENGTH_OF_MESSAGE} errorMessage={textTooLongMessage} styles={editBoxStyles}>\n <InputBoxButton className={editingButtonStyle} ariaLabel={strings.editBoxCancelButton} tooltipContent={strings.editBoxCancelButton} onRenderIcon={onRenderThemedCancelIcon} onClick={() => {\n onCancel && onCancel(message.messageId);\n }} id={'dismissIconWrapper'} />\n <InputBoxButton className={editingButtonStyle} ariaLabel={strings.editBoxSubmitButton} tooltipContent={strings.editBoxSubmitButton} onRenderIcon={onRenderThemedSubmitIcon} onClick={e => {\n submitEnabled && onSubmit(textValue, message.metadata, {\n attachedFilesMetadata\n });\n e.stopPropagation();\n }} id={'submitIconWrapper'} />\n </InputBoxComponent>\n {message.failureReason && <div className={mergeStyles(chatMessageFailedTagStyle(theme), {\n padding: '0.5rem'\n })}>\n {message.failureReason}\n </div>}\n {onRenderFileUploads()}\n </Stack>;\n};\nconst isMessageTooLong = (messageText: string): boolean => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;\nconst isMessageEmpty = (messageText: string, attachedFilesMetadata: FileMetadata[]): boolean => messageText.trim().length === 0 && attachedFilesMetadata.length === 0;\nconst getMessageState = (messageText: string, attachedFilesMetadata: FileMetadata[]): MessageState => isMessageEmpty(messageText, attachedFilesMetadata) ? 'too short' : isMessageTooLong(messageText) ? 'too long' : 'OK';\n\n// @TODO: Remove when file-sharing feature becomes stable.\nconst getMessageAttachedFilesMetadata = (message: ChatMessage): FileMetadata[] | undefined => {\n /* @conditional-compile-remove(file-sharing) */\n return message.attachedFilesMetadata;\n return [];\n};\"../../../../acs-ui-common/src\""]}
|
1
|
+
{"version":3,"file":"ChatMessageComponentAsEditBox.js","sourceRoot":"","sources":["../../../../../../preprocess-dist/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAc,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,IAAI,EAAE,0CAAoC;AACnD,OAAO,EAAE,aAAa,EAAE,sCAAgC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,MAAM,uCAAu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G,CAAC,WAAmB,EAAE,qBAAqC,EAAW,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,qBAAqB,CAAC,MAAM,KAAK,CAAC,CAAC;AACtK,MAAM,eAAe,GAAG,CAAC,WAAmB,EAAE,qBAAqC,EAAgB,EAAE,CAAC,cAAc,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AAE3N,0DAA0D;AAC1D,MAAM,+BAA+B,GAAG,CAAC,OAAoB,EAA8B,EAAE;IAC3F,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { concatStyleSets, Icon, ITextField, mergeStyles, Stack } from '@fluentui/react';\nimport { Chat } from '@internal/northstar-wrapper';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { editBoxStyle, inputBoxIcon, editingButtonStyle, editBoxStyleSet } from '../styles/EditBox.styles';\nimport { InputBoxButton, InputBoxComponent } from '../InputBoxComponent';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { borderAndBoxShadowStyle } from '../styles/SendBox.styles';\nimport { ChatMessage } from '../../types';\nimport { _FileUploadCards } from '../FileUploadCards';\nimport { FileMetadata } from '../FileDownloadCards';\nimport { chatMessageFailedTagStyle, chatMessageEditContainerStyle } from '../styles/ChatMessageComponent.styles';\nconst MAXIMUM_LENGTH_OF_MESSAGE = 8000;\nconst onRenderCancelIcon = (color: string): JSX.Element => {\n const className = mergeStyles(inputBoxIcon, {\n color\n });\n return <Icon iconName={'EditBoxCancel'} className={className} />;\n};\nconst onRenderSubmitIcon = (color: string): JSX.Element => {\n const className = mergeStyles(inputBoxIcon, {\n color\n });\n return <Icon iconName={'EditBoxSubmit'} className={className} />;\n};\n\n/** @private */\nexport type ChatMessageComponentAsEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (text: string, metadata?: Record<string, string>, options?: {\n attachedFilesMetadata?: FileMetadata[];\n }) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /**\n * Inline the accept and reject edit buttons when editing a message.\n * Setting to false will mean they are on a new line inside the editable chat message.\n */\n inlineEditButtons: boolean;\n};\ntype MessageState = 'OK' | 'too short' | 'too long';\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditBoxProps): JSX.Element => {\n const {\n onCancel,\n onSubmit,\n strings,\n message\n } = props;\n const [textValue, setTextValue] = useState<string>(message.content || '');\n const [attachedFilesMetadata, setAttachedFilesMetadata] = React.useState(getMessageAttachedFilesMetadata(message));\n const editTextFieldRef = React.useRef<ITextField>(null);\n const theme = useTheme();\n const messageState = getMessageState(textValue, attachedFilesMetadata ?? []);\n const submitEnabled = messageState === 'OK';\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n const setText = (event?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n const textTooLongMessage = messageState === 'too long' ? _formatString(strings.editBoxTextLimit, {\n limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}`\n }) : undefined;\n const onRenderThemedCancelIcon = useCallback(() => onRenderCancelIcon(theme.palette.neutralSecondary), [theme.palette.neutralSecondary]);\n const onRenderThemedSubmitIcon = useCallback(() => onRenderSubmitIcon(theme.palette.neutralSecondary), [theme.palette.neutralSecondary]);\n const editBoxStyles = useMemo(() => {\n return concatStyleSets(editBoxStyleSet, {\n textField: {\n borderColor: theme.palette.themePrimary\n }\n });\n }, [theme.palette.themePrimary]);\n const onRenderFileUploads = useCallback(() => {\n return attachedFilesMetadata?.length && <div style={{\n margin: '0.25rem'\n }}>\n <_FileUploadCards activeFileUploads={attachedFilesMetadata?.map(file => ({\n id: file.name,\n filename: file.name,\n progress: 1\n }))} onCancelFileUpload={fileId => {\n setAttachedFilesMetadata(attachedFilesMetadata?.filter(file => file.name !== fileId));\n }} />\n </div>;\n }, [attachedFilesMetadata]);\n const getContent = (): JSX.Element => {\n return <Stack className={mergeStyles(borderAndBoxShadowStyle({\n theme,\n hasErrorMessage: message.failureReason !== undefined,\n disabled: false\n }))}>\n <InputBoxComponent inlineChildren={props.inlineEditButtons} id={'editbox'} textFieldRef={editTextFieldRef} inputClassName={editBoxStyle(props.inlineEditButtons)} placeholderText={strings.editBoxPlaceholderText} textValue={textValue} onChange={setText} onKeyDown={ev => {\n if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {\n ev.stopPropagation();\n }\n }} onEnterKeyDown={() => {\n submitEnabled && onSubmit(textValue, message.metadata, {\n attachedFilesMetadata\n });\n }} supportNewline={false} maxLength={MAXIMUM_LENGTH_OF_MESSAGE} errorMessage={textTooLongMessage} styles={editBoxStyles}>\n <InputBoxButton className={editingButtonStyle} ariaLabel={strings.editBoxCancelButton} tooltipContent={strings.editBoxCancelButton} onRenderIcon={onRenderThemedCancelIcon} onClick={() => {\n onCancel && onCancel(message.messageId);\n }} id={'dismissIconWrapper'} />\n <InputBoxButton className={editingButtonStyle} ariaLabel={strings.editBoxSubmitButton} tooltipContent={strings.editBoxSubmitButton} onRenderIcon={onRenderThemedSubmitIcon} onClick={e => {\n submitEnabled && onSubmit(textValue, message.metadata, {\n attachedFilesMetadata\n });\n e.stopPropagation();\n }} id={'submitIconWrapper'} />\n </InputBoxComponent>\n {message.failureReason && <div className={mergeStyles(chatMessageFailedTagStyle(theme), {\n padding: '0.5rem'\n })}>\n {message.failureReason}\n </div>}\n {onRenderFileUploads()}\n </Stack>;\n };\n return <Chat.Message styles={chatMessageEditContainerStyle} content={getContent()} />;\n};\nconst isMessageTooLong = (messageText: string): boolean => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;\nconst isMessageEmpty = (messageText: string, attachedFilesMetadata: FileMetadata[]): boolean => messageText.trim().length === 0 && attachedFilesMetadata.length === 0;\nconst getMessageState = (messageText: string, attachedFilesMetadata: FileMetadata[]): MessageState => isMessageEmpty(messageText, attachedFilesMetadata) ? 'too short' : isMessageTooLong(messageText) ? 'too long' : 'OK';\n\n// @TODO: Remove when file-sharing feature becomes stable.\nconst getMessageAttachedFilesMetadata = (message: ChatMessage): FileMetadata[] | undefined => {\n return [];\n};\"../../../../northstar-wrapper/src\"\"../../../../acs-ui-common/src\""]}
|
@@ -1,12 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ChatMessage } from '../../types/ChatMessage';
|
3
|
-
import { FileMetadata } from '../FileDownloadCards';
|
4
|
-
import { BlockedMessage } from '../../types/ChatMessage';
|
5
3
|
import { MessageThreadStrings } from '../MessageThread';
|
6
4
|
import { ComponentSlotStyle, OnRenderAvatarCallback } from '../../types';
|
7
5
|
import { FileDownloadHandler } from '../FileDownloadCards';
|
8
6
|
declare type ChatMessageComponentAsMessageBubbleProps = {
|
9
|
-
message: ChatMessage
|
7
|
+
message: ChatMessage;
|
10
8
|
messageContainerStyle?: ComponentSlotStyle;
|
11
9
|
showDate?: boolean;
|
12
10
|
disableEditing?: boolean;
|
@@ -44,14 +42,6 @@ declare type ChatMessageComponentAsMessageBubbleProps = {
|
|
44
42
|
* @beta
|
45
43
|
*/
|
46
44
|
onDisplayDateTimeString?: (messageDate: Date) => string;
|
47
|
-
/**
|
48
|
-
* Optional function to fetch attachments.
|
49
|
-
*/
|
50
|
-
onFetchAttachments?: (attachment: FileMetadata) => Promise<void>;
|
51
|
-
/**
|
52
|
-
* Optional map of attachment ids to blob urls.
|
53
|
-
*/
|
54
|
-
attachmentsMap?: Record<string, string>;
|
55
45
|
};
|
56
46
|
/** @private */
|
57
47
|
export declare const ChatMessageComponentAsMessageBubble: React.MemoExoticComponent<(props: ChatMessageComponentAsMessageBubbleProps) => JSX.Element>;
|
@@ -9,8 +9,6 @@ import { useIdentifiers } from '../../identifiers/IdentifierProvider';
|
|
9
9
|
import { useTheme } from '../../theming';
|
10
10
|
import { ChatMessageActionFlyout } from './ChatMessageActionsFlyout';
|
11
11
|
import { ChatMessageContent } from './ChatMessageContent';
|
12
|
-
/* @conditional-compile-remove(data-loss-prevention) */
|
13
|
-
import { BlockedMessageContent } from './ChatMessageContent';
|
14
12
|
import { chatMessageActionMenuProps } from './ChatMessageActionMenu';
|
15
13
|
import { _FileDownloadCards } from '../FileDownloadCards';
|
16
14
|
import { useLocale } from '../../localization';
|
@@ -20,8 +18,6 @@ const generateDefaultTimestamp = (createdOn, showDate, strings) => {
|
|
20
18
|
};
|
21
19
|
// onDisplayDateTimeString from props overwrite onDisplayDateTimeString from locale
|
22
20
|
const generateCustomizedTimestamp = (props, createdOn, locale) => {
|
23
|
-
/* @conditional-compile-remove(date-time-customization) */
|
24
|
-
return props.onDisplayDateTimeString ? props.onDisplayDateTimeString(createdOn) : locale.onDisplayDateTimeString ? locale.onDisplayDateTimeString(createdOn) : '';
|
25
21
|
return '';
|
26
22
|
};
|
27
23
|
/** @private */
|
@@ -42,7 +38,7 @@ const MessageBubble = (props) => {
|
|
42
38
|
const messageRef = useRef(null);
|
43
39
|
const messageActionButtonRef = useRef(null);
|
44
40
|
const [chatMessageActionFlyoutTarget, setChatMessageActionFlyoutTarget] = useState(undefined);
|
45
|
-
const chatActionsEnabled = !disableEditing && message.status !== 'sending' && !!message.mine
|
41
|
+
const chatActionsEnabled = !disableEditing && message.status !== 'sending' && !!message.mine;
|
46
42
|
const [messageReadBy, setMessageReadBy] = useState([]);
|
47
43
|
const actionMenuProps = wasInteractionByTouch ? undefined : chatMessageActionMenuProps({
|
48
44
|
ariaLabel: (_a = strings.actionMenuMoreOptions) !== null && _a !== void 0 ? _a : '',
|
@@ -63,15 +59,7 @@ const MessageBubble = (props) => {
|
|
63
59
|
// or not we need to set the target to undefined here to actually hide the action flyout
|
64
60
|
setChatMessageActionFlyoutTarget(undefined);
|
65
61
|
}, [setChatMessageActionFlyoutTarget]);
|
66
|
-
const defaultOnRenderFileDownloads = useCallback(() => {
|
67
|
-
var _a;
|
68
|
-
return React.createElement(_FileDownloadCards, { userId: userId, fileMetadata: message['attachedFilesMetadata'] || [], downloadHandler: fileDownloadHandler,
|
69
|
-
/* @conditional-compile-remove(file-sharing) */ strings: {
|
70
|
-
downloadFile: (_a = props.strings.downloadFile) !== null && _a !== void 0 ? _a : locale.strings.messageThread.downloadFile
|
71
|
-
} });
|
72
|
-
}, [userId, message,
|
73
|
-
props,
|
74
|
-
locale, fileDownloadHandler]);
|
62
|
+
const defaultOnRenderFileDownloads = useCallback(() => React.createElement(_FileDownloadCards, { userId: userId, fileMetadata: message['attachedFilesMetadata'] || [], downloadHandler: fileDownloadHandler }), [userId, message, fileDownloadHandler]);
|
75
63
|
const editedOn = 'editedOn' in message ? message.editedOn : undefined;
|
76
64
|
const getMessageDetails = useCallback(() => {
|
77
65
|
if (messageStatus === 'failed') {
|
@@ -83,15 +71,8 @@ const MessageBubble = (props) => {
|
|
83
71
|
return undefined;
|
84
72
|
}, [editedOn, message.messageType, messageStatus, strings.editedTag, strings.failToSendTag, theme]);
|
85
73
|
const getContent = useCallback(() => {
|
86
|
-
/* @conditional-compile-remove(data-loss-prevention) */
|
87
|
-
if (message.messageType === 'blocked') {
|
88
|
-
return React.createElement("div", { tabIndex: 0 },
|
89
|
-
React.createElement(BlockedMessageContent, { message: message, strings: strings }));
|
90
|
-
}
|
91
74
|
return React.createElement("div", { tabIndex: 0 },
|
92
|
-
React.createElement(ChatMessageContent, { message: message, strings: strings,
|
93
|
-
/* @conditional-compile-remove(teams-inline-images) */ onFetchAttachment: props.onFetchAttachments,
|
94
|
-
/* @conditional-compile-remove(teams-inline-images) */ attachmentsMap: props.attachmentsMap }),
|
75
|
+
React.createElement(ChatMessageContent, { message: message, strings: strings }),
|
95
76
|
props.onRenderFileDownloads ? props.onRenderFileDownloads(userId, message) : defaultOnRenderFileDownloads());
|
96
77
|
}, [defaultOnRenderFileDownloads, message, props, strings, userId]);
|
97
78
|
const chatMessage = React.createElement(React.Fragment, null,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../preprocess-dist/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,0CAAoC;AAEzD,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AACnI,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,uDAAuD;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAuB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAmB,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAoDhE,MAAM,wBAAwB,GAAG,CAAC,SAAe,EAAE,QAA6B,EAAE,OAA6B,EAAU,EAAE;IACzH,MAAM,kBAAkB,GAAG,QAAQ,CAAC,CAAC,CAAC,6BAA6B,CAAC,SAAS,EAAE,IAAI,IAAI,EAAE,EAA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CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE;oBACzoB,IAAI,CAAC,qBAAqB,EAAE;wBAC1B,OAAO;qBACR;oBACD,oEAAoE;oBACpE,gEAAgE;oBAChE,uCAAuC;oBACvC,yEAAyE;oBACzE,8DAA8D;oBAC9D,gCAAgC,CAAC,UAAU,CAAC,CAAC;oBAC7C,IAAI,OAAO,CAAC,WAAW,KAAK,MAAM,EAAE;wBAClC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;qBACtD;gBACH,CAAC,GAAI,CACC;QACL,kBAAkB,IAAI,oBAAC,uBAAuB,IAAC,MAAM,EAAE,CAAC,6BAA6B,EAAE,MAAM,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,QAAQ,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,GAAI,CACzf,CAAC;IACN,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle, mergeStyles } from '@fluentui/react';\nimport { Chat, Text } from '@internal/northstar-wrapper';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useRef, useState } from 'react';\nimport { chatMessageEditedTagStyle, chatMessageDateStyle, chatMessageFailedTagStyle } from '../styles/ChatMessageComponent.styles';\nimport { formatTimeForChatMessage, formatTimestampForChatMessage } from '../utils/Datetime';\nimport { useIdentifiers } from '../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../theming';\nimport { ChatMessageActionFlyout } from './ChatMessageActionsFlyout';\nimport { ChatMessageContent } from './ChatMessageContent';\nimport { ChatMessage } from '../../types/ChatMessage';\n/* @conditional-compile-remove(teams-inline-images) */\nimport { FileMetadata } from '../FileDownloadCards';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessageContent } from './ChatMessageContent';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types/ChatMessage';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { chatMessageActionMenuProps } from './ChatMessageActionMenu';\nimport { ComponentSlotStyle, OnRenderAvatarCallback } from '../../types';\nimport { _FileDownloadCards, FileDownloadHandler } from '../FileDownloadCards';\nimport { ComponentLocale, useLocale } from '../../localization';\ntype ChatMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onEditClick: () => void;\n onRemoveClick?: () => void;\n onResendClick?: () => void;\n strings: MessageThreadStrings;\n userId: string;\n messageStatus?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n /**\n * Optional callback to render uploaded files in the message component.\n */\n onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;\n /**\n * Optional function called when someone clicks on the file download icon.\n */\n fileDownloadHandler?: FileDownloadHandler;\n remoteParticipantsCount?: number;\n onActionButtonClick: (message: ChatMessage, setMessageReadBy: (readBy: {\n id: string;\n displayName: string;\n }[]) => void) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(teams-inline-images) */\n /**\n * Optional function to fetch attachments.\n */\n onFetchAttachments?: (attachment: FileMetadata) => Promise<void>;\n /* @conditional-compile-remove(teams-inline-images) */\n /**\n * Optional map of attachment ids to blob urls.\n */\n attachmentsMap?: Record<string, string>;\n};\nconst generateDefaultTimestamp = (createdOn: Date, showDate: boolean | undefined, strings: MessageThreadStrings): string => {\n const formattedTimestamp = showDate ? formatTimestampForChatMessage(createdOn, new Date(), strings) : formatTimeForChatMessage(createdOn);\n return formattedTimestamp;\n};\n\n// onDisplayDateTimeString from props overwrite onDisplayDateTimeString from locale\nconst generateCustomizedTimestamp = (props: ChatMessageComponentAsMessageBubbleProps, createdOn: Date, locale: ComponentLocale): string => {\n /* @conditional-compile-remove(date-time-customization) */\n return props.onDisplayDateTimeString ? props.onDisplayDateTimeString(createdOn) : locale.onDisplayDateTimeString ? locale.onDisplayDateTimeString(createdOn) : '';\n return '';\n};\n/** @private */\nconst MessageBubble = (props: ChatMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n const {\n userId,\n message,\n onRemoveClick,\n onResendClick,\n disableEditing,\n showDate,\n messageContainerStyle,\n strings,\n onEditClick,\n remoteParticipantsCount = 0,\n onRenderAvatar,\n showMessageStatus,\n messageStatus,\n fileDownloadHandler\n } = props;\n const defaultTimeStamp = message.createdOn ? generateDefaultTimestamp(message.createdOn, showDate, strings) : undefined;\n const customTimestamp = message.createdOn ? generateCustomizedTimestamp(props, message.createdOn, locale) : '';\n const formattedTimestamp = customTimestamp || defaultTimeStamp;\n\n // Track if the action menu was opened by touch - if so we increase the touch targets for the items\n const [wasInteractionByTouch, setWasInteractionByTouch] = useState(false);\n\n // The chat message action flyout should target the Chat.Message action menu if clicked,\n // or target the chat message if opened via touch press.\n // Undefined indicates the flyout menu should not be being shown.\n const messageRef = useRef<HTMLDivElement | null>(null);\n const messageActionButtonRef = useRef<HTMLElement | null>(null);\n const [chatMessageActionFlyoutTarget, setChatMessageActionFlyoutTarget] = useState<React.MutableRefObject<HTMLElement | null> | undefined>(undefined);\n const chatActionsEnabled = !disableEditing && message.status !== 'sending' && !!message.mine && /* @conditional-compile-remove(data-loss-prevention) */message.messageType !== 'blocked';\n const [messageReadBy, setMessageReadBy] = useState<{\n id: string;\n displayName: string;\n }[]>([]);\n const actionMenuProps = wasInteractionByTouch ? undefined : chatMessageActionMenuProps({\n ariaLabel: strings.actionMenuMoreOptions ?? '',\n enabled: chatActionsEnabled,\n menuButtonRef: messageActionButtonRef,\n // Force show the action button while the flyout is open (otherwise this will dismiss when the pointer is hovered over the flyout)\n forceShow: chatMessageActionFlyoutTarget === messageActionButtonRef,\n onActionButtonClick: () => {\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n setChatMessageActionFlyoutTarget(messageActionButtonRef);\n }\n },\n theme\n });\n const onActionFlyoutDismiss = useCallback((): void => {\n // When the flyout dismiss is called, since we control if the action flyout is visible\n // or not we need to set the target to undefined here to actually hide the action flyout\n setChatMessageActionFlyoutTarget(undefined);\n }, [setChatMessageActionFlyoutTarget]);\n const defaultOnRenderFileDownloads = useCallback(() => <_FileDownloadCards userId={userId} fileMetadata={message['attachedFilesMetadata'] || []} downloadHandler={fileDownloadHandler}\n /* @conditional-compile-remove(file-sharing) */ strings={{\n downloadFile: props.strings.downloadFile ?? locale.strings.messageThread.downloadFile\n }} />, [userId, message, /* @conditional-compile-remove(file-sharing) */\n props, /* @conditional-compile-remove(file-sharing) */\n locale, fileDownloadHandler]);\n const editedOn = 'editedOn' in message ? message.editedOn : undefined;\n const getMessageDetails = useCallback(() => {\n if (messageStatus === 'failed') {\n return <div className={chatMessageFailedTagStyle(theme)}>{strings.failToSendTag}</div>;\n } else if (message.messageType === 'chat' && editedOn) {\n return <div className={chatMessageEditedTagStyle(theme)}>{strings.editedTag}</div>;\n }\n return undefined;\n }, [editedOn, message.messageType, messageStatus, strings.editedTag, strings.failToSendTag, theme]);\n const getContent = useCallback(() => {\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.messageType === 'blocked') {\n return <div tabIndex={0}>\n <BlockedMessageContent message={message} strings={strings} />\n </div>;\n }\n return <div tabIndex={0}>\n <ChatMessageContent message={message} strings={strings}\n /* @conditional-compile-remove(teams-inline-images) */ onFetchAttachment={props.onFetchAttachments}\n /* @conditional-compile-remove(teams-inline-images) */ attachmentsMap={props.attachmentsMap} />\n {props.onRenderFileDownloads ? props.onRenderFileDownloads(userId, message) : defaultOnRenderFileDownloads()}\n </div>;\n }, [defaultOnRenderFileDownloads, message, props, strings, userId]);\n const chatMessage = <>\n <div ref={messageRef}>\n <Chat.Message data-ui-id=\"chat-composite-message\" className={mergeStyles((messageContainerStyle as IStyle))} styles={messageContainerStyle} content={getContent()} author={<Text className={chatMessageDateStyle}>{message.senderDisplayName}</Text>} mine={message.mine} timestamp={<Text data-ui-id={ids.messageTimestamp}>{formattedTimestamp}</Text>} details={getMessageDetails()} positionActionMenu={false} actionMenu={actionMenuProps} onTouchStart={() => setWasInteractionByTouch(true)} onPointerDown={() => setWasInteractionByTouch(false)} onKeyDown={() => setWasInteractionByTouch(false)} onBlur={() => setWasInteractionByTouch(false)} onClick={() => {\n if (!wasInteractionByTouch) {\n return;\n }\n // If the message was touched via touch we immediately open the menu\n // flyout (when using mouse the 3-dot menu that appears on hover\n // must be clicked to open the flyout).\n // In doing so here we set the target of the flyout to be the message and\n // not the 3-dot menu button to position the flyout correctly.\n setChatMessageActionFlyoutTarget(messageRef);\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n }\n }} />\n </div>\n {chatActionsEnabled && <ChatMessageActionFlyout hidden={!chatMessageActionFlyoutTarget} target={chatMessageActionFlyoutTarget} increaseFlyoutItemSize={wasInteractionByTouch} onDismiss={onActionFlyoutDismiss} onEditClick={onEditClick} onRemoveClick={onRemoveClick} onResendClick={onResendClick} strings={strings} messageReadBy={messageReadBy} messageStatus={messageStatus ?? 'failed'} remoteParticipantsCount={remoteParticipantsCount} onRenderAvatar={onRenderAvatar} showMessageStatus={showMessageStatus} />}\n </>;\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);\"../../../../northstar-wrapper/src\"\"../../../../acs-ui-common/src\""]}
|
1
|
+
{"version":3,"file":"ChatMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../preprocess-dist/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,0CAAoC;AAEzD,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AACnI,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAuB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAmB,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA0ChE,MAAM,wBAAwB,GAAG,CAAC,SAAe,EAAE,QAA6B,EAAE,OAA6B,EAAU,EAAE;IACzH,MAAM,kBAAkB,GAAG,QAAQ,CAAC,CAAC,CAAC,6BAA6B,CAAC,SAAS,EAAE,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,GAAI,QAAQ,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,GAAI,CACzf,CAAC;IACN,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle, mergeStyles } from '@fluentui/react';\nimport { Chat, Text } from '@internal/northstar-wrapper';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useRef, useState } from 'react';\nimport { chatMessageEditedTagStyle, chatMessageDateStyle, chatMessageFailedTagStyle } from '../styles/ChatMessageComponent.styles';\nimport { formatTimeForChatMessage, formatTimestampForChatMessage } from '../utils/Datetime';\nimport { useIdentifiers } from '../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../theming';\nimport { ChatMessageActionFlyout } from './ChatMessageActionsFlyout';\nimport { ChatMessageContent } from './ChatMessageContent';\nimport { ChatMessage } from '../../types/ChatMessage';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { chatMessageActionMenuProps } from './ChatMessageActionMenu';\nimport { ComponentSlotStyle, OnRenderAvatarCallback } from '../../types';\nimport { _FileDownloadCards, FileDownloadHandler } from '../FileDownloadCards';\nimport { ComponentLocale, useLocale } from '../../localization';\ntype ChatMessageComponentAsMessageBubbleProps = {\n message: ChatMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onEditClick: () => void;\n onRemoveClick?: () => void;\n onResendClick?: () => void;\n strings: MessageThreadStrings;\n userId: string;\n messageStatus?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n /**\n * Optional callback to render uploaded files in the message component.\n */\n onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;\n /**\n * Optional function called when someone clicks on the file download icon.\n */\n fileDownloadHandler?: FileDownloadHandler;\n remoteParticipantsCount?: number;\n onActionButtonClick: (message: ChatMessage, setMessageReadBy: (readBy: {\n id: string;\n displayName: string;\n }[]) => void) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n};\nconst generateDefaultTimestamp = (createdOn: Date, showDate: boolean | undefined, strings: MessageThreadStrings): string => {\n const formattedTimestamp = showDate ? formatTimestampForChatMessage(createdOn, new Date(), strings) : formatTimeForChatMessage(createdOn);\n return formattedTimestamp;\n};\n\n// onDisplayDateTimeString from props overwrite onDisplayDateTimeString from locale\nconst generateCustomizedTimestamp = (props: ChatMessageComponentAsMessageBubbleProps, createdOn: Date, locale: ComponentLocale): string => {\n return '';\n};\n/** @private */\nconst MessageBubble = (props: ChatMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n const {\n userId,\n message,\n onRemoveClick,\n onResendClick,\n disableEditing,\n showDate,\n messageContainerStyle,\n strings,\n onEditClick,\n remoteParticipantsCount = 0,\n onRenderAvatar,\n showMessageStatus,\n messageStatus,\n fileDownloadHandler\n } = props;\n const defaultTimeStamp = message.createdOn ? generateDefaultTimestamp(message.createdOn, showDate, strings) : undefined;\n const customTimestamp = message.createdOn ? generateCustomizedTimestamp(props, message.createdOn, locale) : '';\n const formattedTimestamp = customTimestamp || defaultTimeStamp;\n\n // Track if the action menu was opened by touch - if so we increase the touch targets for the items\n const [wasInteractionByTouch, setWasInteractionByTouch] = useState(false);\n\n // The chat message action flyout should target the Chat.Message action menu if clicked,\n // or target the chat message if opened via touch press.\n // Undefined indicates the flyout menu should not be being shown.\n const messageRef = useRef<HTMLDivElement | null>(null);\n const messageActionButtonRef = useRef<HTMLElement | null>(null);\n const [chatMessageActionFlyoutTarget, setChatMessageActionFlyoutTarget] = useState<React.MutableRefObject<HTMLElement | null> | undefined>(undefined);\n const chatActionsEnabled = !disableEditing && message.status !== 'sending' && !!message.mine;\n const [messageReadBy, setMessageReadBy] = useState<{\n id: string;\n displayName: string;\n }[]>([]);\n const actionMenuProps = wasInteractionByTouch ? undefined : chatMessageActionMenuProps({\n ariaLabel: strings.actionMenuMoreOptions ?? '',\n enabled: chatActionsEnabled,\n menuButtonRef: messageActionButtonRef,\n // Force show the action button while the flyout is open (otherwise this will dismiss when the pointer is hovered over the flyout)\n forceShow: chatMessageActionFlyoutTarget === messageActionButtonRef,\n onActionButtonClick: () => {\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n setChatMessageActionFlyoutTarget(messageActionButtonRef);\n }\n },\n theme\n });\n const onActionFlyoutDismiss = useCallback((): void => {\n // When the flyout dismiss is called, since we control if the action flyout is visible\n // or not we need to set the target to undefined here to actually hide the action flyout\n setChatMessageActionFlyoutTarget(undefined);\n }, [setChatMessageActionFlyoutTarget]);\n const defaultOnRenderFileDownloads = useCallback(() => <_FileDownloadCards userId={userId} fileMetadata={message['attachedFilesMetadata'] || []} downloadHandler={fileDownloadHandler} />, [userId, message, fileDownloadHandler]);\n const editedOn = 'editedOn' in message ? message.editedOn : undefined;\n const getMessageDetails = useCallback(() => {\n if (messageStatus === 'failed') {\n return <div className={chatMessageFailedTagStyle(theme)}>{strings.failToSendTag}</div>;\n } else if (message.messageType === 'chat' && editedOn) {\n return <div className={chatMessageEditedTagStyle(theme)}>{strings.editedTag}</div>;\n }\n return undefined;\n }, [editedOn, message.messageType, messageStatus, strings.editedTag, strings.failToSendTag, theme]);\n const getContent = useCallback(() => {\n return <div tabIndex={0}>\n <ChatMessageContent message={message} strings={strings} />\n {props.onRenderFileDownloads ? props.onRenderFileDownloads(userId, message) : defaultOnRenderFileDownloads()}\n </div>;\n }, [defaultOnRenderFileDownloads, message, props, strings, userId]);\n const chatMessage = <>\n <div ref={messageRef}>\n <Chat.Message data-ui-id=\"chat-composite-message\" className={mergeStyles((messageContainerStyle as IStyle))} styles={messageContainerStyle} content={getContent()} author={<Text className={chatMessageDateStyle}>{message.senderDisplayName}</Text>} mine={message.mine} timestamp={<Text data-ui-id={ids.messageTimestamp}>{formattedTimestamp}</Text>} details={getMessageDetails()} positionActionMenu={false} actionMenu={actionMenuProps} onTouchStart={() => setWasInteractionByTouch(true)} onPointerDown={() => setWasInteractionByTouch(false)} onKeyDown={() => setWasInteractionByTouch(false)} onBlur={() => setWasInteractionByTouch(false)} onClick={() => {\n if (!wasInteractionByTouch) {\n return;\n }\n // If the message was touched via touch we immediately open the menu\n // flyout (when using mouse the 3-dot menu that appears on hover\n // must be clicked to open the flyout).\n // In doing so here we set the target of the flyout to be the message and\n // not the 3-dot menu button to position the flyout correctly.\n setChatMessageActionFlyoutTarget(messageRef);\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n }\n }} />\n </div>\n {chatActionsEnabled && <ChatMessageActionFlyout hidden={!chatMessageActionFlyoutTarget} target={chatMessageActionFlyoutTarget} increaseFlyoutItemSize={wasInteractionByTouch} onDismiss={onActionFlyoutDismiss} onEditClick={onEditClick} onRemoveClick={onRemoveClick} onResendClick={onResendClick} strings={strings} messageReadBy={messageReadBy} messageStatus={messageStatus ?? 'failed'} remoteParticipantsCount={remoteParticipantsCount} onRenderAvatar={onRenderAvatar} showMessageStatus={showMessageStatus} />}\n </>;\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);\"../../../../northstar-wrapper/src\"\"../../../../acs-ui-common/src\""]}
|
@@ -1,23 +1,11 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ChatMessage } from '../../types/ChatMessage';
|
3
|
-
import { BlockedMessage } from '../../types/ChatMessage';
|
4
3
|
import { MessageThreadStrings } from '../MessageThread';
|
5
|
-
import { FileMetadata } from '../FileDownloadCards';
|
6
4
|
declare type ChatMessageContentProps = {
|
7
5
|
message: ChatMessage;
|
8
6
|
strings: MessageThreadStrings;
|
9
|
-
attachmentsMap?: Record<string, string>;
|
10
|
-
onFetchAttachment?: (attachment: FileMetadata) => Promise<void>;
|
11
|
-
};
|
12
|
-
declare type BlockedMessageContentProps = {
|
13
|
-
message: BlockedMessage;
|
14
|
-
strings: MessageThreadStrings;
|
15
7
|
};
|
16
8
|
/** @private */
|
17
9
|
export declare const ChatMessageContent: (props: ChatMessageContentProps) => JSX.Element;
|
18
|
-
/**
|
19
|
-
* @private
|
20
|
-
*/
|
21
|
-
export declare const BlockedMessageContent: (props: BlockedMessageContentProps) => JSX.Element;
|
22
10
|
export {};
|
23
11
|
//# sourceMappingURL=ChatMessageContent.d.ts.map
|
@@ -1,15 +1,12 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import React from 'react';
|
4
|
-
/* @conditional-compile-remove(teams-inline-images) */
|
5
|
-
import { useEffect } from 'react';
|
6
4
|
import { _formatString } from "../../../../acs-ui-common/src";
|
7
5
|
import { Parser, ProcessNodeDefinitions, IsValidNodeDefinitions } from 'html-to-react';
|
8
6
|
import Linkify from 'react-linkify';
|
9
7
|
import { Link } from '@fluentui/react';
|
10
|
-
/* @conditional-compile-remove(data-loss-prevention) */
|
11
|
-
import { FontIcon, Stack } from '@fluentui/react';
|
12
8
|
import LiveMessage from '../Announcer/LiveMessage';
|
9
|
+
import DOMPurify from 'dompurify';
|
13
10
|
/** @private */
|
14
11
|
export const ChatMessageContent = (props) => {
|
15
12
|
switch (props.message.contentType) {
|
@@ -30,86 +27,47 @@ const MessageContentWithLiveAria = (props) => {
|
|
30
27
|
props.content);
|
31
28
|
};
|
32
29
|
const MessageContentAsRichTextHTML = (props) => {
|
33
|
-
|
34
|
-
author: `${props.message.senderDisplayName}`
|
35
|
-
});
|
36
|
-
/* @conditional-compile-remove(teams-inline-images) */
|
37
|
-
useEffect(() => {
|
38
|
-
var _a;
|
39
|
-
(_a = props.message.attachedFilesMetadata) === null || _a === void 0 ? void 0 : _a.map(fileMetadata => {
|
40
|
-
if (props.onFetchAttachment && props.attachmentsMap && props.attachmentsMap[fileMetadata.id] === undefined) {
|
41
|
-
props.onFetchAttachment(fileMetadata);
|
42
|
-
}
|
43
|
-
});
|
44
|
-
}, [props]);
|
45
|
-
return React.createElement(MessageContentWithLiveAria, { message: props.message, liveMessage: `${props.message.mine ? '' : liveAuthor} ${extractContent(props.message.content || '')}`, ariaLabel: messageContentAriaText(props), content: processHtmlToReact(props) });
|
30
|
+
return React.createElement(MessageContentWithLiveAria, { message: props.message, liveMessage: generateLiveMessage(props), ariaLabel: messageContentAriaText(props), content: processHtmlToReact(props) });
|
46
31
|
};
|
47
32
|
const MessageContentAsText = (props) => {
|
48
|
-
|
49
|
-
author: `${props.message.senderDisplayName}`
|
50
|
-
});
|
51
|
-
return React.createElement(MessageContentWithLiveAria, { message: props.message, liveMessage: `${props.message.mine ? '' : liveAuthor} ${extractContent(props.message.content || '')}`, ariaLabel: messageContentAriaText(props), content: React.createElement(Linkify, { componentDecorator: (decoratedHref, decoratedText, key) => {
|
33
|
+
return React.createElement(MessageContentWithLiveAria, { message: props.message, liveMessage: generateLiveMessage(props), ariaLabel: messageContentAriaText(props), content: React.createElement(Linkify, { componentDecorator: (decoratedHref, decoratedText, key) => {
|
52
34
|
return React.createElement(Link, { target: "_blank", href: decoratedHref, key: key }, decoratedText);
|
53
35
|
} }, props.message.content) });
|
54
36
|
};
|
55
|
-
/* @conditional-compile-remove(data-loss-prevention) */
|
56
|
-
/**
|
57
|
-
* @private
|
58
|
-
*/
|
59
|
-
export const BlockedMessageContent = (props) => {
|
60
|
-
var _a;
|
61
|
-
const Icon = React.createElement(FontIcon, { iconName: 'DataLossPreventionProhibited' });
|
62
|
-
const blockedMessage = props.message.warningText === undefined ? props.strings.blockedWarningText : props.message.warningText;
|
63
|
-
const blockedMessageLink = props.message.link;
|
64
|
-
const blockedMessageLinkText = blockedMessageLink ? (_a = props.message.linkText) !== null && _a !== void 0 ? _a : props.strings.blockedWarningLinkText : '';
|
65
|
-
const liveAuthor = props.message.mine || props.message.senderDisplayName === undefined ? '' : props.message.senderDisplayName;
|
66
|
-
const liveBlockedWarningText = `${liveAuthor} ${blockedMessage} ${blockedMessageLinkText}`;
|
67
|
-
return React.createElement(MessageContentWithLiveAria, { message: props.message, liveMessage: liveBlockedWarningText, ariaLabel: liveBlockedWarningText, content: React.createElement(Stack, { horizontal: true, wrap: true },
|
68
|
-
Icon,
|
69
|
-
blockedMessage && React.createElement("p", null, blockedMessage),
|
70
|
-
blockedMessageLink && React.createElement(Link, { target: '_blank', href: blockedMessageLink }, blockedMessageLinkText)) });
|
71
|
-
};
|
72
37
|
// https://stackoverflow.com/questions/28899298/extract-the-text-out-of-html-string-using-javascript
|
73
38
|
const extractContent = (s) => {
|
74
39
|
const span = document.createElement('span');
|
75
40
|
span.innerHTML = s;
|
76
41
|
return span.textContent || span.innerText;
|
77
42
|
};
|
43
|
+
const generateLiveMessage = (props) => {
|
44
|
+
const liveAuthor = _formatString(props.strings.liveAuthorIntro, {
|
45
|
+
author: `${props.message.senderDisplayName}`
|
46
|
+
});
|
47
|
+
return `${props.message.editedOn ? props.strings.editedTag : ''} ${props.message.mine ? '' : liveAuthor} ${extractContent(props.message.content || '')} `;
|
48
|
+
};
|
78
49
|
const messageContentAriaText = (props) => {
|
50
|
+
// Strip all html tags from the content for aria.
|
79
51
|
return props.message.content ? props.message.mine ? _formatString(props.strings.messageContentMineAriaText, {
|
80
|
-
message: props.message.content
|
52
|
+
message: DOMPurify.sanitize(props.message.content, {
|
53
|
+
ALLOWED_TAGS: []
|
54
|
+
})
|
81
55
|
}) : _formatString(props.strings.messageContentAriaText, {
|
82
56
|
author: `${props.message.senderDisplayName}`,
|
83
|
-
message: props.message.content
|
57
|
+
message: DOMPurify.sanitize(props.message.content, {
|
58
|
+
ALLOWED_TAGS: []
|
59
|
+
})
|
84
60
|
}) : undefined;
|
85
61
|
};
|
86
62
|
const processNodeDefinitions = ProcessNodeDefinitions();
|
87
63
|
const htmlToReactParser = Parser();
|
88
|
-
/* @conditional-compile-remove(teams-inline-images) */
|
89
|
-
const processInlineImage = (props) => ({
|
90
|
-
// Custom <img> processing
|
91
|
-
shouldProcessNode: (node) => {
|
92
|
-
var _a;
|
93
|
-
// Process img node with id in attachments list
|
94
|
-
return node.name && node.name === 'img' && node.attribs && node.attribs.id && ((_a = props.message.attachedFilesMetadata) === null || _a === void 0 ? void 0 : _a.find(f => f.id === node.attribs.id));
|
95
|
-
},
|
96
|
-
processNode: (node, children, index) => {
|
97
|
-
// logic to check id in map/list
|
98
|
-
if (props.attachmentsMap && node.attribs.id in props.attachmentsMap) {
|
99
|
-
node.attribs = Object.assign(Object.assign({}, node.attribs), { src: props.attachmentsMap[node.attribs.id] });
|
100
|
-
}
|
101
|
-
return processNodeDefinitions.processDefaultNode(node, children, index);
|
102
|
-
}
|
103
|
-
});
|
104
64
|
const processHtmlToReact = (props) => {
|
105
65
|
var _a;
|
106
|
-
const steps = [
|
107
|
-
processInlineImage(props), {
|
66
|
+
const steps = [{
|
108
67
|
// Process everything else in the default way
|
109
68
|
shouldProcessNode: IsValidNodeDefinitions.alwaysValid,
|
110
69
|
processNode: processNodeDefinitions.processDefaultNode
|
111
|
-
}
|
112
|
-
];
|
70
|
+
}];
|
113
71
|
return htmlToReactParser.parseWithInstructions((_a = props.message.content) !== null && _a !== void 0 ? _a : '', IsValidNodeDefinitions.alwaysValid, steps);
|
114
72
|
};
|
115
73
|
//# sourceMappingURL=ChatMessageContent.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageContent.js","sourceRoot":"","sources":["../../../../../../preprocess-dist/react-components/src/components/ChatMessage/ChatMessageContent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,M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\n// Licensed under the MIT license.\n\nimport React from 'react';\n/* @conditional-compile-remove(teams-inline-images) */\nimport { useEffect } from 'react';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { Parser, ProcessNodeDefinitions, IsValidNodeDefinitions, ProcessingInstructionType } from 'html-to-react';\nimport Linkify from 'react-linkify';\nimport { ChatMessage } from '../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types/ChatMessage';\nimport { Link } from '@fluentui/react';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { FontIcon, Stack } from '@fluentui/react';\nimport { MessageThreadStrings } from '../MessageThread';\n/* @conditional-compile-remove(teams-inline-images) */\nimport { FileMetadata } from '../FileDownloadCards';\nimport LiveMessage from '../Announcer/LiveMessage';\ntype ChatMessageContentProps = {\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(teams-inline-images) */\n attachmentsMap?: Record<string, string>;\n /* @conditional-compile-remove(teams-inline-images) */\n onFetchAttachment?: (attachment: FileMetadata) => Promise<void>;\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\ntype BlockedMessageContentProps = {\n message: BlockedMessage;\n strings: MessageThreadStrings;\n};\ntype MessageContentWithLiveAriaProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */BlockedMessage;\n liveMessage: string;\n ariaLabel?: string;\n content: JSX.Element;\n};\n\n/** @private */\nexport const ChatMessageContent = (props: ChatMessageContentProps): JSX.Element => {\n switch (props.message.contentType) {\n case 'text':\n return MessageContentAsText(props);\n case 'html':\n return MessageContentAsRichTextHTML(props);\n case 'richtext/html':\n return MessageContentAsRichTextHTML(props);\n default:\n console.warn('unknown message content type');\n return <></>;\n }\n};\nconst MessageContentWithLiveAria = (props: MessageContentWithLiveAriaProps): JSX.Element => {\n return <div data-ui-status={props.message.status} role=\"text\" aria-label={props.ariaLabel}>\n <LiveMessage message={props.liveMessage} ariaLive=\"polite\" />\n {props.content}\n </div>;\n};\nconst MessageContentAsRichTextHTML = (props: ChatMessageContentProps): JSX.Element => {\n const liveAuthor = _formatString(props.strings.liveAuthorIntro, {\n author: `${props.message.senderDisplayName}`\n });\n\n /* @conditional-compile-remove(teams-inline-images) */\n useEffect(() => {\n props.message.attachedFilesMetadata?.map(fileMetadata => {\n if (props.onFetchAttachment && props.attachmentsMap && props.attachmentsMap[fileMetadata.id] === undefined) {\n props.onFetchAttachment(fileMetadata);\n }\n });\n }, [props]);\n return <MessageContentWithLiveAria message={props.message} liveMessage={`${props.message.mine ? '' : liveAuthor} ${extractContent(props.message.content || '')}`} ariaLabel={messageContentAriaText(props)} content={processHtmlToReact(props)} />;\n};\nconst MessageContentAsText = (props: ChatMessageContentProps): JSX.Element => {\n const liveAuthor = _formatString(props.strings.liveAuthorIntro, {\n author: `${props.message.senderDisplayName}`\n });\n return <MessageContentWithLiveAria message={props.message} liveMessage={`${props.message.mine ? '' : liveAuthor} ${extractContent(props.message.content || '')}`} ariaLabel={messageContentAriaText(props)} content={<Linkify componentDecorator={(decoratedHref: string, decoratedText: string, key: number) => {\n return <Link target=\"_blank\" href={decoratedHref} key={key}>\n {decoratedText}\n </Link>;\n }}>\n {props.message.content}\n </Linkify>} />;\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\n/**\n * @private\n */\nexport const BlockedMessageContent = (props: BlockedMessageContentProps): JSX.Element => {\n const Icon: JSX.Element = <FontIcon iconName={'DataLossPreventionProhibited'} />;\n const blockedMessage = props.message.warningText === undefined ? props.strings.blockedWarningText : props.message.warningText;\n const blockedMessageLink = props.message.link;\n const blockedMessageLinkText = blockedMessageLink ? props.message.linkText ?? props.strings.blockedWarningLinkText : '';\n const liveAuthor = props.message.mine || props.message.senderDisplayName === undefined ? '' : props.message.senderDisplayName;\n const liveBlockedWarningText = `${liveAuthor} ${blockedMessage} ${blockedMessageLinkText}`;\n return <MessageContentWithLiveAria message={props.message} liveMessage={liveBlockedWarningText} ariaLabel={liveBlockedWarningText} content={<Stack horizontal wrap>\n {Icon}\n {blockedMessage && <p>{blockedMessage}</p>}\n {blockedMessageLink && <Link target={'_blank'} href={blockedMessageLink}>\n {blockedMessageLinkText}\n </Link>}\n </Stack>} />;\n};\n\n// https://stackoverflow.com/questions/28899298/extract-the-text-out-of-html-string-using-javascript\nconst extractContent = (s: string): string => {\n const span = document.createElement('span');\n span.innerHTML = s;\n return span.textContent || span.innerText;\n};\nconst messageContentAriaText = (props: ChatMessageContentProps): string | undefined => {\n return props.message.content ? props.message.mine ? _formatString(props.strings.messageContentMineAriaText, {\n message: props.message.content\n }) : _formatString(props.strings.messageContentAriaText, {\n author: `${props.message.senderDisplayName}`,\n message: props.message.content\n }) : undefined;\n};\nconst processNodeDefinitions = ProcessNodeDefinitions();\nconst htmlToReactParser = Parser();\n\n/* @conditional-compile-remove(teams-inline-images) */\nconst processInlineImage = (props: ChatMessageContentProps): ProcessingInstructionType => ({\n // Custom <img> processing\n shouldProcessNode: (node): boolean => {\n // Process img node with id in attachments list\n return node.name && node.name === 'img' && node.attribs && node.attribs.id && props.message.attachedFilesMetadata?.find(f => f.id === node.attribs.id);\n },\n processNode: (node, children, index): HTMLElement => {\n // logic to check id in map/list\n if (props.attachmentsMap && node.attribs.id in props.attachmentsMap) {\n node.attribs = {\n ...node.attribs,\n src: props.attachmentsMap[node.attribs.id]\n };\n }\n return processNodeDefinitions.processDefaultNode(node, children, index);\n }\n});\nconst processHtmlToReact = (props: ChatMessageContentProps): JSX.Element => {\n const steps: ProcessingInstructionType[] = [/* @conditional-compile-remove(teams-inline-images) */\n processInlineImage(props), {\n // Process everything else in the default way\n shouldProcessNode: IsValidNodeDefinitions.alwaysValid,\n processNode: processNodeDefinitions.processDefaultNode\n }];\n return htmlToReactParser.parseWithInstructions(props.message.content ?? '', IsValidNodeDefinitions.alwaysValid, steps);\n};\"../../../../acs-ui-common/src\""]}
|
1
|
+
{"version":3,"file":"ChatMessageContent.js","sourceRoot":"","sources":["../../../../../../preprocess-dist/react-components/src/components/ChatMessage/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C,WAAW,EAAE,KAAK,CAAC,CAAC;AACzH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { Parser, ProcessNodeDefinitions, IsValidNodeDefinitions, ProcessingInstructionType } from 'html-to-react';\nimport Linkify from 'react-linkify';\nimport { ChatMessage } from '../../types/ChatMessage';\nimport { Link } from '@fluentui/react';\nimport { MessageThreadStrings } from '../MessageThread';\nimport LiveMessage from '../Announcer/LiveMessage';\nimport DOMPurify from 'dompurify';\ntype ChatMessageContentProps = {\n message: ChatMessage;\n strings: MessageThreadStrings;\n};\ntype MessageContentWithLiveAriaProps = {\n message: ChatMessage;\n liveMessage: string;\n ariaLabel?: string;\n content: JSX.Element;\n};\n\n/** @private */\nexport const ChatMessageContent = (props: ChatMessageContentProps): JSX.Element => {\n switch (props.message.contentType) {\n case 'text':\n return MessageContentAsText(props);\n case 'html':\n return MessageContentAsRichTextHTML(props);\n case 'richtext/html':\n return MessageContentAsRichTextHTML(props);\n default:\n console.warn('unknown message content type');\n return <></>;\n }\n};\nconst MessageContentWithLiveAria = (props: MessageContentWithLiveAriaProps): JSX.Element => {\n return <div data-ui-status={props.message.status} role=\"text\" aria-label={props.ariaLabel}>\n <LiveMessage message={props.liveMessage} ariaLive=\"polite\" />\n {props.content}\n </div>;\n};\nconst MessageContentAsRichTextHTML = (props: ChatMessageContentProps): JSX.Element => {\n return <MessageContentWithLiveAria message={props.message} liveMessage={generateLiveMessage(props)} ariaLabel={messageContentAriaText(props)} content={processHtmlToReact(props)} />;\n};\nconst MessageContentAsText = (props: ChatMessageContentProps): JSX.Element => {\n return <MessageContentWithLiveAria message={props.message} liveMessage={generateLiveMessage(props)} ariaLabel={messageContentAriaText(props)} content={<Linkify componentDecorator={(decoratedHref: string, decoratedText: string, key: number) => {\n return <Link target=\"_blank\" href={decoratedHref} key={key}>\n {decoratedText}\n </Link>;\n }}>\n {props.message.content}\n </Linkify>} />;\n};\n// https://stackoverflow.com/questions/28899298/extract-the-text-out-of-html-string-using-javascript\nconst extractContent = (s: string): string => {\n const span = document.createElement('span');\n span.innerHTML = s;\n return span.textContent || span.innerText;\n};\nconst generateLiveMessage = (props: ChatMessageContentProps): string => {\n const liveAuthor = _formatString(props.strings.liveAuthorIntro, {\n author: `${props.message.senderDisplayName}`\n });\n return `${props.message.editedOn ? props.strings.editedTag : ''} ${props.message.mine ? '' : liveAuthor} ${extractContent(props.message.content || '')} `;\n};\nconst messageContentAriaText = (props: ChatMessageContentProps): string | undefined => {\n // Strip all html tags from the content for aria.\n\n return props.message.content ? props.message.mine ? _formatString(props.strings.messageContentMineAriaText, {\n message: DOMPurify.sanitize(props.message.content, {\n ALLOWED_TAGS: []\n })\n }) : _formatString(props.strings.messageContentAriaText, {\n author: `${props.message.senderDisplayName}`,\n message: DOMPurify.sanitize(props.message.content, {\n ALLOWED_TAGS: []\n })\n }) : undefined;\n};\nconst processNodeDefinitions = ProcessNodeDefinitions();\nconst htmlToReactParser = Parser();\nconst processHtmlToReact = (props: ChatMessageContentProps): JSX.Element => {\n const steps: ProcessingInstructionType[] = [{\n // Process everything else in the default way\n shouldProcessNode: IsValidNodeDefinitions.alwaysValid,\n processNode: processNodeDefinitions.processDefaultNode\n }];\n return htmlToReactParser.parseWithInstructions(props.message.content ?? '', IsValidNodeDefinitions.alwaysValid, steps);\n};\"../../../../acs-ui-common/src\""]}
|
@@ -13,8 +13,6 @@ import React, { useEffect } from 'react';
|
|
13
13
|
import { IconButton } from '@fluentui/react';
|
14
14
|
import { concatStyleSets, DefaultButton, FocusZone, mergeStyles, Stack, Text, TextField, useTheme } from '@fluentui/react';
|
15
15
|
import { useState } from 'react';
|
16
|
-
/* @conditional-compile-remove(dialpad) */
|
17
|
-
import { useLocale } from '../../localization';
|
18
16
|
import { buttonStyles, containerStyles, iconButtonStyles, digitStyles, letterStyles, textFieldStyles } from '../styles/Dialpad.styles';
|
19
17
|
import { formatPhoneNumber } from '../utils/formatPhoneNumber';
|
20
18
|
import useLongPress from '../utils/useLongPress';
|
@@ -165,11 +163,7 @@ const DialpadContainer = (props) => {
|
|
165
163
|
* @beta
|
166
164
|
*/
|
167
165
|
export const Dialpad = (props) => {
|
168
|
-
/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */
|
169
|
-
const localeStrings = useLocale().strings.dialpad;
|
170
166
|
const dialpadLocaleStringsTrampoline = () => {
|
171
|
-
/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */
|
172
|
-
return localeStrings;
|
173
167
|
// Even though the component strings type doesn't have `DialpadStrings` in stable build,
|
174
168
|
// the string values exist. So unsafe cast for stable build.
|
175
169
|
return '';
|