botframework-webchat-component 4.14.1 → 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 -106
- package/.prettierrc.yml +1 -1
- package/lib/Activity/CarouselFilmStrip.js +1 -1
- package/lib/Activity/CarouselFilmStripAttachment.js +1 -1
- package/lib/Activity/Speak.js +1 -1
- package/lib/Activity/StackedLayout.d.ts.map +1 -1
- package/lib/Activity/StackedLayout.js +2 -2
- package/lib/Attachment/FileAttachment.js +2 -2
- package/lib/Attachment/FileContent.d.ts.map +1 -1
- package/lib/Attachment/FileContent.js +11 -1
- package/lib/BasicSendBox.js +1 -1
- package/lib/BasicToaster.js +5 -2
- package/lib/BasicTranscript.d.ts +7 -0
- package/lib/BasicTranscript.d.ts.map +1 -0
- package/lib/BasicTranscript.js +368 -725
- package/lib/BasicTypingIndicator.d.ts +2 -1
- package/lib/BasicTypingIndicator.d.ts.map +1 -1
- package/lib/BasicTypingIndicator.js +12 -4
- package/lib/Composer.d.ts.map +1 -1
- package/lib/Composer.js +34 -29
- package/lib/Middleware/Activity/createCoreMiddleware.d.ts.map +1 -1
- package/lib/Middleware/Activity/createCoreMiddleware.js +1 -1
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.js +1 -1
- package/lib/Middleware/ActivityStatus/createSendStatusMiddleware.js +18 -15
- package/lib/Middleware/Attachment/createCoreMiddleware.js +2 -5
- package/lib/Middleware/AttachmentForScreenReader/createCoreMiddleware.d.ts.map +1 -1
- package/lib/Middleware/AttachmentForScreenReader/createCoreMiddleware.js +1 -1
- package/lib/Middleware/Avatar/createCoreMiddleware.d.ts.map +1 -1
- package/lib/Middleware/Avatar/createCoreMiddleware.js +2 -3
- package/lib/Middleware/CardAction/createCoreMiddleware.js +10 -3
- package/lib/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.d.ts.map +1 -1
- package/lib/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.js +1 -1
- package/lib/Middleware/Toast/createCoreMiddleware.d.ts.map +1 -1
- package/lib/Middleware/Toast/createCoreMiddleware.js +1 -1
- package/lib/Middleware/TypingIndicator/createCoreMiddleware.d.ts.map +1 -1
- package/lib/Middleware/TypingIndicator/createCoreMiddleware.js +8 -6
- package/lib/ScreenReaderActivity.js +14 -5
- package/lib/ScreenReaderText.d.ts +9 -0
- package/lib/ScreenReaderText.d.ts.map +1 -0
- package/lib/ScreenReaderText.js +22 -8
- package/lib/SendBox/DictationInterims.js +1 -1
- package/lib/SendBox/IconButton.d.ts +11 -0
- package/lib/SendBox/IconButton.d.ts.map +1 -0
- package/lib/SendBox/IconButton.js +26 -6
- package/lib/SendBox/MicrophoneButton.js +1 -1
- package/lib/SendBox/SendButton.js +1 -1
- package/lib/SendBox/SuggestedAction.d.ts +17 -0
- package/lib/SendBox/SuggestedAction.d.ts.map +1 -0
- package/lib/SendBox/SuggestedAction.js +25 -16
- package/lib/SendBox/SuggestedActions.d.ts.map +1 -1
- package/lib/SendBox/SuggestedActions.js +25 -8
- package/lib/SendBox/TextBox.js +1 -1
- package/lib/SendBox/UploadButton.js +1 -1
- package/lib/Styles/StyleSet/BasicTranscript.d.ts +13 -5
- package/lib/Styles/StyleSet/BasicTranscript.d.ts.map +1 -1
- package/lib/Styles/StyleSet/BasicTranscript.js +21 -9
- package/lib/Styles/StyleSet/Bubble.d.ts.map +1 -1
- package/lib/Styles/StyleSet/Bubble.js +1 -1
- package/lib/Styles/StyleSet/CarouselFilmStrip.d.ts.map +1 -1
- package/lib/Styles/StyleSet/CarouselFilmStrip.js +1 -1
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.d.ts.map +1 -1
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.js +1 -1
- 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/ScrollToEndButton.d.ts +1 -1
- package/lib/Styles/StyleSet/ScrollToEndButton.js +2 -2
- package/lib/Styles/StyleSet/SendBoxButton.d.ts +56 -10
- package/lib/Styles/StyleSet/SendBoxButton.d.ts.map +1 -1
- package/lib/Styles/StyleSet/SendBoxButton.js +76 -12
- package/lib/Styles/StyleSet/SendBoxTextBox.d.ts +1 -1
- package/lib/Styles/StyleSet/SendBoxTextBox.d.ts.map +1 -1
- package/lib/Styles/StyleSet/SendBoxTextBox.js +3 -3
- package/lib/Styles/StyleSet/StackedLayout.d.ts.map +1 -1
- package/lib/Styles/StyleSet/StackedLayout.js +1 -1
- package/lib/Styles/StyleSet/SuggestedAction.d.ts +73 -28
- package/lib/Styles/StyleSet/SuggestedAction.d.ts.map +1 -1
- package/lib/Styles/StyleSet/SuggestedAction.js +116 -41
- package/lib/Styles/StyleSet/SuggestedActions.d.ts +13 -6
- package/lib/Styles/StyleSet/SuggestedActions.d.ts.map +1 -1
- package/lib/Styles/StyleSet/SuggestedActions.js +13 -6
- package/lib/Styles/createStyleSet.d.ts +323 -54
- package/lib/Styles/createStyleSet.d.ts.map +1 -1
- package/lib/Styles/createStyleSet.js +4 -1
- package/lib/Styles/mirrorStyle.js +12 -3
- package/lib/Toast/NotificationIcon.js +7 -3
- package/lib/Toast/createToastMiddleware.d.ts.map +1 -1
- package/lib/Toast/createToastMiddleware.js +1 -1
- 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/AccessibleButton.d.ts +11 -0
- package/lib/Utils/AccessibleButton.d.ts.map +1 -0
- package/lib/Utils/AccessibleButton.js +11 -6
- package/lib/Utils/FocusRedirector.d.ts +9 -0
- package/lib/Utils/FocusRedirector.d.ts.map +1 -0
- package/lib/Utils/FocusRedirector.js +16 -13
- package/lib/Utils/InlineMarkdown.js +12 -5
- 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/activityAltText.d.ts +8 -0
- package/lib/Utils/activityAltText.d.ts.map +1 -0
- package/lib/Utils/createCustomEvent.js +8 -2
- package/lib/Utils/detectBrowser.js +4 -2
- package/lib/Utils/downscaleImageToDataURL/downscaleImageToDataURLUsingWorker.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 +9 -2
- package/lib/Utils/readDataURIToBlob.js +1 -1
- 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/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 +13 -5
- package/lib/hooks/index.js +24 -24
- package/lib/hooks/internal/BypassSpeechSynthesisPonyfill.js +5 -4
- 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/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/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 +11 -2
- 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/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/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/useFocus.d.ts +1 -1
- package/lib/hooks/useFocus.d.ts.map +1 -1
- package/lib/hooks/useFocus.js +1 -1
- package/lib/hooks/useRenderMarkdownAsHTML.d.ts.map +1 -1
- package/lib/hooks/useRenderMarkdownAsHTML.js +1 -1
- package/lib/hooks/useScrollTo.d.ts.map +1 -1
- package/lib/hooks/useScrollTo.js +1 -1
- package/lib/hooks/useScrollToEnd.d.ts.map +1 -1
- package/lib/hooks/useScrollToEnd.js +1 -1
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -15
- 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/package.json +17 -24
- package/src/Activity/CarouselFilmStripAttachment.js +0 -1
- package/src/Activity/StackedLayout.tsx +10 -9
- package/src/Attachment/FileAttachment.js +1 -1
- package/src/Attachment/FileContent.tsx +12 -0
- package/src/BasicToaster.js +5 -1
- package/src/BasicTranscript.tsx +878 -0
- package/src/BasicTypingIndicator.tsx +3 -2
- package/src/Composer.tsx +41 -29
- package/src/Middleware/Activity/createCoreMiddleware.tsx +50 -44
- package/src/Middleware/ActivityStatus/createSendStatusMiddleware.js +2 -0
- package/src/Middleware/Attachment/createCoreMiddleware.tsx +28 -28
- package/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.tsx +25 -23
- package/src/Middleware/Avatar/createCoreMiddleware.tsx +9 -8
- package/src/Middleware/CardAction/createCoreMiddleware.js +9 -2
- package/src/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.ts +11 -9
- package/src/Middleware/Toast/createCoreMiddleware.tsx +12 -10
- package/src/Middleware/TypingIndicator/createCoreMiddleware.tsx +8 -2
- package/src/ScreenReaderActivity.js +18 -3
- package/src/{ScreenReaderText.js → ScreenReaderText.tsx} +27 -9
- package/src/SendBox/{IconButton.js → IconButton.tsx} +19 -3
- package/src/SendBox/{SuggestedAction.js → SuggestedAction.tsx} +72 -35
- package/src/SendBox/SuggestedActions.tsx +47 -20
- package/src/Styles/StyleSet/BasicTranscript.ts +34 -20
- package/src/Styles/StyleSet/Bubble.ts +0 -1
- package/src/Styles/StyleSet/CarouselFilmStrip.ts +12 -10
- package/src/Styles/StyleSet/CarouselFilmStripAttachment.ts +4 -3
- package/src/Styles/StyleSet/KeyboardHelp.ts +157 -0
- package/src/Styles/StyleSet/ScrollToEndButton.ts +1 -1
- 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 +129 -42
- package/src/Styles/StyleSet/SuggestedActions.ts +13 -5
- package/src/Styles/createStyleSet.ts +2 -1
- package/src/Styles/mirrorStyle.js +10 -2
- package/src/Toast/NotificationIcon.js +4 -1
- package/src/Toast/createToastMiddleware.tsx +4 -1
- 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/{FocusRedirector.js → FocusRedirector.tsx} +21 -8
- package/src/Utils/InlineMarkdown.js +18 -2
- package/src/Utils/TypeFocusSink/inputtableKey.ts +5 -1
- 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.ts +14 -0
- package/src/Utils/isZeroOrPositive.ts +7 -0
- package/src/Utils/mapMap.js +7 -1
- package/src/Utils/scrollIntoViewWithBlockNearest.ts +20 -0
- package/src/Utils/shallowEquals.js +8 -1
- package/src/Utils/supportPseudoClass.ts +17 -0
- package/src/Utils/{tabbableElements.js → tabbableElements.ts} +6 -5
- package/src/connectToWebChat.js +11 -4
- package/src/hooks/internal/BypassSpeechSynthesisPonyfill.js +3 -1
- 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 +1 -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/useStateRef.ts +31 -0
- package/src/hooks/internal/useValueRef.ts +22 -0
- package/src/hooks/useFocus.ts +1 -1
- package/src/hooks/useRenderMarkdownAsHTML.ts +4 -5
- package/src/hooks/useScrollTo.ts +4 -3
- package/src/hooks/useScrollToEnd.ts +4 -3
- package/src/index.ts +0 -1
- 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/.eslintignore +0 -1
- package/lib/Utils/findLastIndex.js +0 -32
- package/lib/hooks/internal/useAcknowledgedActivity.js +0 -90
- package/lib/hooks/internal/useDispatchTranscriptFocus.js +0 -19
- package/src/BasicTranscript.js +0 -1139
- package/src/Utils/findLastIndex.js +0 -11
- package/src/Utils/findLastIndex.spec.js +0 -31
- package/src/Utils/getActivityUniqueId.js +0 -3
- package/src/Utils/intersectionOf.js +0 -11
- package/src/Utils/isZeroOrPositive.js +0 -4
- 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
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* eslint no-magic-numbers: "off" */
|
|
2
|
-
|
|
3
|
-
import findLastIndex from './findLastIndex';
|
|
4
|
-
|
|
5
|
-
describe('find last index', () => {
|
|
6
|
-
test('of an existing element should return the index of last occurrence', () => {
|
|
7
|
-
const actual = findLastIndex([1, 2, 3, 2, 1], value => value === 2);
|
|
8
|
-
|
|
9
|
-
expect(actual).toBe(3);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('of a non-existing element should return -1', () => {
|
|
13
|
-
const actual = findLastIndex([1, 2, 3, 2, 1], value => value === 4);
|
|
14
|
-
|
|
15
|
-
expect(actual).toBe(-1);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('of an empty array should return -1', () => {
|
|
19
|
-
const actual = findLastIndex([], value => value === 1);
|
|
20
|
-
|
|
21
|
-
expect(actual).toBe(-1);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('without a predicate should throw', () => {
|
|
25
|
-
expect(() => findLastIndex([])).toThrowError('not a function');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('without an array should throw', () => {
|
|
29
|
-
expect(() => findLastIndex(undefined, value => value === 1)).toThrowError();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { hooks } from 'botframework-webchat-api';
|
|
2
|
-
import { useMemo, useRef } from 'react';
|
|
3
|
-
import { useSticky } from 'react-scroll-to-bottom';
|
|
4
|
-
|
|
5
|
-
import findLastIndex from '../../Utils/findLastIndex';
|
|
6
|
-
import getActivityUniqueId from '../../Utils/getActivityUniqueId';
|
|
7
|
-
import useChanged from './useChanged';
|
|
8
|
-
|
|
9
|
-
const { useActivities } = hooks;
|
|
10
|
-
|
|
11
|
-
// Acknowledged means either:
|
|
12
|
-
// 1. The user sent a message
|
|
13
|
-
// - We don't need a condition here. When Web Chat sends the user's message, it will scroll to bottom, and it will trigger condition 2 below.
|
|
14
|
-
// 2. The user scroll to the bottom of the transcript, from a non-bottom scroll position
|
|
15
|
-
// - If the transcript is already at the bottom, the user needs to scroll up and then go back down
|
|
16
|
-
// - What happens if we are relaxing "scrolled from a non-bottom scroll position":
|
|
17
|
-
// 1. The condition will become solely "at the bottom of the transcript"
|
|
18
|
-
// 2. Auto-scroll will always scroll the transcript to the bottom
|
|
19
|
-
// 3. Web Chat will always acknowledge all activities as it is at the bottom
|
|
20
|
-
// 4. Acknowledge flag become useless
|
|
21
|
-
// 5. Therefore, even the developer set "pause after 3 activities", if activities are coming in at a slow pace (not batched in a single render)
|
|
22
|
-
// Web Chat will keep scrolling and not snapped/paused
|
|
23
|
-
|
|
24
|
-
// Note: When Web Chat is loaded, there are no activities acknowledged. We need to assume all arriving activities are acknowledged until end-user sends their first activity.
|
|
25
|
-
// Activities loaded initially could be from conversation history. Without assuming acknowledgement, Web Chat will not scroll initially (as everything is not acknowledged).
|
|
26
|
-
// It would be better if the chat adapter should let Web Chat know if the activity is loaded from history or not.
|
|
27
|
-
|
|
28
|
-
// TODO: [P2] #3670 Move the "conversation history acknowledgement" logic mentioned above to polyfill of chat adapters.
|
|
29
|
-
// 1. Chat adapter should send "acknowledged" as part of "channelData"
|
|
30
|
-
// 2. If "acknowledged" is "undefined", we set it to:
|
|
31
|
-
// a. true, if there are no egress activities yet
|
|
32
|
-
// b. Otherwise, false
|
|
33
|
-
export default function useAcknowledgedActivity() {
|
|
34
|
-
const [activities] = useActivities();
|
|
35
|
-
const [sticky] = useSticky();
|
|
36
|
-
const lastStickyActivityIDRef = useRef();
|
|
37
|
-
|
|
38
|
-
const stickyChanged = useChanged(sticky);
|
|
39
|
-
const stickyChangedToSticky = stickyChanged && sticky;
|
|
40
|
-
|
|
41
|
-
const lastStickyActivityID = useMemo(() => {
|
|
42
|
-
if (stickyChangedToSticky) {
|
|
43
|
-
lastStickyActivityIDRef.current = getActivityUniqueId(activities[activities.length - 1] || {});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return lastStickyActivityIDRef.current;
|
|
47
|
-
}, [activities, lastStickyActivityIDRef, stickyChangedToSticky]);
|
|
48
|
-
|
|
49
|
-
return useMemo(() => {
|
|
50
|
-
const lastStickyActivityIndex = activities.findIndex(
|
|
51
|
-
activity => getActivityUniqueId(activity) === lastStickyActivityID
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const lastEgressActivityIndex = findLastIndex(activities, ({ from: { role } = {} }) => role === 'user');
|
|
55
|
-
|
|
56
|
-
// As described above, if no activities were acknowledged through egress activity, we will assume everything is acknowledged.
|
|
57
|
-
const lastAcknowledgedActivityIndex = !~lastEgressActivityIndex
|
|
58
|
-
? activities.length - 1
|
|
59
|
-
: Math.max(lastStickyActivityIndex, lastEgressActivityIndex);
|
|
60
|
-
|
|
61
|
-
const lastAcknowledgedActivity = activities[lastAcknowledgedActivityIndex];
|
|
62
|
-
|
|
63
|
-
return [lastAcknowledgedActivity];
|
|
64
|
-
}, [activities, lastStickyActivityID]);
|
|
65
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import useWebChatUIContext from './useWebChatUIContext';
|
|
2
|
-
|
|
3
|
-
export default function useDispatchTranscriptFocus() {
|
|
4
|
-
const { dispatchTranscriptFocus, numTranscriptFocusObservers } = useWebChatUIContext();
|
|
5
|
-
|
|
6
|
-
return numTranscriptFocusObservers ? dispatchTranscriptFocus : undefined;
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
export default function useMemoize(fn, callback, deps) {
|
|
4
|
-
if (typeof fn !== 'function') {
|
|
5
|
-
throw new Error('The first argument must be a function.');
|
|
6
|
-
} else if (typeof callback !== 'function') {
|
|
7
|
-
throw new Error('The second argument must be a function.');
|
|
8
|
-
} else if (!Array.isArray(deps)) {
|
|
9
|
-
throw new Error('The third argument must be an array.');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const memoizedFn = useMemo(() => {
|
|
13
|
-
let cache = [];
|
|
14
|
-
|
|
15
|
-
return run => {
|
|
16
|
-
const nextCache = [];
|
|
17
|
-
const result = run((...args) => {
|
|
18
|
-
const { result } = [...cache, ...nextCache].find(
|
|
19
|
-
({ args: cachedArgs }) =>
|
|
20
|
-
args.length === cachedArgs.length && args.every((arg, index) => Object.is(arg, cachedArgs[index]))
|
|
21
|
-
) || { result: fn(...args) };
|
|
22
|
-
|
|
23
|
-
nextCache.push({ args, result });
|
|
24
|
-
|
|
25
|
-
return result;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
cache = nextCache;
|
|
29
|
-
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
// We are manually creating the deps here. The "callback" arg is also designed not to be impact deps, similar to useEffect(fn), where "fn" is not in deps.
|
|
33
|
-
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
34
|
-
}, [fn, ...deps]);
|
|
35
|
-
|
|
36
|
-
return memoizedFn(callback);
|
|
37
|
-
}
|