botframework-webchat-api 4.18.1-main.20260518.2a3d1d3 → 4.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/decorator.js +1 -1
- package/dist/botframework-webchat-api.d.mts +1250 -173
- package/dist/botframework-webchat-api.decorator.d.mts +26 -71
- package/dist/botframework-webchat-api.decorator.mjs +2 -1
- package/dist/botframework-webchat-api.decorator.mjs.LEGAL.txt +0 -0
- package/dist/botframework-webchat-api.decorator.mjs.map +1 -1
- package/dist/botframework-webchat-api.internal.d.mts +1 -66
- package/dist/botframework-webchat-api.internal.mjs +2 -1
- package/dist/botframework-webchat-api.internal.mjs.LEGAL.txt +0 -0
- package/dist/botframework-webchat-api.internal.mjs.map +1 -1
- package/dist/botframework-webchat-api.mjs +139 -1
- package/dist/botframework-webchat-api.mjs.LEGAL.txt +27 -2
- package/dist/botframework-webchat-api.mjs.map +1 -1
- package/dist/chunk-2S76JUVM.mjs +3 -0
- package/dist/chunk-2S76JUVM.mjs.LEGAL.txt +0 -0
- package/dist/chunk-2S76JUVM.mjs.map +1 -0
- package/dist/{chunk-VAX7AB37.mjs → chunk-J6D5YEY6.mjs} +2 -1
- package/dist/chunk-J6D5YEY6.mjs.LEGAL.txt +0 -0
- package/dist/chunk-ZAMHKQQC.mjs +3 -0
- package/dist/chunk-ZAMHKQQC.mjs.LEGAL.txt +0 -0
- package/dist/chunk-ZAMHKQQC.mjs.map +1 -0
- package/dist/metafile-esm.json +1 -1
- package/internal.js +1 -1
- package/lib/StyleOptions.d.ts +697 -0
- package/lib/StyleOptions.d.ts.map +1 -0
- package/lib/StyleOptions.js +2 -0
- package/lib/decorator/index.d.ts +5 -0
- package/lib/decorator/index.d.ts.map +1 -0
- package/lib/decorator/index.js +28 -0
- package/lib/decorator/private/ActivityBorderDecoratorMiddleware.d.ts +27 -0
- package/lib/decorator/private/ActivityBorderDecoratorMiddleware.d.ts.map +1 -0
- package/lib/decorator/private/ActivityBorderDecoratorMiddleware.js +19 -0
- package/lib/decorator/private/ActivityDecorator.d.ts +9 -0
- package/lib/decorator/private/ActivityDecorator.d.ts.map +1 -0
- package/lib/decorator/private/ActivityDecorator.js +36 -0
- package/lib/decorator/private/DecoratorComposer.d.ts +3 -0
- package/lib/decorator/private/DecoratorComposer.d.ts.map +1 -0
- package/lib/decorator/private/DecoratorComposer.js +13 -0
- package/lib/decorator/private/activityDecoratorRequest.d.ts +6 -0
- package/lib/decorator/private/activityDecoratorRequest.d.ts.map +1 -0
- package/lib/decorator/private/activityDecoratorRequest.js +2 -0
- package/lib/decorator/private/createDecoratorComposer.d.ts +11 -0
- package/lib/decorator/private/createDecoratorComposer.d.ts.map +1 -0
- package/lib/decorator/private/createDecoratorComposer.js +27 -0
- package/lib/decorator/private/templateMiddleware.d.ts +30 -0
- package/lib/decorator/private/templateMiddleware.d.ts.map +1 -0
- package/lib/decorator/private/templateMiddleware.js +53 -0
- package/lib/decorator/private/templateMiddleware.test.d.ts +3 -0
- package/lib/decorator/private/templateMiddleware.test.d.ts.map +1 -0
- package/lib/defaultStyleOptions.d.ts +4 -0
- package/lib/defaultStyleOptions.d.ts.map +1 -0
- package/lib/defaultStyleOptions.js +277 -0
- package/lib/external/PrecompiledGlobalize.js +6361 -0
- package/lib/hooks/Composer.d.ts +88 -0
- package/lib/hooks/Composer.d.ts.map +1 -0
- package/lib/hooks/Composer.js +605 -0
- package/lib/hooks/index.d.ts +73 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +504 -0
- package/lib/hooks/internal/ErrorBox.js +47 -0
- package/lib/hooks/internal/SendBoxMiddleware.d.ts +37 -0
- package/lib/hooks/internal/SendBoxMiddleware.d.ts.map +1 -0
- package/lib/hooks/internal/SendBoxMiddleware.js +17 -0
- package/lib/hooks/internal/SendBoxToolbarMiddleware.d.ts +37 -0
- package/lib/hooks/internal/SendBoxToolbarMiddleware.d.ts.map +1 -0
- package/lib/hooks/internal/SendBoxToolbarMiddleware.js +17 -0
- package/lib/hooks/internal/Tracker.d.ts +4 -0
- package/lib/hooks/internal/Tracker.d.ts.map +1 -0
- package/lib/hooks/internal/Tracker.js +15 -0
- package/lib/hooks/internal/WebChatAPIContext.d.ts +80 -0
- package/lib/hooks/internal/WebChatAPIContext.d.ts.map +1 -0
- package/lib/hooks/internal/WebChatAPIContext.js +12 -0
- package/lib/hooks/internal/WebChatReduxContext.js +17 -0
- package/lib/hooks/internal/defaultSelectVoice.js +28 -0
- package/lib/hooks/internal/private/templateMiddleware.d.ts +3 -0
- package/lib/hooks/internal/private/templateMiddleware.d.ts.map +1 -0
- package/lib/hooks/internal/private/templateMiddleware.js +12 -0
- package/lib/hooks/internal/useCreateActivityRendererInternal.d.ts +4 -0
- package/lib/hooks/internal/useCreateActivityRendererInternal.d.ts.map +1 -0
- package/lib/hooks/internal/useCreateActivityRendererInternal.js +37 -0
- package/lib/hooks/internal/useDebugDeps.js +39 -0
- package/lib/hooks/internal/useDirFromProps.js +12 -0
- package/lib/hooks/internal/useErrorBoxClass.js +14 -0
- package/lib/hooks/internal/useForceRender.js +24 -0
- package/lib/hooks/internal/useLocalizedGlobalize.js +12 -0
- package/lib/hooks/internal/useLocalizedStrings.js +14 -0
- package/lib/hooks/internal/useMarkActivity.js +12 -0
- package/lib/hooks/internal/usePrevious.d.ts +3 -0
- package/lib/hooks/internal/usePrevious.d.ts.map +1 -0
- package/lib/hooks/internal/usePrevious.js +15 -0
- package/lib/hooks/internal/useReadTelemetryDimensions.js +20 -0
- package/lib/hooks/internal/useSetDictateState.d.ts +2 -0
- package/lib/hooks/internal/useSetDictateState.d.ts.map +1 -0
- package/lib/hooks/internal/useSetDictateState.js +12 -0
- package/lib/hooks/internal/useTimer.d.ts +5 -0
- package/lib/hooks/internal/useTimer.d.ts.map +1 -0
- package/lib/hooks/internal/useTimer.js +43 -0
- package/lib/hooks/internal/useTracker.js +42 -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 +22 -0
- package/lib/hooks/internal/useWebChatAPIContext.d.ts +83 -0
- package/lib/hooks/internal/useWebChatAPIContext.d.ts.map +1 -0
- package/lib/hooks/internal/useWebChatAPIContext.js +17 -0
- package/lib/hooks/middleware/UserlandBoundary.js +48 -0
- package/lib/hooks/middleware/applyMiddleware.js +122 -0
- package/lib/hooks/middleware/concatMiddleware.d.ts +6 -0
- package/lib/hooks/middleware/concatMiddleware.d.ts.map +1 -0
- package/lib/hooks/middleware/concatMiddleware.js +33 -0
- package/lib/hooks/middleware/createDefaultCardActionMiddleware.d.ts +3 -0
- package/lib/hooks/middleware/createDefaultCardActionMiddleware.d.ts.map +1 -0
- package/lib/hooks/middleware/createDefaultCardActionMiddleware.js +43 -0
- package/lib/hooks/middleware/createDefaultGroupActivitiesMiddleware.d.ts +7 -0
- package/lib/hooks/middleware/createDefaultGroupActivitiesMiddleware.d.ts.map +1 -0
- package/lib/hooks/middleware/createDefaultGroupActivitiesMiddleware.js +68 -0
- package/lib/hooks/private/numberWithInfinity.d.ts +3 -0
- package/lib/hooks/private/numberWithInfinity.d.ts.map +1 -0
- package/lib/hooks/private/numberWithInfinity.js +17 -0
- package/lib/hooks/private/numberWithInfinity.spec.d.ts +2 -0
- package/lib/hooks/private/numberWithInfinity.spec.d.ts.map +1 -0
- package/lib/hooks/private/reduceIterable.d.ts +2 -0
- package/lib/hooks/private/reduceIterable.d.ts.map +1 -0
- package/lib/hooks/private/reduceIterable.js +26 -0
- package/lib/hooks/private/reduceIterable.spec.d.ts +2 -0
- package/lib/hooks/private/reduceIterable.spec.d.ts.map +1 -0
- package/lib/hooks/useActiveTyping.d.ts +4 -0
- package/lib/hooks/useActiveTyping.d.ts.map +1 -0
- package/lib/hooks/useActiveTyping.js +81 -0
- package/lib/hooks/useActivities.d.ts +3 -0
- package/lib/hooks/useActivities.d.ts.map +1 -0
- package/lib/hooks/useActivities.js +14 -0
- package/lib/hooks/useActivityKeys.d.ts +3 -0
- package/lib/hooks/useActivityKeys.d.ts.map +1 -0
- package/lib/hooks/useActivityKeys.js +11 -0
- package/lib/hooks/useActivityKeysByRead.d.ts +3 -0
- package/lib/hooks/useActivityKeysByRead.d.ts.map +1 -0
- package/lib/hooks/useActivityKeysByRead.js +11 -0
- package/lib/hooks/useAvatarForBot.d.ts +5 -0
- package/lib/hooks/useAvatarForBot.d.ts.map +1 -0
- package/lib/hooks/useAvatarForBot.js +26 -0
- package/lib/hooks/useAvatarForUser.d.ts +5 -0
- package/lib/hooks/useAvatarForUser.d.ts.map +1 -0
- package/lib/hooks/useAvatarForUser.js +26 -0
- package/lib/hooks/useByteFormatter.d.ts +2 -0
- package/lib/hooks/useByteFormatter.d.ts.map +1 -0
- package/lib/hooks/useByteFormatter.js +43 -0
- package/lib/hooks/useConnectivityStatus.d.ts +2 -0
- package/lib/hooks/useConnectivityStatus.d.ts.map +1 -0
- package/lib/hooks/useConnectivityStatus.js +14 -0
- package/lib/hooks/useCreateActivityRenderer.d.ts +3 -0
- package/lib/hooks/useCreateActivityRenderer.d.ts.map +1 -0
- package/lib/hooks/useCreateActivityRenderer.js +14 -0
- package/lib/hooks/useCreateActivityStatusRenderer.d.ts +10 -0
- package/lib/hooks/useCreateActivityStatusRenderer.d.ts.map +1 -0
- package/lib/hooks/useCreateActivityStatusRenderer.js +72 -0
- package/lib/hooks/useCreateAttachmentForScreenReaderRenderer.d.ts +3 -0
- package/lib/hooks/useCreateAttachmentForScreenReaderRenderer.d.ts.map +1 -0
- package/lib/hooks/useCreateAttachmentForScreenReaderRenderer.js +12 -0
- package/lib/hooks/useCreateAvatarRenderer.d.ts +6 -0
- package/lib/hooks/useCreateAvatarRenderer.d.ts.map +1 -0
- package/lib/hooks/useCreateAvatarRenderer.js +44 -0
- package/lib/hooks/useCreateScrollToEndButtonRenderer.d.ts +3 -0
- package/lib/hooks/useCreateScrollToEndButtonRenderer.d.ts.map +1 -0
- package/lib/hooks/useCreateScrollToEndButtonRenderer.js +12 -0
- package/lib/hooks/useDateFormatter.d.ts +2 -0
- package/lib/hooks/useDateFormatter.d.ts.map +1 -0
- package/lib/hooks/useDateFormatter.js +35 -0
- package/lib/hooks/useDebouncedNotifications.d.ts +13 -0
- package/lib/hooks/useDebouncedNotifications.d.ts.map +1 -0
- package/lib/hooks/useDebouncedNotifications.js +118 -0
- package/lib/hooks/useDictateInterims.d.ts +2 -0
- package/lib/hooks/useDictateInterims.d.ts.map +1 -0
- package/lib/hooks/useDictateInterims.js +16 -0
- package/lib/hooks/useDictateState.d.ts +2 -0
- package/lib/hooks/useDictateState.d.ts.map +1 -0
- package/lib/hooks/useDictateState.js +15 -0
- package/lib/hooks/useDirection.d.ts +2 -0
- package/lib/hooks/useDirection.d.ts.map +1 -0
- package/lib/hooks/useDirection.js +38 -0
- package/lib/hooks/useDisabled.d.ts +2 -0
- package/lib/hooks/useDisabled.d.ts.map +1 -0
- package/lib/hooks/useDisabled.js +12 -0
- package/lib/hooks/useDismissNotification.d.ts +2 -0
- package/lib/hooks/useDismissNotification.d.ts.map +1 -0
- package/lib/hooks/useDismissNotification.js +12 -0
- package/lib/hooks/useEmitTypingIndicator.d.ts +2 -0
- package/lib/hooks/useEmitTypingIndicator.d.ts.map +1 -0
- package/lib/hooks/useEmitTypingIndicator.js +12 -0
- package/lib/hooks/useGetActivitiesByKey.d.ts +3 -0
- package/lib/hooks/useGetActivitiesByKey.d.ts.map +1 -0
- package/lib/hooks/useGetActivitiesByKey.js +11 -0
- package/lib/hooks/useGetActivityByKey.d.ts +3 -0
- package/lib/hooks/useGetActivityByKey.d.ts.map +1 -0
- package/lib/hooks/useGetActivityByKey.js +11 -0
- package/lib/hooks/useGetHasAcknowledgedByActivityKey.d.ts +3 -0
- package/lib/hooks/useGetHasAcknowledgedByActivityKey.d.ts.map +1 -0
- package/lib/hooks/useGetHasAcknowledgedByActivityKey.js +11 -0
- package/lib/hooks/useGetKeyByActivity.d.ts +3 -0
- package/lib/hooks/useGetKeyByActivity.d.ts.map +1 -0
- package/lib/hooks/useGetKeyByActivity.js +11 -0
- package/lib/hooks/useGetKeyByActivityId.d.ts +3 -0
- package/lib/hooks/useGetKeyByActivityId.d.ts.map +1 -0
- package/lib/hooks/useGetKeyByActivityId.js +11 -0
- package/lib/hooks/useGetSendTimeoutForActivity.d.ts +5 -0
- package/lib/hooks/useGetSendTimeoutForActivity.d.ts.map +1 -0
- package/lib/hooks/useGetSendTimeoutForActivity.js +33 -0
- package/lib/hooks/useGrammars.d.ts +2 -0
- package/lib/hooks/useGrammars.d.ts.map +1 -0
- package/lib/hooks/useGrammars.js +12 -0
- package/lib/hooks/useGroupActivities.d.ts +8 -0
- package/lib/hooks/useGroupActivities.d.ts.map +1 -0
- package/lib/hooks/useGroupActivities.js +12 -0
- package/lib/hooks/useGroupTimestamp.d.ts +2 -0
- package/lib/hooks/useGroupTimestamp.d.ts.map +1 -0
- package/lib/hooks/useGroupTimestamp.js +21 -0
- package/lib/hooks/useLanguage.d.ts +2 -0
- package/lib/hooks/useLanguage.d.ts.map +1 -0
- package/lib/hooks/useLanguage.js +19 -0
- package/lib/hooks/useLastAcknowledgedActivityKey.d.ts +3 -0
- package/lib/hooks/useLastAcknowledgedActivityKey.d.ts.map +1 -0
- package/lib/hooks/useLastAcknowledgedActivityKey.js +11 -0
- package/lib/hooks/useLastReadActivityKey.d.ts +3 -0
- package/lib/hooks/useLastReadActivityKey.d.ts.map +1 -0
- package/lib/hooks/useLastReadActivityKey.js +11 -0
- package/lib/hooks/useLocalizer.d.ts +13 -0
- package/lib/hooks/useLocalizer.d.ts.map +1 -0
- package/lib/hooks/useLocalizer.js +75 -0
- package/lib/hooks/useMarkActivityAsSpoken.d.ts +3 -0
- package/lib/hooks/useMarkActivityAsSpoken.d.ts.map +1 -0
- package/lib/hooks/useMarkActivityAsSpoken.js +16 -0
- package/lib/hooks/useMarkActivityKeyAsRead.d.ts +3 -0
- package/lib/hooks/useMarkActivityKeyAsRead.d.ts.map +1 -0
- package/lib/hooks/useMarkActivityKeyAsRead.js +11 -0
- package/lib/hooks/useMarkAllAsAcknowledged.d.ts +3 -0
- package/lib/hooks/useMarkAllAsAcknowledged.d.ts.map +1 -0
- package/lib/hooks/useMarkAllAsAcknowledged.js +11 -0
- package/lib/hooks/useNotifications.d.ts +3 -0
- package/lib/hooks/useNotifications.d.ts.map +1 -0
- package/lib/hooks/useNotifications.js +14 -0
- package/lib/hooks/usePerformCardAction.d.ts +3 -0
- package/lib/hooks/usePerformCardAction.d.ts.map +1 -0
- package/lib/hooks/usePerformCardAction.js +12 -0
- package/lib/hooks/usePonyfill.d.ts +3 -0
- package/lib/hooks/usePonyfill.d.ts.map +1 -0
- package/lib/hooks/usePonyfill.js +11 -0
- package/lib/hooks/usePostActivity.d.ts +3 -0
- package/lib/hooks/usePostActivity.d.ts.map +1 -0
- package/lib/hooks/usePostActivity.js +12 -0
- package/lib/hooks/useReferenceGrammarID.d.ts +2 -0
- package/lib/hooks/useReferenceGrammarID.d.ts.map +1 -0
- package/lib/hooks/useReferenceGrammarID.js +14 -0
- package/lib/hooks/useRelativeTimeFormatter.d.ts +2 -0
- package/lib/hooks/useRelativeTimeFormatter.d.ts.map +1 -0
- package/lib/hooks/useRelativeTimeFormatter.js +61 -0
- package/lib/hooks/useRenderAttachment.d.ts +3 -0
- package/lib/hooks/useRenderAttachment.d.ts.map +1 -0
- package/lib/hooks/useRenderAttachment.js +14 -0
- package/lib/hooks/useRenderToast.d.ts +3 -0
- package/lib/hooks/useRenderToast.d.ts.map +1 -0
- package/lib/hooks/useRenderToast.js +12 -0
- package/lib/hooks/useRenderTypingIndicator.d.ts +3 -0
- package/lib/hooks/useRenderTypingIndicator.d.ts.map +1 -0
- package/lib/hooks/useRenderTypingIndicator.js +12 -0
- package/lib/hooks/useSendBoxAttachments.d.ts +6 -0
- package/lib/hooks/useSendBoxAttachments.d.ts.map +1 -0
- package/lib/hooks/useSendBoxAttachments.js +23 -0
- package/lib/hooks/useSendBoxValue.d.ts +2 -0
- package/lib/hooks/useSendBoxValue.d.ts.map +1 -0
- package/lib/hooks/useSendBoxValue.js +16 -0
- package/lib/hooks/useSendEvent.d.ts +2 -0
- package/lib/hooks/useSendEvent.d.ts.map +1 -0
- package/lib/hooks/useSendEvent.js +12 -0
- package/lib/hooks/useSendFiles.d.ts +10 -0
- package/lib/hooks/useSendFiles.d.ts.map +1 -0
- package/lib/hooks/useSendFiles.js +35 -0
- package/lib/hooks/useSendMessage.d.ts +6 -0
- package/lib/hooks/useSendMessage.d.ts.map +1 -0
- package/lib/hooks/useSendMessage.js +33 -0
- package/lib/hooks/useSendMessageBack.d.ts +2 -0
- package/lib/hooks/useSendMessageBack.d.ts.map +1 -0
- package/lib/hooks/useSendMessageBack.js +12 -0
- package/lib/hooks/useSendPostBack.d.ts +2 -0
- package/lib/hooks/useSendPostBack.d.ts.map +1 -0
- package/lib/hooks/useSendPostBack.js +12 -0
- package/lib/hooks/useSendStatusByActivityKey.d.ts +22 -0
- package/lib/hooks/useSendStatusByActivityKey.d.ts.map +1 -0
- package/lib/hooks/useSendStatusByActivityKey.js +31 -0
- package/lib/hooks/useSendTimeoutForActivity.d.ts +4 -0
- package/lib/hooks/useSendTimeoutForActivity.d.ts.map +1 -0
- package/lib/hooks/useSendTimeoutForActivity.js +22 -0
- package/lib/hooks/useSendTypingIndicator.d.ts +2 -0
- package/lib/hooks/useSendTypingIndicator.d.ts.map +1 -0
- package/lib/hooks/useSendTypingIndicator.js +14 -0
- package/lib/hooks/useSetNotification.d.ts +3 -0
- package/lib/hooks/useSetNotification.d.ts.map +1 -0
- package/lib/hooks/useSetNotification.js +12 -0
- package/lib/hooks/useShouldSpeakIncomingActivity.d.ts +2 -0
- package/lib/hooks/useShouldSpeakIncomingActivity.d.ts.map +1 -0
- package/lib/hooks/useShouldSpeakIncomingActivity.js +22 -0
- package/lib/hooks/useStartDictate.d.ts +2 -0
- package/lib/hooks/useStartDictate.d.ts.map +1 -0
- package/lib/hooks/useStartDictate.js +12 -0
- package/lib/hooks/useStopDictate.d.ts +2 -0
- package/lib/hooks/useStopDictate.d.ts.map +1 -0
- package/lib/hooks/useStopDictate.js +12 -0
- package/lib/hooks/useStyleOptions.d.ts +3 -0
- package/lib/hooks/useStyleOptions.d.ts.map +1 -0
- package/lib/hooks/useStyleOptions.js +12 -0
- package/lib/hooks/useSubmitSendBox.d.ts +4 -0
- package/lib/hooks/useSubmitSendBox.d.ts.map +1 -0
- package/lib/hooks/useSubmitSendBox.js +49 -0
- package/lib/hooks/useSuggestedActions.d.ts +3 -0
- package/lib/hooks/useSuggestedActions.d.ts.map +1 -0
- package/lib/hooks/useSuggestedActions.js +25 -0
- package/lib/hooks/useTimeoutForSend.d.ts +3 -0
- package/lib/hooks/useTimeoutForSend.d.ts.map +1 -0
- package/lib/hooks/useTimeoutForSend.js +21 -0
- package/lib/hooks/useTrackDimension.d.ts +2 -0
- package/lib/hooks/useTrackDimension.d.ts.map +1 -0
- package/lib/hooks/useTrackDimension.js +14 -0
- package/lib/hooks/useTrackEvent.d.ts +10 -0
- package/lib/hooks/useTrackEvent.d.ts.map +1 -0
- package/lib/hooks/useTrackEvent.js +51 -0
- package/lib/hooks/useTrackException.d.ts +2 -0
- package/lib/hooks/useTrackException.d.ts.map +1 -0
- package/lib/hooks/useTrackException.js +31 -0
- package/lib/hooks/useTrackTiming.d.ts +2 -0
- package/lib/hooks/useTrackTiming.d.ts.map +1 -0
- package/lib/hooks/useTrackTiming.js +93 -0
- package/lib/hooks/useUserID.d.ts +2 -0
- package/lib/hooks/useUserID.d.ts.map +1 -0
- package/lib/hooks/useUserID.js +12 -0
- package/lib/hooks/useUsername.d.ts +2 -0
- package/lib/hooks/useUsername.d.ts.map +1 -0
- package/lib/hooks/useUsername.js +12 -0
- package/lib/hooks/useVoiceSelector.d.ts +2 -0
- package/lib/hooks/useVoiceSelector.d.ts.map +1 -0
- package/lib/hooks/useVoiceSelector.js +16 -0
- package/lib/hooks/utils/ErrorBoundary.js +68 -0
- package/lib/hooks/utils/observableToPromise.d.ts +3 -0
- package/lib/hooks/utils/observableToPromise.d.ts.map +1 -0
- package/lib/hooks/utils/observableToPromise.js +28 -0
- package/lib/index.d.ts +37 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +88 -0
- package/lib/internal.d.ts +3 -0
- package/lib/internal.d.ts.map +1 -0
- package/lib/internal.js +14 -0
- package/lib/localization/Localize.d.ts +4 -0
- package/lib/localization/Localize.d.ts.map +1 -0
- package/lib/localization/Localize.js +50 -0
- package/lib/localization/ar-EG.json +42 -0
- package/lib/localization/ar-JO.json +45 -0
- package/lib/localization/ar-SA.json +112 -0
- package/lib/localization/bg-BG.json +112 -0
- package/lib/localization/ca-ES.json +112 -0
- package/lib/localization/cs-CZ.json +112 -0
- package/lib/localization/da-DK.json +112 -0
- package/lib/localization/de-DE.json +112 -0
- package/lib/localization/el-GR.json +112 -0
- package/lib/localization/en-US.json +183 -0
- package/lib/localization/es-ES.json +112 -0
- package/lib/localization/et-EE.json +112 -0
- package/lib/localization/eu-ES.json +112 -0
- package/lib/localization/fi-FI.json +112 -0
- package/lib/localization/fr-FR.json +112 -0
- package/lib/localization/getAllLocalizedStrings.d.ts +6 -0
- package/lib/localization/getAllLocalizedStrings.d.ts.map +1 -0
- package/lib/localization/getAllLocalizedStrings.js +117 -0
- package/lib/localization/getRTLList.d.ts +2 -0
- package/lib/localization/getRTLList.d.ts.map +1 -0
- package/lib/localization/getRTLList.js +46 -0
- package/lib/localization/gl-ES.json +112 -0
- package/lib/localization/he-IL.json +112 -0
- package/lib/localization/hi-IN.json +112 -0
- package/lib/localization/hr-HR.json +112 -0
- package/lib/localization/hu-HU.json +112 -0
- package/lib/localization/id-ID.json +112 -0
- package/lib/localization/it-IT.json +112 -0
- package/lib/localization/ja-JP.json +112 -0
- package/lib/localization/kk-KZ.json +112 -0
- package/lib/localization/ko-KR.json +112 -0
- package/lib/localization/lt-LT.json +112 -0
- package/lib/localization/lv-LV.json +112 -0
- package/lib/localization/mergeLocalizedStrings.d.ts +7 -0
- package/lib/localization/mergeLocalizedStrings.d.ts.map +1 -0
- package/lib/localization/mergeLocalizedStrings.js +49 -0
- package/lib/localization/ms-MY.json +112 -0
- package/lib/localization/nb-NO.json +112 -0
- package/lib/localization/nl-NL.json +112 -0
- package/lib/localization/overrides.json +257 -0
- package/lib/localization/pl-PL.json +112 -0
- package/lib/localization/pt-BR.json +112 -0
- package/lib/localization/pt-PT.json +112 -0
- package/lib/localization/ro-RO.json +112 -0
- package/lib/localization/ru-RU.json +112 -0
- package/lib/localization/sk-SK.json +112 -0
- package/lib/localization/sl-SI.json +112 -0
- package/lib/localization/sl-SL.json +3 -0
- package/lib/localization/sr-Cyrl-CS.json +112 -0
- package/lib/localization/sr-Cyrl.json +3 -0
- package/lib/localization/sr-Latn-CS.json +112 -0
- package/lib/localization/sr-Latn.json +3 -0
- package/lib/localization/sv-SE.json +112 -0
- package/lib/localization/th-TH.json +112 -0
- package/lib/localization/tr-TR.json +112 -0
- package/lib/localization/uk-UA.json +112 -0
- package/lib/localization/vi-VN.json +112 -0
- package/lib/localization/yue.json +115 -0
- package/lib/localization/zh-CN.json +112 -0
- package/lib/localization/zh-HK.json +112 -0
- package/lib/localization/zh-TW.json +112 -0
- package/lib/normalizeStyleOptions.d.ts +3 -0
- package/lib/normalizeStyleOptions.d.ts.map +1 -0
- package/lib/normalizeStyleOptions.js +147 -0
- package/lib/patchStyleOptionsFromDeprecatedProps.js +21 -0
- package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.d.ts +6 -0
- package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.js +153 -0
- package/lib/providers/ActivityAcknowledgement/private/Context.d.ts +13 -0
- package/lib/providers/ActivityAcknowledgement/private/Context.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/private/Context.js +14 -0
- package/lib/providers/ActivityAcknowledgement/private/useContext.d.ts +3 -0
- package/lib/providers/ActivityAcknowledgement/private/useContext.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/private/useContext.js +18 -0
- package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.d.ts +5 -0
- package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.js +15 -0
- package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.d.ts +2 -0
- package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.js +12 -0
- package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.d.ts +2 -0
- package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.js +12 -0
- package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.d.ts +2 -0
- package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.js +12 -0
- package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.d.ts +2 -0
- package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.js +12 -0
- package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.d.ts +2 -0
- package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.d.ts.map +1 -0
- package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.js +12 -0
- package/lib/providers/ActivityKeyer/ActivityKeyerComposer.d.ts +20 -0
- package/lib/providers/ActivityKeyer/ActivityKeyerComposer.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/ActivityKeyerComposer.js +149 -0
- package/lib/providers/ActivityKeyer/private/Context.d.ts +13 -0
- package/lib/providers/ActivityKeyer/private/Context.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/Context.js +10 -0
- package/lib/providers/ActivityKeyer/private/getActivityId.d.ts +3 -0
- package/lib/providers/ActivityKeyer/private/getActivityId.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/getActivityId.js +10 -0
- package/lib/providers/ActivityKeyer/private/getClientActivityId.d.ts +3 -0
- package/lib/providers/ActivityKeyer/private/getClientActivityId.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/getClientActivityId.js +11 -0
- package/lib/providers/ActivityKeyer/private/lastOf.d.ts +2 -0
- package/lib/providers/ActivityKeyer/private/lastOf.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/lastOf.js +10 -0
- package/lib/providers/ActivityKeyer/private/lastOf.spec.d.ts +2 -0
- package/lib/providers/ActivityKeyer/private/lastOf.spec.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/someIterable.d.ts +2 -0
- package/lib/providers/ActivityKeyer/private/someIterable.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/someIterable.js +27 -0
- package/lib/providers/ActivityKeyer/private/someIterable.spec.d.ts +2 -0
- package/lib/providers/ActivityKeyer/private/someIterable.spec.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/uniqueId.d.ts +2 -0
- package/lib/providers/ActivityKeyer/private/uniqueId.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/uniqueId.js +15 -0
- package/lib/providers/ActivityKeyer/private/useContext.d.ts +3 -0
- package/lib/providers/ActivityKeyer/private/useContext.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/private/useContext.js +18 -0
- package/lib/providers/ActivityKeyer/useActivityKeys.d.ts +2 -0
- package/lib/providers/ActivityKeyer/useActivityKeys.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/useActivityKeys.js +12 -0
- package/lib/providers/ActivityKeyer/useGetActivitiesByKey.d.ts +3 -0
- package/lib/providers/ActivityKeyer/useGetActivitiesByKey.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/useGetActivitiesByKey.js +12 -0
- package/lib/providers/ActivityKeyer/useGetActivityByKey.d.ts +3 -0
- package/lib/providers/ActivityKeyer/useGetActivityByKey.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/useGetActivityByKey.js +12 -0
- package/lib/providers/ActivityKeyer/useGetKeyByActivity.d.ts +3 -0
- package/lib/providers/ActivityKeyer/useGetKeyByActivity.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/useGetKeyByActivity.js +12 -0
- package/lib/providers/ActivityKeyer/useGetKeyByActivityId.d.ts +2 -0
- package/lib/providers/ActivityKeyer/useGetKeyByActivityId.d.ts.map +1 -0
- package/lib/providers/ActivityKeyer/useGetKeyByActivityId.js +12 -0
- package/lib/providers/ActivityListener/ActivityListenerComposer.d.ts +7 -0
- package/lib/providers/ActivityListener/ActivityListenerComposer.d.ts.map +1 -0
- package/lib/providers/ActivityListener/ActivityListenerComposer.js +55 -0
- package/lib/providers/ActivityListener/private/Context.d.ts +8 -0
- package/lib/providers/ActivityListener/private/Context.d.ts.map +1 -0
- package/lib/providers/ActivityListener/private/Context.js +15 -0
- package/lib/providers/ActivityListener/private/useContext.d.ts +2 -0
- package/lib/providers/ActivityListener/private/useContext.d.ts.map +1 -0
- package/lib/providers/ActivityListener/private/useContext.js +13 -0
- package/lib/providers/ActivityListener/useUpsertedActivities.d.ts +3 -0
- package/lib/providers/ActivityListener/useUpsertedActivities.d.ts.map +1 -0
- package/lib/providers/ActivityListener/useUpsertedActivities.js +12 -0
- package/lib/providers/ActivitySendStatus/ActivitySendStatusComposer.d.ts +4 -0
- package/lib/providers/ActivitySendStatus/ActivitySendStatusComposer.d.ts.map +1 -0
- package/lib/providers/ActivitySendStatus/ActivitySendStatusComposer.js +149 -0
- package/lib/providers/ActivitySendStatus/private/Context.d.ts +9 -0
- package/lib/providers/ActivitySendStatus/private/Context.d.ts.map +1 -0
- package/lib/providers/ActivitySendStatus/private/Context.js +13 -0
- package/lib/providers/ActivitySendStatus/private/isMapEqual.d.ts +7 -0
- package/lib/providers/ActivitySendStatus/private/isMapEqual.d.ts.map +1 -0
- package/lib/providers/ActivitySendStatus/private/isMapEqual.js +55 -0
- package/lib/providers/ActivitySendStatus/private/useContext.d.ts +3 -0
- package/lib/providers/ActivitySendStatus/private/useContext.d.ts.map +1 -0
- package/lib/providers/ActivitySendStatus/private/useContext.js +18 -0
- package/lib/providers/ActivitySendStatus/useSendStatusByActivityKey.d.ts +22 -0
- package/lib/providers/ActivitySendStatus/useSendStatusByActivityKey.d.ts.map +1 -0
- package/lib/providers/ActivitySendStatus/useSendStatusByActivityKey.js +31 -0
- package/lib/providers/ActivitySendStatusTelemetry/ActivitySendStatusTelemetryComposer.d.ts +3 -0
- package/lib/providers/ActivitySendStatusTelemetry/ActivitySendStatusTelemetryComposer.d.ts.map +1 -0
- package/lib/providers/ActivitySendStatusTelemetry/ActivitySendStatusTelemetryComposer.js +71 -0
- package/lib/providers/ActivityTyping/ActivityTypingComposer.d.ts +9 -0
- package/lib/providers/ActivityTyping/ActivityTypingComposer.d.ts.map +1 -0
- package/lib/providers/ActivityTyping/ActivityTypingComposer.js +98 -0
- package/lib/providers/ActivityTyping/private/Context.d.ts +8 -0
- package/lib/providers/ActivityTyping/private/Context.d.ts.map +1 -0
- package/lib/providers/ActivityTyping/private/Context.js +15 -0
- package/lib/providers/ActivityTyping/private/useContext.d.ts +3 -0
- package/lib/providers/ActivityTyping/private/useContext.d.ts.map +1 -0
- package/lib/providers/ActivityTyping/private/useContext.js +13 -0
- package/lib/providers/ActivityTyping/private/useMemoWithPrevious.d.ts +3 -0
- package/lib/providers/ActivityTyping/private/useMemoWithPrevious.d.ts.map +1 -0
- package/lib/providers/ActivityTyping/private/useMemoWithPrevious.js +22 -0
- package/lib/providers/ActivityTyping/types/AllTyping.d.ts +9 -0
- package/lib/providers/ActivityTyping/types/AllTyping.d.ts.map +1 -0
- package/lib/providers/ActivityTyping/types/AllTyping.js +2 -0
- package/lib/providers/ActivityTyping/useAllTyping.d.ts +3 -0
- package/lib/providers/ActivityTyping/useAllTyping.d.ts.map +1 -0
- package/lib/providers/ActivityTyping/useAllTyping.js +12 -0
- package/lib/providers/Ponyfill/PonyfillComposer.d.ts +17 -0
- package/lib/providers/Ponyfill/PonyfillComposer.d.ts.map +1 -0
- package/lib/providers/Ponyfill/PonyfillComposer.js +87 -0
- package/lib/providers/Ponyfill/private/PonyfillContext.d.ts +8 -0
- package/lib/providers/Ponyfill/private/PonyfillContext.d.ts.map +1 -0
- package/lib/providers/Ponyfill/private/PonyfillContext.js +10 -0
- package/lib/providers/Ponyfill/private/useContext.d.ts +6 -0
- package/lib/providers/Ponyfill/private/useContext.d.ts.map +1 -0
- package/lib/providers/Ponyfill/private/useContext.js +17 -0
- package/lib/providers/Ponyfill/usePonyfill.d.ts +3 -0
- package/lib/providers/Ponyfill/usePonyfill.d.ts.map +1 -0
- package/lib/providers/Ponyfill/usePonyfill.js +12 -0
- package/lib/tsconfig.json +18 -0
- package/lib/types/ActivityMiddleware.d.ts +24 -0
- package/lib/types/ActivityMiddleware.d.ts.map +1 -0
- package/lib/types/ActivityMiddleware.js +2 -0
- package/lib/types/ActivityStatusMiddleware.d.ts +17 -0
- package/lib/types/ActivityStatusMiddleware.d.ts.map +1 -0
- package/lib/types/ActivityStatusMiddleware.js +2 -0
- package/lib/types/AttachmentForScreenReaderMiddleware.d.ts +14 -0
- package/lib/types/AttachmentForScreenReaderMiddleware.d.ts.map +1 -0
- package/lib/types/AttachmentForScreenReaderMiddleware.js +2 -0
- package/lib/types/AttachmentMiddleware.d.ts +12 -0
- package/lib/types/AttachmentMiddleware.d.ts.map +1 -0
- package/lib/types/AttachmentMiddleware.js +2 -0
- package/lib/types/AvatarMiddleware.d.ts +15 -0
- package/lib/types/AvatarMiddleware.d.ts.map +1 -0
- package/lib/types/AvatarMiddleware.js +2 -0
- package/lib/types/CardActionMiddleware.d.ts +19 -0
- package/lib/types/CardActionMiddleware.d.ts.map +1 -0
- package/lib/types/CardActionMiddleware.js +2 -0
- package/lib/types/ComponentMiddleware.d.ts +31 -0
- package/lib/types/ComponentMiddleware.d.ts.map +1 -0
- package/lib/types/ComponentMiddleware.js +2 -0
- package/lib/types/ContextOf.d.ts +4 -0
- package/lib/types/ContextOf.d.ts.map +1 -0
- package/lib/types/ContextOf.js +2 -0
- package/lib/types/FunctionMiddleware.d.ts +6 -0
- package/lib/types/FunctionMiddleware.d.ts.map +1 -0
- package/lib/types/FunctionMiddleware.js +2 -0
- package/lib/types/GroupActivitiesMiddleware.d.ts +22 -0
- package/lib/types/GroupActivitiesMiddleware.d.ts.map +1 -0
- package/lib/types/GroupActivitiesMiddleware.js +2 -0
- package/lib/types/LocalizedStrings.d.ts +5 -0
- package/lib/types/LocalizedStrings.d.ts.map +1 -0
- package/lib/types/LocalizedStrings.js +2 -0
- package/lib/types/Notification.d.ts +10 -0
- package/lib/types/Notification.d.ts.map +1 -0
- package/lib/types/Notification.js +2 -0
- package/lib/types/PrecompiledGlobalize.d.ts +13 -0
- package/lib/types/PrecompiledGlobalize.d.ts.map +1 -0
- package/lib/types/PrecompiledGlobalize.js +2 -0
- package/lib/types/ScrollToEndButtonMiddleware.d.ts +30 -0
- package/lib/types/ScrollToEndButtonMiddleware.d.ts.map +1 -0
- package/lib/types/ScrollToEndButtonMiddleware.js +2 -0
- package/lib/types/SendStatus.d.ts +3 -0
- package/lib/types/SendStatus.d.ts.map +1 -0
- package/lib/types/SendStatus.js +2 -0
- package/lib/types/TelemetryMeasurementEvent.d.ts +31 -0
- package/lib/types/TelemetryMeasurementEvent.d.ts.map +1 -0
- package/lib/types/TelemetryMeasurementEvent.js +2 -0
- package/lib/types/ToastMiddleware.d.ts +11 -0
- package/lib/types/ToastMiddleware.d.ts.map +1 -0
- package/lib/types/ToastMiddleware.js +2 -0
- package/lib/types/Typing.d.ts +8 -0
- package/lib/types/Typing.d.ts.map +1 -0
- package/lib/types/Typing.js +2 -0
- package/lib/types/TypingIndicatorMiddleware.d.ts +17 -0
- package/lib/types/TypingIndicatorMiddleware.d.ts.map +1 -0
- package/lib/types/TypingIndicatorMiddleware.js +2 -0
- package/lib/types/WebSpeechPonyfill.d.ts +19 -0
- package/lib/types/WebSpeechPonyfill.d.ts.map +1 -0
- package/lib/types/WebSpeechPonyfill.js +2 -0
- package/lib/types/WebSpeechPonyfillFactory.d.ts +6 -0
- package/lib/types/WebSpeechPonyfillFactory.d.ts.map +1 -0
- package/lib/types/WebSpeechPonyfillFactory.js +2 -0
- package/lib/utils/createCustomEvent.d.ts +4 -0
- package/lib/utils/createCustomEvent.d.ts.map +1 -0
- package/lib/utils/createCustomEvent.js +34 -0
- package/lib/utils/findLastIndex.d.ts +2 -0
- package/lib/utils/findLastIndex.d.ts.map +1 -0
- package/lib/utils/findLastIndex.js +22 -0
- package/lib/utils/findMin.d.ts +7 -0
- package/lib/utils/findMin.d.ts.map +1 -0
- package/lib/utils/findMin.js +46 -0
- package/lib/utils/freezeArray.d.ts +8 -0
- package/lib/utils/freezeArray.d.ts.map +1 -0
- package/lib/utils/freezeArray.js +19 -0
- package/lib/utils/isObject.js +12 -0
- package/lib/utils/mapMap.d.ts +6 -0
- package/lib/utils/mapMap.d.ts.map +1 -0
- package/lib/utils/mapMap.js +27 -0
- package/lib/utils/normalizeLanguage.d.ts +2 -0
- package/lib/utils/normalizeLanguage.d.ts.map +1 -0
- package/lib/utils/normalizeLanguage.js +115 -0
- package/lib/utils/randomId.d.ts +2 -0
- package/lib/utils/randomId.d.ts.map +1 -0
- package/lib/utils/randomId.js +15 -0
- package/lib/utils/warnOnce.d.ts +2 -0
- package/lib/utils/warnOnce.d.ts.map +1 -0
- package/lib/utils/warnOnce.js +16 -0
- package/package.json +90 -158
- package/src/StyleOptions.ts +285 -400
- package/src/decorator/index.ts +4 -0
- package/src/decorator/private/ActivityBorderDecoratorMiddleware.ts +31 -0
- package/src/decorator/private/ActivityDecorator.tsx +31 -0
- package/src/decorator/private/DecoratorComposer.tsx +6 -0
- package/src/decorator/private/activityDecoratorRequest.ts +6 -0
- package/src/decorator/private/createDecoratorComposer.tsx +36 -0
- package/src/{middleware → decorator}/private/templateMiddleware.test.tsx +17 -19
- package/src/decorator/private/templateMiddleware.ts +58 -0
- package/src/defaultStyleOptions.ts +23 -40
- package/src/hooks/Composer.tsx +142 -204
- package/src/hooks/index.ts +2 -19
- package/src/hooks/internal/ErrorBox.js +34 -0
- package/src/hooks/internal/SendBoxMiddleware.ts +21 -0
- package/src/hooks/internal/SendBoxToolbarMiddleware.ts +21 -0
- package/src/hooks/internal/Tracker.ts +1 -1
- package/src/hooks/internal/WebChatAPIContext.ts +12 -7
- package/src/hooks/internal/WebChatReduxContext.js +2 -3
- package/src/hooks/internal/private/templateMiddleware.ts +4 -0
- package/src/hooks/internal/useCreateActivityRendererInternal.ts +46 -0
- package/src/hooks/internal/useDebugDeps.js +30 -0
- package/src/hooks/internal/useErrorBoxClass.js +7 -0
- package/src/hooks/middleware/UserlandBoundary.js +2 -2
- package/src/hooks/middleware/applyMiddleware.js +5 -5
- package/src/hooks/middleware/concatMiddleware.spec.js +0 -20
- package/src/hooks/middleware/concatMiddleware.ts +6 -7
- package/src/hooks/middleware/createDefaultGroupActivitiesMiddleware.ts +75 -0
- package/src/hooks/private/reduceIterable.spec.ts +2 -0
- package/src/hooks/useActiveTyping.ts +2 -3
- package/src/hooks/useActivities.ts +3 -62
- package/src/hooks/useCreateActivityRenderer.ts +6 -27
- package/src/hooks/useCreateActivityStatusRenderer.tsx +33 -13
- package/src/hooks/useCreateAvatarRenderer.ts +33 -19
- package/src/hooks/useDebouncedNotifications.spec.js +0 -1
- package/src/hooks/useDisabled.ts +2 -8
- package/src/hooks/useGroupActivities.ts +10 -0
- package/src/hooks/useLocalizer.ts +3 -3
- package/src/hooks/useRenderAttachment.ts +2 -2
- package/src/hooks/useSendBoxAttachments.ts +0 -2
- package/src/hooks/useSendFiles.ts +1 -1
- package/src/hooks/useSendTimeoutForActivity.ts +0 -2
- package/src/hooks/useStyleOptions.ts +6 -1
- package/src/hooks/useSuggestedActions.ts +23 -9
- package/src/hooks/useTrackEvent.ts +3 -3
- package/src/index.ts +94 -52
- package/src/internal.ts +3 -0
- package/src/localization/ar-SA.json +111 -134
- package/src/localization/bg-BG.json +111 -134
- package/src/localization/ca-ES.json +111 -134
- package/src/localization/cs-CZ.json +111 -134
- package/src/localization/da-DK.json +111 -134
- package/src/localization/de-DE.json +111 -134
- package/src/localization/el-GR.json +111 -134
- package/src/localization/en-US.json +19 -45
- package/src/localization/es-ES.json +111 -134
- package/src/localization/et-EE.json +111 -134
- package/src/localization/eu-ES.json +111 -134
- package/src/localization/fi-FI.json +111 -134
- package/src/localization/fr-FR.json +111 -134
- package/src/localization/gl-ES.json +111 -134
- package/src/localization/he-IL.json +111 -134
- package/src/localization/hi-IN.json +111 -134
- package/src/localization/hr-HR.json +111 -134
- package/src/localization/hu-HU.json +111 -134
- package/src/localization/id-ID.json +111 -134
- package/src/localization/it-IT.json +111 -134
- package/src/localization/ja-JP.json +111 -134
- package/src/localization/kk-KZ.json +111 -134
- package/src/localization/ko-KR.json +111 -134
- package/src/localization/lt-LT.json +111 -134
- package/src/localization/lv-LV.json +111 -134
- package/src/localization/ms-MY.json +111 -134
- package/src/localization/nb-NO.json +111 -134
- package/src/localization/nl-NL.json +111 -134
- package/src/localization/pl-PL.json +111 -134
- package/src/localization/pt-BR.json +111 -134
- package/src/localization/pt-PT.json +111 -134
- package/src/localization/ro-RO.json +111 -134
- package/src/localization/ru-RU.json +111 -134
- package/src/localization/sk-SK.json +111 -134
- package/src/localization/sl-SI.json +111 -134
- package/src/localization/sr-Cyrl-CS.json +111 -134
- package/src/localization/sr-Latn-CS.json +111 -134
- package/src/localization/sv-SE.json +111 -134
- package/src/localization/th-TH.json +111 -134
- package/src/localization/tr-TR.json +111 -134
- package/src/localization/uk-UA.json +111 -134
- package/src/localization/vi-VN.json +111 -134
- package/src/localization/yue.json +16 -5
- package/src/localization/zh-CN.json +111 -134
- package/src/localization/zh-HK.json +111 -134
- package/src/localization/zh-TW.json +111 -134
- package/src/normalizeStyleOptions.ts +76 -51
- package/src/patchStyleOptionsFromDeprecatedProps.js +14 -0
- package/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx +40 -197
- package/src/providers/ActivityKeyer/private/someIterable.spec.ts +2 -0
- package/src/providers/ActivityListener/ActivityListenerComposer.tsx +1 -1
- package/src/providers/ActivitySendStatus/ActivitySendStatusComposer.tsx +3 -6
- package/src/providers/ActivityTyping/ActivityTypingComposer.tsx +59 -145
- package/src/providers/ActivityTyping/private/useMemoWithPrevious.ts +17 -0
- package/src/tsconfig.json +14 -5
- package/src/types/ActivityMiddleware.ts +36 -0
- package/src/types/ActivityStatusMiddleware.ts +9 -1
- package/src/types/AttachmentForScreenReaderMiddleware.ts +2 -9
- package/src/types/AttachmentMiddleware.ts +16 -0
- package/src/types/AvatarMiddleware.ts +1 -12
- package/src/types/CardActionMiddleware.ts +0 -2
- package/src/types/ComponentMiddleware.ts +1 -1
- package/src/types/GroupActivitiesMiddleware.ts +11 -7
- package/src/utils/isObject.js +5 -0
- package/src/utils/warnOnce.ts +10 -0
- package/LICENSE +0 -21
- package/boot/deprecated/decorator.js +0 -7
- package/boot/deprecated/decorator.mjs +0 -5
- package/boot/deprecated/graph.js +0 -7
- package/boot/deprecated/graph.mjs +0 -5
- package/boot/deprecated/hook.js +0 -7
- package/boot/deprecated/hook.mjs +0 -5
- package/boot/deprecated/internal.js +0 -7
- package/boot/deprecated/internal.mjs +0 -5
- package/boot/deprecated/middleware.js +0 -7
- package/boot/deprecated/middleware.mjs +0 -5
- package/dist/StyleOptions-4TkRjGbQ.d.mts +0 -802
- package/dist/StyleOptions-4TkRjGbQ.d.ts +0 -802
- package/dist/_dtsroll-chunks/B1b7R2eH-avatarMiddleware-CHa011_j.d.ts +0 -109
- package/dist/_dtsroll-chunks/CEcj2Npa-botframework-webchat-redux-store.d.ts +0 -16
- package/dist/_dtsroll-chunks/CZE5KEv8-botframework-webchat-api-middleware.d.ts +0 -230
- package/dist/_dtsroll-chunks/Dtb0H_Ee-handler-chain.d.ts +0 -4
- package/dist/_dtsroll-chunks/N-ttGLxs-botframework-webchat-base.utils.d.ts +0 -4
- package/dist/_dtsroll-chunks/qKTV3q17-avatarMiddleware-CHa011_j.d.ts +0 -93
- package/dist/botframework-webchat-api.d.ts +0 -387
- package/dist/botframework-webchat-api.decorator.d.ts +0 -81
- package/dist/botframework-webchat-api.decorator.js +0 -2
- package/dist/botframework-webchat-api.decorator.js.map +0 -1
- package/dist/botframework-webchat-api.graph.d.mts +0 -5
- package/dist/botframework-webchat-api.graph.d.ts +0 -2
- package/dist/botframework-webchat-api.graph.js +0 -2
- package/dist/botframework-webchat-api.graph.js.map +0 -1
- package/dist/botframework-webchat-api.graph.mjs +0 -2
- package/dist/botframework-webchat-api.hook.d.mts +0 -9
- package/dist/botframework-webchat-api.hook.d.ts +0 -9
- package/dist/botframework-webchat-api.hook.js +0 -2
- package/dist/botframework-webchat-api.hook.js.map +0 -1
- package/dist/botframework-webchat-api.hook.mjs +0 -2
- package/dist/botframework-webchat-api.hook.mjs.map +0 -1
- package/dist/botframework-webchat-api.internal.d.ts +0 -68
- package/dist/botframework-webchat-api.internal.js +0 -2
- package/dist/botframework-webchat-api.internal.js.map +0 -1
- package/dist/botframework-webchat-api.js +0 -2
- package/dist/botframework-webchat-api.js.map +0 -1
- package/dist/botframework-webchat-api.middleware.d.mts +0 -45
- package/dist/botframework-webchat-api.middleware.d.ts +0 -45
- package/dist/botframework-webchat-api.middleware.js +0 -2
- package/dist/botframework-webchat-api.middleware.js.map +0 -1
- package/dist/botframework-webchat-api.middleware.mjs +0 -2
- package/dist/botframework-webchat-api.middleware.mjs.map +0 -1
- package/dist/chunk-3YCFZWVR.js +0 -2
- package/dist/chunk-3YCFZWVR.js.map +0 -1
- package/dist/chunk-3ZWCT7YW.js +0 -2
- package/dist/chunk-3ZWCT7YW.js.map +0 -1
- package/dist/chunk-5HALOM2E.mjs +0 -2
- package/dist/chunk-5HALOM2E.mjs.map +0 -1
- package/dist/chunk-5JETBPYY.mjs +0 -2
- package/dist/chunk-5JETBPYY.mjs.map +0 -1
- package/dist/chunk-5X4VJZOM.js +0 -2
- package/dist/chunk-5X4VJZOM.js.map +0 -1
- package/dist/chunk-7GV72C4W.js +0 -2
- package/dist/chunk-7GV72C4W.js.map +0 -1
- package/dist/chunk-7IP5FN7Q.mjs +0 -2
- package/dist/chunk-7IP5FN7Q.mjs.map +0 -1
- package/dist/chunk-A6GQOZT3.js +0 -2
- package/dist/chunk-A6GQOZT3.js.map +0 -1
- package/dist/chunk-CIL5QUZ4.js +0 -2
- package/dist/chunk-CIL5QUZ4.js.map +0 -1
- package/dist/chunk-FA2GLWPN.mjs +0 -2
- package/dist/chunk-FA2GLWPN.mjs.map +0 -1
- package/dist/chunk-FD7QXXVX.js +0 -2
- package/dist/chunk-FD7QXXVX.js.map +0 -1
- package/dist/chunk-FOKVXAWC.mjs +0 -2
- package/dist/chunk-FOKVXAWC.mjs.map +0 -1
- package/dist/chunk-G5ZR6XJL.js +0 -2
- package/dist/chunk-G5ZR6XJL.js.map +0 -1
- package/dist/chunk-HIYAS5EE.js +0 -2
- package/dist/chunk-HIYAS5EE.js.map +0 -1
- package/dist/chunk-HJXXCOFT.js +0 -2
- package/dist/chunk-HJXXCOFT.js.map +0 -1
- package/dist/chunk-JKWDQH6P.mjs +0 -2
- package/dist/chunk-JKWDQH6P.mjs.map +0 -1
- package/dist/chunk-KDDULPEL.js +0 -2
- package/dist/chunk-KDDULPEL.js.map +0 -1
- package/dist/chunk-KGCBCAKG.js +0 -2
- package/dist/chunk-KGCBCAKG.js.map +0 -1
- package/dist/chunk-RLEJOP6E.mjs +0 -2
- package/dist/chunk-RLEJOP6E.mjs.map +0 -1
- package/dist/chunk-SOXBB2PI.mjs +0 -2
- package/dist/chunk-SOXBB2PI.mjs.map +0 -1
- package/dist/chunk-TU4357L3.mjs +0 -2
- package/dist/chunk-TU4357L3.mjs.map +0 -1
- package/dist/chunk-TWUVYAF5.mjs +0 -2
- package/dist/chunk-TWUVYAF5.mjs.map +0 -1
- package/dist/chunk-VAX7AB37.mjs.map +0 -1
- package/dist/chunk-VNGDFILB.mjs +0 -2
- package/dist/chunk-VNGDFILB.mjs.map +0 -1
- package/dist/hook-BXcgekzo.d.mts +0 -536
- package/dist/hook-C8NHjp6P.d.ts +0 -536
- package/dist/metafile-cjs.json +0 -1
- package/dist/templateMiddleware-BEttHPJk.d.mts +0 -20
- package/dist/templateMiddleware-BEttHPJk.d.ts +0 -20
- package/dist/types-BKuj7f2p.d.ts +0 -228
- package/dist/types-BZzd7aAk.d.mts +0 -228
- package/graph.js +0 -3
- package/hook.js +0 -3
- package/middleware.js +0 -3
- package/src/__tests__/addMetaTag.spec.js +0 -9
- package/src/__tests__/addMetaTag.spec.mjs +0 -9
- package/src/boot/decorator.ts +0 -21
- package/src/boot/graph.ts +0 -1
- package/src/boot/hook.ts +0 -82
- package/src/boot/internal.ts +0 -7
- package/src/boot/middleware.ts +0 -60
- package/src/buildInfo.ts +0 -9
- package/src/decorator/ActivityBorder/ActivityBorderDecorator.tsx +0 -57
- package/src/decorator/ActivityBorder/private/ActivityBorderDecoratorMiddleware.ts +0 -34
- package/src/decorator/ActivityBorder/private/ActivityBorderDecoratorRequestContext.ts +0 -48
- package/src/decorator/ActivityGrouping/ActivityGroupingDecorator.tsx +0 -43
- package/src/decorator/ActivityGrouping/private/ActivityGroupingDecoratorMiddleware.ts +0 -40
- package/src/decorator/DecoratorComposer.tsx +0 -51
- package/src/decorator/internal/InternalDecoratorComposer.tsx +0 -33
- package/src/decorator/internal/LowPriorityDecoratorComposer.tsx +0 -19
- package/src/decorator/private/DecoratorComposerContext.ts +0 -16
- package/src/decorator/private/PassthroughFallback.tsx +0 -12
- package/src/decorator/private/templateDecorator.tsx +0 -113
- package/src/decorator/types.ts +0 -4
- package/src/decorator/useDecoratorRequest.ts +0 -15
- package/src/env.d.ts +0 -9
- package/src/errorBox/errorBoxTelemetryPolymiddleware.ts +0 -53
- package/src/hooks/internal/usePostVoiceActivity.ts +0 -18
- package/src/hooks/internal/useRegisterVoiceHandler.ts +0 -23
- package/src/hooks/internal/useShouldShowMicrophoneButton.ts +0 -22
- package/src/hooks/internal/useVoiceHandlers.ts +0 -11
- package/src/hooks/internal/useVoiceStateWritable.ts +0 -18
- package/src/hooks/middleware/activityFallbackPolymiddleware.ts +0 -23
- package/src/hooks/useStartVoice.ts +0 -9
- package/src/hooks/useStopVoice.ts +0 -9
- package/src/hooks/useUIState.ts +0 -18
- package/src/hooks/useVoiceRecordingMuted.ts +0 -24
- package/src/hooks/useVoiceState.ts +0 -15
- package/src/hooks/validation/uiState.parseUIState.spec.ts +0 -21
- package/src/hooks/validation/uiState.ts +0 -10
- package/src/legacy/LegacyActivityBridge.tsx +0 -77
- package/src/legacy/LegacyActivityBridgeContext.ts +0 -23
- package/src/legacy/createActivityPolymiddlewareFromLegacy.tsx +0 -123
- package/src/legacy/createAvatarPolymiddlewareFromLegacy.tsx +0 -102
- package/src/middleware/AvatarPolymiddlewareProxy.tsx +0 -46
- package/src/middleware/SendBoxMiddleware.ts +0 -28
- package/src/middleware/SendBoxToolbarMiddleware.ts +0 -28
- package/src/middleware/private/templateMiddleware.check.test.tsx +0 -47
- package/src/middleware/private/templateMiddleware.tsx +0 -106
- package/src/middleware/useBuildRenderAvatarCallback.ts +0 -37
- package/src/providers/ActivityTyping/private/useReduceActivities.spec.tsx +0 -236
- package/src/providers/ActivityTyping/private/useReduceActivities.ts +0 -49
- package/src/providers/Capabilities/CapabilitiesComposer.tsx +0 -53
- package/src/providers/Capabilities/private/Context.ts +0 -13
- package/src/providers/Capabilities/private/capabilityRegistry.ts +0 -45
- package/src/providers/Capabilities/private/fetchCapabilitiesFromAdapter.ts +0 -59
- package/src/providers/Capabilities/private/shallowEqual.ts +0 -18
- package/src/providers/Capabilities/private/useContext.ts +0 -12
- package/src/providers/Capabilities/types/Capabilities.ts +0 -16
- package/src/providers/Capabilities/useCapabilities.ts +0 -25
- package/src/providers/GroupActivities/GroupActivitiesComposer.tsx +0 -116
- package/src/providers/GroupActivities/private/GroupActivitiesContext.ts +0 -23
- package/src/providers/GroupActivities/private/createDefaultGroupActivitiesMiddleware.ts +0 -113
- package/src/providers/GroupActivities/private/isGroupingValid.ts +0 -41
- package/src/providers/GroupActivities/private/useGroupActivitiesContext.ts +0 -6
- package/src/providers/GroupActivities/useGroupActivities.ts +0 -20
- package/src/providers/GroupActivities/useGroupActivitiesByName.ts +0 -17
- package/src/providers/SpeechToSpeech/SpeechToSpeechComposer.tsx +0 -20
- package/src/providers/SpeechToSpeech/private/VoiceHandlerBridge.tsx +0 -23
- package/src/providers/SpeechToSpeech/private/VoiceRecorderBridge.tsx +0 -49
- package/src/providers/SpeechToSpeech/private/useAudioPlayer.spec.tsx +0 -355
- package/src/providers/SpeechToSpeech/private/useAudioPlayer.ts +0 -92
- package/src/providers/SpeechToSpeech/private/useRecorder.spec.tsx +0 -344
- package/src/providers/SpeechToSpeech/private/useRecorder.ts +0 -220
- package/src/providers/StyleOptions/StyleOptionsComposer.tsx +0 -46
- package/src/providers/StyleOptions/private/StyleOptionsContext.ts +0 -20
- package/src/providers/StyleOptions/private/rectifyStyleOptions.ts +0 -6
- package/src/providers/StyleOptions/useStyleOptions.ts +0 -6
- /package/dist/{botframework-webchat-api.graph.mjs.map → chunk-J6D5YEY6.mjs.map} +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useCallback,
|
|
1
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
import React, { useCallback, useMemo, useRef, type ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import reduceIterable from '../../hooks/private/reduceIterable';
|
|
5
5
|
import useActivities from '../../hooks/useActivities';
|
|
6
|
-
import usePonyfill from '../Ponyfill/usePonyfill';
|
|
7
6
|
import type { ActivityKeyerContextType } from './private/Context';
|
|
8
7
|
import ActivityKeyerContext from './private/Context';
|
|
9
8
|
import getActivityId from './private/getActivityId';
|
|
@@ -18,11 +17,19 @@ type ActivityToKeyMap = Map<WebChatActivity, string>;
|
|
|
18
17
|
type ClientActivityIdToKeyMap = Map<string, string>;
|
|
19
18
|
type KeyToActivitiesMap = Map<string, readonly WebChatActivity[]>;
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
const
|
|
20
|
+
function getTypingActivityId(activity: WebChatActivity): string | undefined {
|
|
21
|
+
const { type } = activity;
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
if (
|
|
24
|
+
(type === 'message' || type === 'typing') &&
|
|
25
|
+
'text' in activity &&
|
|
26
|
+
typeof activity.text === 'string' &&
|
|
27
|
+
'streamId' in activity.channelData &&
|
|
28
|
+
activity.channelData.streamId
|
|
29
|
+
) {
|
|
30
|
+
return activity.channelData.streamId;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
26
33
|
|
|
27
34
|
/**
|
|
28
35
|
* React context composer component to assign a perma-key to every activity.
|
|
@@ -39,7 +46,6 @@ const MUTABLE_ACTIVITY_WINDOW = 1_000;
|
|
|
39
46
|
* Local key are only persisted in memory. On refresh, they will be a new random key.
|
|
40
47
|
*/
|
|
41
48
|
const ActivityKeyerComposer = ({ children }: Readonly<{ children?: ReactNode | undefined }>) => {
|
|
42
|
-
const [{ cancelIdleCallback, clearTimeout, requestIdleCallback, setTimeout }] = usePonyfill();
|
|
43
49
|
const existingContext = useActivityKeyerContext(false);
|
|
44
50
|
|
|
45
51
|
if (existingContext) {
|
|
@@ -47,118 +53,13 @@ const ActivityKeyerComposer = ({ children }: Readonly<{ children?: ReactNode | u
|
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
const [activities] = useActivities();
|
|
56
|
+
const activityIdToKeyMapRef = useRef<Readonly<ActivityIdToKeyMap>>(Object.freeze(new Map()));
|
|
57
|
+
const activityToKeyMapRef = useRef<Readonly<ActivityToKeyMap>>(Object.freeze(new Map()));
|
|
58
|
+
const clientActivityIdToKeyMapRef = useRef<Readonly<ClientActivityIdToKeyMap>>(Object.freeze(new Map()));
|
|
59
|
+
const keyToActivitiesMapRef = useRef<Readonly<KeyToActivitiesMap>>(Object.freeze(new Map()));
|
|
50
60
|
|
|
51
|
-
// TODO: [
|
|
52
|
-
// the id should represent the latest available activity in the stream
|
|
53
|
-
//
|
|
54
|
-
// Maps are intentionally mutable so the incremental fast path can append to them in-place.
|
|
55
|
-
const activityIdToKeyMapRef = useRef<ActivityIdToKeyMap>(new Map());
|
|
56
|
-
const activityToKeyMapRef = useRef<ActivityToKeyMap>(new Map());
|
|
57
|
-
const clientActivityIdToKeyMapRef = useRef<ClientActivityIdToKeyMap>(new Map());
|
|
58
|
-
const keyToActivitiesMapRef = useRef<KeyToActivitiesMap>(new Map());
|
|
59
|
-
const prevActivitiesRef = useRef<readonly WebChatActivity[]>(Object.freeze([]));
|
|
60
|
-
const prevActivityKeysStateRef = useRef<readonly [readonly string[]]>(
|
|
61
|
-
Object.freeze([Object.freeze([])]) as readonly [readonly string[]]
|
|
62
|
-
);
|
|
63
|
-
const pendingFrozenCheckRef = useRef<
|
|
64
|
-
| {
|
|
65
|
-
readonly current: readonly WebChatActivity[];
|
|
66
|
-
readonly frozenBoundary: number;
|
|
67
|
-
readonly prev: readonly WebChatActivity[];
|
|
68
|
-
}
|
|
69
|
-
| undefined
|
|
70
|
-
>();
|
|
71
|
-
const warnedPositionsRef = useRef<Set<number>>(new Set());
|
|
72
|
-
|
|
73
|
-
// Incremental keying: the fast path only processes newly-appended activities (O(delta) per render)
|
|
74
|
-
// instead of re-iterating all activities (O(n) per render, O(n²) total for n streaming pushes).
|
|
61
|
+
// TODO: [P1] `useMemoWithPrevious` to check and cache the resulting array if it hasn't changed.
|
|
75
62
|
const activityKeysState = useMemo<readonly [readonly string[]]>(() => {
|
|
76
|
-
const prevActivities = prevActivitiesRef.current;
|
|
77
|
-
|
|
78
|
-
// Only the last MUTABLE_ACTIVITY_WINDOW activities are compared each render.
|
|
79
|
-
// Activities before the frozen boundary are assumed unchanged — O(1) instead of O(n).
|
|
80
|
-
const frozenBoundary = Math.max(0, Math.min(prevActivities.length, activities.length) - MUTABLE_ACTIVITY_WINDOW);
|
|
81
|
-
let commonPrefixLength = frozenBoundary;
|
|
82
|
-
const maxPrefix = Math.min(prevActivities.length, activities.length);
|
|
83
|
-
|
|
84
|
-
// eslint-disable-next-line security/detect-object-injection
|
|
85
|
-
while (commonPrefixLength < maxPrefix && prevActivities[commonPrefixLength] === activities[commonPrefixLength]) {
|
|
86
|
-
commonPrefixLength++;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const isAppendOnly = commonPrefixLength === prevActivities.length;
|
|
90
|
-
|
|
91
|
-
if (isAppendOnly) {
|
|
92
|
-
// Fast path: only new activities were appended — process them incrementally.
|
|
93
|
-
if (commonPrefixLength === activities.length) {
|
|
94
|
-
// Array reference changed but content is identical.
|
|
95
|
-
prevActivitiesRef.current = activities;
|
|
96
|
-
|
|
97
|
-
return prevActivityKeysStateRef.current;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Schedule deferred verification of the frozen portion only now that we know:
|
|
101
|
-
// (1) the update is append-only and (2) there are actual content changes.
|
|
102
|
-
if (frozenBoundary) {
|
|
103
|
-
pendingFrozenCheckRef.current = Object.freeze({ current: activities, frozenBoundary, prev: prevActivities });
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const { current: activityIdToKeyMap } = activityIdToKeyMapRef;
|
|
107
|
-
const { current: activityToKeyMap } = activityToKeyMapRef;
|
|
108
|
-
const { current: clientActivityIdToKeyMap } = clientActivityIdToKeyMapRef;
|
|
109
|
-
const { current: keyToActivitiesMap } = keyToActivitiesMapRef;
|
|
110
|
-
|
|
111
|
-
const newKeys: string[] = [];
|
|
112
|
-
|
|
113
|
-
for (let i = commonPrefixLength; i < activities.length; i++) {
|
|
114
|
-
// eslint-disable-next-line security/detect-object-injection
|
|
115
|
-
const activity = activities[i];
|
|
116
|
-
const activityId = getActivityId(activity);
|
|
117
|
-
const clientActivityId = getClientActivityId(activity);
|
|
118
|
-
const typingActivityId = getActivityLivestreamingMetadata(activity)?.sessionId;
|
|
119
|
-
|
|
120
|
-
// Since we mutate maps in-place, a single lookup covers both "previous" and
|
|
121
|
-
// "current-iteration" entries — equivalent to the slow path's dual-map check.
|
|
122
|
-
const key =
|
|
123
|
-
(clientActivityId && clientActivityIdToKeyMap.get(clientActivityId)) ||
|
|
124
|
-
(typingActivityId && activityIdToKeyMap.get(typingActivityId)) ||
|
|
125
|
-
(activityId && activityIdToKeyMap.get(activityId)) ||
|
|
126
|
-
activityToKeyMap.get(activity) ||
|
|
127
|
-
uniqueId();
|
|
128
|
-
|
|
129
|
-
activityId && activityIdToKeyMap.set(activityId, key);
|
|
130
|
-
typingActivityId && activityIdToKeyMap.set(typingActivityId, key);
|
|
131
|
-
clientActivityId && clientActivityIdToKeyMap.set(clientActivityId, key);
|
|
132
|
-
activityToKeyMap.set(activity, key);
|
|
133
|
-
|
|
134
|
-
const activitiesForKey = keyToActivitiesMap.get(key);
|
|
135
|
-
|
|
136
|
-
keyToActivitiesMap.set(
|
|
137
|
-
key,
|
|
138
|
-
activitiesForKey ? Object.freeze([...activitiesForKey, activity]) : Object.freeze([activity])
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
!activitiesForKey && newKeys.push(key);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
prevActivitiesRef.current = activities;
|
|
145
|
-
|
|
146
|
-
if (!newKeys.length) {
|
|
147
|
-
// New activities might be added to existing keys — no new keys, but the keyToActivitiesMap
|
|
148
|
-
// was mutated. Return a new tuple reference so context consumers re-render and see the
|
|
149
|
-
// updated activities-per-key via getActivitiesByKey.
|
|
150
|
-
return Object.freeze([prevActivityKeysStateRef.current[0]]) as readonly [readonly string[]];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const nextKeys = Object.freeze([...prevActivityKeysStateRef.current[0], ...newKeys]);
|
|
154
|
-
const result = Object.freeze([nextKeys]) as readonly [readonly string[]];
|
|
155
|
-
|
|
156
|
-
prevActivityKeysStateRef.current = result;
|
|
157
|
-
|
|
158
|
-
return result;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Slow path: activities were removed or reordered — full recalculation.
|
|
162
63
|
const { current: activityIdToKeyMap } = activityIdToKeyMapRef;
|
|
163
64
|
const { current: activityToKeyMap } = activityToKeyMapRef;
|
|
164
65
|
const { current: clientActivityIdToKeyMap } = clientActivityIdToKeyMapRef;
|
|
@@ -171,98 +72,34 @@ const ActivityKeyerComposer = ({ children }: Readonly<{ children?: ReactNode | u
|
|
|
171
72
|
activities.forEach(activity => {
|
|
172
73
|
const activityId = getActivityId(activity);
|
|
173
74
|
const clientActivityId = getClientActivityId(activity);
|
|
174
|
-
const typingActivityId =
|
|
75
|
+
const typingActivityId = getTypingActivityId(activity);
|
|
175
76
|
|
|
176
77
|
const key =
|
|
177
|
-
(clientActivityId &&
|
|
178
|
-
|
|
179
|
-
(
|
|
180
|
-
(activityIdToKeyMap.get(typingActivityId) || nextActivityIdToKeyMap.get(typingActivityId))) ||
|
|
181
|
-
(activityId && (activityIdToKeyMap.get(activityId) || nextActivityIdToKeyMap.get(activityId))) ||
|
|
78
|
+
(clientActivityId && clientActivityIdToKeyMap.get(clientActivityId)) ||
|
|
79
|
+
(typingActivityId && activityIdToKeyMap.get(typingActivityId)) ||
|
|
80
|
+
(activityId && activityIdToKeyMap.get(activityId)) ||
|
|
182
81
|
activityToKeyMap.get(activity) ||
|
|
183
|
-
nextActivityToKeyMap.get(activity) ||
|
|
184
82
|
uniqueId();
|
|
185
83
|
|
|
186
84
|
activityId && nextActivityIdToKeyMap.set(activityId, key);
|
|
187
|
-
typingActivityId && nextActivityIdToKeyMap.set(typingActivityId, key);
|
|
188
85
|
clientActivityId && nextClientActivityIdToKeyMap.set(clientActivityId, key);
|
|
189
86
|
nextActivityToKeyMap.set(activity, key);
|
|
190
87
|
nextActivityKeys.add(key);
|
|
191
88
|
|
|
192
|
-
const
|
|
89
|
+
const activities = nextKeyToActivitiesMap.has(key) ? [...nextKeyToActivitiesMap.get(key)] : [];
|
|
193
90
|
|
|
194
|
-
|
|
195
|
-
nextKeyToActivitiesMap.set(key, Object.freeze(
|
|
91
|
+
activities.push(activity);
|
|
92
|
+
nextKeyToActivitiesMap.set(key, Object.freeze(activities));
|
|
196
93
|
});
|
|
197
94
|
|
|
198
|
-
activityIdToKeyMapRef.current = nextActivityIdToKeyMap;
|
|
199
|
-
activityToKeyMapRef.current = nextActivityToKeyMap;
|
|
200
|
-
clientActivityIdToKeyMapRef.current = nextClientActivityIdToKeyMap;
|
|
201
|
-
keyToActivitiesMapRef.current = nextKeyToActivitiesMap;
|
|
202
|
-
prevActivitiesRef.current = activities;
|
|
203
|
-
|
|
204
|
-
// Slow path did a full recalculation — no frozen check needed, reset warnings.
|
|
205
|
-
pendingFrozenCheckRef.current = undefined;
|
|
206
|
-
warnedPositionsRef.current.clear();
|
|
207
|
-
|
|
208
|
-
const nextKeys = Object.freeze([...nextActivityKeys.values()]);
|
|
209
|
-
const result = Object.freeze([nextKeys]) as readonly [readonly string[]];
|
|
210
|
-
|
|
211
|
-
prevActivityKeysStateRef.current = result;
|
|
212
|
-
|
|
213
|
-
return result;
|
|
214
|
-
}, [
|
|
215
|
-
activities,
|
|
216
|
-
activityIdToKeyMapRef,
|
|
217
|
-
activityToKeyMapRef,
|
|
218
|
-
clientActivityIdToKeyMapRef,
|
|
219
|
-
keyToActivitiesMapRef,
|
|
220
|
-
pendingFrozenCheckRef,
|
|
221
|
-
prevActivitiesRef,
|
|
222
|
-
prevActivityKeysStateRef,
|
|
223
|
-
warnedPositionsRef
|
|
224
|
-
]);
|
|
225
|
-
|
|
226
|
-
// Deferred verification: after FROZEN_CHECK_TIMEOUT of quiet, validate that activities
|
|
227
|
-
// inside the frozen portion have not actually changed. Warn once per position if they did.
|
|
228
|
-
// Uses requestIdleCallback inside the timeout to avoid contending with the first post-stream repaint.
|
|
229
|
-
useEffect(() => {
|
|
230
|
-
const pending = pendingFrozenCheckRef.current;
|
|
231
|
-
|
|
232
|
-
if (!pending) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
let idleHandle: ReturnType<NonNullable<typeof requestIdleCallback>> | undefined;
|
|
237
|
-
|
|
238
|
-
const runCheck = () => {
|
|
239
|
-
const { current: currentActivities, frozenBoundary, prev: prevFrozenActivities } = pending;
|
|
240
|
-
|
|
241
|
-
for (let i = 0; i < frozenBoundary; i++) {
|
|
242
|
-
// eslint-disable-next-line security/detect-object-injection
|
|
243
|
-
if (prevFrozenActivities[i] !== currentActivities[i] && !warnedPositionsRef.current.has(i)) {
|
|
244
|
-
warnedPositionsRef.current.add(i);
|
|
245
|
-
|
|
246
|
-
console.warn(
|
|
247
|
-
`botframework-webchat internal: change in activity at position ${i} was not applied because it is outside the mutable window of ${MUTABLE_ACTIVITY_WINDOW}.`
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const timer = setTimeout(() => {
|
|
254
|
-
if (requestIdleCallback) {
|
|
255
|
-
idleHandle = requestIdleCallback(runCheck);
|
|
256
|
-
} else {
|
|
257
|
-
runCheck();
|
|
258
|
-
}
|
|
259
|
-
}, FROZEN_CHECK_TIMEOUT);
|
|
95
|
+
activityIdToKeyMapRef.current = Object.freeze(nextActivityIdToKeyMap);
|
|
96
|
+
activityToKeyMapRef.current = Object.freeze(nextActivityToKeyMap);
|
|
97
|
+
clientActivityIdToKeyMapRef.current = Object.freeze(nextClientActivityIdToKeyMap);
|
|
98
|
+
keyToActivitiesMapRef.current = Object.freeze(nextKeyToActivitiesMap);
|
|
260
99
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
};
|
|
265
|
-
}, [activities, cancelIdleCallback, clearTimeout, requestIdleCallback, setTimeout]);
|
|
100
|
+
// `nextActivityKeys` could potentially same as `prevActivityKeys` despite reference differences, we should memoize it.
|
|
101
|
+
return Object.freeze([Object.freeze([...nextActivityKeys.values()])]) as readonly [readonly string[]];
|
|
102
|
+
}, [activities, activityIdToKeyMapRef, activityToKeyMapRef, clientActivityIdToKeyMapRef, keyToActivitiesMapRef]);
|
|
266
103
|
|
|
267
104
|
const getActivitiesByKey: (key?: string | undefined) => readonly WebChatActivity[] | undefined = useCallback(
|
|
268
105
|
(key?: string | undefined): readonly WebChatActivity[] | undefined => key && keyToActivitiesMapRef.current.get(key),
|
|
@@ -285,7 +122,13 @@ const ActivityKeyerComposer = ({ children }: Readonly<{ children?: ReactNode | u
|
|
|
285
122
|
);
|
|
286
123
|
|
|
287
124
|
const contextValue = useMemo<ActivityKeyerContextType>(
|
|
288
|
-
() => ({
|
|
125
|
+
() => ({
|
|
126
|
+
activityKeysState,
|
|
127
|
+
getActivityByKey,
|
|
128
|
+
getActivitiesByKey,
|
|
129
|
+
getKeyByActivity,
|
|
130
|
+
getKeyByActivityId
|
|
131
|
+
}),
|
|
289
132
|
[activityKeysState, getActivitiesByKey, getActivityByKey, getKeyByActivity, getKeyByActivityId]
|
|
290
133
|
);
|
|
291
134
|
|
|
@@ -8,7 +8,7 @@ type Props = Readonly<{ children?: ReactNode | undefined }>;
|
|
|
8
8
|
|
|
9
9
|
const ActivityListenerComposer = memo(({ children }: Props) => {
|
|
10
10
|
const [activities] = useActivities();
|
|
11
|
-
const prevActivities = usePrevious<
|
|
11
|
+
const prevActivities = usePrevious<WebChatActivity[]>(activities, []);
|
|
12
12
|
|
|
13
13
|
const upsertedActivitiesState = useMemo<readonly [readonly WebChatActivity[]]>(() => {
|
|
14
14
|
const upserts: WebChatActivity[] = [];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef, type
|
|
2
|
-
import { querySendStatusFromOutgoingActivity } from 'botframework-webchat-core/activity.js';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, type FC, type PropsWithChildren } from 'react';
|
|
3
2
|
|
|
4
3
|
import { useActivities, usePonyfill } from '../../hooks/index';
|
|
5
4
|
import useForceRender from '../../hooks/internal/useForceRender';
|
|
@@ -15,7 +14,7 @@ import isMapEqual from './private/isMapEqual';
|
|
|
15
14
|
const EXPIRY_SEND_FAILED = -Infinity;
|
|
16
15
|
const EXPIRY_SENT = Infinity;
|
|
17
16
|
|
|
18
|
-
const ActivitySendStatusComposer = ({ children }
|
|
17
|
+
const ActivitySendStatusComposer: FC<PropsWithChildren<{}>> = ({ children }) => {
|
|
19
18
|
const [activities] = useActivities();
|
|
20
19
|
const [{ clearTimeout, Date, setTimeout }] = usePonyfill();
|
|
21
20
|
const forceRender = useForceRender();
|
|
@@ -44,11 +43,9 @@ const ActivitySendStatusComposer = ({ children }: Readonly<{ children?: ReactNod
|
|
|
44
43
|
|
|
45
44
|
if (key) {
|
|
46
45
|
const {
|
|
47
|
-
channelData: { state }
|
|
46
|
+
channelData: { state, 'webchat:send-status': sendStatus }
|
|
48
47
|
} = activity;
|
|
49
48
|
|
|
50
|
-
const sendStatus = querySendStatusFromOutgoingActivity(activity);
|
|
51
|
-
|
|
52
49
|
// `channelData.state` is being deprecated in favor of `channelData['webchat:send-status']`.
|
|
53
50
|
// Please refer to #4362 for details. Remove on or after 2024-07-31.
|
|
54
51
|
const rectifiedSendStatus = sendStatus || (state === 'sent' ? 'sent' : 'sending');
|
|
@@ -1,166 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import React, { memo, useCallback, useMemo, type ReactNode } from 'react';
|
|
1
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
import React, { memo, useMemo, type ReactNode } from 'react';
|
|
3
|
+
import { useRefFrom } from 'use-ref-from';
|
|
5
4
|
|
|
6
5
|
import numberWithInfinity from '../../hooks/private/numberWithInfinity';
|
|
6
|
+
import useActivities from '../../hooks/useActivities';
|
|
7
7
|
import usePonyfill from '../../hooks/usePonyfill';
|
|
8
|
+
import useUpsertedActivities from '../../providers/ActivityListener/useUpsertedActivities';
|
|
8
9
|
import ActivityTypingContext, { ActivityTypingContextType } from './private/Context';
|
|
9
|
-
import
|
|
10
|
+
import useMemoWithPrevious from './private/useMemoWithPrevious';
|
|
10
11
|
import { type AllTyping } from './types/AllTyping';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
livestreamActivities: Map<
|
|
14
|
-
string,
|
|
15
|
-
{
|
|
16
|
-
activity: WebChatActivity;
|
|
17
|
-
contentful: boolean;
|
|
18
|
-
firstReceivedAt: number;
|
|
19
|
-
lastReceivedAt: number;
|
|
20
|
-
}
|
|
21
|
-
>;
|
|
22
|
-
name: string | undefined;
|
|
23
|
-
role: 'bot' | 'user';
|
|
24
|
-
typingIndicator:
|
|
25
|
-
| {
|
|
26
|
-
activity: WebChatActivity;
|
|
27
|
-
duration: number;
|
|
28
|
-
firstReceivedAt: number;
|
|
29
|
-
lastReceivedAt: number;
|
|
30
|
-
}
|
|
31
|
-
| undefined;
|
|
32
|
-
};
|
|
13
|
+
const INITIAL_ALL_TYPING_STATE = Object.freeze([Object.freeze(new Map())] as const);
|
|
33
14
|
|
|
34
15
|
type Props = Readonly<{ children?: ReactNode | undefined }>;
|
|
35
16
|
|
|
17
|
+
function isLivestreamChunk(activity: WebChatActivity): boolean {
|
|
18
|
+
return (
|
|
19
|
+
activity.type === 'typing' &&
|
|
20
|
+
'text' in activity &&
|
|
21
|
+
typeof activity.text === 'string' &&
|
|
22
|
+
activity.channelData.streamType !== 'informative'
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
36
26
|
const ActivityTypingComposer = ({ children }: Props) => {
|
|
37
27
|
const [{ Date }] = usePonyfill();
|
|
28
|
+
const [activities] = useActivities();
|
|
29
|
+
const [upsertedActivities] = useUpsertedActivities();
|
|
30
|
+
const activitiesRef = useRefFrom(activities);
|
|
31
|
+
|
|
32
|
+
const allTypingState = useMemoWithPrevious<readonly [ReadonlyMap<string, AllTyping>]>(
|
|
33
|
+
(prevAllTypingState = INITIAL_ALL_TYPING_STATE) => {
|
|
34
|
+
const { current: activities } = activitiesRef;
|
|
35
|
+
const nextTyping = new Map(prevAllTypingState[0]);
|
|
36
|
+
let changed = false;
|
|
37
|
+
|
|
38
|
+
const firstIndex = upsertedActivities.reduce(
|
|
39
|
+
(firstIndex, upsertedActivity) => Math.min(firstIndex, activities.indexOf(upsertedActivity)),
|
|
40
|
+
Infinity
|
|
41
|
+
);
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
type
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (livestreamingMetadata) {
|
|
68
|
-
mutableEntry.typingIndicator = undefined;
|
|
69
|
-
|
|
70
|
-
const { sessionId } = livestreamingMetadata;
|
|
71
|
-
|
|
72
|
-
if (livestreamingMetadata.type === 'final activity') {
|
|
73
|
-
mutableEntry.livestreamActivities.delete(sessionId);
|
|
74
|
-
} else {
|
|
75
|
-
mutableEntry.livestreamActivities.set(
|
|
76
|
-
sessionId,
|
|
77
|
-
Object.freeze({
|
|
78
|
-
firstReceivedAt: mutableEntry.livestreamActivities.get(sessionId)?.firstReceivedAt ?? receivedAt,
|
|
79
|
-
...mutableEntry.livestreamActivities.get(sessionId),
|
|
80
|
-
activity,
|
|
81
|
-
contentful: livestreamingMetadata.type !== 'contentless',
|
|
82
|
-
lastReceivedAt: receivedAt
|
|
83
|
-
})
|
|
84
|
-
);
|
|
43
|
+
for (const activity of activities.slice(firstIndex)) {
|
|
44
|
+
const {
|
|
45
|
+
from,
|
|
46
|
+
from: { id, role },
|
|
47
|
+
type
|
|
48
|
+
} = activity;
|
|
49
|
+
|
|
50
|
+
if (type === 'typing' && (role === 'bot' || role === 'user')) {
|
|
51
|
+
const currentTyping = nextTyping.get(id);
|
|
52
|
+
// TODO: When we rework on types of DLActivity, we will make sure all activities has "webChat.receivedAt", this coalesces can be removed.
|
|
53
|
+
const receivedAt = activity.channelData.webChat?.receivedAt || Date.now();
|
|
54
|
+
|
|
55
|
+
nextTyping.set(id, {
|
|
56
|
+
firstReceivedAt: currentTyping?.firstReceivedAt || receivedAt,
|
|
57
|
+
lastActivityDuration: numberWithInfinity(
|
|
58
|
+
activity.channelData.webChat?.styleOptions?.typingAnimationDuration
|
|
59
|
+
),
|
|
60
|
+
lastReceivedAt: receivedAt,
|
|
61
|
+
name: from.name,
|
|
62
|
+
role,
|
|
63
|
+
type: isLivestreamChunk(activity) ? 'livestream' : 'busy' // Informative message means the bot is busy.
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
changed = true;
|
|
67
|
+
} else if (type === 'message') {
|
|
68
|
+
nextTyping.delete(id);
|
|
69
|
+
changed = true;
|
|
85
70
|
}
|
|
86
|
-
} else if (type === 'message') {
|
|
87
|
-
mutableEntry.typingIndicator = undefined;
|
|
88
|
-
} else if (type === 'typing') {
|
|
89
|
-
mutableEntry.typingIndicator = Object.freeze({
|
|
90
|
-
activity,
|
|
91
|
-
duration: numberWithInfinity(activity.channelData.webChat?.styleOptions?.typingAnimationDuration),
|
|
92
|
-
firstReceivedAt: mutableEntry.typingIndicator?.firstReceivedAt ?? receivedAt,
|
|
93
|
-
lastReceivedAt: receivedAt
|
|
94
|
-
});
|
|
95
71
|
}
|
|
96
72
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return Object.freeze(typingState);
|
|
73
|
+
return changed ? Object.freeze([nextTyping]) : prevAllTypingState;
|
|
100
74
|
},
|
|
101
|
-
[
|
|
75
|
+
[activitiesRef, upsertedActivities]
|
|
102
76
|
);
|
|
103
77
|
|
|
104
|
-
const state: ReadonlyMap<string, Entry> = useReduceActivities(reducer) || Object.freeze(new Map());
|
|
105
|
-
|
|
106
|
-
const allTyping = useMemo(() => {
|
|
107
|
-
const map = new Map<string, AllTyping>();
|
|
108
|
-
|
|
109
|
-
for (const [id, entry] of state.entries()) {
|
|
110
|
-
const firstContentfulLivestream = iteratorFind(
|
|
111
|
-
entry.livestreamActivities.values(),
|
|
112
|
-
({ contentful }) => contentful
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
const firstContentlessLivestream = iteratorFind(
|
|
116
|
-
entry.livestreamActivities.values(),
|
|
117
|
-
({ contentful }) => !contentful
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
if (firstContentfulLivestream) {
|
|
121
|
-
map.set(
|
|
122
|
-
id,
|
|
123
|
-
Object.freeze({
|
|
124
|
-
firstReceivedAt: firstContentfulLivestream.firstReceivedAt,
|
|
125
|
-
lastActivityDuration: Infinity,
|
|
126
|
-
lastReceivedAt: firstContentfulLivestream.lastReceivedAt,
|
|
127
|
-
name: entry.name,
|
|
128
|
-
role: entry.role,
|
|
129
|
-
type: 'livestream'
|
|
130
|
-
} satisfies AllTyping)
|
|
131
|
-
);
|
|
132
|
-
} else if (firstContentlessLivestream) {
|
|
133
|
-
map.set(
|
|
134
|
-
id,
|
|
135
|
-
Object.freeze({
|
|
136
|
-
firstReceivedAt: firstContentlessLivestream.firstReceivedAt,
|
|
137
|
-
lastActivityDuration: Infinity,
|
|
138
|
-
lastReceivedAt: firstContentlessLivestream.lastReceivedAt,
|
|
139
|
-
name: entry.name,
|
|
140
|
-
role: entry.role,
|
|
141
|
-
type: 'busy'
|
|
142
|
-
} satisfies AllTyping)
|
|
143
|
-
);
|
|
144
|
-
} else if (entry.typingIndicator) {
|
|
145
|
-
map.set(
|
|
146
|
-
id,
|
|
147
|
-
Object.freeze({
|
|
148
|
-
firstReceivedAt: entry.typingIndicator.firstReceivedAt,
|
|
149
|
-
lastActivityDuration: entry.typingIndicator.duration,
|
|
150
|
-
lastReceivedAt: entry.typingIndicator.lastReceivedAt,
|
|
151
|
-
name: entry.name,
|
|
152
|
-
role: entry.role,
|
|
153
|
-
type: 'busy'
|
|
154
|
-
} satisfies AllTyping)
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return map;
|
|
160
|
-
}, [state]);
|
|
161
|
-
|
|
162
|
-
const allTypingState = useMemo(() => Object.freeze([allTyping] as const), [allTyping]);
|
|
163
|
-
|
|
164
78
|
const context = useMemo<ActivityTypingContextType>(() => ({ allTypingState }), [allTypingState]);
|
|
165
79
|
|
|
166
80
|
return <ActivityTypingContext.Provider value={context}>{children}</ActivityTypingContext.Provider>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// TODO: [P1] Dedupe.
|
|
2
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { DependencyList } from 'react';
|
|
5
|
+
|
|
6
|
+
export default function useMemoWithPrevious<T>(factory: (prevValue: T | undefined) => T, deps: DependencyList): T {
|
|
7
|
+
const prevValueRef = useRef<T | undefined>(undefined);
|
|
8
|
+
// We are building a `useMemo`-like hook, `deps` is passed as-is and `factory` is not one fo the dependencies.
|
|
9
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10
|
+
const value = useMemo<T>(() => factory(prevValueRef.current), deps);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
prevValueRef.current = value;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return value;
|
|
17
|
+
}
|
package/src/tsconfig.json
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"allowSyntheticDefaultImports": true,
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationDir": "../lib",
|
|
6
|
+
"declarationMap": true,
|
|
3
7
|
"downlevelIteration": true,
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
"emitDeclarationOnly": true,
|
|
9
|
+
"jsx": "react",
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"moduleResolution": "Bundler",
|
|
12
|
+
"preserveWatchOutput": true,
|
|
13
|
+
"pretty": true,
|
|
14
|
+
"resolveJsonModule": true, // Required for localization files
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"sourceMap": true
|
|
17
|
+
}
|
|
9
18
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { RenderAttachment } from './AttachmentMiddleware';
|
|
3
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
4
|
+
|
|
5
|
+
type ActivityProps = {
|
|
6
|
+
hideTimestamp: boolean;
|
|
7
|
+
renderActivityStatus: (options: { hideTimestamp: boolean }) => ReactNode;
|
|
8
|
+
renderAvatar: false | (() => Exclude<ReactNode, boolean | null | undefined>);
|
|
9
|
+
showCallout: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type ActivityComponent = (props: ActivityProps) => Exclude<ReactNode, boolean | null | undefined>;
|
|
13
|
+
|
|
14
|
+
type ActivityComponentFactoryOptions = {
|
|
15
|
+
activity: WebChatActivity;
|
|
16
|
+
nextVisibleActivity: WebChatActivity;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type ActivityComponentFactory = (options: ActivityComponentFactoryOptions) => ActivityComponent | false;
|
|
20
|
+
|
|
21
|
+
// TODO: [P2] This is inherited from our older signature (pre-hook) which requires passing "renderAttachment" argument.
|
|
22
|
+
// With hooks, the middleware should not need "renderAttachment", they can grab it from "useCreateAttachmentRenderer" hook.
|
|
23
|
+
type LegacyRenderActivity = (
|
|
24
|
+
renderAttachment: RenderAttachment,
|
|
25
|
+
{ hideTimestamp, renderActivityStatus, renderAvatar, showCallout }: ActivityProps
|
|
26
|
+
) => Exclude<ReactNode, boolean>;
|
|
27
|
+
|
|
28
|
+
type LegacyActivityRenderer = (options: ActivityComponentFactoryOptions) => LegacyRenderActivity | false;
|
|
29
|
+
|
|
30
|
+
// The middleware created by the web developer, are using the legacy signature (with "renderAttachment" argument).
|
|
31
|
+
type ActivityEnhancer = (next: LegacyActivityRenderer) => LegacyActivityRenderer;
|
|
32
|
+
type ActivityMiddleware = () => ActivityEnhancer;
|
|
33
|
+
|
|
34
|
+
export default ActivityMiddleware;
|
|
35
|
+
|
|
36
|
+
export type { ActivityComponentFactory, LegacyActivityRenderer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
2
1
|
import type { ReactElement } from 'react';
|
|
2
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
3
3
|
|
|
4
4
|
import type { SendStatus } from '../types/SendStatus';
|
|
5
5
|
|
|
@@ -8,6 +8,14 @@ type RenderActivityStatusOptions = {
|
|
|
8
8
|
activity: WebChatActivity;
|
|
9
9
|
hideTimestamp: boolean;
|
|
10
10
|
sendState: SendStatus;
|
|
11
|
+
|
|
12
|
+
// "nextVisibleActivity" is for backward compatibility, please remove this line on or after 2022-07-22.
|
|
13
|
+
/** @deprecated */
|
|
14
|
+
nextVisibleActivity: WebChatActivity;
|
|
15
|
+
|
|
16
|
+
// "sameTimestampGroup" is for backward compatibility, please remove this line on or after 2022-07-22.
|
|
17
|
+
/** @deprecated */
|
|
18
|
+
sameTimestampGroup: boolean;
|
|
11
19
|
};
|
|
12
20
|
|
|
13
21
|
type RenderActivityStatus = (options: RenderActivityStatusOptions) => ReactElement;
|