@microsoft/omnichannel-chat-widget 0.1.0-main.dbc1afa → 0.1.0-main.df142b8
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/README.md +32 -0
- package/lib/cjs/assets/Icons.js +4 -2
- package/lib/cjs/common/Constants.js +25 -160
- package/lib/cjs/common/KeyCodes.js +0 -3
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +0 -4
- package/lib/cjs/common/storage/default/defaultCacheManager.js +24 -0
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +102 -0
- package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +78 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +48 -25
- package/lib/cjs/common/telemetry/TelemetryHelper.js +16 -57
- package/lib/cjs/common/telemetry/TelemetryManager.js +0 -31
- package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +0 -2
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +30 -36
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +0 -9
- package/lib/cjs/common/utils.js +65 -93
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +8 -46
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +19 -25
- package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -32
- package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -36
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
- package/lib/cjs/components/footerstateful/FooterStateful.js +11 -42
- package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +14 -43
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
- package/lib/cjs/components/headerstateful/HeaderStateful.js +17 -31
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +37 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +18 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +32 -0
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +62 -0
- package/lib/cjs/components/livechatwidget/common/Deferred.js +35 -0
- package/lib/cjs/components/livechatwidget/common/authHelper.js +50 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +10 -9
- package/lib/cjs/components/livechatwidget/common/createFooter.js +4 -23
- package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -10
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +36 -43
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +14 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +70 -40
- package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
- package/lib/cjs/components/livechatwidget/common/endChat.js +95 -48
- package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +7 -16
- package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +32 -53
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +78 -128
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +4 -17
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -15
- package/lib/cjs/components/livechatwidget/common/shareObservable.js +41 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +219 -122
- package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +0 -8
- package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
- package/lib/cjs/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +313 -203
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +19 -19
- package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +4 -17
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -17
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -23
- package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
- package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
- package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
- package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +10 -42
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +19 -33
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -24
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -19
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -7
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +9 -26
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -16
- package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -15
- package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -37
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +9 -19
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -60
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +82 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +89 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -12
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +6 -28
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +1 -12
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -19
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -12
- package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
- package/lib/cjs/contexts/ChatContextStore.js +0 -2
- package/lib/cjs/contexts/ChatSDKStore.js +0 -2
- package/lib/cjs/contexts/common/ConversationState.js +3 -3
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +30 -26
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +13 -13
- package/lib/cjs/contexts/createReducer.js +164 -102
- package/lib/cjs/controller/componentController.js +4 -33
- package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
- package/lib/cjs/hooks/useChatContextStore.js +0 -6
- package/lib/cjs/hooks/useChatSDKStore.js +0 -6
- package/lib/cjs/index.js +0 -5
- package/lib/cjs/plugins/newMessageEventHandler.js +15 -36
- package/lib/esm/assets/Icons.js +2 -1
- package/lib/esm/common/Constants.js +22 -147
- package/lib/esm/common/KeyCodes.js +0 -2
- package/lib/esm/common/contextDataStore/DataStoreManager.js +0 -2
- package/lib/esm/common/storage/default/defaultCacheManager.js +16 -0
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +95 -0
- package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +52 -22
- package/lib/esm/common/telemetry/TelemetryHelper.js +16 -45
- package/lib/esm/common/telemetry/TelemetryManager.js +0 -18
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +28 -24
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +0 -5
- package/lib/esm/common/utils.js +61 -51
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +8 -17
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -12
- package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +9 -13
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -15
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
- package/lib/esm/components/footerstateful/FooterStateful.js +13 -23
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +14 -36
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
- package/lib/esm/components/headerstateful/HeaderStateful.js +17 -16
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +30 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +11 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +25 -0
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +55 -0
- package/lib/esm/components/livechatwidget/common/Deferred.js +28 -0
- package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -4
- package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
- package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +38 -37
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +7 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +72 -27
- package/lib/esm/components/livechatwidget/common/endChat.js +97 -32
- package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +9 -11
- package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +35 -22
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +78 -110
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +4 -9
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -7
- package/lib/esm/components/livechatwidget/common/shareObservable.js +35 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +219 -100
- package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
- package/lib/esm/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +316 -147
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +19 -7
- package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +4 -5
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -5
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
- package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
- package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
- package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
- package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -26
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +21 -9
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -6
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -4
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +9 -18
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -12
- package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -5
- package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
- package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -22
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +11 -11
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -38
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +34 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +80 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +83 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +3 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +7 -14
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +3 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +3 -8
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -14
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -5
- package/lib/esm/contexts/ChatAdapterStore.js +2 -1
- package/lib/esm/contexts/ChatContextStore.js +2 -1
- package/lib/esm/contexts/ChatSDKStore.js +2 -1
- package/lib/esm/contexts/common/ConversationState.js +3 -3
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +30 -26
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +13 -9
- package/lib/esm/contexts/createReducer.js +164 -99
- package/lib/esm/controller/componentController.js +5 -4
- package/lib/esm/hooks/useChatAdapterStore.js +0 -4
- package/lib/esm/hooks/useChatContextStore.js +0 -4
- package/lib/esm/hooks/useChatSDKStore.js +0 -4
- package/lib/esm/plugins/newMessageEventHandler.js +15 -26
- package/lib/types/assets/Icons.d.ts +1 -0
- package/lib/types/common/Constants.d.ts +20 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
- package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
- package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
- package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +35 -7
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -4
- package/lib/types/common/utils.d.ts +7 -3
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -7
- package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -2
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -2
- package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -0
- package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
- package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
- package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
- package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -2
- package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
- package/lib/types/contexts/common/ConversationState.d.ts +3 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -3
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +30 -25
- package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
- package/package.json +5 -4
|
@@ -4,27 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DeliveredTimestamp = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _DirectLineSenderRole = require("../../../enums/DirectLineSenderRole");
|
|
11
|
-
|
|
12
9
|
var _react2 = require("@fluentui/react");
|
|
13
|
-
|
|
14
10
|
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
15
|
-
|
|
16
11
|
var _defaultTimestampContentStyles = require("../defaultStyles/defaultTimestampContentStyles");
|
|
17
|
-
|
|
18
12
|
var _utils = require("../../../../../../common/utils");
|
|
19
|
-
|
|
20
13
|
var _ = require("../../../../../..");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
25
16
|
const DeliveredTimestamp = _ref => {
|
|
26
17
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
|
|
27
|
-
|
|
28
18
|
let {
|
|
29
19
|
args,
|
|
30
20
|
role,
|
|
@@ -32,7 +22,8 @@ const DeliveredTimestamp = _ref => {
|
|
|
32
22
|
} = _ref;
|
|
33
23
|
const [state] = (0, _.useChatContextStore)();
|
|
34
24
|
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
35
|
-
const contentStyles = {
|
|
25
|
+
const contentStyles = {
|
|
26
|
+
..._defaultTimestampContentStyles.defaultTimestampContentStyles,
|
|
36
27
|
...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.timestampContentStyleProps)
|
|
37
28
|
};
|
|
38
29
|
const {
|
|
@@ -52,5 +43,4 @@ const DeliveredTimestamp = _ref => {
|
|
|
52
43
|
"aria-hidden": "false"
|
|
53
44
|
}, ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_DELIVERED) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_DELIVERED));
|
|
54
45
|
};
|
|
55
|
-
|
|
56
46
|
exports.DeliveredTimestamp = DeliveredTimestamp;
|
|
@@ -4,37 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.NotDeliveredTimestamp = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Constants = require("../../../../../../common/Constants");
|
|
11
|
-
|
|
12
9
|
var _KeyCodes = require("../../../../../../common/KeyCodes");
|
|
13
|
-
|
|
14
10
|
var _react2 = require("@fluentui/react");
|
|
15
|
-
|
|
16
11
|
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
17
|
-
|
|
18
12
|
var _defaultTimestampContentStyles = require("../defaultStyles/defaultTimestampContentStyles");
|
|
19
|
-
|
|
20
13
|
var _defaultTimestampFailedStyles = require("../defaultStyles/defaultTimestampFailedStyles");
|
|
21
|
-
|
|
22
14
|
var _defaultTimestampRetryStyles = require("../defaultStyles/defaultTimestampRetryStyles");
|
|
23
|
-
|
|
24
15
|
var _utils = require("../../../../../../common/utils");
|
|
25
|
-
|
|
26
16
|
var _botframeworkWebchat = require("botframework-webchat");
|
|
27
|
-
|
|
28
17
|
var _ = require("../../../../../..");
|
|
29
|
-
|
|
30
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
|
|
32
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
20
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
35
21
|
const NotDeliveredTimestamp = _ref => {
|
|
36
22
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _state$domainStates$r4, _state$domainStates$m, _state$domainStates$m2;
|
|
37
|
-
|
|
38
23
|
let {
|
|
39
24
|
args
|
|
40
25
|
} = _ref;
|
|
@@ -53,54 +38,48 @@ const NotDeliveredTimestamp = _ref => {
|
|
|
53
38
|
} = activity;
|
|
54
39
|
const [state] = (0, _.useChatContextStore)();
|
|
55
40
|
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
56
|
-
const contentStyles = {
|
|
41
|
+
const contentStyles = {
|
|
42
|
+
..._defaultTimestampContentStyles.defaultTimestampContentStyles,
|
|
57
43
|
...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.timestampContentStyleProps)
|
|
58
44
|
};
|
|
59
|
-
const failedTextStyles = {
|
|
45
|
+
const failedTextStyles = {
|
|
46
|
+
..._defaultTimestampFailedStyles.defaultTimestampFailedStyles,
|
|
60
47
|
...((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : _state$domainStates$r3.timestampFailedTextStyleProps)
|
|
61
48
|
};
|
|
62
|
-
const retryTextStyles = {
|
|
49
|
+
const retryTextStyles = {
|
|
50
|
+
..._defaultTimestampRetryStyles.defaultTimestampRetryStyles,
|
|
63
51
|
...((_state$domainStates$r4 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r4 === void 0 ? void 0 : _state$domainStates$r4.timestampRetryTextStyleProps)
|
|
64
52
|
};
|
|
65
53
|
(0, _react.useEffect)(() => {
|
|
66
54
|
var _timestampRef$current;
|
|
67
|
-
|
|
68
55
|
const timestampWebChatNodes = timestampRef === null || timestampRef === void 0 ? void 0 : (_timestampRef$current = timestampRef.current) === null || _timestampRef$current === void 0 ? void 0 : _timestampRef$current.childNodes;
|
|
69
|
-
|
|
70
56
|
if ((timestampWebChatNodes === null || timestampWebChatNodes === void 0 ? void 0 : timestampWebChatNodes.length) > 1) {
|
|
71
57
|
timestampWebChatNodes[1].innerText = (0, _utils.getTimestampHourMinute)(timestamp);
|
|
72
58
|
}
|
|
73
59
|
}, [timestampRef]);
|
|
74
60
|
const onRetryClick = (0, _react.useCallback)(async event => {
|
|
75
61
|
var _activity$channelData;
|
|
76
|
-
|
|
77
62
|
removeNotDeliveredTimestamp(event);
|
|
78
63
|
activity.previousClientActivityID = (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : _activity$channelData.clientActivityID;
|
|
79
64
|
await postActivity(activity);
|
|
80
65
|
focus("sendBox");
|
|
81
66
|
}, [activity, focus, postActivity]);
|
|
82
|
-
|
|
83
67
|
const onRetryKeyEnter = event => {
|
|
84
68
|
if (event.code === _KeyCodes.KeyCodes.ENTER) {
|
|
85
69
|
event.preventDefault();
|
|
86
70
|
onRetryClick(event);
|
|
87
71
|
}
|
|
88
72
|
};
|
|
89
|
-
|
|
90
73
|
const removeNotDeliveredTimestamp = event => {
|
|
91
74
|
let parent = event.target.parentElement;
|
|
92
|
-
|
|
93
75
|
while (parent.tagName !== _Constants.HtmlAttributeNames.listItem) {
|
|
94
76
|
parent = parent.parentElement;
|
|
95
|
-
|
|
96
77
|
if (parent.tagName === _Constants.HtmlAttributeNames.unorderedList) {
|
|
97
78
|
return;
|
|
98
79
|
}
|
|
99
80
|
}
|
|
100
|
-
|
|
101
81
|
parent.parentNode.removeChild(parent);
|
|
102
82
|
};
|
|
103
|
-
|
|
104
83
|
return /*#__PURE__*/_react.default.createElement(_react2.Stack, {
|
|
105
84
|
style: contentStyles,
|
|
106
85
|
dir: dir,
|
|
@@ -114,5 +93,4 @@ const NotDeliveredTimestamp = _ref => {
|
|
|
114
93
|
tabIndex: 0
|
|
115
94
|
}, " ", ((_state$domainStates$m2 = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m2 === void 0 ? void 0 : _state$domainStates$m2.MIDDLEWARE_MESSAGE_RETRY) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_RETRY, " "));
|
|
116
95
|
};
|
|
117
|
-
|
|
118
96
|
exports.NotDeliveredTimestamp = NotDeliveredTimestamp;
|
|
@@ -4,31 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SendingTimestamp = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _react2 = require("@fluentui/react");
|
|
11
|
-
|
|
12
9
|
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
13
|
-
|
|
14
10
|
var _defaultTimestampContentStyles = require("../defaultStyles/defaultTimestampContentStyles");
|
|
15
|
-
|
|
16
11
|
var _utils = require("../../../../../../common/utils");
|
|
17
|
-
|
|
18
12
|
var _ = require("../../../../../..");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
23
15
|
const SendingTimestamp = _ref => {
|
|
24
16
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
|
|
25
|
-
|
|
26
17
|
let {
|
|
27
18
|
args
|
|
28
19
|
} = _ref;
|
|
29
20
|
const [state] = (0, _.useChatContextStore)();
|
|
30
21
|
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
31
|
-
const contentStyles = {
|
|
22
|
+
const contentStyles = {
|
|
23
|
+
..._defaultTimestampContentStyles.defaultTimestampContentStyles,
|
|
32
24
|
...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.timestampContentStyleProps)
|
|
33
25
|
};
|
|
34
26
|
const {
|
|
@@ -42,5 +34,4 @@ const SendingTimestamp = _ref => {
|
|
|
42
34
|
horizontal: true
|
|
43
35
|
}, /*#__PURE__*/_react.default.createElement("span", null, " ", (0, _utils.getTimestampHourMinute)(timestamp)), /*#__PURE__*/_react.default.createElement("span", null, " \xA0-\xA0 "), /*#__PURE__*/_react.default.createElement("span", null, " ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_SENDING) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_SENDING, " "));
|
|
44
36
|
};
|
|
45
|
-
|
|
46
37
|
exports.SendingTimestamp = SendingTimestamp;
|
|
@@ -4,34 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.typingIndicatorMiddleware = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
|
|
11
|
-
|
|
12
9
|
var _defaultMiddlewareLocalizedTexts = require("../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
13
|
-
|
|
14
10
|
var _defaultTypingIndicatorBubbleStyles = require("./defaultStyles/defaultTypingIndicatorBubbleStyles");
|
|
15
|
-
|
|
16
11
|
var _defaultTypingIndicatorContainerStyles = require("./defaultStyles/defaultTypingIndicatorContainerStyles");
|
|
17
|
-
|
|
18
12
|
var _defaultTypingIndicatorMessageStyles = require("./defaultStyles/defaultTypingIndicatorMessageStyles");
|
|
19
|
-
|
|
20
13
|
var _ = require("../../../../..");
|
|
21
|
-
|
|
22
14
|
var _useChatSDKStore = _interopRequireDefault(require("../../../../../hooks/useChatSDKStore"));
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
16
|
/******
|
|
27
17
|
* TypingIndicatorMiddleware
|
|
28
18
|
*
|
|
29
19
|
* This middleware changes the component that shows who's actively typing. It uses the default Microsoft LiveChatWidget styles.
|
|
30
20
|
******/
|
|
21
|
+
|
|
31
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
23
|
const TypingIndicator = _ref => {
|
|
33
24
|
var _state$domainStates$l, _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3;
|
|
34
|
-
|
|
35
25
|
let {
|
|
36
26
|
activeTyping,
|
|
37
27
|
visible
|
|
@@ -39,39 +29,37 @@ const TypingIndicator = _ref => {
|
|
|
39
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
30
|
const chatSDK = (0, _useChatSDKStore.default)();
|
|
41
31
|
const [state] = (0, _.useChatContextStore)();
|
|
42
|
-
|
|
43
32
|
if (!activeTyping || Object.keys(activeTyping).length === 0 || ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.LiveChatVersion) === 1 && !visible) {
|
|
44
33
|
return null;
|
|
45
34
|
}
|
|
46
|
-
|
|
47
35
|
activeTyping = Object.keys(activeTyping).map(key => activeTyping[key]);
|
|
48
|
-
|
|
49
36
|
for (let i = 0; i < activeTyping.length; i++) {
|
|
50
37
|
if (activeTyping[i].role && activeTyping[i].role === _DirectLineSenderRole.DirectLineSenderRole.User) {
|
|
51
38
|
var _state$domainStates$l2;
|
|
52
|
-
|
|
53
39
|
//visible is set to false if the current user is typing, in which case, we just send typing indicator to OC
|
|
54
40
|
if (((_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.LiveChatVersion) === 2 && !visible) {
|
|
55
41
|
chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.sendTypingEvent();
|
|
56
42
|
return null;
|
|
57
43
|
}
|
|
58
|
-
|
|
59
44
|
activeTyping.splice(i, 1);
|
|
60
45
|
i--;
|
|
61
46
|
}
|
|
62
47
|
}
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
const localizedTexts = {
|
|
49
|
+
..._defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
|
|
65
50
|
...state.domainStates.middlewareLocalizedTexts
|
|
66
51
|
};
|
|
67
52
|
const message = getTypingIndicatorMessage(activeTyping, localizedTexts);
|
|
68
|
-
const typingIndicatorStyles = {
|
|
53
|
+
const typingIndicatorStyles = {
|
|
54
|
+
..._defaultTypingIndicatorContainerStyles.defaultTypingIndicatorContainerStyles,
|
|
69
55
|
...((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.typingIndicatorStyleProps)
|
|
70
56
|
};
|
|
71
|
-
const typingIndicatorBubbleStyles = {
|
|
57
|
+
const typingIndicatorBubbleStyles = {
|
|
58
|
+
..._defaultTypingIndicatorBubbleStyles.defaultTypingIndicatorBubbleStyles,
|
|
72
59
|
...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.typingIndicatorBubbleStyleProps)
|
|
73
60
|
};
|
|
74
|
-
const typingIndicatorMessageStyles = {
|
|
61
|
+
const typingIndicatorMessageStyles = {
|
|
62
|
+
..._defaultTypingIndicatorMessageStyles.defaultTypingIndicatorMessageStyles,
|
|
75
63
|
...((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : _state$domainStates$r3.typingIndicatorMessageStyleProps)
|
|
76
64
|
};
|
|
77
65
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("style", null, `
|
|
@@ -113,9 +101,9 @@ const TypingIndicator = _ref => {
|
|
|
113
101
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
114
102
|
style: typingIndicatorMessageStyles
|
|
115
103
|
}, " ", message, " ")));
|
|
116
|
-
};
|
|
117
|
-
|
|
104
|
+
};
|
|
118
105
|
|
|
106
|
+
// eslint-disable-next-line react/display-name, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
119
107
|
const typingIndicatorMiddleware = () => next => args => {
|
|
120
108
|
const {
|
|
121
109
|
activeTyping,
|
|
@@ -125,11 +113,10 @@ const typingIndicatorMiddleware = () => next => args => {
|
|
|
125
113
|
activeTyping: activeTyping,
|
|
126
114
|
visible: visible
|
|
127
115
|
});
|
|
128
|
-
};
|
|
129
|
-
|
|
116
|
+
};
|
|
130
117
|
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
131
119
|
exports.typingIndicatorMiddleware = typingIndicatorMiddleware;
|
|
132
|
-
|
|
133
120
|
const getTypingIndicatorMessage = (activeTyping, localizedTexts) => {
|
|
134
121
|
if (!activeTyping || activeTyping.length === 0) {
|
|
135
122
|
return "";
|
|
@@ -140,19 +127,15 @@ const getTypingIndicatorMessage = (activeTyping, localizedTexts) => {
|
|
|
140
127
|
const firstMember = activeTyping[0].name;
|
|
141
128
|
const lastMember = activeTyping[1].name;
|
|
142
129
|
let message = localizedTexts.MIDDLEWARE_TYPING_INDICATOR_TWO;
|
|
143
|
-
|
|
144
130
|
if (!message) {
|
|
145
131
|
return "";
|
|
146
132
|
}
|
|
147
|
-
|
|
148
133
|
if (message.includes("{0}")) {
|
|
149
134
|
message = message.replace("{0}", firstMember);
|
|
150
135
|
}
|
|
151
|
-
|
|
152
136
|
if (message.includes("{1}")) {
|
|
153
137
|
message = message.replace("{1}", lastMember);
|
|
154
138
|
}
|
|
155
|
-
|
|
156
139
|
return message;
|
|
157
140
|
} else {
|
|
158
141
|
const message = localizedTexts.MIDDLEWARE_TYPING_INDICATOR_MULTIPLE;
|
|
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
9
|
-
|
|
10
8
|
/******
|
|
11
9
|
* AttachmentProcessingMiddleware
|
|
12
10
|
*
|
|
13
11
|
* Handles attachment sending.
|
|
14
12
|
******/
|
|
13
|
+
|
|
15
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
15
|
const createSendFileAction = files => {
|
|
17
16
|
return {
|
|
@@ -20,32 +19,27 @@ const createSendFileAction = files => {
|
|
|
20
19
|
},
|
|
21
20
|
type: _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_FILES
|
|
22
21
|
};
|
|
23
|
-
};
|
|
24
|
-
|
|
22
|
+
};
|
|
25
23
|
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
25
|
const attachmentProcessingMiddleware = _ref => {
|
|
27
26
|
let {
|
|
28
27
|
dispatch
|
|
29
28
|
} = _ref;
|
|
30
29
|
return next => async action => {
|
|
31
30
|
var _action$payload, _action$payload$files;
|
|
32
|
-
|
|
33
31
|
if ((action === null || action === void 0 ? void 0 : action.type) === _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_FILES && (action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$files = _action$payload.files) === null || _action$payload$files === void 0 ? void 0 : _action$payload$files.length) > 0) {
|
|
34
32
|
const files = action.payload.files;
|
|
35
|
-
|
|
36
33
|
if (files.length === 1) {
|
|
37
34
|
return next(action);
|
|
38
35
|
}
|
|
39
|
-
|
|
40
36
|
const dispatchAction = createSendFileAction(files.slice(0, files.length - 1));
|
|
41
37
|
const nextAction = createSendFileAction([files[files.length - 1]]);
|
|
42
38
|
await dispatch(dispatchAction);
|
|
43
39
|
return next(nextAction);
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
return next(action);
|
|
47
42
|
};
|
|
48
43
|
};
|
|
49
|
-
|
|
50
44
|
var _default = attachmentProcessingMiddleware;
|
|
51
45
|
exports.default = _default;
|
|
@@ -4,46 +4,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _NotificationHandler = require("../../notification/NotificationHandler");
|
|
9
|
-
|
|
10
8
|
var _NotificationScenarios = require("../../enums/NotificationScenarios");
|
|
11
|
-
|
|
12
9
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
13
|
-
|
|
14
10
|
/******
|
|
15
11
|
* AttachmentUploadValidatorMiddleware
|
|
16
12
|
*
|
|
17
13
|
* Checks if the attachment being uploaded satisfies Omnichannel's requirement on file extensions and file size.
|
|
18
14
|
******/
|
|
15
|
+
|
|
19
16
|
const MBtoBRatio = 1000000;
|
|
17
|
+
|
|
20
18
|
/*
|
|
21
19
|
* If an attachment is invalid, delete this attachment from the attachments list
|
|
22
20
|
* If the result attachment list is empty, return a dummy action
|
|
23
21
|
*/
|
|
24
|
-
|
|
25
22
|
const validateAttachment = (action, allowedFileExtensions, maxUploadFileSize, localizedTexts) => {
|
|
26
23
|
var _action$payload, _action$payload$activ, _action$payload2, _action$payload2$acti, _action$payload2$acti2, _action$payload3, _action$payload3$acti, _action$payload3$acti2;
|
|
27
|
-
|
|
28
24
|
const attachments = action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$activ = _action$payload.activity) === null || _action$payload$activ === void 0 ? void 0 : _action$payload$activ.attachments;
|
|
29
25
|
const attachmentSizes = action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : (_action$payload2$acti2 = _action$payload2$acti.channelData) === null || _action$payload2$acti2 === void 0 ? void 0 : _action$payload2$acti2.attachmentSizes;
|
|
30
|
-
|
|
31
26
|
if (attachments) {
|
|
32
27
|
for (let i = 0; i < attachments.length; i++) {
|
|
33
28
|
const fileExtensionValid = validateFileExtension(attachments[i], allowedFileExtensions);
|
|
34
29
|
const fileSizeValid = validateFileSize(attachmentSizes[i], maxUploadFileSize);
|
|
35
30
|
const fileIsEmpty = parseInt(attachmentSizes[i]) == 0;
|
|
36
|
-
|
|
37
31
|
if (!fileExtensionValid || !fileSizeValid || fileIsEmpty) {
|
|
38
32
|
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.AttachmentError, buildErrorMessage(attachments[i].name, fileExtensionValid, fileSizeValid, fileIsEmpty, maxUploadFileSize, localizedTexts));
|
|
39
|
-
|
|
40
33
|
attachments.splice(i, 1);
|
|
41
34
|
attachmentSizes.splice(i, 1);
|
|
42
35
|
i--;
|
|
43
36
|
}
|
|
44
37
|
}
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
if ((action === null || action === void 0 ? void 0 : (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$acti = _action$payload3.activity) === null || _action$payload3$acti === void 0 ? void 0 : (_action$payload3$acti2 = _action$payload3$acti.attachments) === null || _action$payload3$acti2 === void 0 ? void 0 : _action$payload3$acti2.length) > 0) {
|
|
48
40
|
return action;
|
|
49
41
|
} else {
|
|
@@ -52,37 +44,30 @@ const validateAttachment = (action, allowedFileExtensions, maxUploadFileSize, lo
|
|
|
52
44
|
payload: null
|
|
53
45
|
};
|
|
54
46
|
}
|
|
55
|
-
};
|
|
56
|
-
|
|
47
|
+
};
|
|
57
48
|
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
50
|
const validateFileExtension = (attachment, allowedFileExtensions) => {
|
|
59
51
|
if (!allowedFileExtensions) {
|
|
60
52
|
return true;
|
|
61
53
|
}
|
|
62
|
-
|
|
63
54
|
const fileName = attachment.name.toLowerCase();
|
|
64
55
|
const index = fileName.lastIndexOf(".");
|
|
65
|
-
|
|
66
56
|
if (!index) {
|
|
67
57
|
return false;
|
|
68
58
|
}
|
|
69
|
-
|
|
70
59
|
const fileExtension = fileName.substring(index);
|
|
71
60
|
const allExtensions = allowedFileExtensions === null || allowedFileExtensions === void 0 ? void 0 : allowedFileExtensions.toLowerCase().split(",");
|
|
72
61
|
return allExtensions.indexOf(fileExtension) > -1;
|
|
73
62
|
};
|
|
74
|
-
|
|
75
63
|
const validateFileSize = (attachmentSize, maxUploadFileSize) => {
|
|
76
64
|
return (maxUploadFileSize && parseInt(maxUploadFileSize) * MBtoBRatio) > parseInt(attachmentSize);
|
|
77
65
|
};
|
|
78
|
-
|
|
79
66
|
const buildErrorMessage = (fileName, supportedFileExtension, supportedFileSize, fileIsEmpty, maxUploadFileSize, localizedTexts) => {
|
|
80
67
|
let errorMessage = "";
|
|
81
|
-
|
|
82
68
|
if (!fileName || !maxUploadFileSize) {
|
|
83
69
|
return localizedTexts.MIDDLEWARE_BANNER_FILE_NULL_ERROR ?? "";
|
|
84
70
|
}
|
|
85
|
-
|
|
86
71
|
if (!supportedFileExtension && !supportedFileSize) {
|
|
87
72
|
errorMessage = getFileSizeAndFileExtensionErrorMessage(fileName, maxUploadFileSize, localizedTexts);
|
|
88
73
|
} else if (!supportedFileSize) {
|
|
@@ -94,33 +79,25 @@ const buildErrorMessage = (fileName, supportedFileExtension, supportedFileSize,
|
|
|
94
79
|
} else {
|
|
95
80
|
errorMessage = localizedTexts.MIDDLEWARE_BANNER_ERROR_MESSAGE ?? "";
|
|
96
81
|
}
|
|
97
|
-
|
|
98
82
|
return errorMessage;
|
|
99
83
|
};
|
|
100
|
-
|
|
101
84
|
const getFileSizeAndFileExtensionErrorMessage = (fileName, maxUploadFileSize, localizedTexts) => {
|
|
102
85
|
const index = fileName.lastIndexOf(".");
|
|
103
86
|
let errorMessage;
|
|
104
|
-
|
|
105
87
|
if (index < 0) {
|
|
106
88
|
errorMessage = localizedTexts.MIDDLEWARE_BANNER_FILE_SIZE_WITHOUT_EXTENSION_ERROR;
|
|
107
89
|
} else {
|
|
108
90
|
var _errorMessage;
|
|
109
|
-
|
|
110
91
|
const fileExtension = fileName.substring(index);
|
|
111
92
|
errorMessage = localizedTexts.MIDDLEWARE_BANNER_FILE_SIZE_EXTENSION_ERROR;
|
|
112
|
-
|
|
113
93
|
if ((_errorMessage = errorMessage) !== null && _errorMessage !== void 0 && _errorMessage.includes("{1}")) {
|
|
114
94
|
errorMessage = errorMessage.replace("{1}", fileExtension);
|
|
115
95
|
}
|
|
116
96
|
}
|
|
117
|
-
|
|
118
97
|
return errorMessage ? errorMessage.includes("{0}") ? errorMessage.replace("{0}", maxUploadFileSize) : errorMessage : "";
|
|
119
98
|
};
|
|
120
|
-
|
|
121
99
|
const getFileExtensionErrorMessage = (fileName, localizedTexts) => {
|
|
122
100
|
const index = fileName.lastIndexOf(".");
|
|
123
|
-
|
|
124
101
|
if (index < 0) {
|
|
125
102
|
return localizedTexts.MIDDLEWARE_BANNER_FILE_WITHOUT_EXTENSION ?? "";
|
|
126
103
|
} else {
|
|
@@ -129,13 +106,12 @@ const getFileExtensionErrorMessage = (fileName, localizedTexts) => {
|
|
|
129
106
|
return errorMessage ? errorMessage.includes("{0}") ? errorMessage.replace("{0}", fileExtension) : errorMessage : "";
|
|
130
107
|
}
|
|
131
108
|
};
|
|
132
|
-
|
|
133
109
|
const getFileSizeErrorMessage = (maxUploadFileSize, localizedTexts) => {
|
|
134
110
|
const errorMessage = localizedTexts.MIDDLEWARE_BANNER_FILE_SIZE_ERROR;
|
|
135
111
|
return errorMessage ? errorMessage.includes("{0}") ? errorMessage.replace("{0}", maxUploadFileSize) : errorMessage : "";
|
|
136
|
-
};
|
|
137
|
-
|
|
112
|
+
};
|
|
138
113
|
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
139
115
|
const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxUploadFileSize, localizedTexts) => _ref => {
|
|
140
116
|
let {
|
|
141
117
|
dispatch
|
|
@@ -143,19 +119,15 @@ const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxUpl
|
|
|
143
119
|
return next => action => {
|
|
144
120
|
if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
|
|
145
121
|
var _payload$activity, _payload$activity2, _payload$activity2$ch, _payload$activity3, _payload$activity3$at, _payload$activity4, _payload$activity4$ch, _payload$activity4$ch2;
|
|
146
|
-
|
|
147
122
|
const {
|
|
148
123
|
payload
|
|
149
124
|
} = action;
|
|
150
|
-
|
|
151
125
|
if (payload !== null && payload !== void 0 && (_payload$activity = payload.activity) !== null && _payload$activity !== void 0 && _payload$activity.attachments && payload !== null && payload !== void 0 && (_payload$activity2 = payload.activity) !== null && _payload$activity2 !== void 0 && (_payload$activity2$ch = _payload$activity2.channelData) !== null && _payload$activity2$ch !== void 0 && _payload$activity2$ch.attachmentSizes && (payload === null || payload === void 0 ? void 0 : (_payload$activity3 = payload.activity) === null || _payload$activity3 === void 0 ? void 0 : (_payload$activity3$at = _payload$activity3.attachments) === null || _payload$activity3$at === void 0 ? void 0 : _payload$activity3$at.length) === (payload === null || payload === void 0 ? void 0 : (_payload$activity4 = payload.activity) === null || _payload$activity4 === void 0 ? void 0 : (_payload$activity4$ch = _payload$activity4.channelData) === null || _payload$activity4$ch === void 0 ? void 0 : (_payload$activity4$ch2 = _payload$activity4$ch.attachmentSizes) === null || _payload$activity4$ch2 === void 0 ? void 0 : _payload$activity4$ch2.length)) {
|
|
152
126
|
return next(validateAttachment(action, allowedFileExtensions, maxUploadFileSize, localizedTexts));
|
|
153
127
|
}
|
|
154
128
|
}
|
|
155
|
-
|
|
156
129
|
return next(action);
|
|
157
130
|
};
|
|
158
131
|
};
|
|
159
|
-
|
|
160
132
|
var _default = createAttachmentUploadValidatorMiddleware;
|
|
161
133
|
exports.default = _default;
|
|
@@ -4,18 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _Constants = require("../../../../../common/Constants");
|
|
9
|
-
|
|
10
8
|
var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
|
|
11
|
-
|
|
12
9
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
13
|
-
|
|
14
10
|
/******
|
|
15
11
|
* ChannelDataMiddleware
|
|
16
12
|
*
|
|
17
13
|
* Adds necessary tags if not present so that the rendering middlewares can process them later.
|
|
18
14
|
******/
|
|
15
|
+
|
|
19
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
20
17
|
const channelDataMiddleware = _ref => {
|
|
21
18
|
let {
|
|
@@ -23,16 +20,13 @@ const channelDataMiddleware = _ref => {
|
|
|
23
20
|
} = _ref;
|
|
24
21
|
return next => action => {
|
|
25
22
|
var _action$payload, _action$payload$activ;
|
|
26
|
-
|
|
27
23
|
if ((action === null || action === void 0 ? void 0 : action.type) === _WebChatActionType.WebChatActionType.DIRECT_LINE_POST_ACTIVITY_PENDING && action !== null && action !== void 0 && (_action$payload = action.payload) !== null && _action$payload !== void 0 && (_action$payload$activ = _action$payload.activity) !== null && _action$payload$activ !== void 0 && _action$payload$activ.channelData) {
|
|
28
24
|
const channelIdTag = `${_Constants.Constants.channelIdKey}${_Constants.Constants.ChannelId}`;
|
|
29
25
|
const customerMessageTag = `${_Constants.Constants.CustomerTag}`;
|
|
30
|
-
|
|
31
26
|
if (action.payload.activity.channelData.tags) {
|
|
32
27
|
if (!action.payload.activity.channelData.tags.includes(channelIdTag)) {
|
|
33
28
|
action.payload.activity.channelData.tags.push(channelIdTag);
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
if (!action.payload.activity.channelData.tags.includes(customerMessageTag)) {
|
|
37
31
|
action.payload.activity.channelData.tags.push(customerMessageTag);
|
|
38
32
|
}
|
|
@@ -40,15 +34,12 @@ const channelDataMiddleware = _ref => {
|
|
|
40
34
|
action.payload.activity.channelData.tags = [channelIdTag];
|
|
41
35
|
action.payload.activity.channelData.tags.push(customerMessageTag);
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
action.payload.activity.channelData.metadata = {
|
|
45
38
|
deliveryMode: _omnichannelChatSdk.DeliveryMode.Bridged
|
|
46
39
|
};
|
|
47
40
|
}
|
|
48
|
-
|
|
49
41
|
return next(action);
|
|
50
42
|
};
|
|
51
43
|
};
|
|
52
|
-
|
|
53
44
|
var _default = channelDataMiddleware;
|
|
54
45
|
exports.default = _default;
|
|
@@ -4,21 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _Constants = require("../../../../../common/Constants");
|
|
9
|
-
|
|
10
8
|
var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
|
|
11
|
-
|
|
12
9
|
var _MessageType = require("../../enums/MessageType");
|
|
13
|
-
|
|
14
10
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
15
|
-
|
|
16
11
|
/******
|
|
17
12
|
* ConversationEndMiddleware
|
|
18
13
|
*
|
|
19
14
|
* This middleware is invoked when the conversation is ended by the agent/bot.
|
|
20
15
|
* The callback is then invoked to hide the send box (by default).
|
|
21
16
|
******/
|
|
17
|
+
|
|
22
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
23
19
|
const createConversationEndMiddleware = conversationEndCallback => _ref => {
|
|
24
20
|
let {
|
|
@@ -26,32 +22,25 @@ const createConversationEndMiddleware = conversationEndCallback => _ref => {
|
|
|
26
22
|
} = _ref;
|
|
27
23
|
return next => action => {
|
|
28
24
|
var _action$payload;
|
|
29
|
-
|
|
30
25
|
if ((action === null || action === void 0 ? void 0 : action.type) == _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
|
|
31
26
|
var _activity$from, _activity$from2, _activity$channelData7, _activity$channelData8;
|
|
32
|
-
|
|
33
27
|
const activity = action.payload.activity;
|
|
34
|
-
|
|
35
28
|
if (((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === _DirectLineSenderRole.DirectLineSenderRole.Bot && activity.channelId === "ACS_CHANNEL") {
|
|
36
29
|
var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
|
|
37
|
-
|
|
38
30
|
// ACS
|
|
39
31
|
if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.systemMessageTag) && ((_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(_Constants.Constants.agentEndConversationMessageTag) || (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.supervisorForceCloseMessageTag))) {
|
|
40
32
|
conversationEndCallback();
|
|
41
33
|
}
|
|
42
34
|
} else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === _DirectLineSenderRole.DirectLineSenderRole.Channel && ((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.type) === _MessageType.MessageTypes.Thread && (_activity$channelData8 = activity.channelData) !== null && _activity$channelData8 !== void 0 && _activity$channelData8.properties) {
|
|
43
35
|
var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
|
|
44
|
-
|
|
45
36
|
// IC3
|
|
46
37
|
if (((_activity$channelData9 = activity.channelData) === null || _activity$channelData9 === void 0 ? void 0 : (_activity$channelData10 = _activity$channelData9.properties) === null || _activity$channelData10 === void 0 ? void 0 : _activity$channelData10.isdeleted) === _Constants.Constants.truePascal || !((_activity$channelData11 = activity.channelData) !== null && _activity$channelData11 !== void 0 && (_activity$channelData12 = _activity$channelData11.properties) !== null && _activity$channelData12 !== void 0 && _activity$channelData12.containsExternalEntitiesListeningAll)) {
|
|
47
38
|
conversationEndCallback();
|
|
48
39
|
}
|
|
49
40
|
}
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
return next(action);
|
|
53
43
|
};
|
|
54
44
|
};
|
|
55
|
-
|
|
56
45
|
var _default = createConversationEndMiddleware;
|
|
57
46
|
exports.default = _default;
|