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,10 +1,19 @@
|
|
|
1
1
|
/* eslint no-magic-numbers: ["error", { "ignore": [-1] }] */
|
|
2
2
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import React, { forwardRef, useRef } from 'react';
|
|
4
|
+
import React, { forwardRef, MouseEventHandler, ReactNode, useRef } from 'react';
|
|
5
5
|
|
|
6
6
|
const PREVENT_DEFAULT_HANDLER = event => event.preventDefault();
|
|
7
7
|
|
|
8
|
+
type AccessibleButtonProps = {
|
|
9
|
+
'aria-hidden'?: boolean;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
13
|
+
tabIndex?: number;
|
|
14
|
+
type: 'button';
|
|
15
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
16
|
+
|
|
8
17
|
// Differences between <button> and <AccessibleButton>:
|
|
9
18
|
// - Disable behavior
|
|
10
19
|
// - When the widget is disabled
|
|
@@ -23,8 +32,8 @@ const PREVENT_DEFAULT_HANDLER = event => event.preventDefault();
|
|
|
23
32
|
// - aria-disabled="true" is the source of truth
|
|
24
33
|
// - If the widget is contained by a <form>, the developer need to filter out some `onSubmit` event caused by this widget
|
|
25
34
|
|
|
26
|
-
const AccessibleButton = forwardRef(
|
|
27
|
-
({ 'aria-hidden': ariaHidden, disabled, onClick, tabIndex, ...props }, forwardedRef) => {
|
|
35
|
+
const AccessibleButton = forwardRef<HTMLButtonElement, AccessibleButtonProps>(
|
|
36
|
+
({ 'aria-hidden': ariaHidden, children, disabled, onClick, tabIndex, ...props }, forwardedRef) => {
|
|
28
37
|
const targetRef = useRef();
|
|
29
38
|
|
|
30
39
|
const ref = forwardedRef || targetRef;
|
|
@@ -38,13 +47,16 @@ const AccessibleButton = forwardRef(
|
|
|
38
47
|
tabIndex={disabled ? -1 : tabIndex}
|
|
39
48
|
{...props}
|
|
40
49
|
type="button"
|
|
41
|
-
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</button>
|
|
42
53
|
);
|
|
43
54
|
}
|
|
44
55
|
);
|
|
45
56
|
|
|
46
57
|
AccessibleButton.defaultProps = {
|
|
47
58
|
'aria-hidden': undefined,
|
|
59
|
+
children: undefined,
|
|
48
60
|
disabled: undefined,
|
|
49
61
|
onClick: undefined,
|
|
50
62
|
tabIndex: undefined
|
|
@@ -54,9 +66,12 @@ AccessibleButton.displayName = 'AccessibleButton';
|
|
|
54
66
|
|
|
55
67
|
AccessibleButton.propTypes = {
|
|
56
68
|
'aria-hidden': PropTypes.bool,
|
|
69
|
+
children: PropTypes.any,
|
|
57
70
|
disabled: PropTypes.bool,
|
|
58
71
|
onClick: PropTypes.func,
|
|
59
72
|
tabIndex: PropTypes.number,
|
|
73
|
+
// TypeScript class is not mappable to PropTypes.oneOf(['button'])
|
|
74
|
+
// @ts-ignore
|
|
60
75
|
type: PropTypes.oneOf(['button']).isRequired
|
|
61
76
|
};
|
|
62
77
|
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
/* eslint no-magic-numbers: ["error", { "ignore": [-1] }] */
|
|
2
2
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import React, {
|
|
4
|
+
import React, {
|
|
5
|
+
ChangeEventHandler,
|
|
6
|
+
FocusEventHandler,
|
|
7
|
+
forwardRef,
|
|
8
|
+
KeyboardEventHandler,
|
|
9
|
+
ReactEventHandler,
|
|
10
|
+
useRef
|
|
11
|
+
} from 'react';
|
|
5
12
|
|
|
6
13
|
import useEnterKeyHint from '../hooks/internal/useEnterKeyHint';
|
|
7
14
|
|
|
@@ -23,9 +30,28 @@ import useEnterKeyHint from '../hooks/internal/useEnterKeyHint';
|
|
|
23
30
|
// - aria-disabled="true" is the source of truth
|
|
24
31
|
// - If the widget is contained by a <form>, the developer need to filter out some `onSubmit` event caused by this widget
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
type AccessibleInputTextProps = {
|
|
34
|
+
className?: string;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
enterKeyHint?: string;
|
|
37
|
+
inputMode?: 'text' | 'none' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
|
|
38
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
39
|
+
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
40
|
+
onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
|
|
41
|
+
onKeyDownCapture?: KeyboardEventHandler<HTMLInputElement>;
|
|
42
|
+
onKeyPress?: KeyboardEventHandler<HTMLInputElement>;
|
|
43
|
+
onSelect?: ReactEventHandler<HTMLInputElement>;
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
readOnly?: boolean;
|
|
46
|
+
tabIndex?: number;
|
|
47
|
+
type: 'text';
|
|
48
|
+
value?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const AccessibleInputText = forwardRef<HTMLInputElement, AccessibleInputTextProps>(
|
|
27
52
|
(
|
|
28
53
|
{
|
|
54
|
+
className,
|
|
29
55
|
disabled,
|
|
30
56
|
enterKeyHint,
|
|
31
57
|
onChange,
|
|
@@ -34,7 +60,10 @@ const AccessibleInputText = forwardRef(
|
|
|
34
60
|
onKeyDownCapture,
|
|
35
61
|
onKeyPress,
|
|
36
62
|
onSelect,
|
|
63
|
+
placeholder,
|
|
64
|
+
readOnly,
|
|
37
65
|
tabIndex,
|
|
66
|
+
value,
|
|
38
67
|
...props
|
|
39
68
|
},
|
|
40
69
|
forwardedRef
|
|
@@ -48,15 +77,18 @@ const AccessibleInputText = forwardRef(
|
|
|
48
77
|
return (
|
|
49
78
|
<input
|
|
50
79
|
aria-disabled={disabled || undefined}
|
|
80
|
+
className={className}
|
|
51
81
|
onChange={disabled ? undefined : onChange}
|
|
52
82
|
onFocus={disabled ? undefined : onFocus}
|
|
53
83
|
onKeyDown={disabled ? undefined : onKeyDown}
|
|
54
84
|
onKeyDownCapture={disabled ? undefined : onKeyDownCapture}
|
|
55
85
|
onKeyPress={disabled ? undefined : onKeyPress}
|
|
56
86
|
onSelect={disabled ? undefined : onSelect}
|
|
57
|
-
|
|
87
|
+
placeholder={placeholder}
|
|
88
|
+
readOnly={readOnly || disabled}
|
|
58
89
|
ref={ref}
|
|
59
90
|
tabIndex={disabled ? -1 : tabIndex}
|
|
91
|
+
value={value}
|
|
60
92
|
{...props}
|
|
61
93
|
type="text"
|
|
62
94
|
/>
|
|
@@ -65,30 +97,41 @@ const AccessibleInputText = forwardRef(
|
|
|
65
97
|
);
|
|
66
98
|
|
|
67
99
|
AccessibleInputText.defaultProps = {
|
|
100
|
+
className: undefined,
|
|
68
101
|
disabled: undefined,
|
|
69
102
|
enterKeyHint: undefined,
|
|
103
|
+
inputMode: undefined,
|
|
70
104
|
onChange: undefined,
|
|
71
105
|
onFocus: undefined,
|
|
72
106
|
onKeyDown: undefined,
|
|
73
107
|
onKeyDownCapture: undefined,
|
|
74
108
|
onKeyPress: undefined,
|
|
75
109
|
onSelect: undefined,
|
|
76
|
-
|
|
110
|
+
placeholder: undefined,
|
|
111
|
+
readOnly: undefined,
|
|
112
|
+
tabIndex: undefined,
|
|
113
|
+
value: undefined
|
|
77
114
|
};
|
|
78
115
|
|
|
79
116
|
AccessibleInputText.displayName = 'AccessibleInputText';
|
|
80
117
|
|
|
81
118
|
AccessibleInputText.propTypes = {
|
|
119
|
+
className: PropTypes.string,
|
|
82
120
|
disabled: PropTypes.bool,
|
|
83
121
|
enterKeyHint: PropTypes.string,
|
|
122
|
+
inputMode: PropTypes.oneOf(['text', 'none', 'tel', 'url', 'email', 'numeric', 'decimal', 'search']),
|
|
84
123
|
onChange: PropTypes.func,
|
|
85
124
|
onFocus: PropTypes.func,
|
|
86
125
|
onKeyDown: PropTypes.func,
|
|
87
126
|
onKeyDownCapture: PropTypes.func,
|
|
88
127
|
onKeyPress: PropTypes.func,
|
|
89
128
|
onSelect: PropTypes.func,
|
|
129
|
+
placeholder: PropTypes.string,
|
|
130
|
+
readOnly: PropTypes.bool,
|
|
90
131
|
tabIndex: PropTypes.number,
|
|
91
|
-
type
|
|
132
|
+
// @ts-ignore PropTypes and TypeScript type do not well understood each other.
|
|
133
|
+
type: PropTypes.oneOf(['text']).isRequired,
|
|
134
|
+
value: PropTypes.string
|
|
92
135
|
};
|
|
93
136
|
|
|
94
137
|
export default AccessibleInputText;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
/* eslint no-magic-numbers: ["error", { "ignore": [-1] }] */
|
|
2
2
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import React, {
|
|
4
|
+
import React, {
|
|
5
|
+
ChangeEventHandler,
|
|
6
|
+
FocusEventHandler,
|
|
7
|
+
forwardRef,
|
|
8
|
+
KeyboardEventHandler,
|
|
9
|
+
ReactEventHandler,
|
|
10
|
+
useRef
|
|
11
|
+
} from 'react';
|
|
5
12
|
|
|
6
13
|
// Differences between <textarea> and <AccessibleTextArea>:
|
|
7
14
|
// - Disable behavior
|
|
@@ -21,8 +28,43 @@ import React, { forwardRef, useRef } from 'react';
|
|
|
21
28
|
// - aria-disabled="true" is the source of truth
|
|
22
29
|
// - If the widget is contained by a <form>, the developer need to filter out some `onSubmit` event caused by this widget
|
|
23
30
|
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
type AccessibleTextAreaProps = {
|
|
32
|
+
className?: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
inputMode?: 'text' | 'none' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
|
|
35
|
+
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
36
|
+
onFocus?: FocusEventHandler<HTMLTextAreaElement>;
|
|
37
|
+
onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
38
|
+
onKeyDownCapture?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
39
|
+
onKeyPress?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
40
|
+
onSelect?: ReactEventHandler<HTMLTextAreaElement>;
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
readOnly?: boolean;
|
|
43
|
+
rows?: number;
|
|
44
|
+
tabIndex?: number;
|
|
45
|
+
value?: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const AccessibleTextArea = forwardRef<HTMLTextAreaElement, AccessibleTextAreaProps>(
|
|
49
|
+
(
|
|
50
|
+
{
|
|
51
|
+
className,
|
|
52
|
+
disabled,
|
|
53
|
+
inputMode,
|
|
54
|
+
onChange,
|
|
55
|
+
onFocus,
|
|
56
|
+
onKeyDown,
|
|
57
|
+
onKeyDownCapture,
|
|
58
|
+
onKeyPress,
|
|
59
|
+
onSelect,
|
|
60
|
+
placeholder,
|
|
61
|
+
readOnly,
|
|
62
|
+
rows,
|
|
63
|
+
tabIndex,
|
|
64
|
+
...props
|
|
65
|
+
},
|
|
66
|
+
forwardedRef
|
|
67
|
+
) => {
|
|
26
68
|
const targetRef = useRef();
|
|
27
69
|
|
|
28
70
|
const ref = forwardedRef || targetRef;
|
|
@@ -30,13 +72,18 @@ const AccessibleTextArea = forwardRef(
|
|
|
30
72
|
return (
|
|
31
73
|
<textarea
|
|
32
74
|
aria-disabled={disabled || undefined}
|
|
75
|
+
className={className}
|
|
76
|
+
inputMode={inputMode}
|
|
33
77
|
onChange={disabled ? undefined : onChange}
|
|
34
78
|
onFocus={disabled ? undefined : onFocus}
|
|
35
79
|
onKeyDown={disabled ? undefined : onKeyDown}
|
|
80
|
+
onKeyDownCapture={disabled ? undefined : onKeyDownCapture}
|
|
36
81
|
onKeyPress={disabled ? undefined : onKeyPress}
|
|
37
82
|
onSelect={disabled ? undefined : onSelect}
|
|
38
|
-
|
|
83
|
+
placeholder={placeholder}
|
|
84
|
+
readOnly={readOnly || disabled}
|
|
39
85
|
ref={ref}
|
|
86
|
+
rows={rows}
|
|
40
87
|
tabIndex={disabled ? -1 : tabIndex}
|
|
41
88
|
{...props}
|
|
42
89
|
/>
|
|
@@ -45,25 +92,39 @@ const AccessibleTextArea = forwardRef(
|
|
|
45
92
|
);
|
|
46
93
|
|
|
47
94
|
AccessibleTextArea.defaultProps = {
|
|
95
|
+
className: undefined,
|
|
48
96
|
disabled: undefined,
|
|
97
|
+
inputMode: undefined,
|
|
49
98
|
onChange: undefined,
|
|
50
99
|
onFocus: undefined,
|
|
51
100
|
onKeyDown: undefined,
|
|
101
|
+
onKeyDownCapture: undefined,
|
|
52
102
|
onKeyPress: undefined,
|
|
53
103
|
onSelect: undefined,
|
|
54
|
-
|
|
104
|
+
placeholder: undefined,
|
|
105
|
+
readOnly: undefined,
|
|
106
|
+
rows: undefined,
|
|
107
|
+
tabIndex: undefined,
|
|
108
|
+
value: undefined
|
|
55
109
|
};
|
|
56
110
|
|
|
57
111
|
AccessibleTextArea.displayName = 'AccessibleTextArea';
|
|
58
112
|
|
|
59
113
|
AccessibleTextArea.propTypes = {
|
|
114
|
+
className: PropTypes.string,
|
|
60
115
|
disabled: PropTypes.bool,
|
|
116
|
+
inputMode: PropTypes.oneOf(['text', 'none', 'tel', 'url', 'email', 'numeric', 'decimal', 'search']),
|
|
61
117
|
onChange: PropTypes.func,
|
|
62
118
|
onFocus: PropTypes.func,
|
|
63
119
|
onKeyDown: PropTypes.func,
|
|
120
|
+
onKeyDownCapture: PropTypes.func,
|
|
64
121
|
onKeyPress: PropTypes.func,
|
|
65
122
|
onSelect: PropTypes.func,
|
|
66
|
-
|
|
123
|
+
placeholder: PropTypes.string,
|
|
124
|
+
readOnly: PropTypes.bool,
|
|
125
|
+
rows: PropTypes.number,
|
|
126
|
+
tabIndex: PropTypes.number,
|
|
127
|
+
value: PropTypes.string
|
|
67
128
|
};
|
|
68
129
|
|
|
69
130
|
export default AccessibleTextArea;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
|
|
4
|
+
import type { FC, MutableRefObject } from 'react';
|
|
5
|
+
|
|
4
6
|
// This is an element, when focused, will send the focus to the ref specified in "redirectRef".
|
|
5
7
|
// Although the focus is being redirected, browser will scroll this redirector element into view.
|
|
6
8
|
|
|
@@ -10,28 +12,39 @@ import React, { useCallback } from 'react';
|
|
|
10
12
|
// When this focus redirector is put inside a scrollable container, you may want to resize or reposition
|
|
11
13
|
// it to prevent unintentional scroll done by the browser default behavior.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
type FocusRedirectorProps = {
|
|
16
|
+
className?: string;
|
|
17
|
+
onFocus?: () => void;
|
|
18
|
+
redirectRef?: MutableRefObject<HTMLElement>;
|
|
19
|
+
};
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
const FocusRedirector: FC<FocusRedirectorProps> = ({ className, onFocus, redirectRef }) => {
|
|
22
|
+
const handleFocus = useCallback(() => {
|
|
23
|
+
redirectRef?.current?.focus();
|
|
18
24
|
onFocus && onFocus();
|
|
19
25
|
}, [onFocus, redirectRef]);
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
// For NVDA, we should set aria-hidden="true".
|
|
28
|
+
// When using NVDA in browse mode, press up/down arrow keys will focus on this redirector.
|
|
29
|
+
// This redirector is designed to capture TAB only and should not react on browse mode.
|
|
30
|
+
// However, reacting with browse mode is currently okay. Just better to leave it alone.
|
|
31
|
+
return <div aria-hidden="true" className={className} onFocus={handleFocus} tabIndex={0} />;
|
|
22
32
|
};
|
|
23
33
|
|
|
24
34
|
FocusRedirector.defaultProps = {
|
|
25
35
|
className: undefined,
|
|
26
|
-
onFocus: undefined
|
|
36
|
+
onFocus: undefined,
|
|
37
|
+
redirectRef: undefined
|
|
27
38
|
};
|
|
28
39
|
|
|
29
40
|
FocusRedirector.propTypes = {
|
|
30
41
|
className: PropTypes.string,
|
|
31
42
|
onFocus: PropTypes.func,
|
|
43
|
+
// PropTypes is not fully compatible with TypeScript.
|
|
44
|
+
// @ts-ignore
|
|
32
45
|
redirectRef: PropTypes.shape({
|
|
33
|
-
current: PropTypes.
|
|
34
|
-
})
|
|
46
|
+
current: PropTypes.instanceOf(HTMLElement)
|
|
47
|
+
})
|
|
35
48
|
};
|
|
36
49
|
|
|
37
50
|
export default FocusRedirector;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint react/no-danger: "off" */
|
|
2
2
|
|
|
3
3
|
import { hooks } from 'botframework-webchat-api';
|
|
4
|
+
import { isForbiddenPropertyName } from 'botframework-webchat-core';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import React, { useCallback, useMemo } from 'react';
|
|
6
7
|
import updateIn from 'simple-update-in';
|
|
@@ -89,7 +90,13 @@ const InlineMarkdown = ({ children, onReference, references }) => {
|
|
|
89
90
|
|
|
90
91
|
const html = useMemo(() => {
|
|
91
92
|
const tree = markdownIt.parseInline(children, {
|
|
92
|
-
references: references.reduce(
|
|
93
|
+
references: references.reduce(
|
|
94
|
+
(references, key) =>
|
|
95
|
+
// Mitigated through denylisting.
|
|
96
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
97
|
+
isForbiddenPropertyName(key) ? references : { ...references, [key]: { href: `#${refToHref[key]}` } },
|
|
98
|
+
{}
|
|
99
|
+
)
|
|
93
100
|
});
|
|
94
101
|
|
|
95
102
|
// Turn "<a href="#retry">Retry</a>" into "<button data-ref="retry" type="button">Retry</button>"
|
|
@@ -104,7 +111,16 @@ const InlineMarkdown = ({ children, onReference, references }) => {
|
|
|
104
111
|
|
|
105
112
|
const href = event.target.getAttribute('data-markdown-href');
|
|
106
113
|
|
|
107
|
-
href &&
|
|
114
|
+
href &&
|
|
115
|
+
onReference &&
|
|
116
|
+
onReference(
|
|
117
|
+
createCustomEvent(
|
|
118
|
+
'reference',
|
|
119
|
+
// Mitigated through denylisting.
|
|
120
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
121
|
+
isForbiddenPropertyName(href) ? {} : { data: hrefToRef[href] }
|
|
122
|
+
)
|
|
123
|
+
);
|
|
108
124
|
},
|
|
109
125
|
[hrefToRef, onReference]
|
|
110
126
|
);
|
|
@@ -12,10 +12,10 @@ const DEFAULT_STYLE = { outline: 0 };
|
|
|
12
12
|
|
|
13
13
|
const BaseFocusBox = ({ children, disabled, onKeyDownCapture, sendFocusRef: sendFocusRefProp, ...otherProps }, ref) => {
|
|
14
14
|
const sendFocusRefPersist = useRef(null);
|
|
15
|
-
const patchedSendFocusRef = useMemo(
|
|
16
|
-
sendFocusRefPersist,
|
|
17
|
-
sendFocusRefProp
|
|
18
|
-
|
|
15
|
+
const patchedSendFocusRef = useMemo(
|
|
16
|
+
() => sendFocusRefProp || sendFocusRefPersist,
|
|
17
|
+
[sendFocusRefPersist, sendFocusRefProp]
|
|
18
|
+
);
|
|
19
19
|
|
|
20
20
|
const context = useMemo(
|
|
21
21
|
() => ({
|
|
@@ -19,7 +19,7 @@ const IE_FOCUSABLE_LIST = [
|
|
|
19
19
|
const IS_FIREFOX = /Firefox\//iu.test(userAgent);
|
|
20
20
|
const IS_IE = /Trident\//iu.test(userAgent);
|
|
21
21
|
|
|
22
|
-
export default function getTabIndex(element) {
|
|
22
|
+
export default function getTabIndex(element: HTMLElement): number | null {
|
|
23
23
|
const { tabIndex } = element;
|
|
24
24
|
|
|
25
25
|
if (IS_IE) {
|
|
@@ -10,6 +10,10 @@ const INPUTTABLE_KEY = {
|
|
|
10
10
|
Subtract: '-' // Numpad subtract key
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
const INPUTTABLE_KEY_KEYS = Object.keys(INPUTTABLE_KEY);
|
|
14
|
+
|
|
13
15
|
export default function inputtableKey(key) {
|
|
14
|
-
|
|
16
|
+
// Mitigated through allowlisting.
|
|
17
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
18
|
+
return key.length === 1 ? key : INPUTTABLE_KEY_KEYS.includes(key) ? INPUTTABLE_KEY[key] : undefined;
|
|
15
19
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import textFormatToContentType from './textFormatToContentType';
|
|
2
|
+
|
|
3
|
+
function walk<T extends Node>(document: Document, walker: (node: T) => string[]): string[] {
|
|
4
|
+
const nodes: T[] = [].slice.call(document.childNodes);
|
|
5
|
+
const results: string[] = [];
|
|
6
|
+
|
|
7
|
+
while (nodes.length) {
|
|
8
|
+
const node = nodes.shift();
|
|
9
|
+
const { childNodes } = node;
|
|
10
|
+
|
|
11
|
+
results.push(...(walker(node) || []));
|
|
12
|
+
nodes.unshift(...[].slice.call(childNodes));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return results;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// From https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
|
|
19
|
+
const HTML_INLINE_TAGS = [
|
|
20
|
+
'A',
|
|
21
|
+
'ABBR',
|
|
22
|
+
'ACRONYM',
|
|
23
|
+
'AUDIO',
|
|
24
|
+
'B',
|
|
25
|
+
'BDI',
|
|
26
|
+
'BDO',
|
|
27
|
+
'BIG',
|
|
28
|
+
'BR',
|
|
29
|
+
'BUTTON',
|
|
30
|
+
'CANVAS',
|
|
31
|
+
'CITE',
|
|
32
|
+
'CODE',
|
|
33
|
+
'DATA',
|
|
34
|
+
'DATALIST',
|
|
35
|
+
'DEL',
|
|
36
|
+
'DFN',
|
|
37
|
+
'EM',
|
|
38
|
+
'EMBED',
|
|
39
|
+
'I',
|
|
40
|
+
'IFRAME',
|
|
41
|
+
'IMG',
|
|
42
|
+
'INPUT',
|
|
43
|
+
'INS',
|
|
44
|
+
'KBD',
|
|
45
|
+
'LABEL',
|
|
46
|
+
'MAP',
|
|
47
|
+
'MARK',
|
|
48
|
+
'METER',
|
|
49
|
+
'NOSCRIPT',
|
|
50
|
+
'OBJECT',
|
|
51
|
+
'OUTPUT',
|
|
52
|
+
'PICTURE',
|
|
53
|
+
'PROGRESS',
|
|
54
|
+
'Q',
|
|
55
|
+
'RUBY',
|
|
56
|
+
'S',
|
|
57
|
+
'SAMP',
|
|
58
|
+
'SCRIPT',
|
|
59
|
+
'SELECT',
|
|
60
|
+
'SLOT',
|
|
61
|
+
'SMALL',
|
|
62
|
+
'SPAN',
|
|
63
|
+
'STRONG',
|
|
64
|
+
'SUB',
|
|
65
|
+
'SUP',
|
|
66
|
+
'SVG',
|
|
67
|
+
'TEMPLATE',
|
|
68
|
+
'TEXTAREA',
|
|
69
|
+
'TIME',
|
|
70
|
+
'U',
|
|
71
|
+
'TT',
|
|
72
|
+
'VAR',
|
|
73
|
+
'VIDEO',
|
|
74
|
+
'WBR'
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Computes all text from a given HTML document as flattened array. This is best-effort.
|
|
79
|
+
*
|
|
80
|
+
* @param {Document} document - HTML document to computes texts from.
|
|
81
|
+
*/
|
|
82
|
+
function htmlTextAlternatives(document: Document): string[] {
|
|
83
|
+
// TODO: [P2] #3923 Revisit this logic with W3C standard, we could do a better text alternatives computation.
|
|
84
|
+
// For example, <abbr title="..."> is not computed.
|
|
85
|
+
// https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_name
|
|
86
|
+
return walk<HTMLElement>(document, node => {
|
|
87
|
+
const { nodeType, tagName, textContent } = node;
|
|
88
|
+
|
|
89
|
+
if (nodeType === Node.TEXT_NODE) {
|
|
90
|
+
return [textContent];
|
|
91
|
+
} else if (tagName === 'IMG') {
|
|
92
|
+
return [node.getAttribute('alt')];
|
|
93
|
+
} else if (!HTML_INLINE_TAGS.includes(tagName)) {
|
|
94
|
+
return ['\n'];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Returns the text alternatives for a message activity.
|
|
101
|
+
*
|
|
102
|
+
* @param {object} activity - Activity to compute the text alternatives.
|
|
103
|
+
* @param {function} renderMarkdownAsHTML - Callback function to render Markdown as HTML string.
|
|
104
|
+
*/
|
|
105
|
+
export default function activityAltText(
|
|
106
|
+
activity: any,
|
|
107
|
+
renderMarkdownAsHTML?: (markdown: string) => string
|
|
108
|
+
): false | string {
|
|
109
|
+
if (activity.type !== 'message') {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const fallbackText = activity?.channelData?.['webchat:fallback-text'];
|
|
114
|
+
|
|
115
|
+
if (typeof fallbackText === 'string') {
|
|
116
|
+
// If `fallbackText` is an empty string, we will treat the activity as presentational and skip narrating it (return false).
|
|
117
|
+
return fallbackText || false;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const text = activity?.channelData?.messageBack?.displayText || activity.text;
|
|
121
|
+
|
|
122
|
+
if (!text) {
|
|
123
|
+
// We will continue to narrate the activity, as empty.
|
|
124
|
+
return '';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (renderMarkdownAsHTML && textFormatToContentType(activity.textFormat) === 'text/markdown') {
|
|
128
|
+
return htmlTextAlternatives(new DOMParser().parseFromString(renderMarkdownAsHTML(text), 'text/html'))
|
|
129
|
+
.join('')
|
|
130
|
+
.replace(/\n{2,}/gu, '\n')
|
|
131
|
+
.trim();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return text;
|
|
135
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isForbiddenPropertyName } from 'botframework-webchat-core';
|
|
2
|
+
|
|
1
3
|
export default function createCustomEvent(name, eventInitDict) {
|
|
2
4
|
let event;
|
|
3
5
|
|
|
@@ -10,7 +12,11 @@ export default function createCustomEvent(name, eventInitDict) {
|
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
Object.entries(eventInitDict).forEach(([key, value]) => {
|
|
13
|
-
|
|
15
|
+
if (!isForbiddenPropertyName(key)) {
|
|
16
|
+
// Mitigated through denylisting.
|
|
17
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
18
|
+
event[key] = value;
|
|
19
|
+
}
|
|
14
20
|
});
|
|
15
21
|
|
|
16
22
|
return event;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { userAgent } = navigator;
|
|
2
2
|
|
|
3
3
|
// not DRY so that list can be alphabetical
|
|
4
|
+
const android = /Linux; Android/u.test(userAgent);
|
|
4
5
|
const chromium = !/Edge\//u.test(userAgent) && /Chrome\//u.test(userAgent);
|
|
5
6
|
const edgeAnaheim = /Edg\//u.test(userAgent);
|
|
6
7
|
const edgeUWP = /Edge\//u.test(userAgent);
|
|
@@ -10,4 +11,4 @@ const ie11 = /Trident\/7.0/u.test(userAgent);
|
|
|
10
11
|
const chrome = chromium && !edgeAnaheim;
|
|
11
12
|
const safari = !(chrome || edgeUWP || ie11 || firefox);
|
|
12
13
|
|
|
13
|
-
export { chrome, chromium, edgeAnaheim, edgeUWP, firefox, ie11, safari };
|
|
14
|
+
export { android, chrome, chromium, edgeAnaheim, edgeUWP, firefox, ie11, safari };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function findAncestor(
|
|
2
|
+
node: HTMLElement,
|
|
3
|
+
predicate: (ancestor: HTMLElement) => boolean
|
|
4
|
+
): HTMLElement | undefined {
|
|
5
|
+
let ancestor = node;
|
|
6
|
+
|
|
7
|
+
while ((ancestor = ancestor.parentElement)) {
|
|
8
|
+
if (predicate(ancestor)) {
|
|
9
|
+
return ancestor;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intersects 2 or more arrays and return an array of values which are common to all of them.
|
|
3
|
+
*/
|
|
4
|
+
export default function intersectionOf<T>(arg0: readonly T[], ...args: readonly (readonly T[])[]): T[] {
|
|
5
|
+
return args.reduce<T[]>(
|
|
6
|
+
(interim: T[], arg: readonly T[]) =>
|
|
7
|
+
interim.reduce((intersection: T[], item: T) => {
|
|
8
|
+
arg.includes(item) && intersection.push(item);
|
|
9
|
+
|
|
10
|
+
return intersection;
|
|
11
|
+
}, []),
|
|
12
|
+
[...arg0]
|
|
13
|
+
);
|
|
14
|
+
}
|
package/src/Utils/mapMap.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { isForbiddenPropertyName } from 'botframework-webchat-core';
|
|
2
|
+
|
|
1
3
|
export default function mapMap(map, mapper) {
|
|
2
4
|
return Object.entries(map).reduce((result, [key, value]) => {
|
|
3
|
-
|
|
5
|
+
if (!isForbiddenPropertyName(key)) {
|
|
6
|
+
// Mitigated through denylisting.
|
|
7
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
8
|
+
result[key] = mapper(value, key);
|
|
9
|
+
}
|
|
4
10
|
|
|
5
11
|
return result;
|
|
6
12
|
}, {});
|