@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
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
7
|
+
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../../common/telemetry/TelemetryConstants";
|
|
8
|
+
import { TelemetryHelper } from "../../../../common/telemetry/TelemetryHelper";
|
|
9
|
+
const supportedSignInCardContentTypes = ["application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"];
|
|
10
|
+
const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
|
|
11
|
+
const delay = t => new Promise(resolve => setTimeout(resolve, t));
|
|
12
|
+
const fetchBotAuthConfigRetries = 3;
|
|
13
|
+
const fetchBotAuthConfigRetryInterval = 1000;
|
|
14
|
+
let response;
|
|
15
|
+
const extractSignInId = signInUrl => {
|
|
16
|
+
const result = botOauthUrlRegex.exec(signInUrl);
|
|
17
|
+
if (result && result[1]) {
|
|
18
|
+
return result[1];
|
|
19
|
+
}
|
|
20
|
+
return "";
|
|
21
|
+
};
|
|
22
|
+
const extractSasUrl = async attachment => {
|
|
23
|
+
let sasUrl = undefined;
|
|
24
|
+
if (attachment && attachment.content && attachment.content.tokenPostResource && attachment.content.tokenPostResource.sasUrl) {
|
|
25
|
+
sasUrl = attachment.content.tokenPostResource.sasUrl;
|
|
26
|
+
}
|
|
27
|
+
if (!sasUrl) {
|
|
28
|
+
const signInId = extractSignInId(attachment.content.buttons[0].value);
|
|
29
|
+
const getTestUrlEndpoint = `https://token.botframework.com/api/sas/gettesturl?signInId=${signInId}`;
|
|
30
|
+
try {
|
|
31
|
+
const response = await window.fetch(getTestUrlEndpoint);
|
|
32
|
+
if (response.status === 200) {
|
|
33
|
+
const responseJson = await response.json();
|
|
34
|
+
sasUrl = responseJson.sasUrl;
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
sasUrl = undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return sasUrl;
|
|
41
|
+
};
|
|
42
|
+
const fetchBotAuthConfig = async retries => {
|
|
43
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
44
|
+
Event: TelemetryEvent.SetBotAuthProviderFetchConfig
|
|
45
|
+
});
|
|
46
|
+
const botAuthConfigRequestEvent = {
|
|
47
|
+
eventName: BroadcastEvent.BotAuthConfigRequest
|
|
48
|
+
};
|
|
49
|
+
BroadcastService.postMessage(botAuthConfigRequestEvent);
|
|
50
|
+
const listener = BroadcastService.getMessageByEventName(BroadcastEvent.BotAuthConfigResponse).subscribe(data => {
|
|
51
|
+
var _data$payload, _data$payload2;
|
|
52
|
+
response = ((_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.response) !== undefined ? (_data$payload2 = data.payload) === null || _data$payload2 === void 0 ? void 0 : _data$payload2.response : response;
|
|
53
|
+
listener.unsubscribe();
|
|
54
|
+
});
|
|
55
|
+
if (response !== undefined) {
|
|
56
|
+
//return response;
|
|
57
|
+
return response;
|
|
58
|
+
}
|
|
59
|
+
if (retries === 1) {
|
|
60
|
+
// Base Case
|
|
61
|
+
throw new Error();
|
|
62
|
+
}
|
|
63
|
+
await delay(fetchBotAuthConfigRetryInterval);
|
|
64
|
+
return await fetchBotAuthConfig(--retries);
|
|
65
|
+
};
|
|
66
|
+
export class BotAuthActivitySubscriber {
|
|
67
|
+
constructor() {
|
|
68
|
+
_defineProperty(this, "observer", void 0);
|
|
69
|
+
_defineProperty(this, "signInCardSeen", void 0);
|
|
70
|
+
this.signInCardSeen = new Set();
|
|
71
|
+
}
|
|
72
|
+
applicable(activity) {
|
|
73
|
+
var _activity$attachments;
|
|
74
|
+
return (activity === null || activity === void 0 ? void 0 : (_activity$attachments = activity.attachments) === null || _activity$attachments === void 0 ? void 0 : _activity$attachments.length) > 0 && activity.attachments[0] && supportedSignInCardContentTypes.indexOf(activity.attachments[0].contentType) >= 0;
|
|
75
|
+
}
|
|
76
|
+
async apply(activity) {
|
|
77
|
+
this.observer.next(false); // Hides card
|
|
78
|
+
const attachment = activity.attachments[0];
|
|
79
|
+
const signInUrl = attachment.content.buttons[0].value;
|
|
80
|
+
const signInId = extractSignInId(signInUrl);
|
|
81
|
+
if (!signInId) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (this.signInCardSeen.has(signInId)) {
|
|
85
|
+
// Prevents duplicate auth
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.signInCardSeen.add(signInId);
|
|
89
|
+
const sasUrl = await extractSasUrl(attachment);
|
|
90
|
+
const event = {
|
|
91
|
+
eventName: BroadcastEvent.SigninCardReceived,
|
|
92
|
+
payload: {
|
|
93
|
+
sasUrl
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
if (!sasUrl) {
|
|
97
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
98
|
+
Event: TelemetryEvent.BotAuthActivityEmptySasUrl,
|
|
99
|
+
Description: "SaS Url is empty"
|
|
100
|
+
});
|
|
101
|
+
return activity;
|
|
102
|
+
} else {
|
|
103
|
+
BroadcastService.postMessage(event);
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const response = await fetchBotAuthConfig(fetchBotAuthConfigRetries);
|
|
107
|
+
if (response === false) {
|
|
108
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
109
|
+
Event: TelemetryEvent.SetBotAuthProviderHideCard
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
113
|
+
Event: TelemetryEvent.SetBotAuthProviderDisplayCard
|
|
114
|
+
});
|
|
115
|
+
return activity;
|
|
116
|
+
}
|
|
117
|
+
} catch {
|
|
118
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
119
|
+
Event: TelemetryEvent.SetBotAuthProviderNotFound
|
|
120
|
+
});
|
|
121
|
+
//this is to ensure listener continues waiting for response
|
|
122
|
+
if (this.signInCardSeen.has(signInId)) {
|
|
123
|
+
this.signInCardSeen.delete(signInId);
|
|
124
|
+
}
|
|
125
|
+
return activity;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async next(activity) {
|
|
129
|
+
if (this.applicable(activity)) {
|
|
130
|
+
return await this.apply(activity);
|
|
131
|
+
}
|
|
132
|
+
return activity;
|
|
133
|
+
}
|
|
134
|
+
}
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
export class DefaultActivitySubscriber {
|
|
4
5
|
constructor() {
|
|
5
6
|
_defineProperty(this, "observer", void 0);
|
|
6
7
|
}
|
|
7
|
-
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
9
|
async next(activity) {
|
|
10
10
|
this.observer.next(activity);
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
}
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
import { ActivityStreamHandler } from "../ActivityStreamHandler";
|
|
4
5
|
export class PauseActivitySubscriber {
|
|
5
6
|
constructor() {
|
|
6
7
|
_defineProperty(this, "observer", void 0);
|
|
7
8
|
}
|
|
8
|
-
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
async apply(activity) {
|
|
11
11
|
await ActivityStreamHandler.restorePromise;
|
|
12
12
|
return activity;
|
|
13
|
-
}
|
|
14
|
-
|
|
13
|
+
}
|
|
15
14
|
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
16
16
|
applicable(activity) {
|
|
17
17
|
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
20
19
|
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
async next(activity) {
|
|
22
22
|
if (this.applicable(activity)) {
|
|
23
23
|
return await this.apply(activity);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
return activity;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
import { DefaultActivitySubscriber } from "./ActivitySubscriber/DefaultActivitySubscriber";
|
|
4
5
|
import { shareObservable } from "./shareObservable";
|
|
5
6
|
export class ChatAdapterShim {
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
|
|
7
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
|
|
8
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
|
|
9
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
14
|
constructor(chatAdapter) {
|
|
11
15
|
_defineProperty(this, "chatAdapter", void 0);
|
|
12
|
-
|
|
13
16
|
_defineProperty(this, "activityObserver", void 0);
|
|
14
|
-
|
|
15
17
|
_defineProperty(this, "subscribers", void 0);
|
|
16
|
-
|
|
17
18
|
this.subscribers = [];
|
|
18
|
-
this.chatAdapter = {
|
|
19
|
-
|
|
19
|
+
this.chatAdapter = {
|
|
20
|
+
...chatAdapter,
|
|
21
|
+
activity$: shareObservable(
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
23
|
new window.Observable(observer => {
|
|
21
|
-
this.activityObserver = observer;
|
|
22
|
-
|
|
24
|
+
this.activityObserver = observer;
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
26
|
const abortController = new window.AbortController();
|
|
24
|
-
|
|
25
27
|
(async () => {
|
|
26
28
|
try {
|
|
27
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -31,29 +33,25 @@ export class ChatAdapterShim {
|
|
|
31
33
|
for (const subscriber of [...this.subscribers, new DefaultActivitySubscriber()]) {
|
|
32
34
|
subscriber.observer = this.activityObserver;
|
|
33
35
|
activity = await subscriber.next(activity);
|
|
34
|
-
|
|
35
36
|
if (!activity) {
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
41
|
observer.complete();
|
|
42
42
|
} catch (error) {
|
|
43
43
|
observer.error(error);
|
|
44
44
|
}
|
|
45
45
|
})();
|
|
46
|
-
|
|
47
46
|
return () => {
|
|
48
47
|
abortController.abort();
|
|
49
48
|
};
|
|
50
49
|
}))
|
|
51
50
|
};
|
|
52
|
-
}
|
|
53
|
-
|
|
51
|
+
}
|
|
54
52
|
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
54
|
addSubscriber(subscriber) {
|
|
56
55
|
this.subscribers.push(subscriber);
|
|
57
56
|
}
|
|
58
|
-
|
|
59
57
|
}
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
export class Deferred {
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
|
|
5
7
|
constructor() {
|
|
6
8
|
_defineProperty(this, "_promise", void 0);
|
|
7
|
-
|
|
8
9
|
_defineProperty(this, "_resolve", void 0);
|
|
9
|
-
|
|
10
10
|
_defineProperty(this, "_reject", () => {
|
|
11
11
|
return;
|
|
12
12
|
});
|
|
13
|
-
|
|
14
13
|
_defineProperty(this, "resolve", value => {
|
|
15
14
|
this._resolve(value);
|
|
16
15
|
});
|
|
17
|
-
|
|
18
16
|
_defineProperty(this, "reject", value => {
|
|
19
17
|
this._reject(value);
|
|
20
18
|
});
|
|
21
|
-
|
|
22
19
|
this._promise = new Promise((resolve, reject) => {
|
|
23
20
|
this._resolve = resolve;
|
|
24
21
|
this._reject = reject;
|
|
25
22
|
});
|
|
26
|
-
}
|
|
23
|
+
}
|
|
27
24
|
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
26
|
|
|
29
27
|
get promise() {
|
|
30
28
|
return this._promise;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
3
|
+
import { ConversationEndEntity } from "../../../contexts/common/ConversationEndEntity";
|
|
4
|
+
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
5
|
+
import { checkPostChatEnabled } from "./setPostChatContextAndLoadSurvey";
|
|
6
|
+
const handleAgentEndConversation = (props, state, dispatch) => {
|
|
7
|
+
const isPostChatEnabled = checkPostChatEnabled(props, state);
|
|
8
|
+
if (isPostChatEnabled) {
|
|
9
|
+
if (!state.appStates.postChatWorkflowInProgress) {
|
|
10
|
+
dispatch({
|
|
11
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
|
|
12
|
+
payload: ConversationEndEntity.Agent
|
|
13
|
+
});
|
|
14
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
15
|
+
Event: TelemetryEvent.ConversationEndedByAgent,
|
|
16
|
+
Description: "Conversation is ended from agent side"
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
dispatch({
|
|
21
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
|
|
22
|
+
payload: ConversationEndEntity.Agent
|
|
23
|
+
});
|
|
24
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
25
|
+
Event: TelemetryEvent.ConversationEndedByAgent,
|
|
26
|
+
Description: "Conversation is ended from agent side"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export { handleAgentEndConversation };
|
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
3
|
-
import { isNullOrEmptyString } from "../../../common/utils";
|
|
4
|
-
|
|
5
|
-
const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
3
|
+
import { isNullOrEmptyString } from "../../../common/utils";
|
|
4
|
+
const getAuthClientFunction = chatConfig => {
|
|
6
5
|
let authClientFunction = undefined;
|
|
7
|
-
|
|
8
6
|
if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
|
|
9
7
|
var _chatConfig$LiveChatC;
|
|
10
|
-
|
|
11
8
|
authClientFunction = (chatConfig === null || chatConfig === void 0 ? void 0 : (_chatConfig$LiveChatC = chatConfig.LiveChatConfigAuthSettings) === null || _chatConfig$LiveChatC === void 0 ? void 0 : _chatConfig$LiveChatC.msdyn_javascriptclientfunction) ?? undefined;
|
|
12
9
|
}
|
|
10
|
+
return authClientFunction;
|
|
11
|
+
};
|
|
13
12
|
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
15
|
+
const authClientFunction = getAuthClientFunction(chatConfig);
|
|
14
16
|
if (getAuthToken && authClientFunction) {
|
|
15
17
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
16
18
|
Event: TelemetryEvent.GetAuthTokenCalled
|
|
17
19
|
});
|
|
18
20
|
const token = await getAuthToken(authClientFunction);
|
|
19
|
-
|
|
20
21
|
if (!isNullOrEmptyString(token)) {
|
|
21
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
23
|
chatSDK.setAuthTokenProvider(async () => {
|
|
23
24
|
return token;
|
|
24
25
|
});
|
|
26
|
+
return true;
|
|
25
27
|
} else {
|
|
26
28
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
27
29
|
Event: TelemetryEvent.ReceivedNullOrEmptyToken
|
|
28
30
|
});
|
|
31
|
+
return false;
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
33
36
|
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
38
|
const removeAuthTokenProvider = chatSDK => {
|
|
35
39
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
40
|
chatSDK.authenticatedUserToken = null;
|
|
37
41
|
};
|
|
38
|
-
|
|
39
|
-
export { handleAuthentication, removeAuthTokenProvider };
|
|
42
|
+
export { getAuthClientFunction, handleAuthentication, removeAuthTokenProvider };
|
|
@@ -3,8 +3,10 @@ import { NotificationLevel } from "../../webchatcontainerstateful/webchatcontrol
|
|
|
3
3
|
import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
4
4
|
import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
5
5
|
import { ChatAdapterShim } from "./ChatAdapterShim";
|
|
6
|
-
import { PauseActivitySubscriber } from "./ActivitySubscriber/PauseActivitySubscriber";
|
|
6
|
+
import { PauseActivitySubscriber } from "./ActivitySubscriber/PauseActivitySubscriber";
|
|
7
|
+
import { BotAuthActivitySubscriber } from "./ActivitySubscriber/BotAuthActivitySubscriber";
|
|
7
8
|
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
10
|
export const createAdapter = async chatSDK => {
|
|
9
11
|
const chatAdapterOptionalParams = {
|
|
10
12
|
IC3Adapter: {
|
|
@@ -13,11 +15,9 @@ export const createAdapter = async chatSDK => {
|
|
|
13
15
|
if (notification.id === NotificationScenarios.InternetConnection && notification.level == NotificationLevel.Error) {
|
|
14
16
|
notification.message = defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION;
|
|
15
17
|
}
|
|
16
|
-
|
|
17
18
|
if (notification.id === NotificationScenarios.InternetConnection && notification.level == NotificationLevel.Success) {
|
|
18
19
|
notification.message = defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
21
|
if (notification.id && notification.message) {
|
|
22
22
|
NotificationHandler.notifyWithLevel(notification.id, notification.message, notification.level);
|
|
23
23
|
}
|
|
@@ -25,13 +25,13 @@ export const createAdapter = async chatSDK => {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
let adapter = await chatSDK.createChatAdapter(chatAdapterOptionalParams);
|
|
29
|
-
|
|
28
|
+
let adapter = await chatSDK.createChatAdapter(chatAdapterOptionalParams);
|
|
29
|
+
//so far, there is no need to convert to the shim adapter when using visual tests
|
|
30
30
|
if (chatSDK.isMockModeOn !== true) {
|
|
31
31
|
adapter = new ChatAdapterShim(adapter);
|
|
32
32
|
adapter.addSubscriber(new PauseActivitySubscriber());
|
|
33
|
+
adapter.addSubscriber(new BotAuthActivitySubscriber());
|
|
33
34
|
return adapter.chatAdapter;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
36
|
return adapter;
|
|
37
37
|
};
|
|
@@ -3,25 +3,13 @@ import React from "react";
|
|
|
3
3
|
import { decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { shouldShowFooter } from "../../../controller/componentController";
|
|
5
5
|
export const createFooter = (props, state) => {
|
|
6
|
-
var _props$
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
controlProps: { ...((_props$footerProps = props.footerProps) === null || _props$footerProps === void 0 ? void 0 : _props$footerProps.controlProps),
|
|
10
|
-
hideDownloadTranscriptButton: true,
|
|
11
|
-
hideEmailTranscriptButton: true,
|
|
12
|
-
hideAudioNotificationButton: true
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const footer = !((_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hideFooter) && shouldShowFooter(state) ? decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
|
|
6
|
+
var _props$controlProps, _props$componentOverr;
|
|
7
|
+
const hideFooterDisplay = !((_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hideFooter) && shouldShowFooter(state) ? false : true;
|
|
8
|
+
const footer = decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
|
|
16
9
|
footerProps: props.footerProps,
|
|
17
10
|
downloadTranscriptProps: props.downloadTranscriptProps,
|
|
18
11
|
audioNotificationProps: props.audioNotificationProps,
|
|
19
|
-
hideFooterDisplay:
|
|
20
|
-
}) : decodeComponentString((_props$componentOverr2 = props.componentOverrides) === null || _props$componentOverr2 === void 0 ? void 0 : _props$componentOverr2.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
|
|
21
|
-
footerProps: footerPropsHidden,
|
|
22
|
-
downloadTranscriptProps: props.downloadTranscriptProps,
|
|
23
|
-
audioNotificationProps: props.audioNotificationProps,
|
|
24
|
-
hideFooterDisplay: true
|
|
12
|
+
hideFooterDisplay: hideFooterDisplay
|
|
25
13
|
});
|
|
26
14
|
return footer;
|
|
27
15
|
};
|
|
@@ -2,7 +2,8 @@ import { Constants } from "../../../common/Constants";
|
|
|
2
2
|
import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
3
3
|
import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
4
4
|
import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
5
|
-
|
|
5
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
6
|
+
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
6
7
|
const isInternetConnected = async () => {
|
|
7
8
|
try {
|
|
8
9
|
const response = await fetch(Constants.internetConnectionTestUrl);
|
|
@@ -12,19 +13,23 @@ const isInternetConnected = async () => {
|
|
|
12
13
|
return false;
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
|
-
|
|
16
16
|
export const createInternetConnectionChangeHandler = async () => {
|
|
17
17
|
const handler = async () => {
|
|
18
18
|
const connected = await isInternetConnected();
|
|
19
|
-
|
|
20
19
|
if (!connected) {
|
|
20
|
+
TelemetryHelper.logActionEvent(LogLevel.WARN, {
|
|
21
|
+
Event: TelemetryEvent.NetworkDisconnected
|
|
22
|
+
});
|
|
21
23
|
NotificationHandler.notifyError(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
|
|
22
24
|
} else {
|
|
25
|
+
TelemetryHelper.logActionEvent(LogLevel.WARN, {
|
|
26
|
+
Event: TelemetryEvent.NetworkReconnected
|
|
27
|
+
});
|
|
23
28
|
NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
|
|
24
29
|
}
|
|
25
|
-
};
|
|
26
|
-
|
|
30
|
+
};
|
|
27
31
|
|
|
32
|
+
// Checking connection status on online & offline events due to possible false positives
|
|
28
33
|
window.addEventListener("online", () => handler(), false);
|
|
29
34
|
window.addEventListener("offline", () => handler(), false);
|
|
30
35
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import MarkdownIt from "markdown-it";
|
|
2
2
|
import MarkdownItForInline from "markdown-it-for-inline";
|
|
3
3
|
import { defaultMarkdownLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMarkdownLocalizedTexts";
|
|
4
|
-
import { Constants } from "../../../common/Constants";
|
|
4
|
+
import { Constants } from "../../../common/Constants";
|
|
5
5
|
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineMarkdownSupport) => {
|
|
7
8
|
let markdown;
|
|
8
|
-
|
|
9
9
|
if (!disableMarkdownMessageFormatting) {
|
|
10
10
|
markdown = new MarkdownIt(Constants.Default, {
|
|
11
11
|
html: true,
|
|
12
12
|
linkify: true,
|
|
13
13
|
breaks: !disableNewLineMarkdownSupport
|
|
14
|
-
});
|
|
14
|
+
});
|
|
15
|
+
// ToDo: Commenting below usage of plugin until deferred bug is resolved: https://github.com/mayashavin/markdown-it-slack/issues/1
|
|
15
16
|
// markdown.use(MarkdownSlack);
|
|
16
17
|
} else {
|
|
17
18
|
markdown = new MarkdownIt(Constants.Zero, {
|
|
@@ -19,38 +20,37 @@ export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineM
|
|
|
19
20
|
linkify: true,
|
|
20
21
|
breaks: !disableNewLineMarkdownSupport
|
|
21
22
|
});
|
|
22
|
-
markdown.enable(["entity",
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
23
|
+
markdown.enable(["entity",
|
|
24
|
+
// Rule to process html entity - {, ¯, "
|
|
25
|
+
"linkify",
|
|
26
|
+
// Rule to replace link-like texts with link nodes
|
|
27
|
+
"html_block",
|
|
28
|
+
// Rule to process html blocks and paragraphs
|
|
29
|
+
"html_inline",
|
|
30
|
+
// Rule to process html tags
|
|
26
31
|
"newline" // Rule to proceess '\n'
|
|
27
32
|
]);
|
|
28
|
-
}
|
|
29
|
-
|
|
33
|
+
}
|
|
30
34
|
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
36
|
markdown.use(MarkdownItForInline, "url_new_win", "link_open", function (tokens, idx, env) {
|
|
32
|
-
const targetAttrIndex = tokens[idx].attrIndex(Constants.Target);
|
|
33
|
-
|
|
37
|
+
const targetAttrIndex = tokens[idx].attrIndex(Constants.Target);
|
|
38
|
+
// Put a transparent pixel instead of the "open in new window" icon, so developers can easily modify the icon in CSS.
|
|
34
39
|
const TRANSPARENT_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
35
|
-
|
|
36
40
|
if (~targetAttrIndex) {
|
|
37
41
|
tokens[idx].attrs[targetAttrIndex][1] = Constants.Blank;
|
|
38
42
|
} else {
|
|
39
43
|
tokens[idx].attrPush([Constants.Target, Constants.Blank]);
|
|
40
44
|
}
|
|
41
|
-
|
|
42
45
|
const relAttrIndex = tokens[idx].attrIndex(Constants.TargetRelationship);
|
|
43
|
-
|
|
44
46
|
if (~relAttrIndex) {
|
|
45
47
|
tokens[idx].attrs[relAttrIndex][1] = Constants.TargetRelationshipAttributes;
|
|
46
48
|
} else {
|
|
47
49
|
tokens[idx].attrPush([Constants.TargetRelationship, Constants.TargetRelationshipAttributes]);
|
|
48
|
-
|
|
49
50
|
if (!disableMarkdownMessageFormatting) {
|
|
50
|
-
tokens[idx].attrPush([Constants.Title, defaultMarkdownLocalizedTexts.MARKDOWN_EXTERNAL_LINK_ALT]);
|
|
51
|
-
|
|
51
|
+
tokens[idx].attrPush([Constants.Title, defaultMarkdownLocalizedTexts.MARKDOWN_EXTERNAL_LINK_ALT]);
|
|
52
|
+
// eslint-disable-next-line quotes
|
|
52
53
|
const iconTokens = markdown.parseInline(``, env)[0].children;
|
|
53
|
-
|
|
54
54
|
if (iconTokens && iconTokens.length > 0) {
|
|
55
55
|
iconTokens[0].attrJoin("class", Constants.OpenLinkIconCssClass);
|
|
56
56
|
tokens.splice(idx + 2, 0, ...iconTokens);
|