botframework-webchat-component 4.13.0 → 4.14.2
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/.eslintignore +1 -9
- package/.eslintrc.yml +6 -0
- package/lib/Activity/Avatar.d.ts +10 -0
- package/lib/Activity/Avatar.d.ts.map +1 -0
- package/lib/Activity/Avatar.js +2 -1
- package/lib/Activity/Bubble.d.ts +11 -0
- package/lib/Activity/Bubble.d.ts.map +1 -0
- package/lib/Activity/Bubble.js +2 -2
- package/lib/Activity/CarouselFilmStrip.js +20 -30
- package/lib/Activity/CarouselFilmStripAttachment.js +120 -0
- package/lib/Activity/CarouselLayout.js +5 -5
- package/lib/Activity/Speak.d.ts +10 -0
- package/lib/Activity/Speak.d.ts.map +1 -0
- package/lib/Activity/Speak.js +10 -12
- package/lib/Activity/StackedLayout.d.ts +18 -0
- package/lib/Activity/StackedLayout.d.ts.map +1 -0
- package/lib/Activity/StackedLayout.js +18 -14
- package/lib/Assets/TypingAnimation.js +2 -2
- package/lib/Attachment/Assets/DownloadIcon.js +3 -1
- package/lib/Attachment/AudioAttachment.js +2 -2
- package/lib/Attachment/AudioContent.d.ts +11 -0
- package/lib/Attachment/AudioContent.d.ts.map +1 -0
- package/lib/Attachment/AudioContent.js +4 -4
- package/lib/Attachment/FileContent.d.ts +10 -0
- package/lib/Attachment/FileContent.d.ts.map +1 -0
- package/lib/Attachment/FileContent.js +4 -9
- package/lib/Attachment/HTMLVideoContent.d.ts +11 -0
- package/lib/Attachment/HTMLVideoContent.d.ts.map +1 -0
- package/lib/Attachment/HTMLVideoContent.js +2 -2
- package/lib/Attachment/ImageContent.d.ts +8 -0
- package/lib/Attachment/ImageContent.d.ts.map +1 -0
- package/lib/Attachment/ImageContent.js +2 -2
- package/lib/Attachment/TextContent.d.ts +8 -0
- package/lib/Attachment/TextContent.d.ts.map +1 -0
- package/lib/Attachment/TextContent.js +4 -4
- package/lib/Attachment/VideoAttachment.js +2 -2
- package/lib/Attachment/VideoContent.d.ts +11 -0
- package/lib/Attachment/VideoContent.d.ts.map +1 -0
- package/lib/Attachment/VideoContent.js +1 -1
- package/lib/Attachment/VimeoContent.d.ts +10 -0
- package/lib/Attachment/VimeoContent.d.ts.map +1 -0
- package/lib/Attachment/VimeoContent.js +8 -8
- package/lib/Attachment/YouTubeContent.d.ts +10 -0
- package/lib/Attachment/YouTubeContent.d.ts.map +1 -0
- package/lib/Attachment/YouTubeContent.js +5 -5
- package/lib/Avatar/ImageAvatar.js +2 -2
- package/lib/Avatar/InitialsAvatar.js +2 -2
- package/lib/BasicConnectivityStatus.js +2 -2
- package/lib/BasicSendBox.d.ts +9 -0
- package/lib/BasicSendBox.d.ts.map +1 -0
- package/lib/BasicSendBox.js +6 -5
- package/lib/BasicToast.js +4 -4
- package/lib/BasicToaster.js +4 -4
- package/lib/BasicTranscript.js +143 -123
- package/lib/BasicTypingIndicator.d.ts +5 -0
- package/lib/BasicTypingIndicator.d.ts.map +1 -0
- package/lib/BasicTypingIndicator.js +2 -2
- package/lib/BasicWebChat.d.ts +9 -0
- package/lib/BasicWebChat.d.ts.map +1 -0
- package/lib/BasicWebChat.js +6 -4
- package/lib/Composer.d.ts +23 -0
- package/lib/Composer.d.ts.map +1 -0
- package/lib/Composer.js +33 -55
- package/lib/ConnectivityStatus/Assets/ErrorNotificationIcon.js +2 -2
- package/lib/ConnectivityStatus/Assets/SpinnerAnimation.js +2 -2
- package/lib/ConnectivityStatus/Assets/WarningNotificationIcon.js +2 -2
- package/lib/ConnectivityStatus/Connected.js +1 -1
- package/lib/ConnectivityStatus/Connecting.js +4 -4
- package/lib/ConnectivityStatus/FailedToConnect.js +2 -2
- package/lib/ConnectivityStatus/JavaScriptError.js +2 -2
- package/lib/Dictation.js +13 -4
- package/lib/ErrorBox.d.ts +8 -0
- package/lib/ErrorBox.d.ts.map +1 -0
- package/lib/ErrorBox.js +2 -2
- package/lib/Middleware/Activity/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/Activity/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/Activity/createCoreMiddleware.js +1 -1
- package/lib/Middleware/ActivityStatus/AbsoluteTime.js +1 -1
- package/lib/Middleware/ActivityStatus/RelativeTime.js +1 -1
- package/lib/Middleware/ActivityStatus/SendStatus/SendFailedRetry.js +3 -3
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.d.ts +11 -0
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.d.ts.map +1 -0
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.js +4 -4
- package/lib/Middleware/ActivityStatus/Timestamp.d.ts +9 -0
- package/lib/Middleware/ActivityStatus/Timestamp.d.ts.map +1 -0
- package/lib/Middleware/ActivityStatus/Timestamp.js +2 -2
- package/lib/Middleware/ActivityStatus/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/ActivityStatus/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/ActivityStatus/createCoreMiddleware.js +1 -1
- package/lib/Middleware/ActivityStatus/createSendStatusMiddleware.js +5 -3
- package/lib/Middleware/ActivityStatus/createTimestampMiddleware.js +1 -1
- package/lib/Middleware/Attachment/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/Attachment/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/Attachment/createCoreMiddleware.js +9 -9
- package/lib/Middleware/AttachmentForScreenReader/AudioAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/FileAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/ImageAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/TextAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/VideoAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/AttachmentForScreenReader/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/AttachmentForScreenReader/createCoreMiddleware.js +9 -5
- package/lib/Middleware/Avatar/createCoreMiddleware.d.ts +11 -0
- package/lib/Middleware/Avatar/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/Avatar/createCoreMiddleware.js +2 -2
- package/lib/Middleware/CardAction/createCoreMiddleware.js +2 -2
- package/lib/Middleware/GroupActivities/createCoreMiddleware.js +1 -1
- package/lib/Middleware/ScrollToEndButton/ScrollToEndButton.js +71 -0
- package/lib/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.d.ts +3 -0
- package/lib/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.d.ts.map +1 -0
- package/lib/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.js +27 -0
- package/lib/Middleware/Toast/createCoreMiddleware.d.ts +4 -0
- package/lib/Middleware/Toast/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/Toast/createCoreMiddleware.js +1 -1
- package/lib/Middleware/TypingIndicator/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/TypingIndicator/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/TypingIndicator/createCoreMiddleware.js +3 -2
- package/lib/ReactWebChat.d.ts +10 -0
- package/lib/ReactWebChat.d.ts.map +1 -0
- package/lib/ReactWebChat.js +19 -7
- package/lib/ScreenReaderActivity.js +64 -45
- package/lib/SendBox/Assets/AttachmentIcon.js +3 -1
- package/lib/SendBox/Assets/MicrophoneIcon.js +3 -1
- package/lib/SendBox/Assets/SendIcon.js +2 -2
- package/lib/SendBox/AutoResizeTextArea.d.ts +23 -0
- package/lib/SendBox/AutoResizeTextArea.d.ts.map +1 -0
- package/lib/SendBox/AutoResizeTextArea.js +6 -6
- package/lib/SendBox/DictationInterims.d.ts +9 -0
- package/lib/SendBox/DictationInterims.d.ts.map +1 -0
- package/lib/SendBox/DictationInterims.js +2 -2
- package/lib/SendBox/IconButton.js +2 -2
- package/lib/SendBox/MicrophoneButton.d.ts +11 -0
- package/lib/SendBox/MicrophoneButton.d.ts.map +1 -0
- package/lib/SendBox/MicrophoneButton.js +25 -24
- package/lib/SendBox/SendButton.d.ts +9 -0
- package/lib/SendBox/SendButton.d.ts.map +1 -0
- package/lib/SendBox/SendButton.js +7 -5
- package/lib/SendBox/SuggestedAction.js +5 -9
- package/lib/SendBox/SuggestedActions.d.ts +5 -0
- package/lib/SendBox/SuggestedActions.d.ts.map +1 -0
- package/lib/SendBox/SuggestedActions.js +10 -7
- package/lib/SendBox/TextBox.d.ts +28 -0
- package/lib/SendBox/TextBox.d.ts.map +1 -0
- package/lib/SendBox/TextBox.js +12 -7
- package/lib/SendBox/UploadButton.d.ts +9 -0
- package/lib/SendBox/UploadButton.d.ts.map +1 -0
- package/lib/SendBox/UploadButton.js +5 -5
- package/lib/Styles/StyleSet/Activities.d.ts +5 -0
- package/lib/Styles/StyleSet/Activities.d.ts.map +1 -0
- package/lib/Styles/StyleSet/AudioAttachment.d.ts +6 -0
- package/lib/Styles/StyleSet/AudioAttachment.d.ts.map +1 -0
- package/lib/Styles/StyleSet/AudioContent.d.ts +4 -0
- package/lib/Styles/StyleSet/AudioContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/AutoResizeTextArea.d.ts +37 -0
- package/lib/Styles/StyleSet/AutoResizeTextArea.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Avatar.d.ts +9 -0
- package/lib/Styles/StyleSet/Avatar.d.ts.map +1 -0
- package/lib/Styles/StyleSet/BasicTranscript.d.ts +77 -0
- package/lib/Styles/StyleSet/BasicTranscript.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Bubble.d.ts +5 -0
- package/lib/Styles/StyleSet/Bubble.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Bubble.js +1 -1
- package/lib/Styles/StyleSet/CarouselFilmStrip.d.ts +5 -0
- package/lib/Styles/StyleSet/CarouselFilmStrip.d.ts.map +1 -0
- package/lib/Styles/StyleSet/CarouselFilmStrip.js +2 -18
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.d.ts +3 -0
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.d.ts.map +1 -0
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.js +63 -0
- package/lib/Styles/StyleSet/CarouselFlipper.d.ts +27 -0
- package/lib/Styles/StyleSet/CarouselFlipper.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ConnectivityNotification.d.ts +13 -0
- package/lib/Styles/StyleSet/ConnectivityNotification.d.ts.map +1 -0
- package/lib/Styles/StyleSet/DictationInterims.d.ts +13 -0
- package/lib/Styles/StyleSet/DictationInterims.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ErrorBox.d.ts +33 -0
- package/lib/Styles/StyleSet/ErrorBox.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ErrorNotification.d.ts +23 -0
- package/lib/Styles/StyleSet/ErrorNotification.d.ts.map +1 -0
- package/lib/Styles/StyleSet/FileContent.d.ts +32 -0
- package/lib/Styles/StyleSet/FileContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ImageAvatar.d.ts +7 -0
- package/lib/Styles/StyleSet/ImageAvatar.d.ts.map +1 -0
- package/lib/Styles/StyleSet/InitialsAvatar.d.ts +19 -0
- package/lib/Styles/StyleSet/InitialsAvatar.d.ts.map +1 -0
- package/lib/Styles/StyleSet/MicrophoneButton.d.ts +13 -0
- package/lib/Styles/StyleSet/MicrophoneButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Root.d.ts +8 -0
- package/lib/Styles/StyleSet/Root.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ScrollToEndButton.d.ts +36 -0
- package/lib/Styles/StyleSet/ScrollToEndButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ScrollToEndButton.js +36 -34
- package/lib/Styles/StyleSet/SendBox.d.ts +24 -0
- package/lib/Styles/StyleSet/SendBox.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SendBoxButton.d.ts +33 -0
- package/lib/Styles/StyleSet/SendBoxButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SendBoxTextBox.d.ts +41 -0
- package/lib/Styles/StyleSet/SendBoxTextBox.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SendStatus.d.ts +8 -0
- package/lib/Styles/StyleSet/SendStatus.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SingleAttachmentActivity.d.ts +11 -0
- package/lib/Styles/StyleSet/SingleAttachmentActivity.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SpinnerAnimation.d.ts +15 -0
- package/lib/Styles/StyleSet/SpinnerAnimation.d.ts.map +1 -0
- package/lib/Styles/StyleSet/StackedLayout.d.ts +63 -0
- package/lib/Styles/StyleSet/StackedLayout.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SuggestedAction.d.ts +49 -0
- package/lib/Styles/StyleSet/SuggestedAction.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SuggestedAction.js +2 -2
- package/lib/Styles/StyleSet/SuggestedActions.d.ts +118 -0
- package/lib/Styles/StyleSet/SuggestedActions.d.ts.map +1 -0
- package/lib/Styles/StyleSet/TextContent.d.ts +28 -0
- package/lib/Styles/StyleSet/TextContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Toast.d.ts +65 -0
- package/lib/Styles/StyleSet/Toast.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Toaster.d.ts +111 -0
- package/lib/Styles/StyleSet/Toaster.d.ts.map +1 -0
- package/lib/Styles/StyleSet/TypingAnimation.d.ts +8 -0
- package/lib/Styles/StyleSet/TypingAnimation.d.ts.map +1 -0
- package/lib/Styles/StyleSet/TypingIndicator.d.ts +11 -0
- package/lib/Styles/StyleSet/TypingIndicator.d.ts.map +1 -0
- package/lib/Styles/StyleSet/UploadButton.d.ts +14 -0
- package/lib/Styles/StyleSet/UploadButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/VideoAttachment.d.ts +2 -0
- package/lib/Styles/StyleSet/VideoAttachment.d.ts.map +1 -0
- package/lib/Styles/StyleSet/VideoContent.d.ts +6 -0
- package/lib/Styles/StyleSet/VideoContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/VimeoContent.d.ts +7 -0
- package/lib/Styles/StyleSet/VimeoContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/WarningNotification.d.ts +22 -0
- package/lib/Styles/StyleSet/WarningNotification.d.ts.map +1 -0
- package/lib/Styles/StyleSet/YouTubeContent.d.ts +7 -0
- package/lib/Styles/StyleSet/YouTubeContent.d.ts.map +1 -0
- package/lib/Styles/createStyleSet.d.ts +1103 -0
- package/lib/Styles/createStyleSet.d.ts.map +1 -0
- package/lib/Styles/createStyleSet.js +44 -41
- package/lib/Styles/mirrorStyle.js +2 -2
- package/lib/Toast/CollapseIcon.js +3 -1
- package/lib/Toast/DismissIcon.js +3 -1
- package/lib/Toast/ExpandIcon.js +3 -1
- package/lib/Toast/NotificationIcon.js +1 -1
- package/lib/Toast/createToastMiddleware.d.ts +4 -0
- package/lib/Toast/createToastMiddleware.d.ts.map +1 -0
- package/lib/Toast/createToastMiddleware.js +2 -2
- package/lib/Utils/AccessKeySink/Surface.js +7 -5
- package/lib/Utils/AccessibleButton.js +6 -4
- package/lib/Utils/AccessibleInputText.d.ts +21 -0
- package/lib/Utils/AccessibleInputText.d.ts.map +1 -0
- package/lib/Utils/AccessibleInputText.js +29 -25
- package/lib/Utils/AccessibleTextArea.d.ts +20 -0
- package/lib/Utils/AccessibleTextArea.d.ts.map +1 -0
- package/lib/Utils/AccessibleTextArea.js +35 -24
- package/lib/Utils/CroppedImage.js +2 -2
- package/lib/Utils/Fade.js +2 -2
- package/lib/Utils/FocusRedirector.js +3 -3
- package/lib/Utils/InlineMarkdown.js +6 -6
- package/lib/Utils/TypeFocusSink/FocusBox.js +6 -4
- package/lib/Utils/TypeFocusSink/getTabIndex.d.ts +2 -0
- package/lib/Utils/TypeFocusSink/getTabIndex.d.ts.map +1 -0
- package/lib/Utils/TypeFocusSink/getTabIndex.js +1 -1
- package/lib/Utils/TypeFocusSink/navigableEvent.js +1 -1
- package/lib/Utils/activityAltText.js +100 -0
- package/lib/Utils/addTargetBlankToHyperlinksMarkdown.js +1 -1
- package/lib/Utils/createCustomEvent.js +1 -1
- package/lib/Utils/debounce.js +1 -1
- package/lib/Utils/detectBrowser.js +1 -1
- package/lib/Utils/downscaleImageToDataURL/downscaleImageToDataURLUsingWorker.js +2 -2
- package/lib/Utils/downscaleImageToDataURL/index.js +2 -2
- package/lib/Utils/filterMap.js +1 -1
- package/lib/Utils/findLastIndex.js +2 -2
- package/lib/Utils/mapMap.js +1 -1
- package/lib/Utils/readDataURIToBlob.js +2 -2
- package/lib/Utils/singleToArray.js +1 -1
- package/lib/connectToWebChat.js +5 -3
- package/lib/hooks/index.d.ts +21 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/internal/BypassSpeechSynthesisPonyfill.js +97 -39
- package/lib/hooks/internal/UITracker.js +2 -2
- package/lib/hooks/internal/useAcknowledgedActivity.js +2 -2
- package/lib/hooks/internal/useDispatchScrollPosition.js +1 -1
- package/lib/hooks/internal/useDispatchTranscriptFocus.js +1 -1
- package/lib/hooks/internal/useEnterKeyHint.js +1 -1
- package/lib/hooks/internal/useForceRender.js +2 -2
- package/lib/hooks/internal/useForceRenderAtInterval.js +2 -2
- package/lib/hooks/internal/useInternalRenderMarkdownInline.js +1 -1
- package/lib/hooks/internal/useLocalizeAccessKey.js +2 -2
- package/lib/hooks/internal/useMemoize.js +2 -2
- package/lib/hooks/internal/useNavigatorPlatform.js +1 -1
- package/lib/hooks/internal/useNonce.js +1 -1
- package/lib/hooks/internal/useRegisterFocusSendBox.js +1 -1
- package/lib/hooks/internal/useRegisterFocusTranscript.js +1 -1
- package/lib/hooks/internal/useRegisterScrollRelative.js +1 -1
- package/lib/hooks/internal/useRegisterScrollTo.js +1 -1
- package/lib/hooks/internal/useRegisterScrollToEnd.js +1 -1
- package/lib/hooks/internal/useReplaceEmoticon.js +2 -2
- package/lib/hooks/internal/useResumeAudioContext.js +33 -0
- package/lib/hooks/internal/useScrollRelative.js +1 -1
- package/lib/hooks/internal/useSettableDictateAbortable.js +1 -1
- package/lib/hooks/internal/useSuggestedActionsAccessKey.js +1 -1
- package/lib/hooks/internal/useUniqueId.d.ts +2 -0
- package/lib/hooks/internal/useUniqueId.d.ts.map +1 -0
- package/lib/hooks/internal/useUniqueId.js +1 -1
- package/lib/hooks/useDictateAbortable.d.ts +2 -0
- package/lib/hooks/useDictateAbortable.d.ts.map +1 -0
- package/lib/hooks/useDictateAbortable.js +2 -2
- package/lib/hooks/useFocus.d.ts +2 -0
- package/lib/hooks/useFocus.d.ts.map +1 -0
- package/lib/hooks/useFocus.js +1 -1
- package/lib/hooks/useFocusSendBox.d.ts +3 -0
- package/lib/hooks/useFocusSendBox.d.ts.map +1 -0
- package/lib/hooks/useFocusSendBox.js +2 -1
- package/lib/hooks/useObserveScrollPosition.d.ts +3 -0
- package/lib/hooks/useObserveScrollPosition.d.ts.map +1 -0
- package/lib/hooks/useObserveScrollPosition.js +2 -2
- package/lib/hooks/useObserveTranscriptFocus.d.ts +5 -0
- package/lib/hooks/useObserveTranscriptFocus.d.ts.map +1 -0
- package/lib/hooks/useObserveTranscriptFocus.js +2 -2
- package/lib/hooks/useRenderMarkdownAsHTML.d.ts +5 -0
- package/lib/hooks/useRenderMarkdownAsHTML.d.ts.map +1 -0
- package/lib/hooks/useRenderMarkdownAsHTML.js +2 -2
- package/lib/hooks/useScrollDown.d.ts +4 -0
- package/lib/hooks/useScrollDown.d.ts.map +1 -0
- package/lib/hooks/useScrollDown.js +1 -1
- package/lib/hooks/useScrollTo.d.ts +5 -0
- package/lib/hooks/useScrollTo.d.ts.map +1 -0
- package/lib/hooks/useScrollTo.js +1 -1
- package/lib/hooks/useScrollToEnd.d.ts +2 -0
- package/lib/hooks/useScrollToEnd.d.ts.map +1 -0
- package/lib/hooks/useScrollToEnd.js +1 -1
- package/lib/hooks/useScrollUp.d.ts +4 -0
- package/lib/hooks/useScrollUp.d.ts.map +1 -0
- package/lib/hooks/useScrollUp.js +1 -1
- package/lib/hooks/useSendFiles.d.ts +2 -0
- package/lib/hooks/useSendFiles.d.ts.map +1 -0
- package/lib/hooks/useSendFiles.js +3 -3
- package/lib/hooks/useStyleSet.d.ts +2 -0
- package/lib/hooks/useStyleSet.d.ts.map +1 -0
- package/lib/hooks/useStyleSet.js +1 -1
- package/lib/hooks/useWebSpeechPonyfill.d.ts +3 -0
- package/lib/hooks/useWebSpeechPonyfill.d.ts.map +1 -0
- package/lib/hooks/useWebSpeechPonyfill.js +1 -1
- package/lib/index.d.ts +209 -22
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -19
- package/lib/tsconfig.json +1 -1
- package/lib/types/ScrollPosition.d.ts +6 -0
- package/lib/types/ScrollPosition.d.ts.map +1 -0
- package/lib/types/ScrollPosition.js +2 -0
- package/package.json +38 -38
- package/src/Activity/{Avatar.js → Avatar.tsx} +9 -2
- package/src/Activity/{Bubble.js → Bubble.tsx} +10 -2
- package/src/Activity/CarouselFilmStrip.js +20 -29
- package/src/Activity/CarouselFilmStripAttachment.js +92 -0
- package/src/Activity/{Speak.js → Speak.tsx} +12 -5
- package/src/Activity/{StackedLayout.js → StackedLayout.tsx} +36 -11
- package/src/Attachment/Assets/DownloadIcon.js +8 -1
- package/src/Attachment/{AudioContent.js → AudioContent.tsx} +12 -3
- package/src/Attachment/{FileContent.js → FileContent.tsx} +10 -7
- package/src/Attachment/{HTMLVideoContent.js → HTMLVideoContent.tsx} +10 -2
- package/src/Attachment/{ImageContent.js → ImageContent.tsx} +7 -2
- package/src/Attachment/{TextContent.js → TextContent.tsx} +14 -7
- package/src/Attachment/{VideoContent.js → VideoContent.tsx} +10 -2
- package/src/Attachment/{VimeoContent.js → VimeoContent.tsx} +15 -8
- package/src/Attachment/{YouTubeContent.js → YouTubeContent.tsx} +12 -5
- package/src/{BasicSendBox.js → BasicSendBox.tsx} +9 -5
- package/src/BasicToaster.js +4 -4
- package/src/BasicTranscript.js +114 -98
- package/src/{BasicTypingIndicator.js → BasicTypingIndicator.tsx} +1 -1
- package/src/{BasicWebChat.js → BasicWebChat.tsx} +13 -4
- package/src/{Composer.js → Composer.tsx} +41 -42
- package/src/Dictation.js +13 -4
- package/src/{ErrorBox.js → ErrorBox.tsx} +7 -2
- package/src/Middleware/Activity/{createCoreMiddleware.js → createCoreMiddleware.tsx} +2 -1
- package/src/Middleware/ActivityStatus/SendStatus/{SendStatus.js → SendStatus.tsx} +8 -3
- package/src/Middleware/ActivityStatus/{Timestamp.js → Timestamp.tsx} +8 -2
- package/src/Middleware/ActivityStatus/{createCoreMiddleware.js → createCoreMiddleware.tsx} +3 -1
- package/src/Middleware/ActivityStatus/createSendStatusMiddleware.js +8 -6
- package/src/Middleware/ActivityStatus/createTimestampMiddleware.js +10 -8
- package/src/Middleware/Attachment/{createCoreMiddleware.js → createCoreMiddleware.tsx} +8 -7
- package/src/Middleware/AttachmentForScreenReader/{createCoreMiddleware.js → createCoreMiddleware.tsx} +4 -3
- package/src/Middleware/Avatar/{createCoreMiddleware.js → createCoreMiddleware.tsx} +10 -3
- package/src/Middleware/CardAction/createCoreMiddleware.js +43 -41
- package/src/Middleware/GroupActivities/createCoreMiddleware.js +6 -4
- package/src/Middleware/ScrollToEndButton/ScrollToEndButton.js +45 -0
- package/src/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.ts +17 -0
- package/src/Middleware/Toast/{createCoreMiddleware.js → createCoreMiddleware.tsx} +3 -1
- package/src/Middleware/TypingIndicator/{createCoreMiddleware.js → createCoreMiddleware.tsx} +3 -4
- package/src/{ReactWebChat.js → ReactWebChat.tsx} +25 -7
- package/src/ScreenReaderActivity.js +47 -37
- package/src/SendBox/Assets/AttachmentIcon.js +1 -1
- package/src/SendBox/Assets/MicrophoneIcon.js +1 -1
- package/src/SendBox/{AutoResizeTextArea.js → AutoResizeTextArea.tsx} +30 -4
- package/src/SendBox/{DictationInterims.js → DictationInterims.tsx} +6 -2
- package/src/SendBox/{MicrophoneButton.js → MicrophoneButton.tsx} +35 -25
- package/src/SendBox/{SendButton.js → SendButton.tsx} +8 -3
- package/src/SendBox/SuggestedAction.js +1 -15
- package/src/SendBox/{SuggestedActions.js → SuggestedActions.tsx} +42 -21
- package/src/SendBox/{TextBox.js → TextBox.tsx} +21 -7
- package/src/SendBox/{UploadButton.js → UploadButton.tsx} +7 -3
- package/src/Styles/StyleSet/CarouselFilmStrip.ts +0 -20
- package/src/Styles/StyleSet/CarouselFilmStripAttachment.ts +56 -0
- package/src/Styles/StyleSet/ScrollToEndButton.ts +33 -31
- package/src/Styles/StyleSet/SuggestedAction.ts +1 -1
- package/src/Styles/createStyleSet.ts +41 -39
- package/src/Toast/CollapseIcon.js +9 -1
- package/src/Toast/DismissIcon.js +9 -1
- package/src/Toast/ExpandIcon.js +9 -1
- package/src/Toast/{createToastMiddleware.js → createToastMiddleware.tsx} +3 -2
- package/src/Utils/{AccessibleInputText.js → AccessibleInputText.tsx} +48 -5
- package/src/Utils/{AccessibleTextArea.js → AccessibleTextArea.tsx} +67 -6
- package/src/Utils/TypeFocusSink/FocusBox.js +4 -4
- package/src/Utils/TypeFocusSink/getTabIndex.ts +1 -1
- package/src/Utils/activityAltText.ts +135 -0
- package/src/Utils/findLastIndex.spec.js +2 -0
- package/src/Utils/intersectionOf.spec.js +2 -0
- package/src/Utils/mapMap.spec.js +2 -0
- package/src/Utils/removeInline.spec.js +2 -0
- package/src/Utils/{singleToArray.js → singleToArray.ts} +1 -1
- package/src/Utils/walkMarkdownTokens.spec.js +3 -3
- package/src/hooks/{index.js → index.ts} +1 -0
- package/src/hooks/internal/BypassSpeechSynthesisPonyfill.js +68 -17
- package/src/hooks/internal/useMemoize.spec.js +2 -0
- package/src/hooks/internal/useResumeAudioContext.ts +7 -0
- package/src/hooks/internal/useScrollRelative.js +4 -3
- package/src/hooks/internal/{useUniqueId.js → useUniqueId.ts} +1 -1
- package/src/hooks/{useDictateAbortable.js → useDictateAbortable.ts} +1 -1
- package/src/hooks/{useFocus.js → useFocus.ts} +1 -1
- package/src/hooks/{useFocusSendBox.js → useFocusSendBox.ts} +2 -1
- package/src/hooks/{useObserveScrollPosition.js → useObserveScrollPosition.ts} +6 -1
- package/src/hooks/{useObserveTranscriptFocus.js → useObserveTranscriptFocus.ts} +6 -1
- package/src/hooks/{useRenderMarkdownAsHTML.js → useRenderMarkdownAsHTML.ts} +6 -2
- package/src/hooks/{useScrollDown.js → useScrollDown.ts} +1 -1
- package/src/hooks/{useScrollTo.js → useScrollTo.ts} +5 -1
- package/src/hooks/{useScrollToEnd.js → useScrollToEnd.ts} +1 -1
- package/src/hooks/{useScrollUp.js → useScrollUp.ts} +1 -1
- package/src/hooks/{useSendFiles.js → useSendFiles.ts} +3 -2
- package/src/hooks/{useStyleSet.js → useStyleSet.ts} +1 -1
- package/src/hooks/useWebSpeechPonyfill.ts +7 -0
- package/src/index.ts +7 -11
- package/src/tsconfig.json +1 -1
- package/src/types/ScrollPosition.ts +6 -0
- package/lib/Activity/ScrollToEndButton.js +0 -81
- package/lib/Attachment/Assets/ErrorIcon.js +0 -22
- package/lib/Utils/remarkStripMarkdown.js +0 -26
- package/lib/hooks/internal/useStripMarkdown.js +0 -19
- package/src/Activity/ScrollToEndButton.js +0 -58
- package/src/Attachment/Assets/ErrorIcon.js +0 -9
- package/src/Utils/remarkStripMarkdown.js +0 -13
- package/src/hooks/internal/useStripMarkdown.js +0 -7
- package/src/hooks/useWebSpeechPonyfill.js +0 -5
- package/src/index.tsx +0 -35
|
@@ -7,13 +7,13 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
9
|
import Bubble from './Bubble';
|
|
10
|
+
import CarouselFilmStripAttachment from './CarouselFilmStripAttachment';
|
|
10
11
|
import connectToWebChat from '../connectToWebChat';
|
|
11
12
|
import isZeroOrPositive from '../Utils/isZeroOrPositive';
|
|
12
13
|
import ScreenReaderText from '../ScreenReaderText';
|
|
13
14
|
import textFormatToContentType from '../Utils/textFormatToContentType';
|
|
14
15
|
import useStyleSet from '../hooks/useStyleSet';
|
|
15
16
|
import useStyleToEmotionObject from '../hooks/internal/useStyleToEmotionObject';
|
|
16
|
-
import useUniqueId from '../hooks/internal/useUniqueId';
|
|
17
17
|
|
|
18
18
|
const { useAvatarForBot, useAvatarForUser, useDirection, useLocalizer, useStyleOptions } = hooks;
|
|
19
19
|
|
|
@@ -36,7 +36,7 @@ const ROOT_STYLE = {
|
|
|
36
36
|
flexShrink: 0
|
|
37
37
|
},
|
|
38
38
|
|
|
39
|
-
'& .webchat__carousel-
|
|
39
|
+
'& .webchat__carousel-filmstrip-attachment': {
|
|
40
40
|
flex: 1
|
|
41
41
|
},
|
|
42
42
|
|
|
@@ -127,7 +127,6 @@ const CarouselFilmStrip = ({
|
|
|
127
127
|
const [{ initials: botInitials }] = useAvatarForBot();
|
|
128
128
|
const [{ initials: userInitials }] = useAvatarForUser();
|
|
129
129
|
const [direction] = useDirection();
|
|
130
|
-
const ariaLabelId = useUniqueId('webchat__carousel-filmstrip__id');
|
|
131
130
|
const localize = useLocalizer();
|
|
132
131
|
const rootClassName = useStyleToEmotionObject()(ROOT_STYLE) + '';
|
|
133
132
|
const showActivityStatus = typeof renderActivityStatus === 'function';
|
|
@@ -146,10 +145,8 @@ const CarouselFilmStrip = ({
|
|
|
146
145
|
const activityDisplayText = messageBackDisplayText || text;
|
|
147
146
|
const fromUser = role === 'user';
|
|
148
147
|
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
? localize('ACTIVITY_YOU_SAID_ALT')
|
|
152
|
-
: localize('ACTIVITY_BOT_SAID_ALT', botInitials || '')
|
|
148
|
+
const greetingAlt = (
|
|
149
|
+
fromUser ? localize('ACTIVITY_YOU_SAID_ALT') : localize('ACTIVITY_BOT_SAID_ALT', botInitials || '')
|
|
153
150
|
).replace(/\s{2,}/gu, ' ');
|
|
154
151
|
|
|
155
152
|
const initials = fromUser ? userInitials : botInitials;
|
|
@@ -169,15 +166,16 @@ const CarouselFilmStrip = ({
|
|
|
169
166
|
const showAvatar = showCallout && hasAvatar && !!renderAvatar;
|
|
170
167
|
const showNub = showCallout && hasNub && (topAlignedCallout || !attachments.length);
|
|
171
168
|
|
|
169
|
+
const hideNub = hasNub && !showNub;
|
|
170
|
+
|
|
172
171
|
return (
|
|
173
172
|
<div
|
|
174
|
-
aria-labelledby={ariaLabelId}
|
|
175
173
|
className={classNames(
|
|
176
174
|
'webchat__carousel-filmstrip',
|
|
177
175
|
{
|
|
178
176
|
'webchat__carousel-filmstrip--extra-trailing': extraTrailing,
|
|
179
177
|
'webchat__carousel-filmstrip--hide-avatar': hasAvatar && !showAvatar,
|
|
180
|
-
'webchat__carousel-filmstrip--hide-nub':
|
|
178
|
+
'webchat__carousel-filmstrip--hide-nub': hideNub,
|
|
181
179
|
'webchat__carousel-filmstrip--no-message': !activityDisplayText,
|
|
182
180
|
'webchat__carousel-filmstrip--rtl': direction === 'rtl',
|
|
183
181
|
'webchat__carousel-filmstrip--show-avatar': showAvatar,
|
|
@@ -196,14 +194,7 @@ const CarouselFilmStrip = ({
|
|
|
196
194
|
<div className="webchat__carousel-filmstrip__avatar-gutter">{showAvatar && renderAvatar({ activity })}</div>
|
|
197
195
|
<div className="webchat__carousel-filmstrip__content">
|
|
198
196
|
{!!activityDisplayText && (
|
|
199
|
-
<div
|
|
200
|
-
aria-roledescription="message"
|
|
201
|
-
className="webchat__carousel-filmstrip__message"
|
|
202
|
-
// Disable "Prop `id` is forbidden on DOM Nodes" rule because we are using the ID prop for accessibility.
|
|
203
|
-
/* eslint-disable-next-line react/forbid-dom-props */
|
|
204
|
-
id={ariaLabelId}
|
|
205
|
-
role="group"
|
|
206
|
-
>
|
|
197
|
+
<div aria-roledescription="message" className="webchat__carousel-filmstrip__message" role="group">
|
|
207
198
|
<ScreenReaderText text={greetingAlt} />
|
|
208
199
|
<Bubble
|
|
209
200
|
className="webchat__carousel-filmstrip__bubble"
|
|
@@ -229,20 +220,20 @@ const CarouselFilmStrip = ({
|
|
|
229
220
|
ref={itemContainerCallbackRef}
|
|
230
221
|
>
|
|
231
222
|
{attachments.map((attachment, index) => (
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
|
|
223
|
+
<CarouselFilmStripAttachment
|
|
224
|
+
activity={activity}
|
|
225
|
+
attachment={attachment}
|
|
226
|
+
fromUser={fromUser}
|
|
227
|
+
hasAvatar={hasAvatar}
|
|
228
|
+
hideNub={hideNub}
|
|
229
|
+
index={index}
|
|
235
230
|
/* Attachments do not have an ID; it is always indexed by number */
|
|
236
|
-
|
|
231
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
237
232
|
key={index}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<Bubble fromUser={fromUser} key={index} nub={false}>
|
|
243
|
-
{renderAttachment({ activity, attachment })}
|
|
244
|
-
</Bubble>
|
|
245
|
-
</li>
|
|
233
|
+
renderAttachment={renderAttachment}
|
|
234
|
+
showAvatar={showAvatar}
|
|
235
|
+
showNub={showNub}
|
|
236
|
+
/>
|
|
246
237
|
))}
|
|
247
238
|
</ul>
|
|
248
239
|
</div>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { hooks } from 'botframework-webchat-api';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import Bubble from './Bubble';
|
|
7
|
+
import ScreenReaderText from '../ScreenReaderText';
|
|
8
|
+
import useStyleSet from '../hooks/useStyleSet';
|
|
9
|
+
|
|
10
|
+
const { useDirection, useLocalizer } = hooks;
|
|
11
|
+
|
|
12
|
+
const CarouselFilmStripAttachment = ({
|
|
13
|
+
activity,
|
|
14
|
+
attachment,
|
|
15
|
+
className,
|
|
16
|
+
fromUser,
|
|
17
|
+
hasAvatar,
|
|
18
|
+
hideNub,
|
|
19
|
+
index,
|
|
20
|
+
renderAttachment,
|
|
21
|
+
showAvatar,
|
|
22
|
+
showNub
|
|
23
|
+
}) => {
|
|
24
|
+
const [direction] = useDirection();
|
|
25
|
+
const localize = useLocalizer();
|
|
26
|
+
const [{ carouselFilmStripAttachment: carouselFilmStripAttachmentStyleSet }] = useStyleSet();
|
|
27
|
+
|
|
28
|
+
const attachedAlt = localize(fromUser ? 'ACTIVITY_YOU_ATTACHED_ALT' : 'ACTIVITY_BOT_ATTACHED_ALT');
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<li
|
|
32
|
+
aria-roledescription="attachment"
|
|
33
|
+
className={classNames(
|
|
34
|
+
'webchat__carousel-filmstrip-attachment',
|
|
35
|
+
{
|
|
36
|
+
'webchat__carousel-filmstrip-attachment--hide-avatar': hasAvatar && !showAvatar,
|
|
37
|
+
'webchat__carousel-filmstrip-attachment--hide-nub': hideNub,
|
|
38
|
+
'webchat__carousel-filmstrip-attachment--rtl': direction === 'rtl',
|
|
39
|
+
'webchat__carousel-filmstrip-attachment--show-avatar': showAvatar,
|
|
40
|
+
'webchat__carousel-filmstrip-attachment--show-nub': showNub
|
|
41
|
+
},
|
|
42
|
+
'react-film__filmstrip__item',
|
|
43
|
+
carouselFilmStripAttachmentStyleSet + '',
|
|
44
|
+
(className || '') + ''
|
|
45
|
+
)}
|
|
46
|
+
role="listitem"
|
|
47
|
+
tabIndex={0}
|
|
48
|
+
>
|
|
49
|
+
<ScreenReaderText text={attachedAlt} />
|
|
50
|
+
{/* eslint-disable-next-line react/no-array-index-key */}
|
|
51
|
+
<Bubble fromUser={fromUser} key={index} nub={false}>
|
|
52
|
+
{renderAttachment({ activity, attachment })}
|
|
53
|
+
<div className="webchat__carousel-filmstrip-attachment--focus" />
|
|
54
|
+
</Bubble>
|
|
55
|
+
</li>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
CarouselFilmStripAttachment.defaultProps = {
|
|
60
|
+
className: ''
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
CarouselFilmStripAttachment.propTypes = {
|
|
64
|
+
activity: PropTypes.shape({
|
|
65
|
+
attachments: PropTypes.array,
|
|
66
|
+
channelData: PropTypes.shape({
|
|
67
|
+
messageBack: PropTypes.shape({
|
|
68
|
+
displayText: PropTypes.string
|
|
69
|
+
}),
|
|
70
|
+
state: PropTypes.string
|
|
71
|
+
}),
|
|
72
|
+
from: PropTypes.shape({
|
|
73
|
+
role: PropTypes.string.isRequired
|
|
74
|
+
}).isRequired,
|
|
75
|
+
text: PropTypes.string,
|
|
76
|
+
textFormat: PropTypes.string,
|
|
77
|
+
timestamp: PropTypes.string
|
|
78
|
+
}).isRequired,
|
|
79
|
+
attachment: PropTypes.shape({
|
|
80
|
+
content: PropTypes.any
|
|
81
|
+
}).isRequired,
|
|
82
|
+
className: PropTypes.string,
|
|
83
|
+
fromUser: PropTypes.any.isRequired,
|
|
84
|
+
hasAvatar: PropTypes.any.isRequired,
|
|
85
|
+
hideNub: PropTypes.bool.isRequired,
|
|
86
|
+
index: PropTypes.number.isRequired,
|
|
87
|
+
renderAttachment: PropTypes.func.isRequired,
|
|
88
|
+
showAvatar: PropTypes.bool.isRequired,
|
|
89
|
+
showNub: PropTypes.bool.isRequired
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default CarouselFilmStripAttachment;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { DirectLineActivity } from 'botframework-webchat-core';
|
|
1
2
|
import { hooks } from 'botframework-webchat-api';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
|
-
import React, { useCallback, useMemo } from 'react';
|
|
4
|
+
import React, { FC, useCallback, useMemo } from 'react';
|
|
4
5
|
import Say, { SayUtterance } from 'react-say';
|
|
5
6
|
|
|
6
7
|
import connectToWebChat from '../connectToWebChat';
|
|
@@ -22,7 +23,11 @@ const connectSpeakActivity = (...selectors) =>
|
|
|
22
23
|
...selectors
|
|
23
24
|
);
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
type SpeakProps = {
|
|
27
|
+
activity: DirectLineActivity;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const Speak: FC<SpeakProps> = ({ activity }) => {
|
|
26
31
|
const [{ showSpokenText }] = useStyleOptions();
|
|
27
32
|
const markActivityAsSpoken = useMarkActivityAsSpoken();
|
|
28
33
|
const selectVoice = useVoiceSelector(activity);
|
|
@@ -40,14 +45,16 @@ const Speak = ({ activity }) => {
|
|
|
40
45
|
speak || text,
|
|
41
46
|
...attachments
|
|
42
47
|
.filter(({ contentType }) => contentType === 'application/vnd.microsoft.card.adaptive')
|
|
43
|
-
.map(
|
|
48
|
+
.map(attachment => attachment?.content?.speak)
|
|
44
49
|
]
|
|
45
50
|
.filter(line => line)
|
|
46
51
|
.join('\r\n')
|
|
47
52
|
);
|
|
48
53
|
}, [activity]);
|
|
49
54
|
|
|
50
|
-
const {
|
|
55
|
+
const {
|
|
56
|
+
channelData: { speechSynthesisUtterance } = {}
|
|
57
|
+
}: { channelData: { speechSynthesisUtterance?: SpeechSynthesisUtterance } } = activity;
|
|
51
58
|
|
|
52
59
|
return (
|
|
53
60
|
!!activity && (
|
|
@@ -57,7 +64,7 @@ const Speak = ({ activity }) => {
|
|
|
57
64
|
) : (
|
|
58
65
|
<Say onEnd={markAsSpoken} onError={markAsSpoken} text={singleLine} voice={selectVoice} />
|
|
59
66
|
)}
|
|
60
|
-
{!!showSpokenText && <SayAlt speak={singleLine}
|
|
67
|
+
{!!showSpokenText && <SayAlt speak={singleLine} />}
|
|
61
68
|
</React.Fragment>
|
|
62
69
|
)
|
|
63
70
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/* eslint complexity: ["error", 30] */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { DirectLineActivity } from 'botframework-webchat-core';
|
|
4
|
+
import { hooks, RenderAttachment } from 'botframework-webchat-api';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
|
-
import React from 'react';
|
|
7
|
+
import React, { FC, ReactNode } from 'react';
|
|
7
8
|
|
|
8
9
|
import Bubble from './Bubble';
|
|
9
10
|
import connectToWebChat from '../connectToWebChat';
|
|
@@ -73,7 +74,7 @@ const connectStackedLayout = (...selectors) =>
|
|
|
73
74
|
options: { botAvatarInitials, userAvatarInitials }
|
|
74
75
|
}
|
|
75
76
|
},
|
|
76
|
-
{ activity: { from: { role } = {} } = {} }
|
|
77
|
+
{ activity: { from: { role = undefined } = {} } = {} }
|
|
77
78
|
) => ({
|
|
78
79
|
avatarInitials: role === 'user' ? userAvatarInitials : botAvatarInitials,
|
|
79
80
|
language,
|
|
@@ -85,7 +86,16 @@ const connectStackedLayout = (...selectors) =>
|
|
|
85
86
|
...selectors
|
|
86
87
|
);
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
type StackedLayoutProps = {
|
|
90
|
+
activity: DirectLineActivity;
|
|
91
|
+
hideTimestamp?: boolean;
|
|
92
|
+
renderActivityStatus?: (({ hideTimestamp: boolean }) => Exclude<ReactNode, boolean | null | undefined>) | false;
|
|
93
|
+
renderAttachment?: RenderAttachment;
|
|
94
|
+
renderAvatar?: (activity: DirectLineActivity) => (() => Exclude<ReactNode, boolean | null | undefined>) | false;
|
|
95
|
+
showCallout?: boolean;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const StackedLayout: FC<StackedLayoutProps> = ({
|
|
89
99
|
activity,
|
|
90
100
|
hideTimestamp,
|
|
91
101
|
renderActivityStatus,
|
|
@@ -93,14 +103,15 @@ const StackedLayout = ({
|
|
|
93
103
|
renderAvatar,
|
|
94
104
|
showCallout
|
|
95
105
|
}) => {
|
|
96
|
-
const [
|
|
106
|
+
const [styleOptions] = useStyleOptions();
|
|
97
107
|
const [{ initials: botInitials }] = useAvatarForBot();
|
|
98
108
|
const [{ initials: userInitials }] = useAvatarForUser();
|
|
99
109
|
const [{ stackedLayout: stackedLayoutStyleSet }] = useStyleSet();
|
|
100
110
|
const ariaLabelId = useUniqueId('webchat__stacked-layout__id');
|
|
101
111
|
const localize = useLocalizer();
|
|
102
112
|
const rootClassName = useStyleToEmotionObject()(ROOT_STYLE) + '';
|
|
103
|
-
|
|
113
|
+
|
|
114
|
+
const { bubbleNubOffset, bubbleNubSize, bubbleFromUserNubOffset, bubbleFromUserNubSize } = styleOptions;
|
|
104
115
|
|
|
105
116
|
const {
|
|
106
117
|
attachments = [],
|
|
@@ -108,6 +119,12 @@ const StackedLayout = ({
|
|
|
108
119
|
from: { role } = {},
|
|
109
120
|
text,
|
|
110
121
|
textFormat
|
|
122
|
+
}: {
|
|
123
|
+
attachments?: [];
|
|
124
|
+
channelData?: { messageBack?: { displayText?: string } };
|
|
125
|
+
from?: { role?: 'bot' | 'user' };
|
|
126
|
+
text?: string;
|
|
127
|
+
textFormat?: string;
|
|
111
128
|
} = activity;
|
|
112
129
|
|
|
113
130
|
const activityDisplayText = messageBackDisplayText || text;
|
|
@@ -153,7 +170,9 @@ const StackedLayout = ({
|
|
|
153
170
|
role="group"
|
|
154
171
|
>
|
|
155
172
|
<div className="webchat__stacked-layout__main">
|
|
156
|
-
<div className="webchat__stacked-layout__avatar-gutter">
|
|
173
|
+
<div className="webchat__stacked-layout__avatar-gutter">
|
|
174
|
+
{showAvatar && renderAvatar && renderAvatar({ activity })}
|
|
175
|
+
</div>
|
|
157
176
|
<div className="webchat__stacked-layout__content">
|
|
158
177
|
{!!activityDisplayText && (
|
|
159
178
|
<div
|
|
@@ -168,7 +187,7 @@ const StackedLayout = ({
|
|
|
168
187
|
<Bubble
|
|
169
188
|
className="webchat__stacked-layout__message"
|
|
170
189
|
fromUser={fromUser}
|
|
171
|
-
nub={showNub || (
|
|
190
|
+
nub={showNub || (hasAvatar || hasNub ? 'hidden' : false)}
|
|
172
191
|
>
|
|
173
192
|
{renderAttachment({
|
|
174
193
|
activity,
|
|
@@ -197,7 +216,7 @@ const StackedLayout = ({
|
|
|
197
216
|
fromUser={fromUser}
|
|
198
217
|
/* eslint-disable-next-line react/no-array-index-key */
|
|
199
218
|
key={index}
|
|
200
|
-
nub={
|
|
219
|
+
nub={hasAvatar || hasNub ? 'hidden' : false}
|
|
201
220
|
>
|
|
202
221
|
{renderAttachment({ activity, attachment })}
|
|
203
222
|
</Bubble>
|
|
@@ -206,7 +225,7 @@ const StackedLayout = ({
|
|
|
206
225
|
</div>
|
|
207
226
|
<div className="webchat__stacked-layout__alignment-pad" />
|
|
208
227
|
</div>
|
|
209
|
-
{
|
|
228
|
+
{typeof renderActivityStatus === 'function' && (
|
|
210
229
|
<div className="webchat__stacked-layout__status">
|
|
211
230
|
<div className="webchat__stacked-layout__avatar-gutter" />
|
|
212
231
|
<div className="webchat__stacked-layout__nub-pad" />
|
|
@@ -221,7 +240,7 @@ const StackedLayout = ({
|
|
|
221
240
|
StackedLayout.defaultProps = {
|
|
222
241
|
hideTimestamp: false,
|
|
223
242
|
renderActivityStatus: false,
|
|
224
|
-
renderAvatar:
|
|
243
|
+
renderAvatar: undefined,
|
|
225
244
|
showCallout: true
|
|
226
245
|
};
|
|
227
246
|
|
|
@@ -242,8 +261,14 @@ StackedLayout.propTypes = {
|
|
|
242
261
|
type: PropTypes.string.isRequired
|
|
243
262
|
}).isRequired,
|
|
244
263
|
hideTimestamp: PropTypes.bool,
|
|
264
|
+
|
|
265
|
+
// PropTypes cannot validate precisely with its TypeScript counterpart.
|
|
266
|
+
// @ts-ignore
|
|
245
267
|
renderActivityStatus: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.func]),
|
|
246
268
|
renderAttachment: PropTypes.func.isRequired,
|
|
269
|
+
|
|
270
|
+
// PropTypes cannot validate precisely with its TypeScript counterpart.
|
|
271
|
+
// @ts-ignore
|
|
247
272
|
renderAvatar: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.func]),
|
|
248
273
|
showCallout: PropTypes.bool
|
|
249
274
|
};
|
|
@@ -4,7 +4,14 @@ import React from 'react';
|
|
|
4
4
|
const ICON_SIZE_FACTOR = 22;
|
|
5
5
|
|
|
6
6
|
const DownloadIcon = ({ className, size }) => (
|
|
7
|
-
<svg
|
|
7
|
+
<svg
|
|
8
|
+
className={className}
|
|
9
|
+
focusable={false}
|
|
10
|
+
height={ICON_SIZE_FACTOR * size}
|
|
11
|
+
role="presentation"
|
|
12
|
+
viewBox="0 0 31.8 46"
|
|
13
|
+
width={ICON_SIZE_FACTOR * size}
|
|
14
|
+
>
|
|
8
15
|
<path d="M26.8,23.8l-10.9,11L5,23.8l1.6-1.6l8.2,8.3V5H17v25.5l8.2-8.3L26.8,23.8z M5.8,41v-2.2H26V41H5.8z" />
|
|
9
16
|
</svg>
|
|
10
17
|
);
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { FC } from 'react';
|
|
3
3
|
|
|
4
4
|
import useStyleSet from '../hooks/useStyleSet';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type AudioContentProps = {
|
|
7
|
+
alt?: string;
|
|
8
|
+
autoPlay?: boolean;
|
|
9
|
+
loop?: boolean;
|
|
10
|
+
poster?: string;
|
|
11
|
+
src: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const AudioContent: FC<AudioContentProps> = ({ alt, autoPlay, loop, src }) => {
|
|
7
15
|
const [{ audioContent: audioContentStyleSet }] = useStyleSet();
|
|
8
16
|
|
|
9
17
|
return (
|
|
@@ -13,7 +21,6 @@ const AudioContent = ({ alt, autoPlay, loop, poster, src }) => {
|
|
|
13
21
|
className={audioContentStyleSet}
|
|
14
22
|
controls={true}
|
|
15
23
|
loop={loop}
|
|
16
|
-
poster={poster}
|
|
17
24
|
src={src}
|
|
18
25
|
/>
|
|
19
26
|
);
|
|
@@ -30,6 +37,8 @@ AudioContent.propTypes = {
|
|
|
30
37
|
alt: PropTypes.string,
|
|
31
38
|
autoPlay: PropTypes.bool,
|
|
32
39
|
loop: PropTypes.bool,
|
|
40
|
+
// We will keep the "poster" prop for #3315.
|
|
41
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
33
42
|
poster: PropTypes.string,
|
|
34
43
|
src: PropTypes.string.isRequired
|
|
35
44
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { hooks } from 'botframework-webchat-api';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { FC } from 'react';
|
|
5
5
|
|
|
6
6
|
import DownloadIcon from './Assets/DownloadIcon';
|
|
7
|
-
import ScreenReaderText from '../ScreenReaderText';
|
|
8
7
|
import useStyleSet from '../hooks/useStyleSet';
|
|
9
8
|
import useStyleToEmotionObject from '../hooks/internal/useStyleToEmotionObject';
|
|
10
9
|
|
|
@@ -61,7 +60,14 @@ FileContentBadge.propTypes = {
|
|
|
61
60
|
size: PropTypes.number
|
|
62
61
|
};
|
|
63
62
|
|
|
64
|
-
|
|
63
|
+
type FileContentProps = {
|
|
64
|
+
className?: string;
|
|
65
|
+
fileName: string;
|
|
66
|
+
href?: string;
|
|
67
|
+
size?: number;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const FileContent: FC<FileContentProps> = ({ className, href, fileName, size }) => {
|
|
65
71
|
const [{ fileContent: fileContentStyleSet }] = useStyleSet();
|
|
66
72
|
const localize = useLocalizer();
|
|
67
73
|
const localizeBytes = useByteFormatter();
|
|
@@ -83,20 +89,17 @@ const FileContent = ({ className, href, fileName, size }) => {
|
|
|
83
89
|
|
|
84
90
|
return (
|
|
85
91
|
<div
|
|
86
|
-
aria-hidden={true}
|
|
87
92
|
className={classNames('webchat__fileContent', rootClassName, fileContentStyleSet + '', (className || '') + '')}
|
|
88
93
|
>
|
|
89
|
-
<ScreenReaderText text={alt} />
|
|
90
94
|
{href ? (
|
|
91
95
|
<a
|
|
92
|
-
aria-
|
|
96
|
+
aria-label={alt}
|
|
93
97
|
className="webchat__fileContent__buttonLink"
|
|
94
98
|
download={fileName}
|
|
95
99
|
href={href}
|
|
96
100
|
rel="noopener noreferrer"
|
|
97
101
|
target="_blank"
|
|
98
102
|
>
|
|
99
|
-
{/* Although nested, Chrome v75 does not respect the above aria-hidden and makes the below aria-hidden in FileContentBadge necessary */}
|
|
100
103
|
<FileContentBadge downloadIcon={true} fileName={fileName} size={size} />
|
|
101
104
|
</a>
|
|
102
105
|
) : (
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { FC } from 'react';
|
|
3
3
|
|
|
4
4
|
import useStyleSet from '../hooks/useStyleSet';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type HTMLVideoContentProps = {
|
|
7
|
+
alt?: string;
|
|
8
|
+
autoPlay?: boolean;
|
|
9
|
+
loop?: boolean;
|
|
10
|
+
poster?: string;
|
|
11
|
+
src: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const HTMLVideoContent: FC<HTMLVideoContentProps> = ({ alt, autoPlay, loop, poster, src }) => {
|
|
7
15
|
const [{ videoContent: videoContentStyleSet }] = useStyleSet();
|
|
8
16
|
|
|
9
17
|
return (
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { hooks } from 'botframework-webchat-api';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { FC } from 'react';
|
|
4
4
|
|
|
5
5
|
import CroppedImage from '../Utils/CroppedImage';
|
|
6
6
|
|
|
7
7
|
const { useStyleOptions } = hooks;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type ImageContentProps = {
|
|
10
|
+
alt?: string;
|
|
11
|
+
src: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const ImageContent: FC<ImageContentProps> = ({ alt, src }) => {
|
|
10
15
|
const [{ bubbleImageHeight }] = useStyleOptions();
|
|
11
16
|
|
|
12
17
|
return <CroppedImage alt={alt} height={bubbleImageHeight} src={src} width="100%" />;
|
|
@@ -5,12 +5,17 @@
|
|
|
5
5
|
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, { FC } from 'react';
|
|
9
9
|
|
|
10
10
|
import useRenderMarkdownAsHTML from '../hooks/useRenderMarkdownAsHTML';
|
|
11
11
|
import useStyleSet from '../hooks/useStyleSet';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type TextContentProps = {
|
|
14
|
+
contentType?: string;
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const TextContent: FC<TextContentProps> = ({ contentType, text }) => {
|
|
14
19
|
const [{ textContent: textContentStyleSet }] = useStyleSet();
|
|
15
20
|
const renderMarkdownAsHTML = useRenderMarkdownAsHTML();
|
|
16
21
|
const contentTypeMarkdown = contentType === 'text/markdown';
|
|
@@ -21,11 +26,13 @@ const TextContent = ({ contentType, text }) => {
|
|
|
21
26
|
dangerouslySetInnerHTML={{ __html: renderMarkdownAsHTML(text || '') }}
|
|
22
27
|
/>
|
|
23
28
|
) : (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
<React.Fragment>
|
|
30
|
+
{(text || '').split('\n').map((line, index) => (
|
|
31
|
+
<p className={classNames('plain', textContentStyleSet + '')} key={index}>
|
|
32
|
+
{line.trim()}
|
|
33
|
+
</p>
|
|
34
|
+
))}
|
|
35
|
+
</React.Fragment>
|
|
29
36
|
);
|
|
30
37
|
};
|
|
31
38
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { FC } from 'react';
|
|
3
3
|
|
|
4
4
|
import HTMLVideoContent from './HTMLVideoContent';
|
|
5
5
|
import VimeoContent from './VimeoContent';
|
|
@@ -30,7 +30,15 @@ function parseURL(url) {
|
|
|
30
30
|
return { hostname, pathname, search };
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
type VideoContentProps = {
|
|
34
|
+
alt?: string;
|
|
35
|
+
autoPlay?: boolean;
|
|
36
|
+
loop?: boolean;
|
|
37
|
+
poster?: string;
|
|
38
|
+
src: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const VideoContent: FC<VideoContentProps> = ({ alt, autoPlay, loop, poster, src }) => {
|
|
34
42
|
const { hostname, pathname, search } = parseURL(src);
|
|
35
43
|
const lastSegment = pathname.split('/').pop();
|
|
36
44
|
const searchParams = new URLSearchParams(search);
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { FC } from 'react';
|
|
3
3
|
|
|
4
4
|
import useStyleSet from '../hooks/useStyleSet';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type VimeoContentProps = {
|
|
7
|
+
alt?: string;
|
|
8
|
+
autoPlay?: boolean;
|
|
9
|
+
embedID: string;
|
|
10
|
+
loop?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const VimeoContent: FC<VimeoContentProps> = ({ alt, autoPlay, embedID, loop }) => {
|
|
7
14
|
const [{ vimeoContent: vimeoContentStyleSet }] = useStyleSet();
|
|
8
15
|
|
|
9
16
|
const search = new URLSearchParams({
|
|
10
|
-
autoplay: autoPlay ? 1 : 0,
|
|
11
|
-
badge: 0,
|
|
12
|
-
byline: 0,
|
|
13
|
-
loop: loop ? 1 : 0,
|
|
14
|
-
portrait: 0,
|
|
15
|
-
title: 0
|
|
17
|
+
autoplay: autoPlay ? '1' : '0',
|
|
18
|
+
badge: '0',
|
|
19
|
+
byline: '0',
|
|
20
|
+
loop: loop ? '1' : '0',
|
|
21
|
+
portrait: '0',
|
|
22
|
+
title: '0'
|
|
16
23
|
}).toString();
|
|
17
24
|
|
|
18
25
|
return (
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { FC } from 'react';
|
|
3
3
|
|
|
4
4
|
import useStyleSet from '../hooks/useStyleSet';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type YouTubeContentProps = {
|
|
7
|
+
alt?: string;
|
|
8
|
+
autoPlay?: boolean;
|
|
9
|
+
embedID: string;
|
|
10
|
+
loop?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const YouTubeContent: FC<YouTubeContentProps> = ({ alt, autoPlay, embedID, loop }) => {
|
|
7
14
|
const [{ youTubeContent: youTubeContentStyleSet }] = useStyleSet();
|
|
8
15
|
|
|
9
16
|
const search = new URLSearchParams({
|
|
10
|
-
autoplay: autoPlay ? 1 : 0,
|
|
11
|
-
loop: loop ? 1 : 0,
|
|
12
|
-
modestbranding: 1
|
|
17
|
+
autoplay: autoPlay ? '1' : '0',
|
|
18
|
+
loop: loop ? '1' : '0',
|
|
19
|
+
modestbranding: '1'
|
|
13
20
|
}).toString();
|
|
14
21
|
|
|
15
22
|
return (
|