@microsoft/omnichannel-chat-widget 0.1.0-main.fdf1fdf → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -34
- package/lib/cjs/assets/Icons.js +4 -2
- package/lib/cjs/common/Constants.js +31 -171
- package/lib/cjs/common/KeyCodes.js +3 -4
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +3 -5
- package/lib/cjs/common/storage/default/defaultCacheManager.js +26 -0
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +111 -0
- package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +78 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +63 -27
- package/lib/cjs/common/telemetry/TelemetryHelper.js +21 -59
- package/lib/cjs/common/telemetry/TelemetryManager.js +3 -32
- 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 +40 -106
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +8 -46
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +2 -24
- package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +18 -49
- package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +9 -37
- 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 +7 -45
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
- package/lib/cjs/components/headerstateful/HeaderStateful.js +19 -31
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +5 -10
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +139 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -6
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +7 -12
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +14 -20
- package/lib/cjs/components/livechatwidget/common/Deferred.js +6 -11
- package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +36 -0
- package/lib/cjs/components/livechatwidget/common/authHelper.js +13 -15
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +4 -13
- 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 +16 -24
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +14 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +127 -49
- package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
- package/lib/cjs/components/livechatwidget/common/endChat.js +65 -70
- 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 +25 -101
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +82 -151
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +4 -17
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +256 -12
- package/lib/cjs/components/livechatwidget/common/shareObservable.js +4 -8
- package/lib/cjs/components/livechatwidget/common/startChat.js +185 -128
- 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 +284 -253
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +37 -25
- package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
- package/lib/cjs/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
- package/lib/cjs/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -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 +35 -24
- 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 -38
- package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +2 -32
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +8 -24
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +21 -37
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +0 -7
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
- package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +12 -27
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +5 -18
- package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +5 -15
- package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -5
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -5
- 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 +17 -41
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +10 -22
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +25 -61
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +2 -13
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -16
- 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 +2 -30
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +7 -18
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +8 -42
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +4 -22
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +20 -33
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +81 -45
- 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/ConversationEndEntity.js +12 -0
- package/lib/cjs/contexts/common/ConversationState.js +0 -1
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +34 -29
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +18 -13
- package/lib/cjs/contexts/createReducer.js +190 -110
- package/lib/cjs/controller/componentController.js +2 -31
- 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/hooks/useDebounce.js +28 -0
- package/lib/cjs/hooks/useWindowDimensions.js +30 -0
- package/lib/cjs/index.js +0 -5
- package/lib/cjs/plugins/newMessageEventHandler.js +29 -36
- package/lib/esm/assets/Icons.js +2 -1
- package/lib/esm/common/Constants.js +27 -158
- package/lib/esm/common/KeyCodes.js +3 -3
- package/lib/esm/common/contextDataStore/DataStoreManager.js +3 -3
- package/lib/esm/common/storage/default/defaultCacheManager.js +18 -0
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +104 -0
- package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +67 -24
- package/lib/esm/common/telemetry/TelemetryHelper.js +21 -47
- package/lib/esm/common/telemetry/TelemetryManager.js +3 -19
- 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 +38 -53
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +8 -17
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +2 -7
- package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +20 -30
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +9 -16
- 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 +7 -35
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
- package/lib/esm/components/headerstateful/HeaderStateful.js +19 -16
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +5 -7
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +134 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -4
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +7 -9
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +14 -16
- package/lib/esm/components/livechatwidget/common/Deferred.js +6 -9
- package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +30 -0
- package/lib/esm/components/livechatwidget/common/authHelper.js +13 -10
- package/lib/esm/components/livechatwidget/common/createAdapter.js +6 -6
- 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 +18 -18
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +7 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +128 -35
- package/lib/esm/components/livechatwidget/common/endChat.js +69 -57
- 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 +28 -67
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +80 -129
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +4 -9
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +259 -6
- package/lib/esm/components/livechatwidget/common/shareObservable.js +4 -7
- package/lib/esm/components/livechatwidget/common/startChat.js +184 -99
- 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 +287 -188
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +38 -13
- package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
- package/lib/esm/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
- package/lib/esm/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -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 +35 -12
- 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 +12 -22
- package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +4 -8
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +8 -6
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +19 -11
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +12 -19
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +5 -14
- package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +5 -5
- package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -3
- 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 +17 -26
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +12 -14
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +25 -39
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +2 -9
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -14
- 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 +4 -28
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +8 -9
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +9 -28
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +5 -14
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +20 -22
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +81 -40
- 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/ConversationEndEntity.js +5 -0
- package/lib/esm/contexts/common/ConversationState.js +0 -1
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +34 -29
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -9
- package/lib/esm/contexts/createReducer.js +190 -107
- package/lib/esm/controller/componentController.js +3 -2
- 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/hooks/useDebounce.js +22 -0
- package/lib/esm/hooks/useWindowDimensions.js +23 -0
- package/lib/esm/plugins/newMessageEventHandler.js +29 -26
- package/lib/types/assets/Icons.d.ts +1 -0
- package/lib/types/common/Constants.d.ts +21 -0
- 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 +45 -9
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +4 -4
- package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
- package/lib/types/common/utils.d.ts +1 -0
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +0 -7
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +6 -0
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +3 -2
- package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -7
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +6 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -4
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +3 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +6 -2
- package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -0
- package/lib/types/components/loadingpanestateful/LoadingPaneStateful.d.ts +1 -2
- package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
- package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +4 -0
- package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +4 -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 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
- 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/timestamps/SendingTimestamp.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +1 -1
- package/lib/types/contexts/common/ConversationEndEntity.d.ts +4 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +9 -3
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +34 -28
- package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
- package/lib/types/hooks/useDebounce.d.ts +3 -0
- package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
- package/package.json +3 -3
|
@@ -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;
|
|
@@ -4,27 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
9
|
-
|
|
10
8
|
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
11
|
-
|
|
12
9
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
13
|
-
|
|
14
10
|
var _isMaskingFromCustomer = require("../../../common/utils/isMaskingFromCustomer");
|
|
15
|
-
|
|
16
11
|
/******
|
|
17
12
|
* DataMaskingMiddleware
|
|
18
13
|
*
|
|
19
14
|
* Applies data masking rules that Omnichannel Admin has configured.
|
|
20
15
|
******/
|
|
16
|
+
|
|
21
17
|
const applyDataMasking = (action, regexCollection) => {
|
|
22
18
|
const maskedChar = "#"; //to do: load from env once OC SDK supporting.
|
|
23
|
-
|
|
24
19
|
let {
|
|
25
20
|
text
|
|
26
21
|
} = action.payload;
|
|
27
|
-
|
|
28
22
|
if (!regexCollection) {
|
|
29
23
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
30
24
|
Event: _TelemetryConstants.TelemetryEvent.InvalidConfiguration,
|
|
@@ -32,25 +26,28 @@ const applyDataMasking = (action, regexCollection) => {
|
|
|
32
26
|
ErrorDetails: "Invalid data masking rules"
|
|
33
27
|
}
|
|
34
28
|
});
|
|
35
|
-
|
|
36
29
|
return action;
|
|
37
30
|
}
|
|
38
|
-
|
|
31
|
+
let isRuleMatched = false;
|
|
39
32
|
for (const ruleId of Object.keys(regexCollection)) {
|
|
40
33
|
const item = regexCollection[ruleId];
|
|
41
|
-
|
|
42
34
|
if (item) {
|
|
43
35
|
try {
|
|
44
36
|
const regex = new RegExp(item, "gi");
|
|
45
|
-
let match;
|
|
46
|
-
|
|
37
|
+
let match;
|
|
38
|
+
// eslint-disable-next-line no-cond-assign
|
|
47
39
|
while (match = regex.exec(text)) {
|
|
48
40
|
const replaceStr = match[0].replace(/./gi, maskedChar);
|
|
49
41
|
text = text.replace(match[0], replaceStr);
|
|
42
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
43
|
+
Event: _TelemetryConstants.TelemetryEvent.DataMaskingRuleApplied,
|
|
44
|
+
Description: `Data Masking Rule Id: ${ruleId} applied.`
|
|
45
|
+
});
|
|
46
|
+
isRuleMatched = true;
|
|
50
47
|
}
|
|
51
48
|
} catch (err) {
|
|
52
49
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
53
|
-
Event: _TelemetryConstants.TelemetryEvent.
|
|
50
|
+
Event: _TelemetryConstants.TelemetryEvent.DataMaskingRuleApplyFailed,
|
|
54
51
|
ExceptionDetails: {
|
|
55
52
|
RuleId: ruleId,
|
|
56
53
|
Exception: err
|
|
@@ -58,28 +55,29 @@ const applyDataMasking = (action, regexCollection) => {
|
|
|
58
55
|
});
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
|
-
}
|
|
62
58
|
|
|
59
|
+
// Exit if rule matched
|
|
60
|
+
if (isRuleMatched === true) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
63
64
|
action.payload.text = text;
|
|
64
65
|
return action;
|
|
65
|
-
};
|
|
66
|
-
|
|
66
|
+
};
|
|
67
67
|
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
68
69
|
const createDataMaskingMiddleware = dataMaskingInfo => _ref => {
|
|
69
70
|
let {
|
|
70
71
|
dispatch
|
|
71
72
|
} = _ref;
|
|
72
73
|
return next => action => {
|
|
73
74
|
var _action$payload;
|
|
74
|
-
|
|
75
75
|
if ((0, _isMaskingFromCustomer.isMaskingforCustomer)(dataMaskingInfo) && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.text && action.type === _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_MESSAGE) {
|
|
76
76
|
const regexCollection = dataMaskingInfo === null || dataMaskingInfo === void 0 ? void 0 : dataMaskingInfo.dataMaskingRules;
|
|
77
77
|
return next(applyDataMasking(action, regexCollection));
|
|
78
78
|
}
|
|
79
|
-
|
|
80
79
|
return next(action);
|
|
81
80
|
};
|
|
82
81
|
};
|
|
83
|
-
|
|
84
82
|
var _default = createDataMaskingMiddleware;
|
|
85
83
|
exports.default = _default;
|
|
@@ -4,16 +4,14 @@ 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 _WebChatActionType = require("../../enums/WebChatActionType");
|
|
11
|
-
|
|
12
9
|
/******
|
|
13
10
|
* GIFUploadMiddleware
|
|
14
11
|
*
|
|
15
12
|
* Ensures that GIF are properly uploaded.
|
|
16
13
|
******/
|
|
14
|
+
|
|
17
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
18
16
|
const gifUploadMiddleware = _ref => {
|
|
19
17
|
let {
|
|
@@ -22,16 +20,13 @@ const gifUploadMiddleware = _ref => {
|
|
|
22
20
|
return next => action => {
|
|
23
21
|
if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
|
|
24
22
|
var _activity$attachments, _activity$channelData, _activity$channelData2;
|
|
25
|
-
|
|
26
23
|
const {
|
|
27
24
|
payload: {
|
|
28
25
|
activity
|
|
29
26
|
}
|
|
30
27
|
} = action;
|
|
31
|
-
|
|
32
28
|
if ((activity === null || activity === void 0 ? void 0 : (_activity$attachments = activity.attachments) === null || _activity$attachments === void 0 ? void 0 : _activity$attachments.length) === (activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.attachmentSizes) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.length)) {
|
|
33
29
|
var _activity$attachments2;
|
|
34
|
-
|
|
35
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
31
|
activity === null || activity === void 0 ? void 0 : (_activity$attachments2 = activity.attachments) === null || _activity$attachments2 === void 0 ? void 0 : _activity$attachments2.forEach(attachment => {
|
|
37
32
|
const {
|
|
@@ -39,17 +34,14 @@ const gifUploadMiddleware = _ref => {
|
|
|
39
34
|
contentUrl,
|
|
40
35
|
contentType
|
|
41
36
|
} = attachment;
|
|
42
|
-
|
|
43
37
|
if (contentType === _Constants.Constants.GifContentType && thumbnailUrl !== contentUrl) {
|
|
44
38
|
attachment.thumbnailUrl = contentUrl;
|
|
45
39
|
}
|
|
46
40
|
});
|
|
47
41
|
}
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
return next(action);
|
|
51
44
|
};
|
|
52
45
|
};
|
|
53
|
-
|
|
54
46
|
var _default = gifUploadMiddleware;
|
|
55
47
|
exports.default = _default;
|
|
@@ -4,21 +4,18 @@ 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 _WebChatActionType = require("../../enums/WebChatActionType");
|
|
11
|
-
|
|
12
9
|
/******
|
|
13
10
|
* HTMLPlayerMiddleware
|
|
14
11
|
*
|
|
15
12
|
* Ensures that video/audio attachment are properly rendered.
|
|
16
13
|
******/
|
|
14
|
+
|
|
17
15
|
const disableHTMLPlayerDownloadButton = htmlTag => {
|
|
18
16
|
setTimeout(() => {
|
|
19
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
18
|
const elements = document.getElementsByTagName(htmlTag);
|
|
21
|
-
|
|
22
19
|
for (let index = 0; index < elements.length; index++) {
|
|
23
20
|
if (!elements[index].getAttribute(_Constants.Constants.controlsList)) {
|
|
24
21
|
elements[index].setAttribute(_Constants.Constants.controlsList, _Constants.Constants.nodownload);
|
|
@@ -30,24 +27,21 @@ const disableHTMLPlayerDownloadButton = htmlTag => {
|
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
29
|
}, 500);
|
|
33
|
-
};
|
|
34
|
-
|
|
30
|
+
};
|
|
35
31
|
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
36
33
|
const htmlPlayerMiddleware = _ref => {
|
|
37
34
|
let {
|
|
38
35
|
dispatch
|
|
39
36
|
} = _ref;
|
|
40
37
|
return next => action => {
|
|
41
38
|
var _action$payload, _action$payload$activ, _action$payload$activ2;
|
|
42
|
-
|
|
43
39
|
if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && ((_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$activ2 = _action$payload$activ.attachments) === null || _action$payload$activ2 === void 0 ? void 0 : _action$payload$activ2.length) > 0) {
|
|
44
40
|
disableHTMLPlayerDownloadButton(_Constants.Constants.video);
|
|
45
41
|
disableHTMLPlayerDownloadButton(_Constants.Constants.audio);
|
|
46
42
|
}
|
|
47
|
-
|
|
48
43
|
return next(action);
|
|
49
44
|
};
|
|
50
45
|
};
|
|
51
|
-
|
|
52
46
|
var _default = htmlPlayerMiddleware;
|
|
53
47
|
exports.default = _default;
|
|
@@ -4,36 +4,28 @@ 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 _dompurify = _interopRequireDefault(require("dompurify"));
|
|
11
|
-
|
|
12
9
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
13
|
-
|
|
14
10
|
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
15
|
-
|
|
16
11
|
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
/******
|
|
21
14
|
* HTMLTextMiddleware
|
|
22
15
|
*
|
|
23
16
|
* Ensures that links within messages are processed so that the caller website cannot be traced.
|
|
24
17
|
******/
|
|
18
|
+
|
|
25
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
20
|
const convertTextToHtmlNode = text => {
|
|
27
21
|
if (!text) return "";
|
|
28
22
|
const element = document.createElement(_Constants.HtmlAttributeNames.div);
|
|
29
|
-
|
|
30
23
|
try {
|
|
31
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
25
|
text = _dompurify.default.sanitize(text);
|
|
33
26
|
element.innerHTML = text;
|
|
34
27
|
} catch (e) {
|
|
35
28
|
const errorMessage = `Failed to purify and set innertHTML with text: ${text}`;
|
|
36
|
-
|
|
37
29
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
38
30
|
Event: _TelemetryConstants.TelemetryEvent.ProcessingHTMLTextMiddlewareFailed,
|
|
39
31
|
ExceptionDetails: {
|
|
@@ -42,56 +34,50 @@ const convertTextToHtmlNode = text => {
|
|
|
42
34
|
}
|
|
43
35
|
});
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
return element;
|
|
47
|
-
};
|
|
48
|
-
|
|
38
|
+
};
|
|
49
39
|
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
41
|
const processHTMLText = (action, text) => {
|
|
51
42
|
const htmlNode = convertTextToHtmlNode(text);
|
|
52
43
|
const aNodes = htmlNode.getElementsByTagName(_Constants.HtmlAttributeNames.aTagName);
|
|
53
|
-
|
|
54
44
|
if ((aNodes === null || aNodes === void 0 ? void 0 : aNodes.length) > 0) {
|
|
55
45
|
try {
|
|
56
46
|
for (let index = 0; index < aNodes.length; index++) {
|
|
57
47
|
var _aNode$tagName;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
const aNode = aNodes[index];
|
|
49
|
+
// Skip if the node is not valid or the node's tag name is not equal to 'a', or the node href is empty.
|
|
61
50
|
if (((_aNode$tagName = aNode.tagName) === null || _aNode$tagName === void 0 ? void 0 : _aNode$tagName.toLowerCase()) !== _Constants.HtmlAttributeNames.aTagName || !aNode.href) {
|
|
62
51
|
continue;
|
|
63
|
-
}
|
|
64
|
-
|
|
52
|
+
}
|
|
65
53
|
|
|
54
|
+
// Add target to 'a' node if target is missing or does not equal to blank
|
|
66
55
|
if (!aNode.target || aNode.target !== _Constants.Constants.blank) {
|
|
67
56
|
aNode.target = _Constants.Constants.blank;
|
|
68
|
-
}
|
|
69
|
-
|
|
57
|
+
}
|
|
70
58
|
|
|
59
|
+
// If rel is missing or rel does not include noopener and noreferrer, add them
|
|
71
60
|
if (!aNode.rel) {
|
|
72
61
|
aNode.rel = `${_Constants.HtmlAttributeNames.noopenerTag} ${_Constants.HtmlAttributeNames.noreferrerTag}`;
|
|
73
62
|
} else {
|
|
74
63
|
if (aNode.rel.indexOf(_Constants.HtmlAttributeNames.noopenerTag) === -1) {
|
|
75
64
|
aNode.rel += ` ${_Constants.HtmlAttributeNames.noopenerTag}`;
|
|
76
65
|
}
|
|
77
|
-
|
|
78
66
|
if (aNode.rel.indexOf(_Constants.HtmlAttributeNames.noreferrerTag) === -1) {
|
|
79
67
|
aNode.rel += ` ${_Constants.HtmlAttributeNames.noreferrerTag}`;
|
|
80
68
|
}
|
|
81
69
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
70
|
+
}
|
|
84
71
|
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
73
|
action = window.simpleUpdateIn(action, [_Constants.Constants.payload, _Constants.Constants.activity, _Constants.Constants.text], () => htmlNode.innerHTML);
|
|
86
74
|
} catch (e) {
|
|
87
75
|
let errorMessage = "Failed to apply action: ";
|
|
88
|
-
|
|
89
76
|
try {
|
|
90
77
|
errorMessage += JSON.stringify(action);
|
|
91
78
|
} catch (e) {
|
|
92
79
|
errorMessage += " (unable to stringify action)";
|
|
93
80
|
}
|
|
94
|
-
|
|
95
81
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
96
82
|
Event: _TelemetryConstants.TelemetryEvent.ProcessingHTMLTextMiddlewareFailed,
|
|
97
83
|
ExceptionDetails: {
|
|
@@ -101,11 +87,10 @@ const processHTMLText = (action, text) => {
|
|
|
101
87
|
});
|
|
102
88
|
}
|
|
103
89
|
}
|
|
104
|
-
|
|
105
90
|
return action;
|
|
106
|
-
};
|
|
107
|
-
|
|
91
|
+
};
|
|
108
92
|
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
109
94
|
const htmlTextMiddleware = _ref => {
|
|
110
95
|
let {
|
|
111
96
|
dispatch
|
|
@@ -114,21 +99,17 @@ const htmlTextMiddleware = _ref => {
|
|
|
114
99
|
if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
|
|
115
100
|
try {
|
|
116
101
|
var _action$payload, _action$payload$activ;
|
|
117
|
-
|
|
118
102
|
const text = (_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.text;
|
|
119
|
-
|
|
120
103
|
if (text) {
|
|
121
104
|
action = processHTMLText(action, text);
|
|
122
105
|
}
|
|
123
106
|
} catch (e) {
|
|
124
107
|
let errorMessage = "Failed to validate action.";
|
|
125
|
-
|
|
126
108
|
try {
|
|
127
109
|
errorMessage += JSON.stringify(action);
|
|
128
110
|
} catch (e) {
|
|
129
111
|
errorMessage += " (unable to stringify action)";
|
|
130
112
|
}
|
|
131
|
-
|
|
132
113
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
133
114
|
Event: _TelemetryConstants.TelemetryEvent.ProcessingHTMLTextMiddlewareFailed,
|
|
134
115
|
ExceptionDetails: {
|
|
@@ -138,10 +119,8 @@ const htmlTextMiddleware = _ref => {
|
|
|
138
119
|
});
|
|
139
120
|
}
|
|
140
121
|
}
|
|
141
|
-
|
|
142
122
|
return next(action);
|
|
143
123
|
};
|
|
144
124
|
};
|
|
145
|
-
|
|
146
125
|
var _default = htmlTextMiddleware;
|
|
147
126
|
exports.default = _default;
|
|
@@ -4,20 +4,16 @@ 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
|
var _Constants = require("../../../../../common/Constants");
|
|
15
|
-
|
|
16
11
|
/******
|
|
17
12
|
* MaxMessageSizeValidator
|
|
18
13
|
*
|
|
19
14
|
* Enforces a max character limit that the sender can send to comply to Omnichannel chat services' limitation.
|
|
20
15
|
******/
|
|
16
|
+
|
|
21
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
22
18
|
const createMaxMessageSizeValidator = localizedTexts => _ref => {
|
|
23
19
|
let {
|
|
@@ -26,21 +22,16 @@ const createMaxMessageSizeValidator = localizedTexts => _ref => {
|
|
|
26
22
|
return next => action => {
|
|
27
23
|
if (action.type === _WebChatActionType.WebChatActionType.WEB_CHAT_SET_SEND_BOX) {
|
|
28
24
|
var _action$payload, _action$payload$text;
|
|
29
|
-
|
|
30
25
|
const textLength = ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$text = _action$payload.text) === null || _action$payload$text === void 0 ? void 0 : _action$payload$text.length) || 0;
|
|
31
|
-
|
|
32
26
|
if (textLength > _Constants.WebChatMiddlewareConstants.maxTextLength) {
|
|
33
27
|
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.MaxSizeError, localizedTexts.MIDDLEWARE_MAX_CHARACTER_COUNT_EXCEEDED);
|
|
34
|
-
|
|
35
28
|
return next(action);
|
|
36
29
|
} else {
|
|
37
30
|
_NotificationHandler.NotificationHandler.dismissNotification(_NotificationScenarios.NotificationScenarios.MaxSizeError);
|
|
38
31
|
}
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
return next(action);
|
|
42
34
|
};
|
|
43
35
|
};
|
|
44
|
-
|
|
45
36
|
var _default = createMaxMessageSizeValidator;
|
|
46
37
|
exports.default = _default;
|
|
@@ -4,16 +4,14 @@ 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 _WebChatActionType = require("../../enums/WebChatActionType");
|
|
11
|
-
|
|
12
9
|
/******
|
|
13
10
|
* PreProcessingMiddleware
|
|
14
11
|
*
|
|
15
12
|
* Adds necessary fields for the activity for the other middlewares to function as expected.
|
|
16
13
|
******/
|
|
14
|
+
|
|
17
15
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
18
16
|
const preProcessingMiddleware = _ref => {
|
|
19
17
|
let {
|
|
@@ -24,31 +22,29 @@ const preProcessingMiddleware = _ref => {
|
|
|
24
22
|
const {
|
|
25
23
|
activity
|
|
26
24
|
} = action.payload;
|
|
27
|
-
|
|
28
25
|
if (!activity.from || activity.from.role === _Constants.Constants.userMessageTag) {
|
|
29
|
-
action = {
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
action = {
|
|
27
|
+
...action,
|
|
28
|
+
payload: {
|
|
29
|
+
...action.payload,
|
|
30
|
+
activity: {
|
|
31
|
+
...action.payload.activity,
|
|
32
32
|
textFormat: _Constants.Constants.markdown
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
|
|
40
39
|
const {
|
|
41
40
|
activity
|
|
42
41
|
} = action.payload;
|
|
43
|
-
|
|
44
42
|
if (activity) {
|
|
45
43
|
action.payload.activity[_Constants.Constants.actionType] = _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY;
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
|
-
|
|
49
46
|
return next(action);
|
|
50
47
|
};
|
|
51
48
|
};
|
|
52
|
-
|
|
53
49
|
var _default = preProcessingMiddleware;
|
|
54
50
|
exports.default = _default;
|
|
@@ -4,22 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
9
|
-
|
|
10
8
|
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
11
|
-
|
|
12
9
|
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
13
|
-
|
|
14
10
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
/******
|
|
19
13
|
* SanitizationMiddleware
|
|
20
14
|
*
|
|
21
15
|
* Sanitizes the text.
|
|
22
16
|
******/
|
|
17
|
+
|
|
23
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
24
19
|
const sanitizationMiddleware = _ref => {
|
|
25
20
|
let {
|
|
@@ -29,26 +24,24 @@ const sanitizationMiddleware = _ref => {
|
|
|
29
24
|
if (action.type === _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_MESSAGE) {
|
|
30
25
|
try {
|
|
31
26
|
var _action$payload;
|
|
32
|
-
|
|
33
27
|
let text = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.text;
|
|
34
|
-
|
|
35
28
|
if (text) {
|
|
36
29
|
text = _dompurify.default.sanitize(text) ?? " ";
|
|
37
30
|
}
|
|
38
31
|
} catch (e) {
|
|
39
|
-
const copyDataForTelemetry = {
|
|
40
|
-
|
|
32
|
+
const copyDataForTelemetry = {
|
|
33
|
+
...action,
|
|
34
|
+
payload: {
|
|
35
|
+
...action.payload,
|
|
41
36
|
text: undefined
|
|
42
37
|
}
|
|
43
38
|
};
|
|
44
39
|
let errorMessage = "Failed to apply action: ";
|
|
45
|
-
|
|
46
40
|
try {
|
|
47
41
|
errorMessage += JSON.stringify(copyDataForTelemetry);
|
|
48
42
|
} catch (e) {
|
|
49
43
|
errorMessage += " (unable to stringify action)";
|
|
50
44
|
}
|
|
51
|
-
|
|
52
45
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
53
46
|
Event: _TelemetryConstants.TelemetryEvent.ProcessingSanitizationMiddlewareFailed,
|
|
54
47
|
ExceptionDetails: {
|
|
@@ -58,10 +51,8 @@ const sanitizationMiddleware = _ref => {
|
|
|
58
51
|
});
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
|
-
|
|
62
54
|
return next(action);
|
|
63
55
|
};
|
|
64
56
|
};
|
|
65
|
-
|
|
66
57
|
var _default = sanitizationMiddleware;
|
|
67
58
|
exports.default = _default;
|