botframework-webchat-component 4.13.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.yml +4 -100
- package/.prettierrc.yml +1 -1
- 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 +21 -31
- 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 +11 -13
- package/lib/Activity/StackedLayout.d.ts +18 -0
- package/lib/Activity/StackedLayout.d.ts.map +1 -0
- package/lib/Activity/StackedLayout.js +19 -15
- 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/FileAttachment.js +2 -2
- package/lib/Attachment/FileContent.d.ts +10 -0
- package/lib/Attachment/FileContent.d.ts.map +1 -0
- package/lib/Attachment/FileContent.js +14 -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 +7 -6
- package/lib/BasicToast.js +4 -4
- package/lib/BasicToaster.js +8 -5
- package/lib/BasicTranscript.d.ts +7 -0
- package/lib/BasicTranscript.d.ts.map +1 -0
- package/lib/BasicTranscript.js +406 -743
- package/lib/BasicTypingIndicator.d.ts +6 -0
- package/lib/BasicTypingIndicator.d.ts.map +1 -0
- package/lib/BasicTypingIndicator.js +13 -5
- 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 +65 -82
- 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 +5 -5
- 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 +21 -16
- 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 +10 -13
- 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 +3 -4
- package/lib/Middleware/CardAction/createCoreMiddleware.js +11 -4
- 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 +9 -6
- 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 +76 -48
- package/lib/ScreenReaderText.d.ts +9 -0
- package/lib/ScreenReaderText.d.ts.map +1 -0
- package/lib/ScreenReaderText.js +22 -8
- 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 +3 -3
- package/lib/SendBox/IconButton.d.ts +11 -0
- package/lib/SendBox/IconButton.d.ts.map +1 -0
- package/lib/SendBox/IconButton.js +27 -7
- 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 +8 -6
- package/lib/SendBox/SuggestedAction.d.ts +17 -0
- package/lib/SendBox/SuggestedAction.d.ts.map +1 -0
- package/lib/SendBox/SuggestedAction.js +29 -24
- package/lib/SendBox/SuggestedActions.d.ts +5 -0
- package/lib/SendBox/SuggestedActions.d.ts.map +1 -0
- package/lib/SendBox/SuggestedActions.js +33 -13
- package/lib/SendBox/TextBox.d.ts +28 -0
- package/lib/SendBox/TextBox.d.ts.map +1 -0
- package/lib/SendBox/TextBox.js +13 -8
- package/lib/SendBox/UploadButton.d.ts +9 -0
- package/lib/SendBox/UploadButton.d.ts.map +1 -0
- package/lib/SendBox/UploadButton.js +6 -6
- 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 +85 -0
- package/lib/Styles/StyleSet/BasicTranscript.d.ts.map +1 -0
- package/lib/Styles/StyleSet/BasicTranscript.js +21 -9
- 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 +2 -2
- 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/KeyboardHelp.d.ts +123 -0
- package/lib/Styles/StyleSet/KeyboardHelp.d.ts.map +1 -0
- package/lib/Styles/StyleSet/KeyboardHelp.js +145 -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 +79 -0
- package/lib/Styles/StyleSet/SendBoxButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SendBoxButton.js +76 -12
- package/lib/Styles/StyleSet/SendBoxTextBox.d.ts +41 -0
- package/lib/Styles/StyleSet/SendBoxTextBox.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SendBoxTextBox.js +3 -3
- 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/StackedLayout.js +1 -1
- package/lib/Styles/StyleSet/SuggestedAction.d.ts +94 -0
- package/lib/Styles/StyleSet/SuggestedAction.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SuggestedAction.js +116 -41
- package/lib/Styles/StyleSet/SuggestedActions.d.ts +125 -0
- package/lib/Styles/StyleSet/SuggestedActions.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SuggestedActions.js +13 -6
- 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 +1372 -0
- package/lib/Styles/createStyleSet.d.ts.map +1 -0
- package/lib/Styles/createStyleSet.js +47 -41
- package/lib/Styles/mirrorStyle.js +13 -4
- 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 +7 -3
- 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/Transcript/ActivityRow.d.ts +9 -0
- package/lib/Transcript/ActivityRow.d.ts.map +1 -0
- package/lib/Transcript/ActivityRow.js +157 -0
- package/lib/Transcript/ActivityTextAlt.js +57 -0
- package/lib/Transcript/FocusTrap.d.ts +8 -0
- package/lib/Transcript/FocusTrap.d.ts.map +1 -0
- package/lib/Transcript/FocusTrap.js +74 -0
- package/lib/Transcript/KeyboardHelp.d.ts +4 -0
- package/lib/Transcript/KeyboardHelp.d.ts.map +1 -0
- package/lib/Transcript/KeyboardHelp.js +550 -0
- package/lib/Transcript/LiveRegionTranscript.d.ts +8 -0
- package/lib/Transcript/LiveRegionTranscript.d.ts.map +1 -0
- package/lib/Transcript/LiveRegionTranscript.js +214 -0
- package/lib/Transcript/types.d.ts +2 -0
- package/lib/Transcript/types.d.ts.map +1 -0
- package/lib/Transcript/types.js +2 -0
- package/lib/Transcript/useActivityAccessibleName.d.ts +4 -0
- package/lib/Transcript/useActivityAccessibleName.d.ts.map +1 -0
- package/lib/Transcript/useActivityAccessibleName.js +97 -0
- package/lib/Utils/AccessKeySink/Surface.js +7 -5
- package/lib/Utils/AccessibleButton.d.ts +11 -0
- package/lib/Utils/AccessibleButton.d.ts.map +1 -0
- package/lib/Utils/AccessibleButton.js +15 -8
- 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.d.ts +9 -0
- package/lib/Utils/FocusRedirector.d.ts.map +1 -0
- package/lib/Utils/FocusRedirector.js +18 -15
- package/lib/Utils/InlineMarkdown.js +17 -10
- 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/inputtableKey.d.ts +2 -0
- package/lib/Utils/TypeFocusSink/inputtableKey.d.ts.map +1 -0
- package/lib/Utils/TypeFocusSink/inputtableKey.js +5 -2
- package/lib/Utils/TypeFocusSink/navigableEvent.js +1 -1
- package/lib/Utils/activityAltText.d.ts +8 -0
- package/lib/Utils/activityAltText.d.ts.map +1 -0
- package/lib/Utils/activityAltText.js +100 -0
- package/lib/Utils/addTargetBlankToHyperlinksMarkdown.js +1 -1
- package/lib/Utils/createCustomEvent.js +9 -3
- package/lib/Utils/debounce.js +1 -1
- package/lib/Utils/detectBrowser.js +4 -2
- package/lib/Utils/downscaleImageToDataURL/downscaleImageToDataURLUsingWorker.js +3 -3
- package/lib/Utils/downscaleImageToDataURL/index.js +2 -2
- package/lib/Utils/filterMap.js +1 -1
- package/lib/Utils/findAncestor.js +17 -0
- package/lib/Utils/getActivityUniqueId.js +4 -2
- package/lib/Utils/intersectionOf.d.ts +5 -0
- package/lib/Utils/intersectionOf.d.ts.map +1 -0
- package/lib/Utils/intersectionOf.js +17 -2
- package/lib/Utils/isZeroOrPositive.d.ts +5 -0
- package/lib/Utils/isZeroOrPositive.d.ts.map +1 -0
- package/lib/Utils/isZeroOrPositive.js +4 -1
- package/lib/Utils/mapMap.js +10 -3
- package/lib/Utils/readDataURIToBlob.js +3 -3
- package/lib/Utils/scrollIntoViewWithBlockNearest.d.ts +7 -0
- package/lib/Utils/scrollIntoViewWithBlockNearest.d.ts.map +1 -0
- package/lib/Utils/scrollIntoViewWithBlockNearest.js +48 -0
- package/lib/Utils/shallowEquals.js +7 -3
- package/lib/Utils/singleToArray.js +1 -1
- package/lib/Utils/supportPseudoClass.d.ts +2 -0
- package/lib/Utils/supportPseudoClass.d.ts.map +1 -0
- package/lib/Utils/supportPseudoClass.js +23 -0
- package/lib/Utils/tabbableElements.d.ts +2 -0
- package/lib/Utils/tabbableElements.d.ts.map +1 -0
- package/lib/Utils/tabbableElements.js +2 -2
- package/lib/connectToWebChat.js +17 -7
- package/lib/hooks/index.d.ts +21 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +25 -25
- package/lib/hooks/internal/BypassSpeechSynthesisPonyfill.js +100 -41
- package/lib/hooks/internal/UITracker.js +2 -2
- package/lib/hooks/internal/useChanged.js +8 -1
- package/lib/hooks/internal/useDispatchScrollPosition.js +3 -7
- package/lib/hooks/internal/useDispatchTranscriptFocusByActivityKey.d.ts +2 -0
- package/lib/hooks/internal/useDispatchTranscriptFocusByActivityKey.d.ts.map +1 -0
- package/lib/hooks/internal/useDispatchTranscriptFocusByActivityKey.js +15 -0
- package/lib/hooks/internal/useEnterKeyHint.js +1 -1
- package/lib/hooks/internal/useFocusVisible.d.ts +3 -0
- package/lib/hooks/internal/useFocusVisible.d.ts.map +1 -0
- package/lib/hooks/internal/useFocusVisible.js +48 -0
- 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/useMemoWithPrevious.d.ts +3 -0
- package/lib/hooks/internal/useMemoWithPrevious.d.ts.map +1 -0
- package/lib/hooks/internal/useMemoWithPrevious.js +22 -0
- package/lib/hooks/internal/useMemoize.d.ts +14 -0
- package/lib/hooks/internal/useMemoize.d.ts.map +1 -0
- package/lib/hooks/internal/useMemoize.js +12 -3
- package/lib/hooks/internal/useNavigatorPlatform.js +1 -1
- package/lib/hooks/internal/useNonce.js +1 -1
- package/lib/hooks/internal/useObserveFocusVisible.d.ts +3 -0
- package/lib/hooks/internal/useObserveFocusVisible.d.ts.map +1 -0
- package/lib/hooks/internal/useObserveFocusVisible.js +208 -0
- package/lib/hooks/internal/usePrevious.d.ts +2 -0
- package/lib/hooks/internal/usePrevious.d.ts.map +1 -0
- package/lib/hooks/internal/usePrevious.js +18 -0
- 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/useStateRef.d.ts +3 -0
- package/lib/hooks/internal/useStateRef.d.ts.map +1 -0
- package/lib/hooks/internal/useStateRef.js +40 -0
- 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/internal/useValueRef.d.ts +3 -0
- package/lib/hooks/internal/useValueRef.d.ts.map +1 -0
- package/lib/hooks/internal/useValueRef.js +25 -0
- 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 +219 -22
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +22 -20
- package/lib/providers/ActivityTree/ActivityTreeComposer.d.ts +5 -0
- package/lib/providers/ActivityTree/ActivityTreeComposer.d.ts.map +1 -0
- package/lib/providers/ActivityTree/ActivityTreeComposer.js +86 -0
- package/lib/providers/ActivityTree/private/Context.d.ts +9 -0
- package/lib/providers/ActivityTree/private/Context.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/Context.js +13 -0
- package/lib/providers/ActivityTree/private/types.d.ts +10 -0
- package/lib/providers/ActivityTree/private/types.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/types.js +2 -0
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.d.ts +4 -0
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.js +58 -0
- package/lib/providers/ActivityTree/private/useActivityTreeWithRenderer.d.ts +5 -0
- package/lib/providers/ActivityTree/private/useActivityTreeWithRenderer.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/useActivityTreeWithRenderer.js +166 -0
- package/lib/providers/ActivityTree/private/useContext.d.ts +3 -0
- package/lib/providers/ActivityTree/private/useContext.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/useContext.js +24 -0
- package/lib/providers/ActivityTree/useActivityTreeWithRenderer.d.ts +8 -0
- package/lib/providers/ActivityTree/useActivityTreeWithRenderer.d.ts.map +1 -0
- package/lib/providers/ActivityTree/useActivityTreeWithRenderer.js +17 -0
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.d.ts +35 -0
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.js +156 -0
- package/lib/providers/LiveRegionTwin/private/Context.d.ts +10 -0
- package/lib/providers/LiveRegionTwin/private/Context.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/Context.js +13 -0
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.d.ts +11 -0
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.js +86 -0
- package/lib/providers/LiveRegionTwin/private/types.d.ts +8 -0
- package/lib/providers/LiveRegionTwin/private/types.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/types.js +2 -0
- package/lib/providers/LiveRegionTwin/private/useContext.d.ts +3 -0
- package/lib/providers/LiveRegionTwin/private/useContext.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/useContext.js +24 -0
- package/lib/providers/LiveRegionTwin/private/useMarkAllAsRenderedEffect.d.ts +2 -0
- package/lib/providers/LiveRegionTwin/private/useMarkAllAsRenderedEffect.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/useMarkAllAsRenderedEffect.js +24 -0
- package/lib/providers/LiveRegionTwin/private/useStaticElementEntries.d.ts +3 -0
- package/lib/providers/LiveRegionTwin/private/useStaticElementEntries.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/useStaticElementEntries.js +15 -0
- package/lib/providers/LiveRegionTwin/useQueueStaticElement.d.ts +8 -0
- package/lib/providers/LiveRegionTwin/useQueueStaticElement.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/useQueueStaticElement.js +20 -0
- package/lib/providers/TranscriptFocus/TranscriptFocusComposer.d.ts +7 -0
- package/lib/providers/TranscriptFocus/TranscriptFocusComposer.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/TranscriptFocusComposer.js +184 -0
- package/lib/providers/TranscriptFocus/private/Context.d.ts +12 -0
- package/lib/providers/TranscriptFocus/private/Context.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/private/Context.js +13 -0
- package/lib/providers/TranscriptFocus/private/useContext.d.ts +2 -0
- package/lib/providers/TranscriptFocus/private/useContext.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/private/useContext.js +24 -0
- package/lib/providers/TranscriptFocus/useActiveDescendantId.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useActiveDescendantId.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useActiveDescendantId.js +15 -0
- package/lib/providers/TranscriptFocus/useFocusByActivityKey.d.ts +8 -0
- package/lib/providers/TranscriptFocus/useFocusByActivityKey.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useFocusByActivityKey.js +21 -0
- package/lib/providers/TranscriptFocus/useFocusRelativeActivity.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useFocusRelativeActivity.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useFocusRelativeActivity.js +15 -0
- package/lib/providers/TranscriptFocus/useFocusedActivityKey.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useFocusedActivityKey.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useFocusedActivityKey.js +15 -0
- package/lib/providers/TranscriptFocus/useFocusedExplicitly.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useFocusedExplicitly.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useFocusedExplicitly.js +15 -0
- package/lib/providers/TranscriptFocus/useGetDescendantIdByActivityKey.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useGetDescendantIdByActivityKey.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useGetDescendantIdByActivityKey.js +15 -0
- 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 +33 -40
- 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 +91 -0
- package/src/Activity/{Speak.js → Speak.tsx} +12 -5
- package/src/Activity/{StackedLayout.js → StackedLayout.tsx} +46 -20
- package/src/Attachment/Assets/DownloadIcon.js +8 -1
- package/src/Attachment/{AudioContent.js → AudioContent.tsx} +12 -3
- package/src/Attachment/FileAttachment.js +1 -1
- package/src/Attachment/{FileContent.js → FileContent.tsx} +22 -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 +9 -5
- package/src/BasicTranscript.tsx +878 -0
- package/src/{BasicTypingIndicator.js → BasicTypingIndicator.tsx} +4 -3
- package/src/{BasicWebChat.js → BasicWebChat.tsx} +13 -4
- package/src/{Composer.js → Composer.tsx} +82 -71
- package/src/Dictation.js +13 -4
- package/src/{ErrorBox.js → ErrorBox.tsx} +7 -2
- package/src/Middleware/Activity/createCoreMiddleware.tsx +78 -0
- 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 +10 -6
- package/src/Middleware/ActivityStatus/createTimestampMiddleware.js +10 -8
- package/src/Middleware/Attachment/createCoreMiddleware.tsx +44 -0
- package/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.tsx +40 -0
- package/src/Middleware/Avatar/{createCoreMiddleware.js → createCoreMiddleware.tsx} +19 -11
- package/src/Middleware/CardAction/createCoreMiddleware.js +51 -42
- package/src/Middleware/GroupActivities/createCoreMiddleware.js +6 -4
- package/src/Middleware/ScrollToEndButton/ScrollToEndButton.js +45 -0
- package/src/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.ts +19 -0
- package/src/Middleware/Toast/createCoreMiddleware.tsx +24 -0
- package/src/Middleware/TypingIndicator/{createCoreMiddleware.js → createCoreMiddleware.tsx} +10 -5
- package/src/{ReactWebChat.js → ReactWebChat.tsx} +25 -7
- package/src/ScreenReaderActivity.js +65 -40
- package/src/{ScreenReaderText.js → ScreenReaderText.tsx} +27 -9
- 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/{IconButton.js → IconButton.tsx} +19 -3
- package/src/SendBox/{MicrophoneButton.js → MicrophoneButton.tsx} +35 -25
- package/src/SendBox/{SendButton.js → SendButton.tsx} +8 -3
- package/src/SendBox/{SuggestedAction.js → SuggestedAction.tsx} +62 -39
- package/src/SendBox/{SuggestedActions.js → SuggestedActions.tsx} +70 -22
- package/src/SendBox/{TextBox.js → TextBox.tsx} +21 -7
- package/src/SendBox/{UploadButton.js → UploadButton.tsx} +7 -3
- package/src/Styles/StyleSet/BasicTranscript.ts +34 -20
- package/src/Styles/StyleSet/Bubble.ts +0 -1
- package/src/Styles/StyleSet/CarouselFilmStrip.ts +12 -30
- package/src/Styles/StyleSet/CarouselFilmStripAttachment.ts +57 -0
- package/src/Styles/StyleSet/KeyboardHelp.ts +157 -0
- package/src/Styles/StyleSet/ScrollToEndButton.ts +33 -31
- package/src/Styles/StyleSet/SendBoxButton.ts +84 -13
- package/src/Styles/StyleSet/SendBoxTextBox.ts +1 -2
- package/src/Styles/StyleSet/StackedLayout.ts +13 -11
- package/src/Styles/StyleSet/SuggestedAction.ts +130 -43
- package/src/Styles/StyleSet/SuggestedActions.ts +13 -5
- package/src/Styles/createStyleSet.ts +43 -40
- package/src/Styles/mirrorStyle.js +10 -2
- package/src/Toast/CollapseIcon.js +9 -1
- package/src/Toast/DismissIcon.js +9 -1
- package/src/Toast/ExpandIcon.js +9 -1
- package/src/Toast/NotificationIcon.js +4 -1
- package/src/Toast/createToastMiddleware.tsx +15 -0
- package/src/Transcript/ActivityRow.tsx +124 -0
- package/src/Transcript/ActivityTextAlt.tsx +32 -0
- package/src/Transcript/FocusTrap.tsx +64 -0
- package/src/Transcript/KeyboardHelp.tsx +282 -0
- package/src/Transcript/LiveRegionTranscript.tsx +181 -0
- package/src/Transcript/types.ts +1 -0
- package/src/Transcript/useActivityAccessibleName.ts +85 -0
- package/src/Utils/{AccessibleButton.js → AccessibleButton.tsx} +19 -4
- package/src/Utils/{AccessibleInputText.js → AccessibleInputText.tsx} +48 -5
- package/src/Utils/{AccessibleTextArea.js → AccessibleTextArea.tsx} +67 -6
- package/src/Utils/{FocusRedirector.js → FocusRedirector.tsx} +21 -8
- package/src/Utils/InlineMarkdown.js +18 -2
- package/src/Utils/TypeFocusSink/FocusBox.js +4 -4
- package/src/Utils/TypeFocusSink/getTabIndex.ts +1 -1
- package/src/Utils/TypeFocusSink/inputtableKey.ts +5 -1
- package/src/Utils/activityAltText.ts +135 -0
- package/src/Utils/createCustomEvent.js +7 -1
- package/src/Utils/detectBrowser.js +2 -1
- package/src/Utils/findAncestor.ts +12 -0
- package/src/Utils/getActivityUniqueId.ts +5 -0
- package/src/Utils/intersectionOf.spec.js +2 -0
- package/src/Utils/intersectionOf.ts +14 -0
- package/src/Utils/isZeroOrPositive.ts +7 -0
- package/src/Utils/mapMap.js +7 -1
- package/src/Utils/mapMap.spec.js +2 -0
- package/src/Utils/removeInline.spec.js +2 -0
- package/src/Utils/scrollIntoViewWithBlockNearest.ts +20 -0
- package/src/Utils/shallowEquals.js +8 -1
- package/src/Utils/{singleToArray.js → singleToArray.ts} +1 -1
- package/src/Utils/supportPseudoClass.ts +17 -0
- package/src/Utils/{tabbableElements.js → tabbableElements.ts} +6 -5
- package/src/Utils/walkMarkdownTokens.spec.js +3 -3
- package/src/connectToWebChat.js +11 -4
- package/src/hooks/{index.js → index.ts} +1 -0
- package/src/hooks/internal/BypassSpeechSynthesisPonyfill.js +70 -17
- package/src/hooks/internal/useChanged.ts +17 -0
- package/src/hooks/internal/useDispatchScrollPosition.js +1 -3
- package/src/hooks/internal/useDispatchTranscriptFocusByActivityKey.ts +5 -0
- package/src/hooks/internal/useFocusVisible.ts +22 -0
- package/src/hooks/internal/useMemoWithPrevious.ts +16 -0
- package/src/hooks/internal/useMemoize.spec.js +3 -1
- package/src/hooks/internal/useMemoize.ts +53 -0
- package/src/hooks/internal/useObserveFocusVisible.ts +252 -0
- package/src/hooks/internal/usePrevious.ts +12 -0
- package/src/hooks/internal/useResumeAudioContext.ts +7 -0
- package/src/hooks/internal/useScrollRelative.js +4 -3
- package/src/hooks/internal/useStateRef.ts +31 -0
- package/src/hooks/internal/{useUniqueId.js → useUniqueId.ts} +1 -1
- package/src/hooks/internal/useValueRef.ts +22 -0
- 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.ts +23 -0
- package/src/hooks/{useScrollDown.js → useScrollDown.ts} +1 -1
- package/src/hooks/useScrollTo.ts +16 -0
- package/src/hooks/useScrollToEnd.ts +12 -0
- 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 -12
- package/src/providers/ActivityTree/ActivityTreeComposer.tsx +74 -0
- package/src/providers/ActivityTree/private/Context.ts +12 -0
- package/src/providers/ActivityTree/private/types.ts +12 -0
- package/src/providers/ActivityTree/private/useActivitiesWithRenderer.ts +66 -0
- package/src/providers/ActivityTree/private/useActivityTreeWithRenderer.ts +140 -0
- package/src/providers/ActivityTree/private/useContext.ts +15 -0
- package/src/providers/ActivityTree/useActivityTreeWithRenderer.ts +16 -0
- package/src/providers/LiveRegionTwin/LiveRegionTwinComposer.tsx +154 -0
- package/src/providers/LiveRegionTwin/private/Context.ts +15 -0
- package/src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx +64 -0
- package/src/providers/LiveRegionTwin/private/types.ts +10 -0
- package/src/providers/LiveRegionTwin/private/useContext.ts +15 -0
- package/src/providers/LiveRegionTwin/private/useMarkAllAsRenderedEffect.ts +13 -0
- package/src/providers/LiveRegionTwin/private/useStaticElementEntries.ts +7 -0
- package/src/providers/LiveRegionTwin/useQueueStaticElement.ts +12 -0
- package/src/providers/TranscriptFocus/TranscriptFocusComposer.tsx +180 -0
- package/src/providers/TranscriptFocus/private/Context.ts +16 -0
- package/src/providers/TranscriptFocus/private/useContext.ts +13 -0
- package/src/providers/TranscriptFocus/useActiveDescendantId.ts +5 -0
- package/src/providers/TranscriptFocus/useFocusByActivityKey.ts +14 -0
- package/src/providers/TranscriptFocus/useFocusRelativeActivity.ts +5 -0
- package/src/providers/TranscriptFocus/useFocusedActivityKey.ts +5 -0
- package/src/providers/TranscriptFocus/useFocusedExplicitly.ts +5 -0
- package/src/providers/TranscriptFocus/useGetDescendantIdByActivityKey.ts +5 -0
- package/src/tsconfig.json +1 -1
- package/src/types/ScrollPosition.ts +6 -0
- package/.eslintignore +0 -9
- package/lib/Activity/ScrollToEndButton.js +0 -81
- package/lib/Attachment/Assets/ErrorIcon.js +0 -22
- package/lib/Utils/findLastIndex.js +0 -32
- package/lib/Utils/remarkStripMarkdown.js +0 -26
- package/lib/hooks/internal/useAcknowledgedActivity.js +0 -90
- package/lib/hooks/internal/useDispatchTranscriptFocus.js +0 -19
- 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/BasicTranscript.js +0 -1123
- package/src/Middleware/Activity/createCoreMiddleware.js +0 -71
- package/src/Middleware/Attachment/createCoreMiddleware.js +0 -43
- package/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.js +0 -37
- package/src/Middleware/Toast/createCoreMiddleware.js +0 -20
- package/src/Toast/createToastMiddleware.js +0 -11
- package/src/Utils/findLastIndex.js +0 -11
- package/src/Utils/findLastIndex.spec.js +0 -29
- package/src/Utils/getActivityUniqueId.js +0 -3
- package/src/Utils/intersectionOf.js +0 -11
- package/src/Utils/isZeroOrPositive.js +0 -4
- package/src/Utils/remarkStripMarkdown.js +0 -13
- package/src/hooks/internal/useAcknowledgedActivity.js +0 -65
- package/src/hooks/internal/useChanged.js +0 -10
- package/src/hooks/internal/useDispatchTranscriptFocus.js +0 -7
- package/src/hooks/internal/useMemoize.js +0 -37
- package/src/hooks/internal/useStripMarkdown.js +0 -7
- package/src/hooks/useRenderMarkdownAsHTML.js +0 -20
- package/src/hooks/useScrollTo.js +0 -11
- package/src/hooks/useScrollToEnd.js +0 -11
- package/src/hooks/useWebSpeechPonyfill.js +0 -5
- package/src/index.tsx +0 -35
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { hooks } from 'botframework-webchat-api';
|
|
2
|
+
import React, { Fragment, VFC } from 'react';
|
|
2
3
|
|
|
3
4
|
const { useActiveTyping, useRenderTypingIndicator } = hooks;
|
|
4
5
|
|
|
5
|
-
function useTypingIndicatorVisible() {
|
|
6
|
+
function useTypingIndicatorVisible(): [boolean] {
|
|
6
7
|
const [activeTyping] = useActiveTyping();
|
|
7
8
|
|
|
8
9
|
return [!!Object.values(activeTyping).filter(({ role }) => role !== 'user').length];
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
const BasicTypingIndicator = () => {
|
|
12
|
+
const BasicTypingIndicator: VFC<{}> = () => {
|
|
12
13
|
const [activeTyping] = useActiveTyping();
|
|
13
14
|
const [visible] = useTypingIndicatorVisible();
|
|
14
15
|
const [typing] = useActiveTyping(Infinity);
|
|
15
16
|
const renderTypingIndicator = useRenderTypingIndicator();
|
|
16
17
|
|
|
17
|
-
return renderTypingIndicator({ activeTyping, typing, visible })
|
|
18
|
+
return <Fragment>{renderTypingIndicator({ activeTyping, typing, visible })}</Fragment>;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export default BasicTypingIndicator;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { hooks } from 'botframework-webchat-api';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { FC } from 'react';
|
|
8
8
|
|
|
9
9
|
import AccessKeySinkSurface from './Utils/AccessKeySink/Surface';
|
|
10
10
|
import BasicConnectivityStatus from './BasicConnectivityStatus';
|
|
@@ -40,7 +40,12 @@ const TRANSCRIPT_STYLE = {
|
|
|
40
40
|
// Subset of landmark roles: https://w3.org/TR/wai-aria/#landmark_roles
|
|
41
41
|
const ARIA_LANDMARK_ROLES = ['complementary', 'contentinfo', 'form', 'main', 'region'];
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
type BasicWebChatProps = {
|
|
44
|
+
className?: string;
|
|
45
|
+
role?: 'complementary' | 'contentinfo' | 'form' | 'main' | 'region';
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const BasicWebChat: FC<BasicWebChatProps> = ({ className, role }) => {
|
|
44
49
|
const [{ root: rootStyleSet }] = useStyleSet();
|
|
45
50
|
const [options] = useStyleOptions();
|
|
46
51
|
const styleToEmotionObject = useStyleToEmotionObject();
|
|
@@ -66,8 +71,6 @@ const BasicWebChat = ({ className, role }) => {
|
|
|
66
71
|
);
|
|
67
72
|
};
|
|
68
73
|
|
|
69
|
-
export default BasicWebChat;
|
|
70
|
-
|
|
71
74
|
BasicWebChat.defaultProps = {
|
|
72
75
|
className: '',
|
|
73
76
|
role: 'complementary'
|
|
@@ -75,5 +78,11 @@ BasicWebChat.defaultProps = {
|
|
|
75
78
|
|
|
76
79
|
BasicWebChat.propTypes = {
|
|
77
80
|
className: PropTypes.string,
|
|
81
|
+
// Ignoring deficiencies with TypeScript/PropTypes inference.
|
|
82
|
+
// @ts-ignore
|
|
78
83
|
role: PropTypes.oneOf(ARIA_LANDMARK_ROLES)
|
|
79
84
|
};
|
|
85
|
+
|
|
86
|
+
export default BasicWebChat;
|
|
87
|
+
|
|
88
|
+
export type { BasicWebChatProps };
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Composer as APIComposer,
|
|
3
|
+
ComposerProps as APIComposerProps,
|
|
4
|
+
hooks,
|
|
5
|
+
WebSpeechPonyfillFactory
|
|
6
|
+
} from 'botframework-webchat-api';
|
|
2
7
|
import { Composer as SayComposer } from 'react-say';
|
|
3
|
-
import
|
|
8
|
+
import { singleToArray } from 'botframework-webchat-core';
|
|
9
|
+
import createEmotion from '@emotion/css/create-instance';
|
|
4
10
|
import createStyleSet from './Styles/createStyleSet';
|
|
5
11
|
import MarkdownIt from 'markdown-it';
|
|
6
12
|
import PropTypes from 'prop-types';
|
|
7
|
-
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
13
|
+
import React, { FC, ReactNode, useCallback, useMemo, useRef, useState } from 'react';
|
|
8
14
|
|
|
9
15
|
import {
|
|
10
16
|
speechSynthesis as bypassSpeechSynthesis,
|
|
11
17
|
SpeechSynthesisUtterance as BypassSpeechSynthesisUtterance
|
|
12
18
|
} from './hooks/internal/BypassSpeechSynthesisPonyfill';
|
|
19
|
+
import ActivityTreeComposer from './providers/ActivityTree/ActivityTreeComposer';
|
|
13
20
|
import addTargetBlankToHyperlinksMarkdown from './Utils/addTargetBlankToHyperlinksMarkdown';
|
|
14
21
|
import createCSSKey from './Utils/createCSSKey';
|
|
15
22
|
import createDefaultActivityMiddleware from './Middleware/Activity/createCoreMiddleware';
|
|
@@ -18,19 +25,18 @@ import createDefaultAttachmentForScreenReaderMiddleware from './Middleware/Attac
|
|
|
18
25
|
import createDefaultAttachmentMiddleware from './Middleware/Attachment/createCoreMiddleware';
|
|
19
26
|
import createDefaultAvatarMiddleware from './Middleware/Avatar/createCoreMiddleware';
|
|
20
27
|
import createDefaultCardActionMiddleware from './Middleware/CardAction/createCoreMiddleware';
|
|
28
|
+
import createDefaultScrollToEndButtonMiddleware from './Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware';
|
|
21
29
|
import createDefaultToastMiddleware from './Middleware/Toast/createCoreMiddleware';
|
|
22
30
|
import createDefaultTypingIndicatorMiddleware from './Middleware/TypingIndicator/createCoreMiddleware';
|
|
23
31
|
import Dictation from './Dictation';
|
|
24
32
|
import downscaleImageToDataURL from './Utils/downscaleImageToDataURL';
|
|
25
33
|
import ErrorBox from './ErrorBox';
|
|
26
34
|
import mapMap from './Utils/mapMap';
|
|
27
|
-
import singleToArray from './Utils/singleToArray';
|
|
28
35
|
import UITracker from './hooks/internal/UITracker';
|
|
29
36
|
import WebChatUIContext from './hooks/internal/WebChatUIContext';
|
|
30
37
|
|
|
31
|
-
const { useReferenceGrammarID, useStyleOptions } = hooks;
|
|
38
|
+
const { useGetActivityByKey, useReferenceGrammarID, useStyleOptions } = hooks;
|
|
32
39
|
|
|
33
|
-
// eslint-disable-next-line no-undef
|
|
34
40
|
const node_env = process.env.node_env || process.env.NODE_ENV;
|
|
35
41
|
|
|
36
42
|
const emotionPool = {};
|
|
@@ -39,7 +45,17 @@ function styleSetToEmotionObjects(styleToEmotionObject, styleSet) {
|
|
|
39
45
|
return mapMap(styleSet, (style, key) => (key === 'options' ? style : styleToEmotionObject(style)));
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
type ComposerCoreProps = {
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
extraStyleSet?: any;
|
|
51
|
+
nonce?: string;
|
|
52
|
+
renderMarkdown?: (markdown: string, { markdownRespectCRLF: boolean }, { externalLinkAlt: string }) => string;
|
|
53
|
+
styleSet?: any;
|
|
54
|
+
suggestedActionsAccessKey?: boolean | string;
|
|
55
|
+
webSpeechPonyfillFactory?: WebSpeechPonyfillFactory;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const ComposerCore: FC<ComposerCoreProps> = ({
|
|
43
59
|
children,
|
|
44
60
|
extraStyleSet,
|
|
45
61
|
nonce,
|
|
@@ -82,7 +98,9 @@ const ComposerCore = ({
|
|
|
82
98
|
// 1. If 2 instances use different nonce, they should result in different hash;
|
|
83
99
|
// 2. If 2 instances are being mounted, pooling will make sure we render only 1 set of <style> tags, instead of 2.
|
|
84
100
|
const emotion =
|
|
85
|
-
|
|
101
|
+
// Prefix "id-" to prevent object injection attack.
|
|
102
|
+
emotionPool[`id-${nonce}`] ||
|
|
103
|
+
(emotionPool[`id-${nonce}`] = createEmotion({ key: `webchat--css-${createCSSKey()}`, nonce }));
|
|
86
104
|
|
|
87
105
|
return style => emotion.css(style);
|
|
88
106
|
}, [nonce]);
|
|
@@ -108,7 +126,6 @@ const ComposerCore = ({
|
|
|
108
126
|
}, [referenceGrammarID, webSpeechPonyfillFactory]);
|
|
109
127
|
|
|
110
128
|
const scrollPositionObserversRef = useRef([]);
|
|
111
|
-
const [numScrollPositionObservers, setNumScrollPositionObservers] = useState(0);
|
|
112
129
|
|
|
113
130
|
const dispatchScrollPosition = useCallback(
|
|
114
131
|
event => scrollPositionObserversRef.current.forEach(observer => observer(event)),
|
|
@@ -118,23 +135,32 @@ const ComposerCore = ({
|
|
|
118
135
|
const observeScrollPosition = useCallback(
|
|
119
136
|
observer => {
|
|
120
137
|
scrollPositionObserversRef.current = [...scrollPositionObserversRef.current, observer];
|
|
121
|
-
setNumScrollPositionObservers(scrollPositionObserversRef.current.length);
|
|
122
138
|
|
|
123
139
|
return () => {
|
|
124
140
|
scrollPositionObserversRef.current = scrollPositionObserversRef.current.filter(target => target !== observer);
|
|
125
|
-
setNumScrollPositionObservers(scrollPositionObserversRef.current.length);
|
|
126
141
|
};
|
|
127
142
|
},
|
|
128
|
-
[scrollPositionObserversRef
|
|
143
|
+
[scrollPositionObserversRef]
|
|
129
144
|
);
|
|
130
145
|
|
|
131
146
|
const transcriptFocusObserversRef = useRef([]);
|
|
132
147
|
const [numTranscriptFocusObservers, setNumTranscriptFocusObservers] = useState(0);
|
|
133
148
|
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
149
|
+
const getActivityByKey = useGetActivityByKey();
|
|
150
|
+
|
|
151
|
+
const dispatchTranscriptFocusByActivityKey = useMemo(() => {
|
|
152
|
+
let prevActivityKey: string | Symbol | undefined = Symbol();
|
|
153
|
+
|
|
154
|
+
return activityKey => {
|
|
155
|
+
if (activityKey !== prevActivityKey) {
|
|
156
|
+
prevActivityKey = activityKey;
|
|
157
|
+
|
|
158
|
+
const event = { activity: getActivityByKey(activityKey) };
|
|
159
|
+
|
|
160
|
+
transcriptFocusObserversRef.current.forEach(observer => observer(event));
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}, [getActivityByKey, transcriptFocusObserversRef]);
|
|
138
164
|
|
|
139
165
|
const observeTranscriptFocus = useCallback(
|
|
140
166
|
observer => {
|
|
@@ -153,13 +179,12 @@ const ComposerCore = ({
|
|
|
153
179
|
() => ({
|
|
154
180
|
dictateAbortable,
|
|
155
181
|
dispatchScrollPosition,
|
|
156
|
-
|
|
182
|
+
dispatchTranscriptFocusByActivityKey,
|
|
157
183
|
focusSendBoxCallbacksRef,
|
|
158
184
|
focusTranscriptCallbacksRef,
|
|
159
185
|
internalMarkdownItState: [internalMarkdownIt],
|
|
160
186
|
internalRenderMarkdownInline,
|
|
161
187
|
nonce,
|
|
162
|
-
numScrollPositionObservers,
|
|
163
188
|
numTranscriptFocusObservers,
|
|
164
189
|
observeScrollPosition,
|
|
165
190
|
observeTranscriptFocus,
|
|
@@ -176,13 +201,12 @@ const ComposerCore = ({
|
|
|
176
201
|
[
|
|
177
202
|
dictateAbortable,
|
|
178
203
|
dispatchScrollPosition,
|
|
179
|
-
|
|
204
|
+
dispatchTranscriptFocusByActivityKey,
|
|
180
205
|
focusSendBoxCallbacksRef,
|
|
181
206
|
focusTranscriptCallbacksRef,
|
|
182
207
|
internalMarkdownIt,
|
|
183
208
|
internalRenderMarkdownInline,
|
|
184
209
|
nonce,
|
|
185
|
-
numScrollPositionObservers,
|
|
186
210
|
numTranscriptFocusObservers,
|
|
187
211
|
observeScrollPosition,
|
|
188
212
|
observeTranscriptFocus,
|
|
@@ -209,6 +233,7 @@ const ComposerCore = ({
|
|
|
209
233
|
};
|
|
210
234
|
|
|
211
235
|
ComposerCore.defaultProps = {
|
|
236
|
+
children: undefined,
|
|
212
237
|
extraStyleSet: undefined,
|
|
213
238
|
nonce: undefined,
|
|
214
239
|
renderMarkdown: undefined,
|
|
@@ -226,7 +251,13 @@ ComposerCore.propTypes = {
|
|
|
226
251
|
webSpeechPonyfillFactory: PropTypes.func
|
|
227
252
|
};
|
|
228
253
|
|
|
229
|
-
|
|
254
|
+
type ComposerProps = APIComposerProps &
|
|
255
|
+
ComposerCoreProps & {
|
|
256
|
+
nonce?: string;
|
|
257
|
+
webSpeechPonyfillFactory?: WebSpeechPonyfillFactory;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const Composer: FC<ComposerProps> = ({
|
|
230
261
|
activityMiddleware,
|
|
231
262
|
activityStatusMiddleware,
|
|
232
263
|
attachmentForScreenReaderMiddleware,
|
|
@@ -236,6 +267,7 @@ const Composer = ({
|
|
|
236
267
|
children,
|
|
237
268
|
extraStyleSet,
|
|
238
269
|
renderMarkdown,
|
|
270
|
+
scrollToEndButtonMiddleware,
|
|
239
271
|
styleSet,
|
|
240
272
|
suggestedActionsAccessKey,
|
|
241
273
|
toastMiddleware,
|
|
@@ -278,15 +310,23 @@ const Composer = ({
|
|
|
278
310
|
[cardActionMiddleware]
|
|
279
311
|
);
|
|
280
312
|
|
|
281
|
-
const patchedToastMiddleware = useMemo(
|
|
282
|
-
toastMiddleware
|
|
283
|
-
|
|
313
|
+
const patchedToastMiddleware = useMemo(
|
|
314
|
+
() => [...singleToArray(toastMiddleware), ...createDefaultToastMiddleware()],
|
|
315
|
+
[toastMiddleware]
|
|
316
|
+
);
|
|
284
317
|
|
|
285
318
|
const patchedTypingIndicatorMiddleware = useMemo(
|
|
286
319
|
() => [...singleToArray(typingIndicatorMiddleware), ...createDefaultTypingIndicatorMiddleware()],
|
|
287
320
|
[typingIndicatorMiddleware]
|
|
288
321
|
);
|
|
289
322
|
|
|
323
|
+
const defaultScrollToEndButtonMiddleware = useMemo(() => createDefaultScrollToEndButtonMiddleware(), []);
|
|
324
|
+
|
|
325
|
+
const patchedScrollToEndButtonMiddleware = useMemo(
|
|
326
|
+
() => [...singleToArray(scrollToEndButtonMiddleware), ...defaultScrollToEndButtonMiddleware],
|
|
327
|
+
[defaultScrollToEndButtonMiddleware, scrollToEndButtonMiddleware]
|
|
328
|
+
);
|
|
329
|
+
|
|
290
330
|
return (
|
|
291
331
|
<React.Fragment>
|
|
292
332
|
<APIComposer
|
|
@@ -300,21 +340,24 @@ const Composer = ({
|
|
|
300
340
|
// Under dev server of create-react-app, "NODE_ENV" will be set to "development".
|
|
301
341
|
internalErrorBoxClass={node_env === 'development' ? ErrorBox : undefined}
|
|
302
342
|
nonce={nonce}
|
|
343
|
+
scrollToEndButtonMiddleware={patchedScrollToEndButtonMiddleware}
|
|
303
344
|
toastMiddleware={patchedToastMiddleware}
|
|
304
345
|
typingIndicatorMiddleware={patchedTypingIndicatorMiddleware}
|
|
305
346
|
{...composerProps}
|
|
306
347
|
>
|
|
307
|
-
<
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
348
|
+
<ActivityTreeComposer>
|
|
349
|
+
<ComposerCore
|
|
350
|
+
extraStyleSet={extraStyleSet}
|
|
351
|
+
nonce={nonce}
|
|
352
|
+
renderMarkdown={renderMarkdown}
|
|
353
|
+
styleSet={styleSet}
|
|
354
|
+
suggestedActionsAccessKey={suggestedActionsAccessKey}
|
|
355
|
+
webSpeechPonyfillFactory={webSpeechPonyfillFactory}
|
|
356
|
+
>
|
|
357
|
+
{children}
|
|
358
|
+
{onTelemetry && <UITracker />}
|
|
359
|
+
</ComposerCore>
|
|
360
|
+
</ActivityTreeComposer>
|
|
318
361
|
</APIComposer>
|
|
319
362
|
</React.Fragment>
|
|
320
363
|
);
|
|
@@ -323,47 +366,15 @@ const Composer = ({
|
|
|
323
366
|
Composer.defaultProps = {
|
|
324
367
|
...APIComposer.defaultProps,
|
|
325
368
|
...ComposerCore.defaultProps,
|
|
326
|
-
|
|
327
|
-
activityRenderer: undefined,
|
|
328
|
-
activityStatusMiddleware: undefined,
|
|
329
|
-
activityStatusRenderer: undefined,
|
|
330
|
-
attachmentForScreenReaderMiddleware: undefined,
|
|
331
|
-
attachmentMiddleware: undefined,
|
|
332
|
-
attachmentRenderer: undefined,
|
|
333
|
-
avatarMiddleware: undefined,
|
|
334
|
-
avatarRenderer: undefined,
|
|
335
|
-
cardActionMiddleware: undefined,
|
|
336
|
-
children: undefined,
|
|
337
|
-
nonce: undefined,
|
|
338
|
-
renderMarkdown: undefined,
|
|
339
|
-
toastMiddleware: undefined,
|
|
340
|
-
toastRenderer: undefined,
|
|
341
|
-
typingIndicatorMiddleware: undefined,
|
|
342
|
-
typingIndicatorRenderer: undefined,
|
|
343
|
-
webSpeechPonyfillFactory: undefined
|
|
369
|
+
children: undefined
|
|
344
370
|
};
|
|
345
371
|
|
|
346
372
|
Composer.propTypes = {
|
|
347
373
|
...APIComposer.propTypes,
|
|
348
374
|
...ComposerCore.propTypes,
|
|
349
|
-
|
|
350
|
-
activityRenderer: PropTypes.func,
|
|
351
|
-
activityStatusMiddleware: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.func), PropTypes.func]),
|
|
352
|
-
activityStatusRenderer: PropTypes.func,
|
|
353
|
-
attachmentForScreenReaderMiddleware: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.func), PropTypes.func]),
|
|
354
|
-
attachmentMiddleware: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.func), PropTypes.func]),
|
|
355
|
-
attachmentRenderer: PropTypes.func,
|
|
356
|
-
avatarMiddleware: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.func), PropTypes.func]),
|
|
357
|
-
avatarRenderer: PropTypes.func,
|
|
358
|
-
cardActionMiddleware: PropTypes.func,
|
|
359
|
-
children: PropTypes.any,
|
|
360
|
-
nonce: PropTypes.string,
|
|
361
|
-
renderMarkdown: PropTypes.func,
|
|
362
|
-
toastMiddleware: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.func), PropTypes.func]),
|
|
363
|
-
toastRenderer: PropTypes.func,
|
|
364
|
-
typingIndicatorMiddleware: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.func), PropTypes.func]),
|
|
365
|
-
typingIndicatorRenderer: PropTypes.func,
|
|
366
|
-
webSpeechPonyfillFactory: PropTypes.func
|
|
375
|
+
children: PropTypes.any
|
|
367
376
|
};
|
|
368
377
|
|
|
369
378
|
export default Composer;
|
|
379
|
+
|
|
380
|
+
export type { ComposerProps };
|
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
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* eslint-disable complexity */
|
|
2
|
+
import { ActivityMiddleware } from 'botframework-webchat-api';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import CarouselLayout from '../../Activity/CarouselLayout';
|
|
6
|
+
import StackedLayout from '../../Activity/StackedLayout';
|
|
7
|
+
|
|
8
|
+
export default function createCoreMiddleware(): ActivityMiddleware[] {
|
|
9
|
+
return [
|
|
10
|
+
() =>
|
|
11
|
+
next =>
|
|
12
|
+
(...args) => {
|
|
13
|
+
const [{ activity }] = args;
|
|
14
|
+
|
|
15
|
+
// TODO: [P4] Can we simplify these if-statement to something more readable?
|
|
16
|
+
|
|
17
|
+
const { type } = activity;
|
|
18
|
+
|
|
19
|
+
// Filter out activities that should not be visible
|
|
20
|
+
if (type === 'conversationUpdate' || type === 'event' || type === 'invoke' || type === 'typing') {
|
|
21
|
+
return false;
|
|
22
|
+
} else if (type === 'message') {
|
|
23
|
+
const { attachments = [], channelData, text } = activity;
|
|
24
|
+
|
|
25
|
+
if (
|
|
26
|
+
// Do not show postback
|
|
27
|
+
(channelData && channelData.postBack) ||
|
|
28
|
+
// Do not show messageBack if displayText is undefined
|
|
29
|
+
(channelData && channelData.messageBack && !channelData.messageBack.displayText) ||
|
|
30
|
+
// Do not show empty bubbles (no text and attachments, and not "typing")
|
|
31
|
+
!(text || attachments.length)
|
|
32
|
+
) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line no-dupe-else-if
|
|
36
|
+
} else if (type === 'typing' && activity.from.role === 'user') {
|
|
37
|
+
// Do not show typing by oneself
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (type === 'message' || type === 'typing') {
|
|
42
|
+
if (
|
|
43
|
+
type === 'message' &&
|
|
44
|
+
(activity.attachments || []).length > 1 &&
|
|
45
|
+
activity.attachmentLayout === 'carousel'
|
|
46
|
+
) {
|
|
47
|
+
// The following line is not a React functional component, it's a render function called by useCreateActivityRenderer() hook.
|
|
48
|
+
// The function signature need to be compatible with older version of activity middleware, which was:
|
|
49
|
+
//
|
|
50
|
+
// renderActivity(
|
|
51
|
+
// renderAttachment: ({ activity, attachment }) => React.Element
|
|
52
|
+
// ) => React.Element
|
|
53
|
+
|
|
54
|
+
return function renderCarouselLayout(renderAttachment, props) {
|
|
55
|
+
typeof props === 'undefined' &&
|
|
56
|
+
console.warn(
|
|
57
|
+
'botframework-webchat: One or more arguments were missing after passing through the activity middleware. Please check your custom activity middleware to make sure it passes all arguments.'
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return <CarouselLayout activity={activity} renderAttachment={renderAttachment} {...props} />;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// The following line is not a React functional component, it's a render function called by useCreateActivityRenderer() hook.
|
|
65
|
+
return function renderStackedLayout(renderAttachment, props) {
|
|
66
|
+
typeof props === 'undefined' &&
|
|
67
|
+
console.warn(
|
|
68
|
+
'botframework-webchat: One or more arguments were missing after passing through the activity middleware. Please check your custom activity middleware to make sure it passes all arguments.'
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return <StackedLayout activity={activity} renderAttachment={renderAttachment} {...props} />;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return next(...args);
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
}
|
|
@@ -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,15 @@ const {
|
|
|
8
8
|
} = Constants;
|
|
9
9
|
|
|
10
10
|
export default function createSendStatusMiddleware() {
|
|
11
|
-
return () =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
return () =>
|
|
12
|
+
next =>
|
|
13
|
+
// This is not a React component.
|
|
14
|
+
// eslint-disable-next-line react/prop-types
|
|
15
|
+
({ activity, sendState, ...args }) => {
|
|
16
|
+
if (sendState !== SENT) {
|
|
17
|
+
return <SendStatus activity={activity} sendState={sendState} />;
|
|
18
|
+
}
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
return next({ activity, sendState, ...args });
|
|
21
|
+
};
|
|
18
22
|
}
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AttachmentMiddleware } from 'botframework-webchat-api';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import AudioAttachment from '../../Attachment/AudioAttachment';
|
|
5
|
+
import FileAttachment from '../../Attachment/FileAttachment';
|
|
6
|
+
import ImageAttachment from '../../Attachment/ImageAttachment';
|
|
7
|
+
import TextAttachment from '../../Attachment/TextAttachment';
|
|
8
|
+
import VideoAttachment from '../../Attachment/VideoAttachment';
|
|
9
|
+
|
|
10
|
+
// TODO: [P4] Rename this file or the whole middleware, it looks either too simple or too comprehensive now
|
|
11
|
+
export default function createCoreMiddleware(): AttachmentMiddleware[] {
|
|
12
|
+
return [
|
|
13
|
+
() =>
|
|
14
|
+
next =>
|
|
15
|
+
(...args) => {
|
|
16
|
+
const [
|
|
17
|
+
{
|
|
18
|
+
activity = {},
|
|
19
|
+
activity: { from: { role = undefined } = {} } = {},
|
|
20
|
+
attachment,
|
|
21
|
+
attachment: { contentType = undefined, contentUrl = undefined, thumbnailUrl = undefined } = {}
|
|
22
|
+
}
|
|
23
|
+
] = args;
|
|
24
|
+
|
|
25
|
+
const isText = /^text\//u.test(contentType);
|
|
26
|
+
|
|
27
|
+
return (isText ? !attachment.content : role === 'user' && !thumbnailUrl) ? (
|
|
28
|
+
<FileAttachment activity={activity} attachment={attachment} />
|
|
29
|
+
) : /^audio\//u.test(contentType) ? (
|
|
30
|
+
<AudioAttachment attachment={attachment} />
|
|
31
|
+
) : /^image\//u.test(contentType) ? (
|
|
32
|
+
<ImageAttachment attachment={attachment} />
|
|
33
|
+
) : /^video\//u.test(contentType) ? (
|
|
34
|
+
<VideoAttachment attachment={attachment} />
|
|
35
|
+
) : contentUrl || contentType === 'application/octet-stream' ? (
|
|
36
|
+
<FileAttachment activity={activity} attachment={attachment} />
|
|
37
|
+
) : isText ? (
|
|
38
|
+
<TextAttachment attachment={attachment} />
|
|
39
|
+
) : (
|
|
40
|
+
next(...args)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
}
|