botframework-webchat-api 4.17.1 → 4.18.1-hotfix.20260127.b53acdf
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 +3 -0
- package/dist/botframework-webchat-api.d.mts +213 -55
- package/dist/botframework-webchat-api.d.ts +1612 -0
- package/dist/botframework-webchat-api.decorator.d.mts +30 -0
- package/dist/botframework-webchat-api.decorator.d.ts +30 -0
- package/dist/botframework-webchat-api.decorator.js +3 -0
- package/dist/botframework-webchat-api.decorator.js.map +1 -0
- package/dist/botframework-webchat-api.decorator.mjs +3 -0
- package/dist/botframework-webchat-api.decorator.mjs.LEGAL.txt +0 -0
- package/dist/botframework-webchat-api.decorator.mjs.map +1 -0
- package/dist/botframework-webchat-api.internal.d.mts +18 -1
- package/dist/botframework-webchat-api.internal.d.ts +20 -0
- package/dist/botframework-webchat-api.internal.js +3 -0
- package/dist/botframework-webchat-api.internal.js.LEGAL.txt +0 -0
- package/dist/botframework-webchat-api.internal.js.map +1 -0
- package/dist/botframework-webchat-api.internal.mjs +1 -1
- package/dist/botframework-webchat-api.internal.mjs.map +1 -1
- package/dist/botframework-webchat-api.js +3 -0
- package/dist/botframework-webchat-api.js.LEGAL.txt +0 -0
- package/dist/botframework-webchat-api.js.map +1 -0
- package/dist/botframework-webchat-api.mjs +1 -1
- package/dist/botframework-webchat-api.mjs.map +1 -1
- package/dist/chunk-2HABAU7C.mjs +3 -0
- package/dist/chunk-2HABAU7C.mjs.LEGAL.txt +0 -0
- package/dist/chunk-2HABAU7C.mjs.map +1 -0
- package/dist/chunk-45Z2ZE4M.js +3 -0
- package/dist/chunk-45Z2ZE4M.js.LEGAL.txt +0 -0
- package/dist/chunk-45Z2ZE4M.js.map +1 -0
- package/dist/chunk-7K3OK5TS.mjs +3 -0
- package/dist/chunk-7K3OK5TS.mjs.LEGAL.txt +0 -0
- package/dist/chunk-7K3OK5TS.mjs.map +1 -0
- package/dist/chunk-LXPINC7N.js +3 -0
- package/dist/chunk-LXPINC7N.js.LEGAL.txt +0 -0
- package/dist/chunk-LXPINC7N.js.map +1 -0
- package/dist/chunk-PRWGXTDA.mjs +3 -0
- package/dist/chunk-PRWGXTDA.mjs.LEGAL.txt +0 -0
- package/dist/chunk-PRWGXTDA.mjs.map +1 -0
- package/dist/chunk-WH7VSYKK.js +3 -0
- package/dist/chunk-WH7VSYKK.js.LEGAL.txt +0 -0
- package/dist/chunk-WH7VSYKK.js.map +1 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -1
- package/dist/types-BXPldIKA.d.mts +86 -0
- package/dist/types-BXPldIKA.d.ts +86 -0
- package/internal.js +1 -1
- package/package.json +68 -70
- package/src/StyleOptions.ts +123 -4
- package/src/decorator/ActivityBorder/ActivityBorderDecorator.tsx +48 -0
- package/src/decorator/ActivityBorder/private/ActivityBorderDecoratorMiddleware.ts +51 -0
- package/src/decorator/ActivityBorder/types.ts +1 -0
- package/src/decorator/ActivityGrouping/ActivityGroupingDecorator.tsx +31 -0
- package/src/decorator/ActivityGrouping/private/ActivityGroupingDecoratorMiddleware.ts +38 -0
- package/src/decorator/ActivityGrouping/types.ts +1 -0
- package/src/decorator/DecoratorComposer.tsx +22 -0
- package/src/decorator/internal/InternalDecoratorComposer.tsx +61 -0
- package/src/decorator/internal/LowPriorityDecoratorComposer.tsx +19 -0
- package/src/decorator/private/DecoratorComposerContext.ts +16 -0
- package/src/decorator/private/PassthroughFallback.tsx +12 -0
- package/src/decorator/private/templateMiddleware.test.tsx +100 -0
- package/src/decorator/private/templateMiddleware.ts +60 -0
- package/src/decorator/types.ts +15 -0
- package/src/decorator.ts +16 -0
- package/src/defaultStyleOptions.ts +26 -5
- package/{lib/external/PrecompiledGlobalize.cjs → src/external/PrecompiledGlobalize.js} +8 -7
- package/src/hooks/Composer.tsx +75 -53
- package/src/hooks/index.ts +7 -1
- package/src/hooks/internal/SendBoxMiddleware.ts +5 -3
- package/src/hooks/internal/SendBoxToolbarMiddleware.ts +5 -3
- package/src/hooks/internal/Tracker.ts +1 -1
- package/src/hooks/internal/WebChatAPIContext.ts +12 -5
- package/src/hooks/internal/private/templateMiddleware.ts +3 -43
- package/src/hooks/internal/usePrevious.ts +5 -2
- package/src/hooks/middleware/concatMiddleware.spec.js +20 -0
- package/src/hooks/middleware/concatMiddleware.ts +6 -5
- package/src/hooks/private/numberWithInfinity.spec.ts +9 -0
- package/src/hooks/private/numberWithInfinity.ts +15 -0
- package/src/hooks/private/reduceIterable.spec.ts +29 -0
- package/src/hooks/private/reduceIterable.ts +13 -0
- package/src/hooks/useActiveTyping.ts +31 -28
- package/src/hooks/useDisabled.ts +8 -2
- package/src/hooks/useGetActivitiesByKey.ts +3 -0
- package/src/hooks/useSuggestedActions.ts +17 -4
- package/src/hooks/useUIState.ts +18 -0
- package/src/hooks/validation/uiState.parseUIState.spec.ts +21 -0
- package/src/hooks/validation/uiState.ts +10 -0
- package/src/index.ts +4 -4
- package/src/internal.ts +3 -1
- package/src/localization/ar-SA.json +19 -0
- package/src/localization/bg-BG.json +19 -0
- package/src/localization/ca-ES.json +19 -0
- package/src/localization/cs-CZ.json +19 -0
- package/src/localization/da-DK.json +19 -0
- package/src/localization/de-DE.json +19 -0
- package/src/localization/el-GR.json +19 -0
- package/src/localization/en-US.json +20 -2
- package/src/localization/es-ES.json +19 -0
- package/src/localization/et-EE.json +19 -0
- package/src/localization/eu-ES.json +19 -0
- package/src/localization/fi-FI.json +19 -0
- package/src/localization/fr-FR.json +19 -0
- package/src/localization/gl-ES.json +19 -0
- package/src/localization/he-IL.json +20 -1
- package/src/localization/hi-IN.json +19 -0
- package/src/localization/hr-HR.json +19 -0
- package/src/localization/hu-HU.json +19 -0
- package/src/localization/id-ID.json +19 -0
- package/src/localization/it-IT.json +19 -0
- package/src/localization/ja-JP.json +19 -0
- package/src/localization/kk-KZ.json +19 -0
- package/src/localization/ko-KR.json +19 -0
- package/src/localization/lt-LT.json +19 -0
- package/src/localization/lv-LV.json +19 -0
- package/src/localization/ms-MY.json +19 -0
- package/src/localization/nb-NO.json +19 -0
- package/src/localization/nl-NL.json +19 -0
- package/src/localization/pl-PL.json +19 -0
- package/src/localization/pt-BR.json +19 -0
- package/src/localization/pt-PT.json +19 -0
- package/src/localization/ro-RO.json +19 -0
- package/src/localization/ru-RU.json +19 -0
- package/src/localization/sk-SK.json +19 -0
- package/src/localization/sl-SI.json +19 -0
- package/src/localization/sr-Cyrl-CS.json +19 -0
- package/src/localization/sr-Latn-CS.json +19 -0
- package/src/localization/sv-SE.json +19 -0
- package/src/localization/th-TH.json +19 -0
- package/src/localization/tr-TR.json +19 -0
- package/src/localization/uk-UA.json +19 -0
- package/src/localization/vi-VN.json +19 -0
- package/src/localization/zh-CN.json +21 -2
- package/src/localization/zh-HK.json +19 -0
- package/src/localization/zh-TW.json +19 -0
- package/src/normalizeStyleOptions.ts +45 -0
- package/src/providers/ActivityAcknowledgement/useLastReadActivityKey.ts +1 -1
- package/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx +50 -30
- package/src/providers/ActivityKeyer/private/Context.ts +2 -1
- package/src/providers/ActivityKeyer/private/lastOf.spec.ts +6 -0
- package/src/providers/ActivityKeyer/private/lastOf.ts +3 -0
- package/src/providers/ActivityKeyer/private/someIterable.spec.ts +44 -0
- package/src/providers/ActivityKeyer/private/someIterable.ts +9 -0
- package/src/providers/ActivityKeyer/useGetActivitiesByKey.ts +7 -0
- package/src/providers/ActivityListener/ActivityListenerComposer.tsx +28 -0
- package/src/providers/ActivityListener/private/Context.tsx +16 -0
- package/src/providers/ActivityListener/private/useContext.ts +6 -0
- package/src/providers/ActivityListener/useUpsertedActivities.ts +6 -0
- package/src/providers/ActivitySendStatus/ActivitySendStatusComposer.tsx +2 -2
- package/src/providers/ActivityTyping/ActivityTypingComposer.tsx +170 -0
- package/src/providers/ActivityTyping/private/Context.ts +16 -0
- package/src/providers/ActivityTyping/private/useContext.ts +6 -0
- package/src/providers/ActivityTyping/private/useMemoWithPrevious.ts +17 -0
- package/src/providers/ActivityTyping/private/useReduceActivities.spec.tsx +231 -0
- package/src/providers/ActivityTyping/private/useReduceActivities.ts +48 -0
- package/src/providers/ActivityTyping/types/AllTyping.ts +8 -0
- package/src/providers/ActivityTyping/useAllTyping.ts +6 -0
- package/src/providers/GroupActivities/GroupActivitiesComposer.tsx +115 -0
- package/src/providers/GroupActivities/private/GroupActivitiesContext.ts +23 -0
- package/src/providers/GroupActivities/private/createDefaultGroupActivitiesMiddleware.ts +93 -0
- package/src/providers/GroupActivities/private/isGroupingValid.ts +41 -0
- package/src/providers/GroupActivities/private/useGroupActivitiesContext.ts +6 -0
- package/src/providers/GroupActivities/useGroupActivities.ts +20 -0
- package/src/providers/GroupActivities/useGroupActivitiesByName.ts +17 -0
- package/src/tsconfig.json +1 -5
- package/src/types/AttachmentForScreenReaderMiddleware.ts +9 -2
- package/src/types/AvatarMiddleware.ts +5 -1
- package/src/types/CardActionMiddleware.ts +2 -0
- package/src/types/ComponentMiddleware.ts +1 -1
- package/src/types/GroupActivitiesMiddleware.ts +7 -11
- package/src/types/Typing.ts +2 -3
- package/src/utils/validateProps.spec.ts +74 -0
- package/src/utils/validateProps.ts +56 -0
- package/dist/chunk-4ZIUY4G5.mjs +0 -3
- package/dist/chunk-4ZIUY4G5.mjs.map +0 -1
- package/lib/StyleOptions.d.ts +0 -697
- package/lib/StyleOptions.d.ts.map +0 -1
- package/lib/StyleOptions.js +0 -2
- package/lib/defaultStyleOptions.d.ts +0 -4
- package/lib/defaultStyleOptions.d.ts.map +0 -1
- package/lib/defaultStyleOptions.js +0 -277
- package/lib/hooks/Composer.d.ts +0 -88
- package/lib/hooks/Composer.d.ts.map +0 -1
- package/lib/hooks/Composer.js +0 -602
- package/lib/hooks/index.d.ts +0 -72
- package/lib/hooks/index.d.ts.map +0 -1
- package/lib/hooks/index.js +0 -497
- package/lib/hooks/internal/ErrorBox.js +0 -47
- package/lib/hooks/internal/SendBoxMiddleware.d.ts +0 -34
- package/lib/hooks/internal/SendBoxMiddleware.d.ts.map +0 -1
- package/lib/hooks/internal/SendBoxMiddleware.js +0 -17
- package/lib/hooks/internal/SendBoxToolbarMiddleware.d.ts +0 -34
- package/lib/hooks/internal/SendBoxToolbarMiddleware.d.ts.map +0 -1
- package/lib/hooks/internal/SendBoxToolbarMiddleware.js +0 -17
- package/lib/hooks/internal/Tracker.d.ts +0 -4
- package/lib/hooks/internal/Tracker.d.ts.map +0 -1
- package/lib/hooks/internal/Tracker.js +0 -15
- package/lib/hooks/internal/WebChatAPIContext.d.ts +0 -80
- package/lib/hooks/internal/WebChatAPIContext.d.ts.map +0 -1
- package/lib/hooks/internal/WebChatAPIContext.js +0 -12
- package/lib/hooks/internal/WebChatReduxContext.js +0 -17
- package/lib/hooks/internal/defaultSelectVoice.js +0 -28
- package/lib/hooks/internal/private/templateMiddleware.d.ts +0 -28
- package/lib/hooks/internal/private/templateMiddleware.d.ts.map +0 -1
- package/lib/hooks/internal/private/templateMiddleware.js +0 -48
- package/lib/hooks/internal/useCreateActivityRendererInternal.d.ts +0 -4
- package/lib/hooks/internal/useCreateActivityRendererInternal.d.ts.map +0 -1
- package/lib/hooks/internal/useCreateActivityRendererInternal.js +0 -37
- package/lib/hooks/internal/useDebugDeps.js +0 -39
- package/lib/hooks/internal/useDirFromProps.js +0 -12
- package/lib/hooks/internal/useErrorBoxClass.js +0 -14
- package/lib/hooks/internal/useForceRender.js +0 -24
- package/lib/hooks/internal/useLocalizedGlobalize.js +0 -12
- package/lib/hooks/internal/useLocalizedStrings.js +0 -14
- package/lib/hooks/internal/useMarkActivity.js +0 -12
- package/lib/hooks/internal/usePrevious.d.ts +0 -2
- package/lib/hooks/internal/usePrevious.d.ts.map +0 -1
- package/lib/hooks/internal/usePrevious.js +0 -15
- package/lib/hooks/internal/useReadTelemetryDimensions.js +0 -20
- package/lib/hooks/internal/useSetDictateState.d.ts +0 -2
- package/lib/hooks/internal/useSetDictateState.d.ts.map +0 -1
- package/lib/hooks/internal/useSetDictateState.js +0 -12
- package/lib/hooks/internal/useTimer.d.ts +0 -5
- package/lib/hooks/internal/useTimer.d.ts.map +0 -1
- package/lib/hooks/internal/useTimer.js +0 -43
- package/lib/hooks/internal/useTracker.js +0 -42
- package/lib/hooks/internal/useValueRef.d.ts +0 -3
- package/lib/hooks/internal/useValueRef.d.ts.map +0 -1
- package/lib/hooks/internal/useValueRef.js +0 -22
- package/lib/hooks/internal/useWebChatAPIContext.d.ts +0 -83
- package/lib/hooks/internal/useWebChatAPIContext.d.ts.map +0 -1
- package/lib/hooks/internal/useWebChatAPIContext.js +0 -17
- package/lib/hooks/middleware/UserlandBoundary.js +0 -48
- package/lib/hooks/middleware/applyMiddleware.js +0 -122
- package/lib/hooks/middleware/concatMiddleware.d.ts +0 -6
- package/lib/hooks/middleware/concatMiddleware.d.ts.map +0 -1
- package/lib/hooks/middleware/concatMiddleware.js +0 -33
- package/lib/hooks/middleware/createDefaultCardActionMiddleware.d.ts +0 -3
- package/lib/hooks/middleware/createDefaultCardActionMiddleware.d.ts.map +0 -1
- package/lib/hooks/middleware/createDefaultCardActionMiddleware.js +0 -43
- package/lib/hooks/middleware/createDefaultGroupActivitiesMiddleware.d.ts +0 -7
- package/lib/hooks/middleware/createDefaultGroupActivitiesMiddleware.d.ts.map +0 -1
- package/lib/hooks/middleware/createDefaultGroupActivitiesMiddleware.js +0 -68
- package/lib/hooks/useActiveTyping.d.ts +0 -6
- package/lib/hooks/useActiveTyping.d.ts.map +0 -1
- package/lib/hooks/useActiveTyping.js +0 -81
- package/lib/hooks/useActivities.d.ts +0 -3
- package/lib/hooks/useActivities.d.ts.map +0 -1
- package/lib/hooks/useActivities.js +0 -14
- package/lib/hooks/useActivityKeys.d.ts +0 -3
- package/lib/hooks/useActivityKeys.d.ts.map +0 -1
- package/lib/hooks/useActivityKeys.js +0 -11
- package/lib/hooks/useActivityKeysByRead.d.ts +0 -3
- package/lib/hooks/useActivityKeysByRead.d.ts.map +0 -1
- package/lib/hooks/useActivityKeysByRead.js +0 -11
- package/lib/hooks/useAvatarForBot.d.ts +0 -5
- package/lib/hooks/useAvatarForBot.d.ts.map +0 -1
- package/lib/hooks/useAvatarForBot.js +0 -26
- package/lib/hooks/useAvatarForUser.d.ts +0 -5
- package/lib/hooks/useAvatarForUser.d.ts.map +0 -1
- package/lib/hooks/useAvatarForUser.js +0 -26
- package/lib/hooks/useByteFormatter.d.ts +0 -2
- package/lib/hooks/useByteFormatter.d.ts.map +0 -1
- package/lib/hooks/useByteFormatter.js +0 -43
- package/lib/hooks/useConnectivityStatus.d.ts +0 -2
- package/lib/hooks/useConnectivityStatus.d.ts.map +0 -1
- package/lib/hooks/useConnectivityStatus.js +0 -14
- package/lib/hooks/useCreateActivityRenderer.d.ts +0 -3
- package/lib/hooks/useCreateActivityRenderer.d.ts.map +0 -1
- package/lib/hooks/useCreateActivityRenderer.js +0 -14
- package/lib/hooks/useCreateActivityStatusRenderer.d.ts +0 -10
- package/lib/hooks/useCreateActivityStatusRenderer.d.ts.map +0 -1
- package/lib/hooks/useCreateActivityStatusRenderer.js +0 -72
- package/lib/hooks/useCreateAttachmentForScreenReaderRenderer.d.ts +0 -3
- package/lib/hooks/useCreateAttachmentForScreenReaderRenderer.d.ts.map +0 -1
- package/lib/hooks/useCreateAttachmentForScreenReaderRenderer.js +0 -12
- package/lib/hooks/useCreateAvatarRenderer.d.ts +0 -6
- package/lib/hooks/useCreateAvatarRenderer.d.ts.map +0 -1
- package/lib/hooks/useCreateAvatarRenderer.js +0 -44
- package/lib/hooks/useCreateScrollToEndButtonRenderer.d.ts +0 -3
- package/lib/hooks/useCreateScrollToEndButtonRenderer.d.ts.map +0 -1
- package/lib/hooks/useCreateScrollToEndButtonRenderer.js +0 -12
- package/lib/hooks/useDateFormatter.d.ts +0 -2
- package/lib/hooks/useDateFormatter.d.ts.map +0 -1
- package/lib/hooks/useDateFormatter.js +0 -35
- package/lib/hooks/useDebouncedNotifications.d.ts +0 -13
- package/lib/hooks/useDebouncedNotifications.d.ts.map +0 -1
- package/lib/hooks/useDebouncedNotifications.js +0 -118
- package/lib/hooks/useDictateInterims.d.ts +0 -2
- package/lib/hooks/useDictateInterims.d.ts.map +0 -1
- package/lib/hooks/useDictateInterims.js +0 -16
- package/lib/hooks/useDictateState.d.ts +0 -2
- package/lib/hooks/useDictateState.d.ts.map +0 -1
- package/lib/hooks/useDictateState.js +0 -15
- package/lib/hooks/useDirection.d.ts +0 -2
- package/lib/hooks/useDirection.d.ts.map +0 -1
- package/lib/hooks/useDirection.js +0 -38
- package/lib/hooks/useDisabled.d.ts +0 -2
- package/lib/hooks/useDisabled.d.ts.map +0 -1
- package/lib/hooks/useDisabled.js +0 -12
- package/lib/hooks/useDismissNotification.d.ts +0 -2
- package/lib/hooks/useDismissNotification.d.ts.map +0 -1
- package/lib/hooks/useDismissNotification.js +0 -12
- package/lib/hooks/useEmitTypingIndicator.d.ts +0 -2
- package/lib/hooks/useEmitTypingIndicator.d.ts.map +0 -1
- package/lib/hooks/useEmitTypingIndicator.js +0 -12
- package/lib/hooks/useGetActivityByKey.d.ts +0 -3
- package/lib/hooks/useGetActivityByKey.d.ts.map +0 -1
- package/lib/hooks/useGetActivityByKey.js +0 -11
- package/lib/hooks/useGetHasAcknowledgedByActivityKey.d.ts +0 -3
- package/lib/hooks/useGetHasAcknowledgedByActivityKey.d.ts.map +0 -1
- package/lib/hooks/useGetHasAcknowledgedByActivityKey.js +0 -11
- package/lib/hooks/useGetKeyByActivity.d.ts +0 -3
- package/lib/hooks/useGetKeyByActivity.d.ts.map +0 -1
- package/lib/hooks/useGetKeyByActivity.js +0 -11
- package/lib/hooks/useGetKeyByActivityId.d.ts +0 -3
- package/lib/hooks/useGetKeyByActivityId.d.ts.map +0 -1
- package/lib/hooks/useGetKeyByActivityId.js +0 -11
- package/lib/hooks/useGetSendTimeoutForActivity.d.ts +0 -5
- package/lib/hooks/useGetSendTimeoutForActivity.d.ts.map +0 -1
- package/lib/hooks/useGetSendTimeoutForActivity.js +0 -33
- package/lib/hooks/useGrammars.d.ts +0 -2
- package/lib/hooks/useGrammars.d.ts.map +0 -1
- package/lib/hooks/useGrammars.js +0 -12
- package/lib/hooks/useGroupActivities.d.ts +0 -8
- package/lib/hooks/useGroupActivities.d.ts.map +0 -1
- package/lib/hooks/useGroupActivities.js +0 -12
- package/lib/hooks/useGroupTimestamp.d.ts +0 -2
- package/lib/hooks/useGroupTimestamp.d.ts.map +0 -1
- package/lib/hooks/useGroupTimestamp.js +0 -21
- package/lib/hooks/useLanguage.d.ts +0 -2
- package/lib/hooks/useLanguage.d.ts.map +0 -1
- package/lib/hooks/useLanguage.js +0 -19
- package/lib/hooks/useLastAcknowledgedActivityKey.d.ts +0 -3
- package/lib/hooks/useLastAcknowledgedActivityKey.d.ts.map +0 -1
- package/lib/hooks/useLastAcknowledgedActivityKey.js +0 -11
- package/lib/hooks/useLastReadActivityKey.d.ts +0 -3
- package/lib/hooks/useLastReadActivityKey.d.ts.map +0 -1
- package/lib/hooks/useLastReadActivityKey.js +0 -11
- package/lib/hooks/useLocalizer.d.ts +0 -13
- package/lib/hooks/useLocalizer.d.ts.map +0 -1
- package/lib/hooks/useLocalizer.js +0 -75
- package/lib/hooks/useMarkActivityAsSpoken.d.ts +0 -3
- package/lib/hooks/useMarkActivityAsSpoken.d.ts.map +0 -1
- package/lib/hooks/useMarkActivityAsSpoken.js +0 -16
- package/lib/hooks/useMarkActivityKeyAsRead.d.ts +0 -3
- package/lib/hooks/useMarkActivityKeyAsRead.d.ts.map +0 -1
- package/lib/hooks/useMarkActivityKeyAsRead.js +0 -11
- package/lib/hooks/useMarkAllAsAcknowledged.d.ts +0 -3
- package/lib/hooks/useMarkAllAsAcknowledged.d.ts.map +0 -1
- package/lib/hooks/useMarkAllAsAcknowledged.js +0 -11
- package/lib/hooks/useNotifications.d.ts +0 -3
- package/lib/hooks/useNotifications.d.ts.map +0 -1
- package/lib/hooks/useNotifications.js +0 -14
- package/lib/hooks/usePerformCardAction.d.ts +0 -3
- package/lib/hooks/usePerformCardAction.d.ts.map +0 -1
- package/lib/hooks/usePerformCardAction.js +0 -12
- package/lib/hooks/usePonyfill.d.ts +0 -3
- package/lib/hooks/usePonyfill.d.ts.map +0 -1
- package/lib/hooks/usePonyfill.js +0 -11
- package/lib/hooks/usePostActivity.d.ts +0 -3
- package/lib/hooks/usePostActivity.d.ts.map +0 -1
- package/lib/hooks/usePostActivity.js +0 -12
- package/lib/hooks/useReferenceGrammarID.d.ts +0 -2
- package/lib/hooks/useReferenceGrammarID.d.ts.map +0 -1
- package/lib/hooks/useReferenceGrammarID.js +0 -14
- package/lib/hooks/useRelativeTimeFormatter.d.ts +0 -2
- package/lib/hooks/useRelativeTimeFormatter.d.ts.map +0 -1
- package/lib/hooks/useRelativeTimeFormatter.js +0 -61
- package/lib/hooks/useRenderAttachment.d.ts +0 -3
- package/lib/hooks/useRenderAttachment.d.ts.map +0 -1
- package/lib/hooks/useRenderAttachment.js +0 -14
- package/lib/hooks/useRenderToast.d.ts +0 -3
- package/lib/hooks/useRenderToast.d.ts.map +0 -1
- package/lib/hooks/useRenderToast.js +0 -12
- package/lib/hooks/useRenderTypingIndicator.d.ts +0 -3
- package/lib/hooks/useRenderTypingIndicator.d.ts.map +0 -1
- package/lib/hooks/useRenderTypingIndicator.js +0 -12
- package/lib/hooks/useSendBoxAttachments.d.ts +0 -6
- package/lib/hooks/useSendBoxAttachments.d.ts.map +0 -1
- package/lib/hooks/useSendBoxAttachments.js +0 -23
- package/lib/hooks/useSendBoxValue.d.ts +0 -2
- package/lib/hooks/useSendBoxValue.d.ts.map +0 -1
- package/lib/hooks/useSendBoxValue.js +0 -16
- package/lib/hooks/useSendEvent.d.ts +0 -2
- package/lib/hooks/useSendEvent.d.ts.map +0 -1
- package/lib/hooks/useSendEvent.js +0 -12
- package/lib/hooks/useSendFiles.d.ts +0 -10
- package/lib/hooks/useSendFiles.d.ts.map +0 -1
- package/lib/hooks/useSendFiles.js +0 -35
- package/lib/hooks/useSendMessage.d.ts +0 -6
- package/lib/hooks/useSendMessage.d.ts.map +0 -1
- package/lib/hooks/useSendMessage.js +0 -33
- package/lib/hooks/useSendMessageBack.d.ts +0 -2
- package/lib/hooks/useSendMessageBack.d.ts.map +0 -1
- package/lib/hooks/useSendMessageBack.js +0 -12
- package/lib/hooks/useSendPostBack.d.ts +0 -2
- package/lib/hooks/useSendPostBack.d.ts.map +0 -1
- package/lib/hooks/useSendPostBack.js +0 -12
- package/lib/hooks/useSendStatusByActivityKey.d.ts +0 -22
- package/lib/hooks/useSendStatusByActivityKey.d.ts.map +0 -1
- package/lib/hooks/useSendStatusByActivityKey.js +0 -31
- package/lib/hooks/useSendTimeoutForActivity.d.ts +0 -4
- package/lib/hooks/useSendTimeoutForActivity.d.ts.map +0 -1
- package/lib/hooks/useSendTimeoutForActivity.js +0 -22
- package/lib/hooks/useSendTypingIndicator.d.ts +0 -2
- package/lib/hooks/useSendTypingIndicator.d.ts.map +0 -1
- package/lib/hooks/useSendTypingIndicator.js +0 -14
- package/lib/hooks/useSetNotification.d.ts +0 -3
- package/lib/hooks/useSetNotification.d.ts.map +0 -1
- package/lib/hooks/useSetNotification.js +0 -12
- package/lib/hooks/useShouldSpeakIncomingActivity.d.ts +0 -2
- package/lib/hooks/useShouldSpeakIncomingActivity.d.ts.map +0 -1
- package/lib/hooks/useShouldSpeakIncomingActivity.js +0 -22
- package/lib/hooks/useStartDictate.d.ts +0 -2
- package/lib/hooks/useStartDictate.d.ts.map +0 -1
- package/lib/hooks/useStartDictate.js +0 -12
- package/lib/hooks/useStopDictate.d.ts +0 -2
- package/lib/hooks/useStopDictate.d.ts.map +0 -1
- package/lib/hooks/useStopDictate.js +0 -12
- package/lib/hooks/useStyleOptions.d.ts +0 -3
- package/lib/hooks/useStyleOptions.d.ts.map +0 -1
- package/lib/hooks/useStyleOptions.js +0 -12
- package/lib/hooks/useSubmitSendBox.d.ts +0 -4
- package/lib/hooks/useSubmitSendBox.d.ts.map +0 -1
- package/lib/hooks/useSubmitSendBox.js +0 -49
- package/lib/hooks/useSuggestedActions.d.ts +0 -3
- package/lib/hooks/useSuggestedActions.d.ts.map +0 -1
- package/lib/hooks/useSuggestedActions.js +0 -25
- package/lib/hooks/useTimeoutForSend.d.ts +0 -3
- package/lib/hooks/useTimeoutForSend.d.ts.map +0 -1
- package/lib/hooks/useTimeoutForSend.js +0 -21
- package/lib/hooks/useTrackDimension.d.ts +0 -2
- package/lib/hooks/useTrackDimension.d.ts.map +0 -1
- package/lib/hooks/useTrackDimension.js +0 -14
- package/lib/hooks/useTrackEvent.d.ts +0 -10
- package/lib/hooks/useTrackEvent.d.ts.map +0 -1
- package/lib/hooks/useTrackEvent.js +0 -51
- package/lib/hooks/useTrackException.d.ts +0 -2
- package/lib/hooks/useTrackException.d.ts.map +0 -1
- package/lib/hooks/useTrackException.js +0 -31
- package/lib/hooks/useTrackTiming.d.ts +0 -2
- package/lib/hooks/useTrackTiming.d.ts.map +0 -1
- package/lib/hooks/useTrackTiming.js +0 -93
- package/lib/hooks/useUserID.d.ts +0 -2
- package/lib/hooks/useUserID.d.ts.map +0 -1
- package/lib/hooks/useUserID.js +0 -12
- package/lib/hooks/useUsername.d.ts +0 -2
- package/lib/hooks/useUsername.d.ts.map +0 -1
- package/lib/hooks/useUsername.js +0 -12
- package/lib/hooks/useVoiceSelector.d.ts +0 -2
- package/lib/hooks/useVoiceSelector.d.ts.map +0 -1
- package/lib/hooks/useVoiceSelector.js +0 -16
- package/lib/hooks/utils/ErrorBoundary.js +0 -68
- package/lib/hooks/utils/observableToPromise.d.ts +0 -3
- package/lib/hooks/utils/observableToPromise.d.ts.map +0 -1
- package/lib/hooks/utils/observableToPromise.js +0 -28
- package/lib/index.d.ts +0 -37
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -88
- package/lib/internal.d.ts +0 -3
- package/lib/internal.d.ts.map +0 -1
- package/lib/internal.js +0 -14
- package/lib/localization/Localize.d.ts +0 -4
- package/lib/localization/Localize.d.ts.map +0 -1
- package/lib/localization/Localize.js +0 -50
- package/lib/localization/ar-EG.json +0 -42
- package/lib/localization/ar-JO.json +0 -45
- package/lib/localization/ar-SA.json +0 -97
- package/lib/localization/bg-BG.json +0 -97
- package/lib/localization/ca-ES.json +0 -97
- package/lib/localization/cs-CZ.json +0 -97
- package/lib/localization/da-DK.json +0 -97
- package/lib/localization/de-DE.json +0 -97
- package/lib/localization/el-GR.json +0 -97
- package/lib/localization/en-US.json +0 -167
- package/lib/localization/es-ES.json +0 -97
- package/lib/localization/et-EE.json +0 -97
- package/lib/localization/eu-ES.json +0 -97
- package/lib/localization/fi-FI.json +0 -97
- package/lib/localization/fr-FR.json +0 -97
- package/lib/localization/getAllLocalizedStrings.d.ts +0 -6
- package/lib/localization/getAllLocalizedStrings.d.ts.map +0 -1
- package/lib/localization/getAllLocalizedStrings.js +0 -117
- package/lib/localization/getRTLList.d.ts +0 -2
- package/lib/localization/getRTLList.d.ts.map +0 -1
- package/lib/localization/getRTLList.js +0 -46
- package/lib/localization/gl-ES.json +0 -97
- package/lib/localization/he-IL.json +0 -97
- package/lib/localization/hi-IN.json +0 -97
- package/lib/localization/hr-HR.json +0 -97
- package/lib/localization/hu-HU.json +0 -97
- package/lib/localization/id-ID.json +0 -97
- package/lib/localization/it-IT.json +0 -97
- package/lib/localization/ja-JP.json +0 -97
- package/lib/localization/kk-KZ.json +0 -97
- package/lib/localization/ko-KR.json +0 -97
- package/lib/localization/lt-LT.json +0 -97
- package/lib/localization/lv-LV.json +0 -97
- package/lib/localization/mergeLocalizedStrings.d.ts +0 -7
- package/lib/localization/mergeLocalizedStrings.d.ts.map +0 -1
- package/lib/localization/mergeLocalizedStrings.js +0 -49
- package/lib/localization/ms-MY.json +0 -97
- package/lib/localization/nb-NO.json +0 -97
- package/lib/localization/nl-NL.json +0 -97
- package/lib/localization/overrides.json +0 -257
- package/lib/localization/pl-PL.json +0 -97
- package/lib/localization/pt-BR.json +0 -97
- package/lib/localization/pt-PT.json +0 -97
- package/lib/localization/ro-RO.json +0 -97
- package/lib/localization/ru-RU.json +0 -97
- package/lib/localization/sk-SK.json +0 -97
- package/lib/localization/sl-SI.json +0 -97
- package/lib/localization/sl-SL.json +0 -3
- package/lib/localization/sr-Cyrl-CS.json +0 -97
- package/lib/localization/sr-Cyrl.json +0 -3
- package/lib/localization/sr-Latn-CS.json +0 -97
- package/lib/localization/sr-Latn.json +0 -3
- package/lib/localization/sv-SE.json +0 -97
- package/lib/localization/th-TH.json +0 -97
- package/lib/localization/tr-TR.json +0 -97
- package/lib/localization/uk-UA.json +0 -97
- package/lib/localization/vi-VN.json +0 -97
- package/lib/localization/yue.json +0 -100
- package/lib/localization/zh-CN.json +0 -97
- package/lib/localization/zh-HK.json +0 -97
- package/lib/localization/zh-TW.json +0 -97
- package/lib/normalizeStyleOptions.d.ts +0 -3
- package/lib/normalizeStyleOptions.d.ts.map +0 -1
- package/lib/normalizeStyleOptions.js +0 -147
- package/lib/patchStyleOptionsFromDeprecatedProps.js +0 -21
- package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.d.ts +0 -6
- package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.js +0 -153
- package/lib/providers/ActivityAcknowledgement/private/Context.d.ts +0 -13
- package/lib/providers/ActivityAcknowledgement/private/Context.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/private/Context.js +0 -14
- package/lib/providers/ActivityAcknowledgement/private/useContext.d.ts +0 -3
- package/lib/providers/ActivityAcknowledgement/private/useContext.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/private/useContext.js +0 -18
- package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.d.ts +0 -5
- package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.js +0 -15
- package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.d.ts +0 -2
- package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.js +0 -12
- package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.d.ts +0 -2
- package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.js +0 -12
- package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.d.ts +0 -2
- package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.js +0 -12
- package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.d.ts +0 -2
- package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.js +0 -12
- package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.d.ts +0 -2
- package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.d.ts.map +0 -1
- package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.js +0 -12
- package/lib/providers/ActivityKeyer/ActivityKeyerComposer.d.ts +0 -20
- package/lib/providers/ActivityKeyer/ActivityKeyerComposer.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/ActivityKeyerComposer.js +0 -119
- package/lib/providers/ActivityKeyer/private/Context.d.ts +0 -12
- package/lib/providers/ActivityKeyer/private/Context.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/private/Context.js +0 -10
- package/lib/providers/ActivityKeyer/private/getActivityId.d.ts +0 -3
- package/lib/providers/ActivityKeyer/private/getActivityId.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/private/getActivityId.js +0 -10
- package/lib/providers/ActivityKeyer/private/getClientActivityId.d.ts +0 -3
- package/lib/providers/ActivityKeyer/private/getClientActivityId.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/private/getClientActivityId.js +0 -11
- package/lib/providers/ActivityKeyer/private/uniqueId.d.ts +0 -2
- package/lib/providers/ActivityKeyer/private/uniqueId.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/private/uniqueId.js +0 -15
- package/lib/providers/ActivityKeyer/private/useContext.d.ts +0 -3
- package/lib/providers/ActivityKeyer/private/useContext.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/private/useContext.js +0 -18
- package/lib/providers/ActivityKeyer/useActivityKeys.d.ts +0 -2
- package/lib/providers/ActivityKeyer/useActivityKeys.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/useActivityKeys.js +0 -12
- package/lib/providers/ActivityKeyer/useGetActivityByKey.d.ts +0 -3
- package/lib/providers/ActivityKeyer/useGetActivityByKey.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/useGetActivityByKey.js +0 -12
- package/lib/providers/ActivityKeyer/useGetKeyByActivity.d.ts +0 -3
- package/lib/providers/ActivityKeyer/useGetKeyByActivity.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/useGetKeyByActivity.js +0 -12
- package/lib/providers/ActivityKeyer/useGetKeyByActivityId.d.ts +0 -2
- package/lib/providers/ActivityKeyer/useGetKeyByActivityId.d.ts.map +0 -1
- package/lib/providers/ActivityKeyer/useGetKeyByActivityId.js +0 -12
- package/lib/providers/ActivitySendStatus/ActivitySendStatusComposer.d.ts +0 -4
- package/lib/providers/ActivitySendStatus/ActivitySendStatusComposer.d.ts.map +0 -1
- package/lib/providers/ActivitySendStatus/ActivitySendStatusComposer.js +0 -149
- package/lib/providers/ActivitySendStatus/private/Context.d.ts +0 -9
- package/lib/providers/ActivitySendStatus/private/Context.d.ts.map +0 -1
- package/lib/providers/ActivitySendStatus/private/Context.js +0 -13
- package/lib/providers/ActivitySendStatus/private/isMapEqual.d.ts +0 -7
- package/lib/providers/ActivitySendStatus/private/isMapEqual.d.ts.map +0 -1
- package/lib/providers/ActivitySendStatus/private/isMapEqual.js +0 -55
- package/lib/providers/ActivitySendStatus/private/useContext.d.ts +0 -3
- package/lib/providers/ActivitySendStatus/private/useContext.d.ts.map +0 -1
- package/lib/providers/ActivitySendStatus/private/useContext.js +0 -18
- package/lib/providers/ActivitySendStatus/useSendStatusByActivityKey.d.ts +0 -22
- package/lib/providers/ActivitySendStatus/useSendStatusByActivityKey.d.ts.map +0 -1
- package/lib/providers/ActivitySendStatus/useSendStatusByActivityKey.js +0 -31
- package/lib/providers/ActivitySendStatusTelemetry/ActivitySendStatusTelemetryComposer.d.ts +0 -3
- package/lib/providers/ActivitySendStatusTelemetry/ActivitySendStatusTelemetryComposer.d.ts.map +0 -1
- package/lib/providers/ActivitySendStatusTelemetry/ActivitySendStatusTelemetryComposer.js +0 -71
- package/lib/providers/Ponyfill/PonyfillComposer.d.ts +0 -17
- package/lib/providers/Ponyfill/PonyfillComposer.d.ts.map +0 -1
- package/lib/providers/Ponyfill/PonyfillComposer.js +0 -87
- package/lib/providers/Ponyfill/private/PonyfillContext.d.ts +0 -8
- package/lib/providers/Ponyfill/private/PonyfillContext.d.ts.map +0 -1
- package/lib/providers/Ponyfill/private/PonyfillContext.js +0 -10
- package/lib/providers/Ponyfill/private/useContext.d.ts +0 -6
- package/lib/providers/Ponyfill/private/useContext.d.ts.map +0 -1
- package/lib/providers/Ponyfill/private/useContext.js +0 -17
- package/lib/providers/Ponyfill/usePonyfill.d.ts +0 -3
- package/lib/providers/Ponyfill/usePonyfill.d.ts.map +0 -1
- package/lib/providers/Ponyfill/usePonyfill.js +0 -12
- package/lib/tsconfig.json +0 -18
- package/lib/types/ActivityMiddleware.d.ts +0 -24
- package/lib/types/ActivityMiddleware.d.ts.map +0 -1
- package/lib/types/ActivityMiddleware.js +0 -2
- package/lib/types/ActivityStatusMiddleware.d.ts +0 -17
- package/lib/types/ActivityStatusMiddleware.d.ts.map +0 -1
- package/lib/types/ActivityStatusMiddleware.js +0 -2
- package/lib/types/AttachmentForScreenReaderMiddleware.d.ts +0 -14
- package/lib/types/AttachmentForScreenReaderMiddleware.d.ts.map +0 -1
- package/lib/types/AttachmentForScreenReaderMiddleware.js +0 -2
- package/lib/types/AttachmentMiddleware.d.ts +0 -12
- package/lib/types/AttachmentMiddleware.d.ts.map +0 -1
- package/lib/types/AttachmentMiddleware.js +0 -2
- package/lib/types/AvatarMiddleware.d.ts +0 -15
- package/lib/types/AvatarMiddleware.d.ts.map +0 -1
- package/lib/types/AvatarMiddleware.js +0 -2
- package/lib/types/CardActionMiddleware.d.ts +0 -19
- package/lib/types/CardActionMiddleware.d.ts.map +0 -1
- package/lib/types/CardActionMiddleware.js +0 -2
- package/lib/types/ComponentMiddleware.d.ts +0 -31
- package/lib/types/ComponentMiddleware.d.ts.map +0 -1
- package/lib/types/ComponentMiddleware.js +0 -2
- package/lib/types/ContextOf.d.ts +0 -4
- package/lib/types/ContextOf.d.ts.map +0 -1
- package/lib/types/ContextOf.js +0 -2
- package/lib/types/FunctionMiddleware.d.ts +0 -6
- package/lib/types/FunctionMiddleware.d.ts.map +0 -1
- package/lib/types/FunctionMiddleware.js +0 -2
- package/lib/types/GroupActivitiesMiddleware.d.ts +0 -22
- package/lib/types/GroupActivitiesMiddleware.d.ts.map +0 -1
- package/lib/types/GroupActivitiesMiddleware.js +0 -2
- package/lib/types/LocalizedStrings.d.ts +0 -5
- package/lib/types/LocalizedStrings.d.ts.map +0 -1
- package/lib/types/LocalizedStrings.js +0 -2
- package/lib/types/Notification.d.ts +0 -10
- package/lib/types/Notification.d.ts.map +0 -1
- package/lib/types/Notification.js +0 -2
- package/lib/types/PrecompiledGlobalize.d.ts +0 -13
- package/lib/types/PrecompiledGlobalize.d.ts.map +0 -1
- package/lib/types/PrecompiledGlobalize.js +0 -2
- package/lib/types/ScrollToEndButtonMiddleware.d.ts +0 -30
- package/lib/types/ScrollToEndButtonMiddleware.d.ts.map +0 -1
- package/lib/types/ScrollToEndButtonMiddleware.js +0 -2
- package/lib/types/SendStatus.d.ts +0 -3
- package/lib/types/SendStatus.d.ts.map +0 -1
- package/lib/types/SendStatus.js +0 -2
- package/lib/types/TelemetryMeasurementEvent.d.ts +0 -31
- package/lib/types/TelemetryMeasurementEvent.d.ts.map +0 -1
- package/lib/types/TelemetryMeasurementEvent.js +0 -2
- package/lib/types/ToastMiddleware.d.ts +0 -11
- package/lib/types/ToastMiddleware.d.ts.map +0 -1
- package/lib/types/ToastMiddleware.js +0 -2
- package/lib/types/Typing.d.ts +0 -8
- package/lib/types/Typing.d.ts.map +0 -1
- package/lib/types/Typing.js +0 -2
- package/lib/types/TypingIndicatorMiddleware.d.ts +0 -17
- package/lib/types/TypingIndicatorMiddleware.d.ts.map +0 -1
- package/lib/types/TypingIndicatorMiddleware.js +0 -2
- package/lib/types/WebSpeechPonyfill.d.ts +0 -19
- package/lib/types/WebSpeechPonyfill.d.ts.map +0 -1
- package/lib/types/WebSpeechPonyfill.js +0 -2
- package/lib/types/WebSpeechPonyfillFactory.d.ts +0 -6
- package/lib/types/WebSpeechPonyfillFactory.d.ts.map +0 -1
- package/lib/types/WebSpeechPonyfillFactory.js +0 -2
- package/lib/utils/createCustomEvent.d.ts +0 -4
- package/lib/utils/createCustomEvent.d.ts.map +0 -1
- package/lib/utils/createCustomEvent.js +0 -34
- package/lib/utils/findLastIndex.d.ts +0 -2
- package/lib/utils/findLastIndex.d.ts.map +0 -1
- package/lib/utils/findLastIndex.js +0 -22
- package/lib/utils/findMin.d.ts +0 -7
- package/lib/utils/findMin.d.ts.map +0 -1
- package/lib/utils/findMin.js +0 -46
- package/lib/utils/freezeArray.d.ts +0 -8
- package/lib/utils/freezeArray.d.ts.map +0 -1
- package/lib/utils/freezeArray.js +0 -19
- package/lib/utils/isObject.js +0 -12
- package/lib/utils/mapMap.d.ts +0 -6
- package/lib/utils/mapMap.d.ts.map +0 -1
- package/lib/utils/mapMap.js +0 -27
- package/lib/utils/normalizeLanguage.d.ts +0 -2
- package/lib/utils/normalizeLanguage.d.ts.map +0 -1
- package/lib/utils/normalizeLanguage.js +0 -115
- package/lib/utils/randomId.d.ts +0 -2
- package/lib/utils/randomId.d.ts.map +0 -1
- package/lib/utils/randomId.js +0 -15
- package/lib/utils/warnOnce.d.ts +0 -2
- package/lib/utils/warnOnce.d.ts.map +0 -1
- package/lib/utils/warnOnce.js +0 -16
- package/src/external/PrecompiledGlobalize.cjs +0 -8855
- package/src/hooks/middleware/createDefaultGroupActivitiesMiddleware.ts +0 -75
- package/src/hooks/useGroupActivities.ts +0 -10
- /package/dist/{chunk-4ZIUY4G5.mjs.LEGAL.txt → botframework-webchat-api.decorator.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/** @jest-environment @happy-dom/jest-environment */
|
|
2
|
+
|
|
3
|
+
import { render, type RenderResult } from '@testing-library/react';
|
|
4
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
5
|
+
import React, { type ComponentType } from 'react';
|
|
6
|
+
import { type useActivities as UseActivitiesType } from '../../../hooks';
|
|
7
|
+
import type UseReduceActivitiesType from './useReduceActivities';
|
|
8
|
+
|
|
9
|
+
type UseReduceActivitiesFn = Parameters<typeof UseReduceActivitiesType>[0];
|
|
10
|
+
|
|
11
|
+
const ACTIVITY_TEMPLATE = {
|
|
12
|
+
channelData: {
|
|
13
|
+
'webchat:sequence-id': 0,
|
|
14
|
+
'webchat:send-status': undefined
|
|
15
|
+
},
|
|
16
|
+
from: { id: 'bot', role: 'bot' },
|
|
17
|
+
id: 'a-00001',
|
|
18
|
+
text: '',
|
|
19
|
+
timestamp: '2025-03-10T12:34:56.789Z',
|
|
20
|
+
type: 'message'
|
|
21
|
+
} satisfies WebChatActivity & { type: 'message' };
|
|
22
|
+
|
|
23
|
+
describe('setup', () => {
|
|
24
|
+
let HookApp: ComponentType<{ fn: UseReduceActivitiesFn }>;
|
|
25
|
+
let useActivities: jest.Mock<ReturnType<typeof UseActivitiesType>, Parameters<typeof UseActivitiesType>>;
|
|
26
|
+
let useReduceActivities: jest.Mock<
|
|
27
|
+
ReturnType<typeof UseReduceActivitiesType>,
|
|
28
|
+
Parameters<typeof UseReduceActivitiesType>
|
|
29
|
+
>;
|
|
30
|
+
let fn: jest.Mock<ReturnType<UseReduceActivitiesFn>, Parameters<UseReduceActivitiesFn>>;
|
|
31
|
+
let renderResult: RenderResult;
|
|
32
|
+
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
jest.mock('../../../hooks', () => ({ __esModule: true, useActivities: jest.fn(() => [[]]) }));
|
|
35
|
+
|
|
36
|
+
({ useActivities } = require('../../../hooks'));
|
|
37
|
+
|
|
38
|
+
useReduceActivities = jest.fn(require('./useReduceActivities').default);
|
|
39
|
+
|
|
40
|
+
fn = jest.fn().mockImplementation((prevResult, activity) => ({
|
|
41
|
+
maxText: prevResult?.maxText > activity['text'] ? prevResult?.maxText : activity['text']
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
HookApp = ({ fn }) => {
|
|
45
|
+
useReduceActivities(fn);
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('reduce nothing', () => {
|
|
52
|
+
render(<HookApp fn={fn} />);
|
|
53
|
+
|
|
54
|
+
expect(fn).toHaveBeenCalledTimes(0);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('when the first activity is received', () => {
|
|
58
|
+
let firstActivity: WebChatActivity;
|
|
59
|
+
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
firstActivity = { ...ACTIVITY_TEMPLATE, id: 'a-00001', text: 'Aloha!' };
|
|
62
|
+
|
|
63
|
+
useActivities.mockImplementationOnce(() => [[firstActivity]]);
|
|
64
|
+
|
|
65
|
+
renderResult = render(<HookApp fn={fn} />);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe('fn() should have been called', () => {
|
|
69
|
+
test('once', () => expect(fn).toHaveBeenCalledTimes(1));
|
|
70
|
+
test('with the activity', () =>
|
|
71
|
+
expect(fn).toHaveBeenLastCalledWith(undefined, firstActivity, 0, expect.arrayContaining([])));
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('return value should be derived from the first activity', () =>
|
|
75
|
+
expect(useReduceActivities).toHaveLastReturnedWith({ maxText: 'Aloha!' }));
|
|
76
|
+
|
|
77
|
+
describe('when the second activity is received', () => {
|
|
78
|
+
let secondActivity: WebChatActivity;
|
|
79
|
+
|
|
80
|
+
beforeEach(() => {
|
|
81
|
+
secondActivity = { ...ACTIVITY_TEMPLATE, id: 'a-00002', text: 'Hello, World!' };
|
|
82
|
+
|
|
83
|
+
useActivities.mockImplementationOnce(() => [[firstActivity, secondActivity]]);
|
|
84
|
+
|
|
85
|
+
renderResult.rerender(<HookApp fn={fn} />);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('fn() should have been called', () => {
|
|
89
|
+
test('twice in total', () => expect(fn).toHaveBeenCalledTimes(2));
|
|
90
|
+
test('with the second activity', () =>
|
|
91
|
+
expect(fn).toHaveBeenLastCalledWith({ maxText: 'Aloha!' }, secondActivity, 1, expect.arrayContaining([])));
|
|
92
|
+
|
|
93
|
+
test('return value should be derived from the second activity', () =>
|
|
94
|
+
expect(useReduceActivities).toHaveLastReturnedWith({ maxText: 'Hello, World!' }));
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe('when the third activity is inserted between the first and second activity', () => {
|
|
98
|
+
let thirdActivity: WebChatActivity;
|
|
99
|
+
|
|
100
|
+
beforeEach(() => {
|
|
101
|
+
thirdActivity = { ...ACTIVITY_TEMPLATE, id: 'a-00003', text: 'Morning!' };
|
|
102
|
+
|
|
103
|
+
useActivities.mockImplementationOnce(() => [[firstActivity, thirdActivity, secondActivity]]);
|
|
104
|
+
|
|
105
|
+
renderResult.rerender(<HookApp fn={fn} />);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('fn() should have been called', () => {
|
|
109
|
+
// It should call 2 more times because the first one should be from cache.
|
|
110
|
+
test('4 times in total', () => expect(fn).toHaveBeenCalledTimes(4));
|
|
111
|
+
|
|
112
|
+
test('with the third activity on 3rd call', () =>
|
|
113
|
+
expect(fn).toHaveBeenNthCalledWith(3, { maxText: 'Aloha!' }, thirdActivity, 1, expect.arrayContaining([])));
|
|
114
|
+
test('with the second activity on 4th call', () =>
|
|
115
|
+
expect(fn).toHaveBeenNthCalledWith(
|
|
116
|
+
4,
|
|
117
|
+
{ maxText: 'Morning!' },
|
|
118
|
+
secondActivity,
|
|
119
|
+
2,
|
|
120
|
+
expect.arrayContaining([])
|
|
121
|
+
));
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('return value should be derived from the third activity', () =>
|
|
125
|
+
expect(useReduceActivities).toHaveLastReturnedWith({ maxText: 'Morning!' }));
|
|
126
|
+
|
|
127
|
+
describe('when all activities are removed', () => {
|
|
128
|
+
beforeEach(() => {
|
|
129
|
+
useActivities.mockImplementationOnce(() => [[]]);
|
|
130
|
+
|
|
131
|
+
renderResult.rerender(<HookApp fn={fn} />);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('should not call fn()', () => expect(fn).toHaveBeenCalledTimes(4));
|
|
135
|
+
test('return value should be undefined', () => expect(useReduceActivities).toHaveLastReturnedWith(undefined));
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe('when the third activity is being replaced', () => {
|
|
139
|
+
let fourthActivity: WebChatActivity;
|
|
140
|
+
|
|
141
|
+
beforeEach(() => {
|
|
142
|
+
fourthActivity = { ...ACTIVITY_TEMPLATE, id: 'a-00004', text: 'Good morning!' };
|
|
143
|
+
|
|
144
|
+
useActivities.mockImplementationOnce(() => [[firstActivity, fourthActivity, secondActivity]]);
|
|
145
|
+
|
|
146
|
+
renderResult.rerender(<HookApp fn={fn} />);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
describe('fn() should have been called', () => {
|
|
150
|
+
// It should call 2 more times because the first one should be from cache.
|
|
151
|
+
test('6 times in total', () => expect(fn).toHaveBeenCalledTimes(6));
|
|
152
|
+
|
|
153
|
+
test('with the fourth activity on 5rd call', () =>
|
|
154
|
+
expect(fn).toHaveBeenNthCalledWith(
|
|
155
|
+
5,
|
|
156
|
+
{ maxText: 'Aloha!' },
|
|
157
|
+
fourthActivity,
|
|
158
|
+
1,
|
|
159
|
+
expect.arrayContaining([])
|
|
160
|
+
));
|
|
161
|
+
|
|
162
|
+
test('with the second activity on 6th call', () =>
|
|
163
|
+
expect(fn).toHaveBeenNthCalledWith(
|
|
164
|
+
6,
|
|
165
|
+
{ maxText: 'Good morning!' },
|
|
166
|
+
secondActivity,
|
|
167
|
+
2,
|
|
168
|
+
expect.arrayContaining([])
|
|
169
|
+
));
|
|
170
|
+
|
|
171
|
+
test('return value should be derived from the second activity', () =>
|
|
172
|
+
expect(useReduceActivities).toHaveLastReturnedWith({ maxText: 'Hello, World!' }));
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
describe('when the first activity is removed', () => {
|
|
178
|
+
beforeEach(() => {
|
|
179
|
+
useActivities.mockImplementationOnce(() => [[secondActivity]]);
|
|
180
|
+
|
|
181
|
+
renderResult.rerender(<HookApp fn={fn} />);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
describe('should call fn', () => {
|
|
185
|
+
test('3 times in total', () => expect(fn).toHaveBeenCalledTimes(3));
|
|
186
|
+
test('with the second activity only', () =>
|
|
187
|
+
expect(fn).toHaveBeenLastCalledWith(undefined, secondActivity, 0, expect.arrayContaining([])));
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test('return value should be derived from the second activity', () =>
|
|
191
|
+
expect(useReduceActivities).toHaveLastReturnedWith({ maxText: 'Hello, World!' }));
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
describe('when the second activity is removed', () => {
|
|
195
|
+
beforeEach(() => {
|
|
196
|
+
useActivities.mockImplementationOnce(() => [[firstActivity]]);
|
|
197
|
+
|
|
198
|
+
renderResult.rerender(<HookApp fn={fn} />);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe('should not call fn()', () => test('once', () => expect(fn).toHaveBeenCalledTimes(2)));
|
|
202
|
+
|
|
203
|
+
test('return value should be derived from the first activity', () =>
|
|
204
|
+
expect(useReduceActivities).toHaveLastReturnedWith({ maxText: 'Aloha!' }));
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
describe('when all activities are removed', () => {
|
|
209
|
+
beforeEach(() => {
|
|
210
|
+
useActivities.mockImplementationOnce(() => [[]]);
|
|
211
|
+
|
|
212
|
+
renderResult.rerender(<HookApp fn={fn} />);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test('should not call fn()', () => expect(fn).toHaveBeenCalledTimes(1));
|
|
216
|
+
test('return value should be undefined', () => expect(useReduceActivities).toHaveLastReturnedWith(undefined));
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
describe('when activities are unchanged', () => {
|
|
220
|
+
beforeEach(() => {
|
|
221
|
+
useActivities.mockImplementationOnce(() => [[firstActivity]]);
|
|
222
|
+
|
|
223
|
+
renderResult.rerender(<HookApp fn={fn} />);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
test('should not call fn()', () => expect(fn).toHaveBeenCalledTimes(1));
|
|
227
|
+
test('return value should be derived from the first activity', () =>
|
|
228
|
+
expect(useReduceActivities).toHaveLastReturnedWith({ maxText: 'Aloha!' }));
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
import { useActivities } from '../../../hooks';
|
|
3
|
+
import useMemoWithPrevious from './useMemoWithPrevious';
|
|
4
|
+
|
|
5
|
+
type Entry<T> = Readonly<{
|
|
6
|
+
activity: WebChatActivity;
|
|
7
|
+
value: T | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
|
|
10
|
+
export default function useReduceActivities<T>(
|
|
11
|
+
fn: (prevValue: T, activity: WebChatActivity, index: number, activities: Readonly<WebChatActivity[]>) => T
|
|
12
|
+
): T {
|
|
13
|
+
const [activities] = useActivities();
|
|
14
|
+
|
|
15
|
+
const state = useMemoWithPrevious<readonly Entry<T>[]>(
|
|
16
|
+
(state = Object.freeze([])) => {
|
|
17
|
+
let changed = activities.length !== state.length;
|
|
18
|
+
let prevValue: T | undefined;
|
|
19
|
+
let shouldRecompute = false;
|
|
20
|
+
|
|
21
|
+
const nextState = activities.map<Entry<T>>((activity, index) => {
|
|
22
|
+
const entry = state[+index];
|
|
23
|
+
|
|
24
|
+
if (!shouldRecompute && Object.is(entry?.activity, activity)) {
|
|
25
|
+
prevValue = entry?.value;
|
|
26
|
+
|
|
27
|
+
// Skips the activity if it has been reduced in the past render loop.
|
|
28
|
+
return entry;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
changed = true;
|
|
32
|
+
shouldRecompute = true;
|
|
33
|
+
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
activity,
|
|
36
|
+
value: (prevValue = fn(prevValue, activity, index, activities))
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Returns the original array if nothing changed.
|
|
41
|
+
return changed ? nextState : state;
|
|
42
|
+
},
|
|
43
|
+
[activities, fn]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line no-magic-numbers
|
|
47
|
+
return state.at(-1)?.value;
|
|
48
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
import React, { memo, useCallback, useMemo, type ReactNode } from 'react';
|
|
3
|
+
import { useRefFrom } from 'use-ref-from';
|
|
4
|
+
|
|
5
|
+
import applyMiddleware from '../../hooks/middleware/applyMiddleware';
|
|
6
|
+
import useStyleOptions from '../../hooks/useStyleOptions';
|
|
7
|
+
import type GroupActivitiesMiddleware from '../../types/GroupActivitiesMiddleware';
|
|
8
|
+
import { type GroupActivities } from '../../types/GroupActivitiesMiddleware';
|
|
9
|
+
import usePonyfill from '../Ponyfill/usePonyfill';
|
|
10
|
+
import createDefaultGroupActivitiesMiddleware from './private/createDefaultGroupActivitiesMiddleware';
|
|
11
|
+
import GroupActivitiesContext, { type GroupActivitiesContextType } from './private/GroupActivitiesContext';
|
|
12
|
+
import isGroupingValid from './private/isGroupingValid';
|
|
13
|
+
|
|
14
|
+
type GroupActivitiesComposerProps = Readonly<{
|
|
15
|
+
children?: ReactNode | undefined;
|
|
16
|
+
groupActivitiesMiddleware: readonly GroupActivitiesMiddleware[];
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
function GroupActivitiesComposer({ children, groupActivitiesMiddleware }: GroupActivitiesComposerProps) {
|
|
20
|
+
const [ponyfill] = usePonyfill();
|
|
21
|
+
const [{ groupActivitiesBy, groupTimestamp }] = useStyleOptions();
|
|
22
|
+
|
|
23
|
+
const runMiddleware = useMemo<(type?: string | undefined) => GroupActivities>(
|
|
24
|
+
() =>
|
|
25
|
+
applyMiddleware(
|
|
26
|
+
'group activities',
|
|
27
|
+
...groupActivitiesMiddleware,
|
|
28
|
+
...createDefaultGroupActivitiesMiddleware({ groupTimestamp, ponyfill }),
|
|
29
|
+
() => () => () => ({})
|
|
30
|
+
),
|
|
31
|
+
[groupActivitiesMiddleware, groupTimestamp, ponyfill]
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const runAllMiddleware = useMemo(() => runMiddleware(), [runMiddleware]);
|
|
35
|
+
|
|
36
|
+
const groupActivities: GroupActivities = useCallback(
|
|
37
|
+
({ activities }: { activities: readonly WebChatActivity[] }) => {
|
|
38
|
+
const results: Readonly<{
|
|
39
|
+
[key: string]: readonly (readonly WebChatActivity[])[];
|
|
40
|
+
}> = runAllMiddleware({ activities }) || Object.freeze({});
|
|
41
|
+
const validatedResults = new Map<string, readonly (readonly WebChatActivity[])[]>();
|
|
42
|
+
|
|
43
|
+
for (const [name, result] of Object.entries(results)) {
|
|
44
|
+
if (isGroupingValid(activities, result)) {
|
|
45
|
+
validatedResults.set(name, result);
|
|
46
|
+
} else {
|
|
47
|
+
validatedResults.set(
|
|
48
|
+
name,
|
|
49
|
+
activities.map(activity => Object.freeze([activity]))
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return Object.fromEntries(validatedResults);
|
|
55
|
+
},
|
|
56
|
+
[runAllMiddleware]
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const groupActivitiesByGroup: Map<string, GroupActivities> = useMemo(
|
|
60
|
+
() =>
|
|
61
|
+
new Map<string, GroupActivities>(
|
|
62
|
+
groupActivitiesBy.map(groupingName => [groupingName, runMiddleware(groupingName)])
|
|
63
|
+
),
|
|
64
|
+
[groupActivitiesBy, runMiddleware]
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const groupActivitiesByGroupRef = useRefFrom(groupActivitiesByGroup);
|
|
68
|
+
const groupActivitiesByRef = useRefFrom(groupActivitiesBy);
|
|
69
|
+
|
|
70
|
+
const groupActivitiesByName = useCallback<
|
|
71
|
+
(activities: readonly WebChatActivity[], groupingName: string) => readonly (readonly WebChatActivity[])[]
|
|
72
|
+
>(
|
|
73
|
+
(activities, groupingName) => {
|
|
74
|
+
const group = groupActivitiesByGroupRef.current.get(groupingName);
|
|
75
|
+
|
|
76
|
+
if (group) {
|
|
77
|
+
const result: ReadonlyMap<string, readonly (readonly WebChatActivity[])[]> = new Map(
|
|
78
|
+
Object.entries(group({ activities }) || {})
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (result.has(groupingName)) {
|
|
82
|
+
const groupingResult = result.get(groupingName);
|
|
83
|
+
|
|
84
|
+
if (isGroupingValid(activities, groupingResult)) {
|
|
85
|
+
return groupingResult;
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
console.warn(
|
|
89
|
+
`botframework-webchat: groupActivitiesMiddleware('${groupingName}') does not return any results`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
console.warn(
|
|
94
|
+
`botframework-webchat: useGroupActivitiesBy can only be called with one of ${groupActivitiesByRef.current}, however "${groupingName}" was passed instead`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return Object.freeze(activities.map(activity => Object.freeze([activity])));
|
|
99
|
+
},
|
|
100
|
+
[groupActivitiesByGroupRef, groupActivitiesByRef]
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const context = useMemo<GroupActivitiesContextType>(
|
|
104
|
+
() => ({
|
|
105
|
+
groupActivities,
|
|
106
|
+
groupActivitiesByName
|
|
107
|
+
}),
|
|
108
|
+
[groupActivities, groupActivitiesByName]
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
return <GroupActivitiesContext.Provider value={context}>{children}</GroupActivitiesContext.Provider>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export default memo(GroupActivitiesComposer);
|
|
115
|
+
export { type GroupActivitiesComposerProps };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
import { createContext } from 'react';
|
|
3
|
+
|
|
4
|
+
type GroupActivitiesContextType = {
|
|
5
|
+
groupActivities: (options: { activities: readonly WebChatActivity[] }) => Readonly<{
|
|
6
|
+
[key: string]: readonly (readonly WebChatActivity[])[];
|
|
7
|
+
}>;
|
|
8
|
+
groupActivitiesByName: (
|
|
9
|
+
activities: readonly WebChatActivity[],
|
|
10
|
+
groupingName: string
|
|
11
|
+
) => readonly (readonly WebChatActivity[])[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const GroupActivitiesContext = createContext<GroupActivitiesContextType>(
|
|
15
|
+
new Proxy({} as GroupActivitiesContextType, {
|
|
16
|
+
get() {
|
|
17
|
+
throw new Error('botframework-webchat: This hook can only be used under <GroupActivitiesContext>');
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default GroupActivitiesContext;
|
|
23
|
+
export { type GroupActivitiesContextType };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type GlobalScopePonyfill, type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
|
|
3
|
+
import type GroupActivitiesMiddleware from '../../../types/GroupActivitiesMiddleware';
|
|
4
|
+
import { type SendStatus } from '../../../types/SendStatus';
|
|
5
|
+
|
|
6
|
+
function bin<T>(items: readonly T[], grouping: (last: T, current: T) => boolean): readonly (readonly T[])[] {
|
|
7
|
+
let lastBin: T[];
|
|
8
|
+
const bins: T[][] = [];
|
|
9
|
+
let lastItem: T;
|
|
10
|
+
|
|
11
|
+
for (const item of items) {
|
|
12
|
+
if (lastItem && grouping(lastItem, item)) {
|
|
13
|
+
lastBin.push(item);
|
|
14
|
+
} else {
|
|
15
|
+
lastBin = [item];
|
|
16
|
+
bins.push(lastBin);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
lastItem = item;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
for (const bin in bins) {
|
|
23
|
+
Object.freeze(bin);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return Object.freeze(bins);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function sending(activity: WebChatActivity): SendStatus | undefined {
|
|
30
|
+
if (activity.from.role === 'user') {
|
|
31
|
+
const {
|
|
32
|
+
channelData: { 'webchat:send-status': sendStatus }
|
|
33
|
+
} = activity;
|
|
34
|
+
|
|
35
|
+
return sendStatus;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function createShouldGroupTimestamp(groupTimestamp: boolean | number, { Date }: GlobalScopePonyfill) {
|
|
40
|
+
return (activityX: WebChatActivity, activityY: WebChatActivity): boolean => {
|
|
41
|
+
if (groupTimestamp === false) {
|
|
42
|
+
// Hide timestamp for all activities.
|
|
43
|
+
return true;
|
|
44
|
+
} else if (activityX && activityY) {
|
|
45
|
+
if (sending(activityX) !== sending(activityY)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
groupTimestamp = typeof groupTimestamp === 'number' ? groupTimestamp : Infinity;
|
|
50
|
+
|
|
51
|
+
const timeX = new Date(activityX.timestamp).getTime();
|
|
52
|
+
const timeY = new Date(activityY.timestamp).getTime();
|
|
53
|
+
|
|
54
|
+
return Math.abs(timeX - timeY) <= groupTimestamp;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function shouldGroupSender(x: WebChatActivity, y: WebChatActivity): boolean {
|
|
62
|
+
const {
|
|
63
|
+
from: { role: roleX, id: idX }
|
|
64
|
+
} = x;
|
|
65
|
+
const {
|
|
66
|
+
from: { role: roleY, id: idY }
|
|
67
|
+
} = y;
|
|
68
|
+
return roleX === roleY && idX === idY;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default function createDefaultGroupActivitiesMiddleware({
|
|
72
|
+
groupTimestamp,
|
|
73
|
+
ponyfill
|
|
74
|
+
}: Readonly<{
|
|
75
|
+
groupTimestamp: boolean | number;
|
|
76
|
+
ponyfill: GlobalScopePonyfill;
|
|
77
|
+
}>): readonly GroupActivitiesMiddleware[] {
|
|
78
|
+
return Object.freeze([
|
|
79
|
+
type =>
|
|
80
|
+
type === 'sender' || typeof type === 'undefined'
|
|
81
|
+
? next =>
|
|
82
|
+
({ activities }) => ({ ...next({ activities }), sender: bin(activities, shouldGroupSender) })
|
|
83
|
+
: undefined,
|
|
84
|
+
type =>
|
|
85
|
+
type === 'status' || typeof type === 'undefined'
|
|
86
|
+
? next =>
|
|
87
|
+
({ activities }) => ({
|
|
88
|
+
...next({ activities }),
|
|
89
|
+
status: bin(activities, createShouldGroupTimestamp(groupTimestamp, ponyfill))
|
|
90
|
+
})
|
|
91
|
+
: undefined
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
|
|
3
|
+
export default function isGroupingValid(
|
|
4
|
+
source: readonly WebChatActivity[],
|
|
5
|
+
bins: readonly (readonly WebChatActivity[])[]
|
|
6
|
+
): boolean {
|
|
7
|
+
const set = new Set(source);
|
|
8
|
+
|
|
9
|
+
if (source.length !== set.size) {
|
|
10
|
+
console.warn('botframework-webchat: Cannot validate activity grouping because some activities are duplicated');
|
|
11
|
+
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
for (const bin of bins) {
|
|
16
|
+
for (const activityInBin of bin) {
|
|
17
|
+
if (!set.has(activityInBin)) {
|
|
18
|
+
console.warn(
|
|
19
|
+
'botframework-webchat: All binned items must be originate from the source list, check groupingActivityMiddleware to make sure it bin from the source list',
|
|
20
|
+
{
|
|
21
|
+
activityInBin
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set.delete(activityInBin);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (set.size) {
|
|
33
|
+
console.warn(
|
|
34
|
+
'botframework-webchat: Not every activity is binned, check groupingActivityMiddleware to make sure it is binning every activity passed'
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import GroupActivitiesContext, { type GroupActivitiesContextType } from './GroupActivitiesContext';
|
|
3
|
+
|
|
4
|
+
export default function useGroupActivitiesContext(): GroupActivitiesContextType {
|
|
5
|
+
return useContext(GroupActivitiesContext);
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
|
|
3
|
+
import useGroupActivitiesContext from './private/useGroupActivitiesContext';
|
|
4
|
+
|
|
5
|
+
type GroupedActivities = readonly (readonly WebChatActivity[])[];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This hook will return a callback function. When called with `activities`, the callback function will run the `groupActivitiesMiddleware` and will return all groupings.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated This function is deprecated and will be removed on or after 2027-05-04. Developers should migrate to [`useGroupActivitiesByName`](#usegroupactivitiesbyname) for performance reason.
|
|
11
|
+
*/
|
|
12
|
+
export default function useGroupActivities(): ({
|
|
13
|
+
activities
|
|
14
|
+
}: Readonly<{
|
|
15
|
+
activities: readonly WebChatActivity[];
|
|
16
|
+
}>) => Readonly<{
|
|
17
|
+
[key: string]: GroupedActivities;
|
|
18
|
+
}> {
|
|
19
|
+
return useGroupActivitiesContext().groupActivities;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
|
|
3
|
+
import useGroupActivitiesContext from './private/useGroupActivitiesContext';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This hook will return a callback function. When called with `activities`, the callback function will run the `groupActivitiesMiddleware` for the specified grouping name.
|
|
7
|
+
*
|
|
8
|
+
* Unlike the [`useGroupActivities`](#usegroupactivities) hook which provide result for all groupings, this hook only provide result for the specified grouping name and the grouping name must be one of the name specified in `styleOptions.groupActivitiesBy`.
|
|
9
|
+
*
|
|
10
|
+
* @returns Result of `groupActivitiesMiddleware` for the specified grouping name
|
|
11
|
+
*/
|
|
12
|
+
export default function useGroupActivitiesBy(): (
|
|
13
|
+
activities: readonly WebChatActivity[],
|
|
14
|
+
name: string
|
|
15
|
+
) => readonly (readonly WebChatActivity[])[] {
|
|
16
|
+
return useGroupActivitiesContext().groupActivitiesByName;
|
|
17
|
+
}
|
package/src/tsconfig.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"allowSyntheticDefaultImports": true,
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"declarationDir": "../lib",
|
|
6
|
-
"declarationMap": true,
|
|
7
4
|
"downlevelIteration": true,
|
|
8
|
-
"emitDeclarationOnly": true,
|
|
9
5
|
"jsx": "react",
|
|
10
6
|
"module": "ESNext",
|
|
11
7
|
"moduleResolution": "Bundler",
|
|
12
|
-
"
|
|
8
|
+
"noEmit": true,
|
|
13
9
|
"pretty": true,
|
|
14
10
|
"resolveJsonModule": true, // Required for localization files
|
|
15
11
|
"skipLibCheck": true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DirectLineAttachment, type WebChatActivity } from 'botframework-webchat-core';
|
|
2
2
|
|
|
3
3
|
// TODO: We should consider using a prop for "attachmentMiddleware" to render for screen reader, instead of having another middleware.
|
|
4
4
|
|
|
@@ -11,11 +11,18 @@ type AttachmentForScreenReaderComponentFactoryOptions = [
|
|
|
11
11
|
}
|
|
12
12
|
];
|
|
13
13
|
|
|
14
|
-
type AttachmentForScreenReaderComponentFactory = ComponentFactory<
|
|
14
|
+
type AttachmentForScreenReaderComponentFactory = ComponentFactory<
|
|
15
|
+
AttachmentForScreenReaderComponentFactoryOptions,
|
|
16
|
+
// Following @types/react to use {} for props.
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
18
|
+
{}
|
|
19
|
+
>;
|
|
15
20
|
|
|
16
21
|
type AttachmentForScreenReaderMiddleware = ComponentMiddleware<
|
|
17
22
|
[],
|
|
18
23
|
AttachmentForScreenReaderComponentFactoryOptions,
|
|
24
|
+
// Following @types/react to use {} for props.
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
19
26
|
{}
|
|
20
27
|
>;
|
|
21
28
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
2
|
|
|
3
3
|
import { StrictStyleOptions } from '../StyleOptions';
|
|
4
4
|
import ComponentMiddleware, { ComponentFactory } from './ComponentMiddleware';
|
|
@@ -11,8 +11,12 @@ type AvatarComponentFactoryArguments = [
|
|
|
11
11
|
}
|
|
12
12
|
];
|
|
13
13
|
|
|
14
|
+
// Following @types/react to use {} for props.
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
14
16
|
type AvatarComponentFactory = ComponentFactory<AvatarComponentFactoryArguments, {}>;
|
|
15
17
|
|
|
18
|
+
// Following @types/react to use {} for props.
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
16
20
|
type AvatarMiddleware = ComponentMiddleware<[], AvatarComponentFactoryArguments, {}>;
|
|
17
21
|
|
|
18
22
|
export default AvatarMiddleware;
|