@microsoft/omnichannel-chat-widget 0.1.0-main.fdf1fdf → 1.0.1-main.068a14e
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
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
1
|
+
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
3
3
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
4
4
|
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
5
|
-
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
5
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
6
|
+
import { Constants } from "../../../common/Constants";
|
|
7
|
+
import { endChat } from "./endChat";
|
|
8
|
+
import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
|
|
9
|
+
import { addDelayInMs } from "../../../common/utils";
|
|
10
|
+
import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
11
|
+
import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
12
|
+
import { ConversationEndEntity } from "../../../contexts/common/ConversationEndEntity";
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, persistedChat) => {
|
|
8
16
|
try {
|
|
9
17
|
if (!persistedChat) {
|
|
10
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -25,13 +33,258 @@ export const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, persist
|
|
|
25
33
|
exception: ex
|
|
26
34
|
}
|
|
27
35
|
});
|
|
28
|
-
}
|
|
29
|
-
|
|
36
|
+
}
|
|
30
37
|
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
39
|
BroadcastService.getMessageByEventName("LoadPostChatSurvey").subscribe(msg => {
|
|
32
40
|
dispatch({
|
|
33
41
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
34
42
|
payload: ConversationState.Postchat
|
|
35
43
|
});
|
|
36
44
|
});
|
|
37
|
-
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
const checkPostChatEnabled = (props, state) => {
|
|
49
|
+
var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates$l, _state$domainStates$l2;
|
|
50
|
+
const isPostChatEnabled = ((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_postconversationsurveyenable) ?? ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable);
|
|
51
|
+
return isPostChatEnabled === Constants.true;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
+
const initiatePostChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
|
|
56
|
+
// Check if Postchat already in progress and handle case where chat is ended by customer
|
|
57
|
+
if (state.appStates.postChatWorkflowInProgress && state.appStates.conversationEndedBy === ConversationEndEntity.Customer) {
|
|
58
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Conversation Details call required by customer as well as agent
|
|
63
|
+
const conversationDetails = await getConversationDetailsCall(chatSDK);
|
|
64
|
+
// Start Postchat workflow
|
|
65
|
+
dispatch({
|
|
66
|
+
type: LiveChatWidgetActionType.SET_POST_CHAT_WORKFLOW_IN_PROGRESS,
|
|
67
|
+
payload: true
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Below logic checks if agent or bot or noone joins conversation and handles them separately
|
|
71
|
+
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.participantType) === Constants.userParticipantTypeTag) {
|
|
72
|
+
if (state.appStates.conversationEndedBy === ConversationEndEntity.Customer) {
|
|
73
|
+
// Set use bot settings to false
|
|
74
|
+
await postChatInitiatedByCustomer(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state, conversationDetails, false);
|
|
75
|
+
} else if (state.appStates.conversationEndedBy === ConversationEndEntity.Agent) {
|
|
76
|
+
await postChatInitiatedByAgent(props, setWebChatStyles, dispatch, state);
|
|
77
|
+
} else {
|
|
78
|
+
const error = `Conversation was Ended after agent joined but App State was not set correctly: conversationEndedBy = ${state.appStates.conversationEndedBy}`;
|
|
79
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
80
|
+
Event: TelemetryEvent.AppStatesException,
|
|
81
|
+
ExceptionDetails: {
|
|
82
|
+
exception: error
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
throw new Error(error);
|
|
86
|
+
}
|
|
87
|
+
} else if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.participantType) === Constants.botParticipantTypeTag) {
|
|
88
|
+
// Set Use bot survey to true
|
|
89
|
+
dispatch({
|
|
90
|
+
type: LiveChatWidgetActionType.SET_SHOULD_USE_BOT_SURVEY,
|
|
91
|
+
payload: true
|
|
92
|
+
});
|
|
93
|
+
if (state.appStates.conversationEndedBy === ConversationEndEntity.Customer) {
|
|
94
|
+
// Set use bot settings to true
|
|
95
|
+
await postChatInitiatedByCustomer(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state, conversationDetails, true);
|
|
96
|
+
} else if (state.appStates.conversationEndedBy === ConversationEndEntity.Agent) {
|
|
97
|
+
await postChatInitiatedByBot(props, setWebChatStyles, dispatch, state);
|
|
98
|
+
} else {
|
|
99
|
+
const error = `Conversation was Ended after bot joined but App State was not set correctly: conversationEndedBy = ${state.appStates.conversationEndedBy}`;
|
|
100
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
101
|
+
Event: TelemetryEvent.AppStatesException,
|
|
102
|
+
ExceptionDetails: {
|
|
103
|
+
exception: error
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
throw new Error(error);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
if (state.appStates.conversationEndedBy === ConversationEndEntity.Customer) {
|
|
110
|
+
// No one has joined chat will be handled by postChat customer
|
|
111
|
+
await postChatInitiatedByCustomer(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state, conversationDetails, false);
|
|
112
|
+
} else {
|
|
113
|
+
const error = `ConversationDetails and App state was not set correctly: conversationDetails = ${JSON.stringify(conversationDetails)} , conversationEndedBy = ${state.appStates.conversationEndedBy}`;
|
|
114
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
115
|
+
Event: TelemetryEvent.AppStatesException,
|
|
116
|
+
ExceptionDetails: {
|
|
117
|
+
exception: error
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
throw new Error(error);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Function for link mode postchat workflow which is essentially same for both customer and agent
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
+
const linkModePostChatWorkflow = (props, dispatch, setWebChatStyles) => {
|
|
128
|
+
var _props$webChatContain, _props$webChatContain2;
|
|
129
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
130
|
+
Event: TelemetryEvent.LinkModePostChatWorkflowStarted
|
|
131
|
+
});
|
|
132
|
+
dispatch({
|
|
133
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
134
|
+
payload: ConversationState.InActive
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Disable SendBox
|
|
138
|
+
if ((props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd) !== false) {
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
140
|
+
setWebChatStyles(styles => {
|
|
141
|
+
return {
|
|
142
|
+
...styles,
|
|
143
|
+
hideSendBox: true
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// Function for embed mode postchat workflow which is essentially same for both customer and agent
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
151
|
+
const embedModePostChatWorkflow = async (dispatch, state) => {
|
|
152
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
153
|
+
Event: TelemetryEvent.EmbedModePostChatWorkflowStarted
|
|
154
|
+
});
|
|
155
|
+
if (state.domainStates.postChatContext) {
|
|
156
|
+
dispatch({
|
|
157
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
158
|
+
payload: ConversationState.PostchatLoading
|
|
159
|
+
});
|
|
160
|
+
await addDelayInMs(Constants.PostChatLoadingDurationInMs);
|
|
161
|
+
const loadPostChatEvent = {
|
|
162
|
+
eventName: BroadcastEvent.LoadPostChatSurvey
|
|
163
|
+
};
|
|
164
|
+
BroadcastService.postMessage(loadPostChatEvent);
|
|
165
|
+
} else {
|
|
166
|
+
const error = `Conversation was Ended but App State was not set correctly: postChatContext = ${state.domainStates.postChatContext}`;
|
|
167
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
168
|
+
Event: TelemetryEvent.AppStatesException,
|
|
169
|
+
ExceptionDetails: {
|
|
170
|
+
exception: error
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
throw new Error(error);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// Function will handle only postchat cases initiated by customer
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
179
|
+
const postChatInitiatedByCustomer = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state, conversationDetails, shouldUseBotSetting) => {
|
|
180
|
+
let postChatSurveyMode = "";
|
|
181
|
+
if (shouldUseBotSetting) {
|
|
182
|
+
var _props$chatConfig2, _props$chatConfig2$Li, _state$domainStates$l3, _state$domainStates$l4;
|
|
183
|
+
postChatSurveyMode = ((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_postconversationsurveybotsurveymode) ?? ((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveybotsurveymode);
|
|
184
|
+
} else {
|
|
185
|
+
var _props$chatConfig3, _props$chatConfig3$Li, _state$domainStates$l5, _state$domainStates$l6;
|
|
186
|
+
postChatSurveyMode = ((_props$chatConfig3 = props.chatConfig) === null || _props$chatConfig3 === void 0 ? void 0 : (_props$chatConfig3$Li = _props$chatConfig3.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig3$Li === void 0 ? void 0 : _props$chatConfig3$Li.msdyn_postconversationsurveymode) ?? ((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : (_state$domainStates$l6 = _state$domainStates$l5.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.msdyn_postconversationsurveymode);
|
|
187
|
+
}
|
|
188
|
+
// Check if agent or bot has joined conversation
|
|
189
|
+
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.canRenderPostChat) === Constants.truePascal) {
|
|
190
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
191
|
+
Event: TelemetryEvent.PostChatWorkflowFromCustomer,
|
|
192
|
+
Description: shouldUseBotSetting ? "PostChat Workflow was started by customer using bot settings" : "PostChat Workflow was started by customer using agent settings"
|
|
193
|
+
});
|
|
194
|
+
const chatSession = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getCurrentLiveChatContext());
|
|
195
|
+
// End chat call to end chatsdk but not close chat, only if chat ended by customer
|
|
196
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, true, false);
|
|
197
|
+
// Saving request Id below for chat transcript calls
|
|
198
|
+
if (chatSession) {
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
200
|
+
chatSDK.chatToken = chatSession.chatToken ?? {};
|
|
201
|
+
chatSDK.requestId = chatSession.requestId;
|
|
202
|
+
}
|
|
203
|
+
if (postChatSurveyMode === PostChatSurveyMode.Embed) {
|
|
204
|
+
await embedModePostChatWorkflow(dispatch, state);
|
|
205
|
+
} else if (postChatSurveyMode === PostChatSurveyMode.Link) {
|
|
206
|
+
linkModePostChatWorkflow(props, dispatch, setWebChatStyles);
|
|
207
|
+
} else {
|
|
208
|
+
const error = `Conversation was Ended but App State was not set correctly: msdyn_postconversationsurveymode = ${postChatSurveyMode}`;
|
|
209
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
210
|
+
Event: TelemetryEvent.AppStatesException,
|
|
211
|
+
ExceptionDetails: {
|
|
212
|
+
exception: error
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
throw new Error(error);
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
// Agent did not join chat so end chat normally
|
|
219
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// Function will handle only postchat cases initiated by agent
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
225
|
+
const postChatInitiatedByAgent = async (props, setWebChatStyles, dispatch, state) => {
|
|
226
|
+
var _props$chatConfig4, _props$chatConfig4$Li, _state$domainStates$l7, _state$domainStates$l8;
|
|
227
|
+
const postChatSurveyMode = ((_props$chatConfig4 = props.chatConfig) === null || _props$chatConfig4 === void 0 ? void 0 : (_props$chatConfig4$Li = _props$chatConfig4.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig4$Li === void 0 ? void 0 : _props$chatConfig4$Li.msdyn_postconversationsurveymode) ?? ((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : (_state$domainStates$l8 = _state$domainStates$l7.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l8 === void 0 ? void 0 : _state$domainStates$l8.msdyn_postconversationsurveymode);
|
|
228
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
229
|
+
Event: TelemetryEvent.PostChatWorkflowFromAgent,
|
|
230
|
+
Description: "PostChat Workflow was started by agent"
|
|
231
|
+
});
|
|
232
|
+
if (postChatSurveyMode === PostChatSurveyMode.Embed) {
|
|
233
|
+
await embedModePostChatWorkflow(dispatch, state);
|
|
234
|
+
} else if (postChatSurveyMode === PostChatSurveyMode.Link) {
|
|
235
|
+
linkModePostChatWorkflow(props, dispatch, setWebChatStyles);
|
|
236
|
+
} else {
|
|
237
|
+
const error = `Conversation was Ended but App State was not set correctly: msdyn_postconversationsurveymode = ${postChatSurveyMode}`;
|
|
238
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
239
|
+
Event: TelemetryEvent.AppStatesException,
|
|
240
|
+
ExceptionDetails: {
|
|
241
|
+
exception: error
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
throw new Error(error);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// Function will handle only postchat cases initiated by bot
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
|
+
const postChatInitiatedByBot = async (props, setWebChatStyles, dispatch, state) => {
|
|
251
|
+
var _props$chatConfig5, _props$chatConfig5$Li, _state$domainStates$l9, _state$domainStates$l10;
|
|
252
|
+
const postChatSurveyMode = ((_props$chatConfig5 = props.chatConfig) === null || _props$chatConfig5 === void 0 ? void 0 : (_props$chatConfig5$Li = _props$chatConfig5.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig5$Li === void 0 ? void 0 : _props$chatConfig5$Li.msdyn_postconversationsurveybotsurveymode) ?? ((_state$domainStates$l9 = state.domainStates.liveChatConfig) === null || _state$domainStates$l9 === void 0 ? void 0 : (_state$domainStates$l10 = _state$domainStates$l9.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l10 === void 0 ? void 0 : _state$domainStates$l10.msdyn_postconversationsurveybotsurveymode);
|
|
253
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
254
|
+
Event: TelemetryEvent.PostChatWorkflowFromBot,
|
|
255
|
+
Description: "PostChat Workflow was started by bot"
|
|
256
|
+
});
|
|
257
|
+
if (postChatSurveyMode === PostChatSurveyMode.Embed) {
|
|
258
|
+
await embedModePostChatWorkflow(dispatch, state);
|
|
259
|
+
} else if (postChatSurveyMode === PostChatSurveyMode.Link) {
|
|
260
|
+
linkModePostChatWorkflow(props, dispatch, setWebChatStyles);
|
|
261
|
+
} else {
|
|
262
|
+
const error = `Conversation was Ended but App State was not set correctly: msdyn_postconversationsurveybotsurveymode = ${postChatSurveyMode}`;
|
|
263
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
264
|
+
Event: TelemetryEvent.AppStatesException,
|
|
265
|
+
ExceptionDetails: {
|
|
266
|
+
exception: error
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
throw new Error(error);
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
274
|
+
const getConversationDetailsCall = async chatSDK => {
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
276
|
+
let conversationDetails = undefined;
|
|
277
|
+
try {
|
|
278
|
+
conversationDetails = await chatSDK.getConversationDetails();
|
|
279
|
+
} catch (error) {
|
|
280
|
+
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
281
|
+
Event: TelemetryEvent.GetConversationDetailsCallFailed,
|
|
282
|
+
ExceptionDetails: {
|
|
283
|
+
exception: `Get Conversation Details Call Failed : ${error}`
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
NotificationHandler.notifyError(NotificationScenarios.Connection, "Get Conversation Details Call Failed: " + error);
|
|
287
|
+
}
|
|
288
|
+
return conversationDetails;
|
|
289
|
+
};
|
|
290
|
+
export { setPostChatContextAndLoadSurvey, checkPostChatEnabled, initiatePostChat };
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
2
|
export function shareObservable(observable) {
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
-
let observers = [];
|
|
4
|
+
let observers = [];
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
let subscription;
|
|
7
8
|
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
10
|
return new window.Observable(observer => {
|
|
9
11
|
if (!subscription) {
|
|
10
12
|
subscription = observable.subscribe({
|
|
11
13
|
complete() {
|
|
12
14
|
observers.forEach(observer => observer.complete());
|
|
13
15
|
},
|
|
14
|
-
|
|
15
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
17
|
error(err) {
|
|
17
18
|
observers.forEach(observer => observer.error(err));
|
|
18
19
|
},
|
|
19
|
-
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
next(value) {
|
|
22
22
|
observers.forEach(observer => observer.next(value));
|
|
23
23
|
}
|
|
24
|
-
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
observers.push(observer);
|
|
29
27
|
return () => {
|
|
30
28
|
observers = observers.filter(o => o !== observer);
|
|
31
|
-
|
|
32
29
|
if (!observers.length) {
|
|
33
30
|
subscription.unsubscribe();
|
|
34
31
|
subscription = null;
|