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
package/src/Dictation.js
CHANGED
|
@@ -2,8 +2,9 @@ import { Composer as DictateComposer } from 'react-dictate-button';
|
|
|
2
2
|
import { Constants } from 'botframework-webchat-core';
|
|
3
3
|
import { hooks } from 'botframework-webchat-api';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import React, { useCallback, useMemo } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import useResumeAudioContext from './hooks/internal/useResumeAudioContext';
|
|
7
8
|
import useSettableDictateAbortable from './hooks/internal/useSettableDictateAbortable';
|
|
8
9
|
import useWebSpeechPonyfill from './hooks/useWebSpeechPonyfill';
|
|
9
10
|
|
|
@@ -40,13 +41,15 @@ const Dictation = ({ onError }) => {
|
|
|
40
41
|
const [sendTypingIndicator] = useSendTypingIndicator();
|
|
41
42
|
const [speechLanguage] = useLanguage('speech');
|
|
42
43
|
const emitTypingIndicator = useEmitTypingIndicator();
|
|
44
|
+
const resumeAudioContext = useResumeAudioContext();
|
|
43
45
|
const setDictateState = useSetDictateState();
|
|
44
46
|
const stopDictate = useStopDictate();
|
|
45
47
|
const submitSendBox = useSubmitSendBox();
|
|
46
48
|
|
|
47
|
-
const numSpeakingActivities = useMemo(
|
|
48
|
-
activities
|
|
49
|
-
|
|
49
|
+
const numSpeakingActivities = useMemo(
|
|
50
|
+
() => activities.filter(({ channelData: { speak } = {} }) => speak).length,
|
|
51
|
+
[activities]
|
|
52
|
+
);
|
|
50
53
|
|
|
51
54
|
const handleDictate = useCallback(
|
|
52
55
|
({ result: { confidence, transcript } = {} }) => {
|
|
@@ -97,6 +100,12 @@ const Dictation = ({ onError }) => {
|
|
|
97
100
|
[dictateState, onError, setDictateState, stopDictate]
|
|
98
101
|
);
|
|
99
102
|
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
window.addEventListener('pointerdown', resumeAudioContext);
|
|
105
|
+
|
|
106
|
+
return () => window.removeEventListener('pointerdown', resumeAudioContext);
|
|
107
|
+
}, [resumeAudioContext]);
|
|
108
|
+
|
|
100
109
|
return (
|
|
101
110
|
<DictateComposer
|
|
102
111
|
lang={speechLanguage}
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
import { hooks } from 'botframework-webchat-api';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { FC } from 'react';
|
|
6
6
|
|
|
7
7
|
import ScreenReaderText from './ScreenReaderText';
|
|
8
8
|
import useStyleSet from './hooks/useStyleSet';
|
|
9
9
|
|
|
10
10
|
const { useLocalizer } = hooks;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type ErrorBoxProps = {
|
|
13
|
+
error: Error;
|
|
14
|
+
type?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const ErrorBox: FC<ErrorBoxProps> = ({ error, type }) => {
|
|
13
18
|
const [{ errorBox: errorBoxStyleSet }] = useStyleSet();
|
|
14
19
|
const localize = useLocalizer();
|
|
15
20
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* eslint-disable complexity */
|
|
2
|
+
import { ActivityMiddleware } from 'botframework-webchat-api';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
import CarouselLayout from '../../Activity/CarouselLayout';
|
|
5
6
|
import StackedLayout from '../../Activity/StackedLayout';
|
|
6
7
|
|
|
7
|
-
export default function createCoreMiddleware() {
|
|
8
|
+
export default function createCoreMiddleware(): ActivityMiddleware[] {
|
|
8
9
|
return [
|
|
9
10
|
() => next => (...args) => {
|
|
10
11
|
const [{ activity }] = args;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Constants } from 'botframework-webchat-core';
|
|
1
|
+
import { Constants, DirectLineActivity } from 'botframework-webchat-core';
|
|
2
2
|
import { hooks } from 'botframework-webchat-api';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import React, { useCallback } from 'react';
|
|
4
|
+
import React, { FC, useCallback } from 'react';
|
|
5
5
|
|
|
6
6
|
import connectToWebChat from '../../../connectToWebChat';
|
|
7
7
|
import ScreenReaderText from '../../../ScreenReaderText';
|
|
@@ -32,7 +32,12 @@ const connectSendStatus = (...selectors) =>
|
|
|
32
32
|
...selectors
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
type SendStatusProps = {
|
|
36
|
+
activity: DirectLineActivity;
|
|
37
|
+
sendState: 'sending' | 'send failed' | 'sent';
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const SendStatus: FC<SendStatusProps> = ({ activity, sendState }) => {
|
|
36
41
|
const [{ sendStatus: sendStatusStyleSet }] = useStyleSet();
|
|
37
42
|
const focus = useFocus();
|
|
38
43
|
const localize = useLocalizer();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { DirectLineActivity } from 'botframework-webchat-core';
|
|
1
2
|
import { hooks } from 'botframework-webchat-api';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
|
-
import React from 'react';
|
|
5
|
+
import React, { FC } from 'react';
|
|
5
6
|
|
|
6
7
|
import AbsoluteTime from './AbsoluteTime';
|
|
7
8
|
import RelativeTime from './RelativeTime';
|
|
@@ -9,7 +10,12 @@ import useStyleSet from '../../hooks/useStyleSet';
|
|
|
9
10
|
|
|
10
11
|
const { useStyleOptions } = hooks;
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
type TimestampProps = {
|
|
14
|
+
activity: DirectLineActivity;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Timestamp: FC<TimestampProps> = ({ activity: { timestamp }, className }) => {
|
|
13
19
|
const [{ timestampFormat }] = useStyleOptions();
|
|
14
20
|
const [{ timestamp: timestampStyleSet, sendStatus: sendStatusStyleSet }] = useStyleSet();
|
|
15
21
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ActivityStatusMiddleware } from 'botframework-webchat-api';
|
|
2
|
+
|
|
1
3
|
import createSendStatusMiddleware from './createSendStatusMiddleware';
|
|
2
4
|
import createTimestampMiddleware from './createTimestampMiddleware';
|
|
3
5
|
|
|
4
|
-
export default function createCoreMiddleware() {
|
|
6
|
+
export default function createCoreMiddleware(): ActivityStatusMiddleware[] {
|
|
5
7
|
return [createSendStatusMiddleware(), createTimestampMiddleware()];
|
|
6
8
|
}
|
|
@@ -8,11 +8,13 @@ const {
|
|
|
8
8
|
} = Constants;
|
|
9
9
|
|
|
10
10
|
export default function createSendStatusMiddleware() {
|
|
11
|
-
return () =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
return () =>
|
|
12
|
+
next =>
|
|
13
|
+
({ activity, sendState, ...args }) => {
|
|
14
|
+
if (sendState !== SENT) {
|
|
15
|
+
return <SendStatus activity={activity} sendState={sendState} />;
|
|
16
|
+
}
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
return next({ activity, sendState, ...args });
|
|
19
|
+
};
|
|
18
20
|
}
|
|
@@ -4,14 +4,16 @@ import AbsoluteTime from './AbsoluteTime';
|
|
|
4
4
|
import Timestamp from './Timestamp';
|
|
5
5
|
|
|
6
6
|
export default function createTimestampMiddleware() {
|
|
7
|
-
return () =>
|
|
8
|
-
|
|
7
|
+
return () =>
|
|
8
|
+
() =>
|
|
9
|
+
(...args) => {
|
|
10
|
+
const [{ activity, hideTimestamp }] = args;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if (hideTimestamp) {
|
|
13
|
+
// If "hideTimestamp" is set, we will not render the visual timestamp. But continue to render the screen reader only version.
|
|
14
|
+
return <AbsoluteTime hide={true} value={activity.timestamp} />;
|
|
15
|
+
}
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
return <Timestamp activity={activity} />;
|
|
18
|
+
};
|
|
17
19
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AttachmentMiddleware } from 'botframework-webchat-api';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import AudioAttachment from '../../Attachment/AudioAttachment';
|
|
@@ -7,7 +8,7 @@ import TextAttachment from '../../Attachment/TextAttachment';
|
|
|
7
8
|
import VideoAttachment from '../../Attachment/VideoAttachment';
|
|
8
9
|
|
|
9
10
|
// TODO: [P4] Rename this file or the whole middleware, it looks either too simple or too comprehensive now
|
|
10
|
-
export default function createCoreMiddleware() {
|
|
11
|
+
export default function createCoreMiddleware(): AttachmentMiddleware[] {
|
|
11
12
|
return [
|
|
12
13
|
// This is not returning a React component, but a render function.
|
|
13
14
|
/* eslint-disable-next-line react/display-name */
|
|
@@ -15,9 +16,9 @@ export default function createCoreMiddleware() {
|
|
|
15
16
|
const [
|
|
16
17
|
{
|
|
17
18
|
activity = {},
|
|
18
|
-
activity: { from: { role } = {} } = {},
|
|
19
|
+
activity: { from: { role = undefined } = {} } = {},
|
|
19
20
|
attachment,
|
|
20
|
-
attachment: { contentType, contentUrl, thumbnailUrl } = {}
|
|
21
|
+
attachment: { contentType = undefined, contentUrl = undefined, thumbnailUrl = undefined } = {}
|
|
21
22
|
}
|
|
22
23
|
] = args;
|
|
23
24
|
|
|
@@ -26,15 +27,15 @@ export default function createCoreMiddleware() {
|
|
|
26
27
|
return (isText ? !attachment.content : role === 'user' && !thumbnailUrl) ? (
|
|
27
28
|
<FileAttachment activity={activity} attachment={attachment} />
|
|
28
29
|
) : /^audio\//u.test(contentType) ? (
|
|
29
|
-
<AudioAttachment
|
|
30
|
+
<AudioAttachment attachment={attachment} />
|
|
30
31
|
) : /^image\//u.test(contentType) ? (
|
|
31
|
-
<ImageAttachment
|
|
32
|
+
<ImageAttachment attachment={attachment} />
|
|
32
33
|
) : /^video\//u.test(contentType) ? (
|
|
33
|
-
<VideoAttachment
|
|
34
|
+
<VideoAttachment attachment={attachment} />
|
|
34
35
|
) : contentUrl || contentType === 'application/octet-stream' ? (
|
|
35
36
|
<FileAttachment activity={activity} attachment={attachment} />
|
|
36
37
|
) : isText ? (
|
|
37
|
-
<TextAttachment
|
|
38
|
+
<TextAttachment attachment={attachment} />
|
|
38
39
|
) : (
|
|
39
40
|
next(...args)
|
|
40
41
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AttachmentForScreenReaderMiddleware } from 'botframework-webchat-api';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import AudioAttachment from './AudioAttachment';
|
|
@@ -6,14 +7,14 @@ import ImageAttachment from './ImageAttachment';
|
|
|
6
7
|
import TextAttachment from './TextAttachment';
|
|
7
8
|
import VideoAttachment from './VideoAttachment';
|
|
8
9
|
|
|
9
|
-
export default function createCoreMiddleware() {
|
|
10
|
+
export default function createCoreMiddleware(): AttachmentForScreenReaderMiddleware[] {
|
|
10
11
|
return [
|
|
11
12
|
() => next => (...args) => {
|
|
12
13
|
const [
|
|
13
14
|
{
|
|
14
|
-
activity: { from: { role } = {} } = {},
|
|
15
|
+
activity: { from: { role = undefined } = {} } = {},
|
|
15
16
|
attachment,
|
|
16
|
-
attachment: { contentType, contentUrl, thumbnailUrl } = {}
|
|
17
|
+
attachment: { contentType = undefined, contentUrl = undefined, thumbnailUrl = undefined } = {}
|
|
17
18
|
}
|
|
18
19
|
] = args;
|
|
19
20
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { AvatarMiddleware } from 'botframework-webchat-api';
|
|
1
2
|
import classNames from 'classnames';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
|
-
import React from 'react';
|
|
4
|
+
import React, { FC } from 'react';
|
|
4
5
|
|
|
5
6
|
import ImageAvatar from '../../Avatar/ImageAvatar';
|
|
6
7
|
import InitialsAvatar from '../../Avatar/InitialsAvatar';
|
|
@@ -18,7 +19,13 @@ const ROOT_STYLE = {
|
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
type DefaultAvatarProps = {
|
|
23
|
+
'aria-hidden'?: boolean;
|
|
24
|
+
className?: string;
|
|
25
|
+
fromUser: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const DefaultAvatar: FC<DefaultAvatarProps> = ({ 'aria-hidden': ariaHidden, className, fromUser }) => {
|
|
22
29
|
const [{ avatar: avatarStyleSet }] = useStyleSet();
|
|
23
30
|
const rootClassName = useStyleToEmotionObject()(ROOT_STYLE) + '';
|
|
24
31
|
|
|
@@ -50,7 +57,7 @@ DefaultAvatar.propTypes = {
|
|
|
50
57
|
fromUser: PropTypes.bool.isRequired
|
|
51
58
|
};
|
|
52
59
|
|
|
53
|
-
export default function createCoreAvatarMiddleware() {
|
|
60
|
+
export default function createCoreAvatarMiddleware(): AvatarMiddleware[] {
|
|
54
61
|
return [
|
|
55
62
|
() => () => ({ fromUser, styleOptions }) => {
|
|
56
63
|
const { botAvatarImage, botAvatarInitials, userAvatarImage, userAvatarInitials } = styleOptions;
|
|
@@ -2,7 +2,7 @@ import { ie11 } from '../../Utils/detectBrowser';
|
|
|
2
2
|
|
|
3
3
|
// This code is adopted from sanitize-html/naughtyScheme.
|
|
4
4
|
// sanitize-html is a dependency of Web Chat but the naughtScheme function is neither exposed nor reusable.
|
|
5
|
-
// https://github.com/apostrophecms/sanitize-html/
|
|
5
|
+
// https://github.com/apostrophecms/sanitize-html/
|
|
6
6
|
function getScheme(href) {
|
|
7
7
|
// Browsers ignore character codes of 32 (space) and below in a surprising
|
|
8
8
|
// number of situations. Start reading here:
|
|
@@ -31,55 +31,57 @@ const ALLOWED_SCHEMES = ['data', 'http', 'https', 'ftp', 'mailto', 'sip', 'tel']
|
|
|
31
31
|
|
|
32
32
|
export default function createDefaultCardActionMiddleware() {
|
|
33
33
|
return [
|
|
34
|
-
() =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
() =>
|
|
35
|
+
next =>
|
|
36
|
+
(...args) => {
|
|
37
|
+
const [
|
|
38
|
+
{
|
|
39
|
+
cardAction: { type, value },
|
|
40
|
+
getSignInUrl
|
|
41
|
+
}
|
|
42
|
+
] = args;
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
switch (type) {
|
|
45
|
+
case 'call':
|
|
46
|
+
case 'downloadFile':
|
|
47
|
+
case 'openUrl':
|
|
48
|
+
case 'playAudio':
|
|
49
|
+
case 'playVideo':
|
|
50
|
+
case 'showImage':
|
|
51
|
+
if (ALLOWED_SCHEMES.includes(getScheme(value))) {
|
|
52
|
+
if (ie11) {
|
|
53
|
+
const newWindow = window.open();
|
|
54
|
+
newWindow.opener = null;
|
|
55
|
+
newWindow.location = value;
|
|
56
|
+
} else {
|
|
57
|
+
window.open(value, '_blank', 'noopener noreferrer');
|
|
58
|
+
}
|
|
54
59
|
} else {
|
|
55
|
-
|
|
60
|
+
console.warn('botframework-webchat: Cannot open URL with disallowed schemes.', value);
|
|
56
61
|
}
|
|
57
|
-
} else {
|
|
58
|
-
console.warn('botframework-webchat: Cannot open URL with disallowed schemes.', value);
|
|
59
|
-
}
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
break;
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
case 'signin': {
|
|
66
|
+
/**
|
|
67
|
+
* @todo TODO: [P3] We should prime the URL into the OAuthCard directly, instead of calling getSessionId on-demand
|
|
68
|
+
* This is to eliminate the delay between window.open() and location.href call
|
|
69
|
+
*/
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
// eslint-disable-next-line wrap-iife
|
|
72
|
+
(async function () {
|
|
73
|
+
const popup = window.open();
|
|
74
|
+
const url = await getSignInUrl();
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
popup.location.href = url;
|
|
77
|
+
})();
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
default:
|
|
83
|
+
return next(...args);
|
|
84
|
+
}
|
|
82
85
|
}
|
|
83
|
-
}
|
|
84
86
|
];
|
|
85
87
|
}
|
|
@@ -48,8 +48,10 @@ function shouldGroupTimestamp(activityX, activityY, groupTimestamp) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export default function createDefaultGroupActivityMiddleware({ groupTimestamp }) {
|
|
51
|
-
return () =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
return () =>
|
|
52
|
+
() =>
|
|
53
|
+
({ activities }) => ({
|
|
54
|
+
sender: bin(activities, (x, y) => x.from.role === y.from.role),
|
|
55
|
+
status: bin(activities, (x, y) => shouldGroupTimestamp(x, y, groupTimestamp))
|
|
56
|
+
});
|
|
55
57
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 useStyleSet from '../../hooks/useStyleSet';
|
|
7
|
+
|
|
8
|
+
const { useDirection, useLocalizer, useStyleOptions } = hooks;
|
|
9
|
+
|
|
10
|
+
const ScrollToEndButton = ({ onClick }) => {
|
|
11
|
+
const [{ scrollToEndButton: scrollToEndButtonStyleSet }] = useStyleSet();
|
|
12
|
+
const [{ scrollToEndButtonBehavior }] = useStyleOptions();
|
|
13
|
+
const [direction] = useDirection();
|
|
14
|
+
const localize = useLocalizer();
|
|
15
|
+
|
|
16
|
+
const text = localize(scrollToEndButtonBehavior === 'any' ? 'TRANSCRIPT_MORE_MESSAGES' : 'TRANSCRIPT_NEW_MESSAGES');
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<button
|
|
20
|
+
aria-label={text}
|
|
21
|
+
className={classNames(
|
|
22
|
+
'webchat__scroll-to-end-button',
|
|
23
|
+
scrollToEndButtonStyleSet + '',
|
|
24
|
+
direction === 'rtl' ? 'webchat__scroll-to-end-button--rtl' : ''
|
|
25
|
+
)}
|
|
26
|
+
onClick={onClick}
|
|
27
|
+
tabIndex={0}
|
|
28
|
+
type="button"
|
|
29
|
+
>
|
|
30
|
+
{text}
|
|
31
|
+
</button>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
ScrollToEndButton.defaultProps = {
|
|
36
|
+
onClick: undefined
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
ScrollToEndButton.displayName = 'ScrollToEndButton';
|
|
40
|
+
|
|
41
|
+
ScrollToEndButton.propTypes = {
|
|
42
|
+
onClick: PropTypes.func
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default ScrollToEndButton;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ScrollToEndButtonMiddleware } from 'botframework-webchat-api';
|
|
2
|
+
|
|
3
|
+
import ScrollToEndButton from './ScrollToEndButton';
|
|
4
|
+
|
|
5
|
+
export default function createScrollToEndButtonMiddleware(): ScrollToEndButtonMiddleware[] {
|
|
6
|
+
return [
|
|
7
|
+
() => () => ({ atEnd, styleOptions: { scrollToEndButtonBehavior }, unread }) =>
|
|
8
|
+
!scrollToEndButtonBehavior
|
|
9
|
+
? // Don't show the button when it is set to false.
|
|
10
|
+
false
|
|
11
|
+
: scrollToEndButtonBehavior === 'any'
|
|
12
|
+
? // Show when the scroll view is not at the end, regardless of number of unread activities.
|
|
13
|
+
!atEnd && ScrollToEndButton
|
|
14
|
+
: // Show when the scroll view is not at the end of the transcript, and there are new/unread activities.
|
|
15
|
+
!atEnd && unread && ScrollToEndButton
|
|
16
|
+
];
|
|
17
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ToastMiddleware } from 'botframework-webchat-api';
|
|
2
|
+
|
|
1
3
|
import createToastMiddleware from '../../Toast/createToastMiddleware';
|
|
2
4
|
|
|
3
|
-
function createCoreMiddleware() {
|
|
5
|
+
function createCoreMiddleware(): ToastMiddleware[] {
|
|
4
6
|
return [
|
|
5
7
|
() => next => (...args) => {
|
|
6
8
|
const [
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { hooks } from 'botframework-webchat-api';
|
|
1
|
+
import { hooks, TypingIndicatorMiddleware } from 'botframework-webchat-api';
|
|
4
2
|
import classNames from 'classnames';
|
|
5
3
|
import React from 'react';
|
|
6
4
|
|
|
@@ -22,6 +20,7 @@ const DotIndicator = () => {
|
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
// TODO: [P4] Rename this file or the whole middleware, it looks either too simple or too comprehensive now
|
|
25
|
-
export default function createCoreMiddleware() {
|
|
23
|
+
export default function createCoreMiddleware(): TypingIndicatorMiddleware[] {
|
|
24
|
+
/* eslint-disable-next-line react/prop-types */
|
|
26
25
|
return [() => () => ({ visible }) => visible && <DotIndicator />];
|
|
27
26
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { VFC } from 'react';
|
|
3
3
|
|
|
4
4
|
import BasicWebChat from './BasicWebChat';
|
|
5
|
-
import Composer from './Composer';
|
|
5
|
+
import Composer, { ComposerProps } from './Composer';
|
|
6
6
|
|
|
7
7
|
// Please keep this file as simple as possible. This is for setting up the surface (a.k.a. <Composer>) and <BasicWebChat> only.
|
|
8
8
|
|
|
@@ -12,22 +12,40 @@ import Composer from './Composer';
|
|
|
12
12
|
// - They can run hooks outside of activity/attachment middleware
|
|
13
13
|
// - They will put <Composer> as very top of their page, and allow buttons on their existing page to send message to bot
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// Subset of landmark roles: https://w3.org/TR/wai-aria/#landmark_roles
|
|
16
|
+
const ARIA_LANDMARK_ROLES = ['complementary', 'contentinfo', 'form', 'main', 'region'];
|
|
17
|
+
|
|
18
|
+
type ReactWebChatProps = Omit<ComposerProps, 'children'> & {
|
|
19
|
+
className?: string;
|
|
20
|
+
role?: 'complementary' | 'contentinfo' | 'form' | 'main' | 'region';
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const ReactWebChat: VFC<ReactWebChatProps> = ({ className, role, ...composerProps }) => (
|
|
16
24
|
<Composer {...composerProps}>
|
|
17
25
|
<BasicWebChat className={className} role={role} />
|
|
18
26
|
</Composer>
|
|
19
27
|
);
|
|
20
28
|
|
|
21
|
-
export default ReactWebChat;
|
|
22
|
-
|
|
23
29
|
ReactWebChat.defaultProps = {
|
|
24
30
|
className: undefined,
|
|
25
31
|
role: undefined,
|
|
26
32
|
...Composer.defaultProps
|
|
27
33
|
};
|
|
28
34
|
|
|
35
|
+
const {
|
|
36
|
+
// Excluding "children" from ComposerProps.
|
|
37
|
+
children: _,
|
|
38
|
+
...composerPropTypesWithoutChildren
|
|
39
|
+
} = Composer.propTypes;
|
|
40
|
+
|
|
29
41
|
ReactWebChat.propTypes = {
|
|
30
42
|
className: PropTypes.string,
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
// Ignoring deficiencies with TypeScript/PropTypes inference.
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
role: PropTypes.oneOf(ARIA_LANDMARK_ROLES),
|
|
46
|
+
...composerPropTypesWithoutChildren
|
|
33
47
|
};
|
|
48
|
+
|
|
49
|
+
export default ReactWebChat;
|
|
50
|
+
|
|
51
|
+
export type { ReactWebChatProps };
|