@microsoft/omnichannel-chat-widget 0.1.0-main.edd8c2a → 0.1.0-main.f514612
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 +259 -0
- package/lib/cjs/assets/Audios.js +8 -0
- package/lib/cjs/assets/Icons.js +28 -0
- package/lib/cjs/common/Constants.js +54 -4
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +14 -0
- package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
- package/lib/cjs/common/storage/default/defaultCacheManager.js +34 -0
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +114 -0
- package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +86 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +67 -4
- package/lib/cjs/common/telemetry/TelemetryHelper.js +22 -4
- package/lib/cjs/common/telemetry/TelemetryManager.js +28 -9
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +48 -15
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +9 -5
- package/lib/cjs/common/utils.js +89 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -54
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/cjs/components/footerstateful/FooterStateful.js +5 -13
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
- package/lib/cjs/components/headerstateful/HeaderStateful.js +14 -10
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
- package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
- package/lib/cjs/components/livechatwidget/common/authHelper.js +65 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
- package/lib/cjs/components/livechatwidget/common/createFooter.js +7 -16
- package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +12 -0
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +32 -32
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +46 -26
- package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +142 -43
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +51 -10
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +144 -39
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +11 -7
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +22 -24
- package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +207 -41
- package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +324 -71
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +27 -5
- package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +96 -2
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
- package/lib/cjs/contexts/common/ConversationState.js +4 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +13 -7
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +20 -5
- package/lib/cjs/contexts/createReducer.js +44 -10
- package/lib/cjs/controller/componentController.js +5 -5
- package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
- package/lib/esm/assets/Audios.js +1 -0
- package/lib/esm/assets/Icons.js +11 -0
- package/lib/esm/common/Constants.js +50 -3
- package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
- package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
- package/lib/esm/common/storage/default/defaultCacheManager.js +19 -0
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +102 -0
- package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +71 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +63 -3
- package/lib/esm/common/telemetry/TelemetryHelper.js +22 -5
- package/lib/esm/common/telemetry/TelemetryManager.js +22 -9
- package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +50 -15
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +9 -5
- package/lib/esm/common/utils.js +64 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -50
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/esm/components/footerstateful/FooterStateful.js +5 -13
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
- package/lib/esm/components/headerstateful/HeaderStateful.js +15 -11
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
- package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
- package/lib/esm/components/livechatwidget/common/authHelper.js +50 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
- package/lib/esm/components/livechatwidget/common/createFooter.js +4 -15
- package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +32 -31
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +44 -27
- package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +139 -42
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +45 -11
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +134 -41
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +10 -3
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +19 -22
- package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +195 -39
- package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +307 -76
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +26 -6
- package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +86 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
- package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
- package/lib/esm/contexts/common/ConversationState.js +4 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +13 -7
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -5
- package/lib/esm/contexts/createReducer.js +44 -9
- package/lib/esm/controller/componentController.js +5 -5
- package/lib/esm/plugins/newMessageEventHandler.js +82 -0
- package/lib/types/assets/Audios.d.ts +1 -0
- package/lib/types/assets/Icons.d.ts +11 -0
- package/lib/types/common/Constants.d.ts +27 -1
- package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -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 +49 -2
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
- package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +15 -9
- package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +12 -0
- package/lib/types/common/utils.d.ts +8 -1
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
- package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +5 -1
- package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
- package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +4 -1
- package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
- package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
- package/lib/types/contexts/common/ConversationState.d.ts +4 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -1
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +14 -8
- package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
- package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
- package/package.json +13 -12
- package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
- package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
- package/lib/cjs/assets/icons/audioIcon.svg +0 -6
- package/lib/cjs/assets/icons/blankIcon.svg +0 -6
- package/lib/cjs/assets/icons/excelIcon.svg +0 -6
- package/lib/cjs/assets/icons/imageIcon.svg +0 -6
- package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
- package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
- package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
- package/lib/cjs/assets/icons/videoIcon.svg +0 -6
- package/lib/cjs/assets/icons/visioIcon.svg +0 -6
- package/lib/cjs/assets/icons/wordIcon.svg +0 -6
- package/lib/esm/assets/assets.d.js +0 -0
- package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
- package/lib/esm/assets/icons/archiveIcon.svg +0 -3
- package/lib/esm/assets/icons/audioIcon.svg +0 -6
- package/lib/esm/assets/icons/blankIcon.svg +0 -6
- package/lib/esm/assets/icons/excelIcon.svg +0 -6
- package/lib/esm/assets/icons/imageIcon.svg +0 -6
- package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
- package/lib/esm/assets/icons/pdfIcon.svg +0 -6
- package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
- package/lib/esm/assets/icons/videoIcon.svg +0 -6
- package/lib/esm/assets/icons/visioIcon.svg +0 -6
- package/lib/esm/assets/icons/wordIcon.svg +0 -6
|
@@ -11,6 +11,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _FileAttachmentIconManager = require("../../../common/utils/FileAttachmentIconManager");
|
|
13
13
|
|
|
14
|
+
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
15
|
+
|
|
14
16
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
15
17
|
|
|
16
18
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
@@ -211,7 +213,7 @@ const createAttachmentMiddleware = enableInlinePlaying => {
|
|
|
211
213
|
const errorData = "Unable to parse the adaptive card format";
|
|
212
214
|
|
|
213
215
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
214
|
-
eventName:
|
|
216
|
+
eventName: _TelemetryConstants.BroadcastEvent.InvalidAdaptiveCardFormat,
|
|
215
217
|
payload: {
|
|
216
218
|
Message: errorData,
|
|
217
219
|
ExceptionDetails: e
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createCardActionMiddleware = void 0;
|
|
7
|
+
|
|
8
|
+
var _BotMagicCodeStore = require("../../BotMagicCodeStore");
|
|
9
|
+
|
|
10
|
+
var CardActionType;
|
|
11
|
+
|
|
12
|
+
(function (CardActionType) {
|
|
13
|
+
CardActionType["OpenUrl"] = "openUrl";
|
|
14
|
+
CardActionType["SignIn"] = "signin";
|
|
15
|
+
})(CardActionType || (CardActionType = {}));
|
|
16
|
+
|
|
17
|
+
const validCardActionTypes = [CardActionType.OpenUrl, CardActionType.SignIn];
|
|
18
|
+
const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
|
|
19
|
+
|
|
20
|
+
const createCardActionMiddleware = botMagicCodeConfig => {
|
|
21
|
+
const cardActionMiddleware = () => next => function () {
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
args[_key] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
27
|
+
const [card] = args;
|
|
28
|
+
|
|
29
|
+
if (card.cardAction && validCardActionTypes.indexOf(card.cardAction.type) >= 0 && card.cardAction.value) {
|
|
30
|
+
// Override signin url only if fwdUrl is valid & feature is enabled
|
|
31
|
+
if ((botMagicCodeConfig === null || botMagicCodeConfig === void 0 ? void 0 : botMagicCodeConfig.disabled) === true && botMagicCodeConfig !== null && botMagicCodeConfig !== void 0 && botMagicCodeConfig.fwdUrl) {
|
|
32
|
+
const baseUrl = window.location.origin;
|
|
33
|
+
const result = botOauthUrlRegex.exec(card.cardAction.value);
|
|
34
|
+
|
|
35
|
+
if (result) {
|
|
36
|
+
_BotMagicCodeStore.BotMagicCodeStore.botOAuthSignInId = `${result[1]}`;
|
|
37
|
+
} // fwdUrl must be on the same domain as the chat widget
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if (botMagicCodeConfig !== null && botMagicCodeConfig !== void 0 && botMagicCodeConfig.fwdUrl.startsWith(baseUrl)) {
|
|
41
|
+
card.cardAction.value += `&fwdUrl=${botMagicCodeConfig.fwdUrl}`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return next(...args);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return cardActionMiddleware;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.createCardActionMiddleware = createCardActionMiddleware;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("@testing-library/jest-dom/extend-expect");
|
|
4
|
+
|
|
5
|
+
var _cardActionMiddleware = require("./cardActionMiddleware");
|
|
6
|
+
|
|
7
|
+
describe("cardActionMiddleware test", () => {
|
|
8
|
+
it("createCardActionMiddleware() with undefined botMagicCodeConfig should not change the sign in card url", () => {
|
|
9
|
+
const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
|
|
13
|
+
const args = {
|
|
14
|
+
cardAction: {
|
|
15
|
+
type: "signin",
|
|
16
|
+
value: signInUrl
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const results = (0, _cardActionMiddleware.createCardActionMiddleware)(undefined)()(next)(args);
|
|
20
|
+
expect(signInUrl).toEqual(results.cardAction.value);
|
|
21
|
+
});
|
|
22
|
+
it("createCardActionMiddleware() with botMagicCode enabled should not change the sign in card url", () => {
|
|
23
|
+
const botMagicCodeConfig = {
|
|
24
|
+
disabled: false
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
|
|
31
|
+
const args = {
|
|
32
|
+
cardAction: {
|
|
33
|
+
type: "signin",
|
|
34
|
+
value: signInUrl
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
|
|
38
|
+
expect(args.cardAction.value).toEqual(results.cardAction.value);
|
|
39
|
+
});
|
|
40
|
+
it("createCardActionMiddleware() with botMagicCode disabled & no fwdUrl should not change the sign in card url", () => {
|
|
41
|
+
const botMagicCodeConfig = {
|
|
42
|
+
disabled: true
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
|
|
49
|
+
const args = {
|
|
50
|
+
cardAction: {
|
|
51
|
+
type: "signin",
|
|
52
|
+
value: signInUrl
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
|
|
56
|
+
expect(args.cardAction.value).toEqual(results.cardAction.value);
|
|
57
|
+
});
|
|
58
|
+
it("createCardActionMiddleware() with botMagicCode disabled & fwdUrl should append the fwdUrl in the sign in card url", () => {
|
|
59
|
+
const botMagicCodeConfig = {
|
|
60
|
+
disabled: true,
|
|
61
|
+
fwdUrl: "http://localhost/forwarder.html"
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
|
|
68
|
+
const args = {
|
|
69
|
+
cardAction: {
|
|
70
|
+
type: "signin",
|
|
71
|
+
value: signInUrl
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
|
|
75
|
+
expect(signInUrl === results.cardAction.value).toBe(false);
|
|
76
|
+
expect(results.cardAction.value === `${signInUrl}&fwdUrl=${botMagicCodeConfig.fwdUrl}`).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
it("createCardActionMiddleware() should not append fwdUrl if fwdUrl & sign in card url are not in the same domain", () => {
|
|
79
|
+
const botMagicCodeConfig = {
|
|
80
|
+
disabled: true,
|
|
81
|
+
fwdUrl: "https://localhost/forwarder.html"
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
|
|
88
|
+
const args = {
|
|
89
|
+
cardAction: {
|
|
90
|
+
type: "signin",
|
|
91
|
+
value: signInUrl
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
|
|
95
|
+
expect(signInUrl === results.cardAction.value).toBe(true);
|
|
96
|
+
expect(results.cardAction.value === `${signInUrl}&fwdUrl=${botMagicCodeConfig.fwdUrl}`).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultReceivedMessageAnchorStyles = void 0;
|
|
7
|
+
const defaultReceivedMessageAnchorStyles = {
|
|
8
|
+
color: "white"
|
|
9
|
+
};
|
|
10
|
+
exports.defaultReceivedMessageAnchorStyles = defaultReceivedMessageAnchorStyles;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
9
|
+
|
|
10
|
+
var _Constants = require("../../../../../common/Constants");
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
13
|
+
const createMessageTimeStampMiddleware = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
dispatch
|
|
16
|
+
} = _ref;
|
|
17
|
+
return next => action => {
|
|
18
|
+
if (isApplicable(action)) {
|
|
19
|
+
return next(evaluateTagsAndOverrideTimeStamp(action));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return next(action);
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const isApplicable = action => {
|
|
27
|
+
return action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && isPVAConversation(action) && isPayloadValid(action) && isValidChannel(action);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const isPayloadValid = action => {
|
|
31
|
+
var _action$payload;
|
|
32
|
+
|
|
33
|
+
return action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const isValidChannel = action => {
|
|
37
|
+
var _action$payload2, _action$payload2$acti;
|
|
38
|
+
|
|
39
|
+
return (action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : _action$payload2$acti.channelId) === _Constants.Constants.acsChannel;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const isPVAConversation = action => {
|
|
43
|
+
return !isTagIncluded(action, _Constants.Constants.systemMessageTag) && !isTagIncluded(action, _Constants.Constants.publicMessageTag) && !isRoleUserOn(action);
|
|
44
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const isTagIncluded = (action, tag) => {
|
|
48
|
+
return isDataTagsPresent(action) && action.payload.activity.channelData.tags.includes(tag);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const isRoleUserOn = action => {
|
|
52
|
+
var _action$payload3, _action$payload3$acti, _action$payload3$acti2;
|
|
53
|
+
|
|
54
|
+
return (action === null || action === void 0 ? void 0 : (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$acti = _action$payload3.activity) === null || _action$payload3$acti === void 0 ? void 0 : (_action$payload3$acti2 = _action$payload3$acti.from) === null || _action$payload3$acti2 === void 0 ? void 0 : _action$payload3$acti2.role) === _Constants.Constants.userMessageTag;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const overrideTimeStamp = (timestampOriginal, timeStampNew) => {
|
|
58
|
+
return isTimestampValid(timeStampNew) ? timeStampNew : timestampOriginal;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const isTimestampValid = timeStamp => {
|
|
62
|
+
const regex = /(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(T)(\d{2})(:{1})(\d{2})(:{1})(\d{2})(.\d+)([Z]{1}))/;
|
|
63
|
+
return regex.test(timeStamp);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const isDataTagsPresent = action => {
|
|
67
|
+
var _action$payload4, _action$payload4$acti, _action$payload4$acti2;
|
|
68
|
+
|
|
69
|
+
return (action === null || action === void 0 ? void 0 : (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : (_action$payload4$acti = _action$payload4.activity) === null || _action$payload4$acti === void 0 ? void 0 : (_action$payload4$acti2 = _action$payload4$acti.channelData) === null || _action$payload4$acti2 === void 0 ? void 0 : _action$payload4$acti2.tags) && action.payload.activity.channelData.tags.length > 0;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const evaluateTagsAndOverrideTimeStamp = action => {
|
|
73
|
+
const tagValue = tagLookup(action, _Constants.Constants.prefixTimestampTag);
|
|
74
|
+
|
|
75
|
+
if (tagValue) {
|
|
76
|
+
const newTimestamp = extractTimeStamp(tagValue);
|
|
77
|
+
action.payload.activity.timestamp = overrideTimeStamp(action.payload.activity.timestamp, newTimestamp);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return action;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const extractTimeStamp = timeStamp => {
|
|
84
|
+
if (timeStamp && timeStamp.length > 0) {
|
|
85
|
+
const ts = timeStamp.split(_Constants.Constants.prefixTimestampTag);
|
|
86
|
+
|
|
87
|
+
if (ts && ts.length > 1) {
|
|
88
|
+
return ts[1];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return timeStamp;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const tagLookup = (action, tag) => {
|
|
96
|
+
if (!isDataTagsPresent(action)) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const tags = action.payload.activity.channelData.tags;
|
|
101
|
+
let value;
|
|
102
|
+
|
|
103
|
+
if (tags && tags.length > 0) {
|
|
104
|
+
for (let i = 0; i < tags.length; i++) {
|
|
105
|
+
value = tags[i];
|
|
106
|
+
|
|
107
|
+
if (value && value.indexOf(tag) > -1) {
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return null;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var _default = createMessageTimeStampMiddleware;
|
|
117
|
+
exports.default = _default;
|
|
@@ -28,22 +28,22 @@ const createConversationEndMiddleware = conversationEndCallback => _ref => {
|
|
|
28
28
|
var _action$payload;
|
|
29
29
|
|
|
30
30
|
if ((action === null || action === void 0 ? void 0 : action.type) == _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
|
|
31
|
-
var _activity$from, _activity$from2, _activity$
|
|
31
|
+
var _activity$from, _activity$from2, _activity$channelData7, _activity$channelData8;
|
|
32
32
|
|
|
33
33
|
const activity = action.payload.activity;
|
|
34
34
|
|
|
35
35
|
if (((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === _DirectLineSenderRole.DirectLineSenderRole.Bot && activity.channelId === "ACS_CHANNEL") {
|
|
36
|
-
var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4;
|
|
36
|
+
var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
|
|
37
37
|
|
|
38
38
|
// ACS
|
|
39
|
-
if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.systemMessageTag) && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(_Constants.Constants.agentEndConversationMessageTag)) {
|
|
39
|
+
if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.systemMessageTag) && ((_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(_Constants.Constants.agentEndConversationMessageTag) || (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.supervisorForceCloseMessageTag))) {
|
|
40
40
|
conversationEndCallback();
|
|
41
41
|
}
|
|
42
|
-
} else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === _DirectLineSenderRole.DirectLineSenderRole.Channel && ((_activity$
|
|
43
|
-
var _activity$
|
|
42
|
+
} else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === _DirectLineSenderRole.DirectLineSenderRole.Channel && ((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.type) === _MessageType.MessageTypes.Thread && (_activity$channelData8 = activity.channelData) !== null && _activity$channelData8 !== void 0 && _activity$channelData8.properties) {
|
|
43
|
+
var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
|
|
44
44
|
|
|
45
45
|
// IC3
|
|
46
|
-
if (((_activity$
|
|
46
|
+
if (((_activity$channelData9 = activity.channelData) === null || _activity$channelData9 === void 0 ? void 0 : (_activity$channelData10 = _activity$channelData9.properties) === null || _activity$channelData10 === void 0 ? void 0 : _activity$channelData10.isdeleted) === _Constants.Constants.truePascal || !((_activity$channelData11 = activity.channelData) !== null && _activity$channelData11 !== void 0 && (_activity$channelData12 = _activity$channelData11.properties) !== null && _activity$channelData12 !== void 0 && _activity$channelData12.containsExternalEntitiesListeningAll)) {
|
|
47
47
|
conversationEndCallback();
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createWebChatTelemetry = createWebChatTelemetry;
|
|
7
|
+
|
|
8
|
+
var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstants");
|
|
9
|
+
|
|
10
|
+
var _TelemetryHelper = require("../../../../common/telemetry/TelemetryHelper");
|
|
11
|
+
|
|
12
|
+
function createWebChatTelemetry() {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
const handleTelemetry = event => {
|
|
15
|
+
const {
|
|
16
|
+
level
|
|
17
|
+
} = event;
|
|
18
|
+
const loglevel = level ? level.toUpperCase() : "";
|
|
19
|
+
|
|
20
|
+
switch (loglevel) {
|
|
21
|
+
case _TelemetryConstants.LogLevel.DEBUG:
|
|
22
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.DEBUG, event);
|
|
23
|
+
|
|
24
|
+
break;
|
|
25
|
+
|
|
26
|
+
case _TelemetryConstants.LogLevel.WARN:
|
|
27
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.WARN, event);
|
|
28
|
+
|
|
29
|
+
break;
|
|
30
|
+
|
|
31
|
+
case _TelemetryConstants.LogLevel.ERROR:
|
|
32
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.ERROR, event);
|
|
33
|
+
|
|
34
|
+
break;
|
|
35
|
+
|
|
36
|
+
case _TelemetryConstants.LogLevel.INFO:
|
|
37
|
+
default:
|
|
38
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.INFO, event);
|
|
39
|
+
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return handleTelemetry;
|
|
45
|
+
}
|
|
@@ -14,6 +14,8 @@ exports.ConversationState = ConversationState;
|
|
|
14
14
|
ConversationState[ConversationState["OutOfOffice"] = 3] = "OutOfOffice";
|
|
15
15
|
ConversationState[ConversationState["ProactiveChat"] = 4] = "ProactiveChat";
|
|
16
16
|
ConversationState[ConversationState["Active"] = 5] = "Active";
|
|
17
|
-
ConversationState[ConversationState["
|
|
18
|
-
ConversationState[ConversationState["
|
|
17
|
+
ConversationState[ConversationState["InActive"] = 6] = "InActive";
|
|
18
|
+
ConversationState[ConversationState["PostchatLoading"] = 7] = "PostchatLoading";
|
|
19
|
+
ConversationState[ConversationState["Postchat"] = 8] = "Postchat";
|
|
20
|
+
ConversationState[ConversationState["Closed"] = 9] = "Closed";
|
|
19
21
|
})(ConversationState || (exports.ConversationState = ConversationState = {}));
|
|
@@ -17,13 +17,13 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
17
17
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT";
|
|
18
18
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 7] = "SET_OUTSIDE_OPERATING_HOURS";
|
|
19
19
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 8] = "SET_PRE_CHAT_SURVEY_RESPONSE";
|
|
20
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
21
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
22
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
23
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
24
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
25
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
26
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
20
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 9] = "SET_CUSTOM_CONTEXT";
|
|
21
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 10] = "SET_SHOW_CONFIRMATION";
|
|
22
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 11] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
|
|
23
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 12] = "SET_PRECHAT_RESPONSE_EMAIL";
|
|
24
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 13] = "SET_AUDIO_NOTIFICATION";
|
|
25
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 14] = "SET_E2VV_ENABLED";
|
|
26
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 15] = "SET_POST_CHAT_CONTEXT";
|
|
27
27
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 16] = "SHOW_CALLING_CONTAINER";
|
|
28
28
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 17] = "SET_INCOMING_CALL";
|
|
29
29
|
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 18] = "DISABLE_VIDEO_CALL";
|
|
@@ -36,4 +36,10 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
36
36
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
|
|
37
37
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 26] = "SET_UNREAD_MESSAGE_COUNT";
|
|
38
38
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 27] = "SET_FOCUS_CHAT_BUTTON";
|
|
39
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
|
|
40
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
|
|
41
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
|
|
42
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 31] = "SET_BOT_OAUTH_SIGNIN_ID";
|
|
43
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 32] = "SET_WIDGET_SIZE";
|
|
44
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 33] = "SET_WIDGET_INSTANCE_ID";
|
|
39
45
|
})(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
|
|
@@ -9,8 +9,19 @@ var _ConversationState = require("./ConversationState");
|
|
|
9
9
|
|
|
10
10
|
var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
11
11
|
|
|
12
|
+
var _utils = require("../../common/utils");
|
|
13
|
+
|
|
14
|
+
var _defaultClientDataStoreProvider = require("../../common/storage/default/defaultClientDataStoreProvider");
|
|
15
|
+
|
|
12
16
|
const getLiveChatWidgetContextInitialState = props => {
|
|
13
|
-
var _props$webChatContain;
|
|
17
|
+
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps, _props$webChatContain;
|
|
18
|
+
|
|
19
|
+
const widgetCacheId = (0, _utils.getWidgetCacheId)(props === null || props === void 0 ? void 0 : (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId, props === null || props === void 0 ? void 0 : (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
|
|
20
|
+
const initialState = (0, _defaultClientDataStoreProvider.defaultClientDataStoreProvider)().getData(widgetCacheId, "localStorage");
|
|
21
|
+
|
|
22
|
+
if (!(0, _utils.isNullOrUndefined)(initialState)) {
|
|
23
|
+
return JSON.parse(initialState);
|
|
24
|
+
}
|
|
14
25
|
|
|
15
26
|
const LiveChatWidgetContextInitialState = {
|
|
16
27
|
domainStates: {
|
|
@@ -22,14 +33,17 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
22
33
|
chatToken: undefined,
|
|
23
34
|
postChatContext: undefined,
|
|
24
35
|
telemetryInternalData: {},
|
|
25
|
-
globalDir: "ltr"
|
|
36
|
+
globalDir: "ltr",
|
|
37
|
+
liveChatContext: undefined,
|
|
38
|
+
customContext: undefined,
|
|
39
|
+
widgetSize: undefined,
|
|
40
|
+
widgetInstanceId: ""
|
|
26
41
|
},
|
|
27
42
|
appStates: {
|
|
28
43
|
conversationState: _ConversationState.ConversationState.Closed,
|
|
29
44
|
isMinimized: false,
|
|
30
45
|
previousElementOnFocusBeforeModalOpen: null,
|
|
31
46
|
outsideOperatingHours: false,
|
|
32
|
-
shouldShowPostChat: false,
|
|
33
47
|
preChatResponseEmail: "",
|
|
34
48
|
isAudioMuted: null,
|
|
35
49
|
newMessage: false,
|
|
@@ -41,7 +55,8 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
41
55
|
proactiveChatInNewWindow: false
|
|
42
56
|
},
|
|
43
57
|
e2vvEnabled: false,
|
|
44
|
-
unreadMessageCount: 0
|
|
58
|
+
unreadMessageCount: 0,
|
|
59
|
+
conversationEndedByAgent: false
|
|
45
60
|
},
|
|
46
61
|
uiStates: {
|
|
47
62
|
showConfirmationPane: false,
|
|
@@ -54,7 +69,7 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
54
69
|
focusChatButton: false
|
|
55
70
|
}
|
|
56
71
|
};
|
|
57
|
-
return
|
|
72
|
+
return LiveChatWidgetContextInitialState;
|
|
58
73
|
};
|
|
59
74
|
|
|
60
75
|
exports.getLiveChatWidgetContextInitialState = getLiveChatWidgetContextInitialState;
|
|
@@ -7,8 +7,6 @@ exports.createReducer = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _LiveChatWidgetActionType = require("./common/LiveChatWidgetActionType");
|
|
9
9
|
|
|
10
|
-
var _TelemetryManager = require("../common/telemetry/TelemetryManager");
|
|
11
|
-
|
|
12
10
|
/* eslint-disable indent */
|
|
13
11
|
const createReducer = () => {
|
|
14
12
|
const reducer = (state, action) => {
|
|
@@ -71,6 +69,14 @@ const createReducer = () => {
|
|
|
71
69
|
}
|
|
72
70
|
};
|
|
73
71
|
|
|
72
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
|
|
73
|
+
return { ...state,
|
|
74
|
+
domainStates: { ...state.domainStates,
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
customContext: action.payload
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
74
80
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
|
|
75
81
|
return { ...state,
|
|
76
82
|
appStates: { ...state.appStates,
|
|
@@ -93,13 +99,6 @@ const createReducer = () => {
|
|
|
93
99
|
}
|
|
94
100
|
};
|
|
95
101
|
|
|
96
|
-
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT:
|
|
97
|
-
return { ...state,
|
|
98
|
-
appStates: { ...state.appStates,
|
|
99
|
-
shouldShowPostChat: action.payload
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
102
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SHOW_CALLING_CONTAINER:
|
|
104
103
|
return { ...state,
|
|
105
104
|
uiStates: { ...state.uiStates,
|
|
@@ -145,6 +144,7 @@ const createReducer = () => {
|
|
|
145
144
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN:
|
|
146
145
|
return { ...state,
|
|
147
146
|
domainStates: { ...state.domainStates,
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
148
148
|
chatToken: action.payload
|
|
149
149
|
}
|
|
150
150
|
};
|
|
@@ -196,7 +196,6 @@ const createReducer = () => {
|
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_TELEMETRY_DATA:
|
|
199
|
-
_TelemetryManager.TelemetryManager.InternalTelemetryData = action.payload;
|
|
200
199
|
return { ...state,
|
|
201
200
|
domainStates: { ...state.domainStates,
|
|
202
201
|
telemetryInternalData: action.payload
|
|
@@ -217,6 +216,41 @@ const createReducer = () => {
|
|
|
217
216
|
}
|
|
218
217
|
};
|
|
219
218
|
|
|
219
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
|
|
220
|
+
return { ...state,
|
|
221
|
+
domainStates: { ...state.domainStates,
|
|
222
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
223
|
+
liveChatContext: action.payload
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_STATE:
|
|
228
|
+
return { ...action.payload
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT:
|
|
232
|
+
return { ...state,
|
|
233
|
+
appStates: { ...state.appStates,
|
|
234
|
+
conversationEndedByAgent: action.payload
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_SIZE:
|
|
239
|
+
return { ...state,
|
|
240
|
+
domainStates: { ...state.domainStates,
|
|
241
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
242
|
+
widgetSize: action.payload
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
|
|
247
|
+
return { ...state,
|
|
248
|
+
domainStates: { ...state.domainStates,
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
|
+
widgetInstanceId: action.payload
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
220
254
|
default:
|
|
221
255
|
return state;
|
|
222
256
|
}
|
|
@@ -8,7 +8,7 @@ exports.shouldShowWebChatContainer = exports.shouldShowReconnectChatPane = expor
|
|
|
8
8
|
var _ConversationState = require("../contexts/common/ConversationState");
|
|
9
9
|
|
|
10
10
|
const shouldShowChatButton = state => {
|
|
11
|
-
return state.appStates.isMinimized || state.appStates.conversationState === _ConversationState.ConversationState.Closed;
|
|
11
|
+
return (state.appStates.isMinimized || state.appStates.conversationState === _ConversationState.ConversationState.Closed) && state.appStates.skipChatButtonRendering == false; // Do not show chat button in case of popout
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.shouldShowChatButton = shouldShowChatButton;
|
|
@@ -26,7 +26,7 @@ const shouldShowHeader = state => {
|
|
|
26
26
|
exports.shouldShowHeader = shouldShowHeader;
|
|
27
27
|
|
|
28
28
|
const shouldShowFooter = state => {
|
|
29
|
-
return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.Active;
|
|
29
|
+
return !state.appStates.isMinimized && (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
exports.shouldShowFooter = shouldShowFooter;
|
|
@@ -38,13 +38,13 @@ const shouldShowEmailTranscriptPane = state => {
|
|
|
38
38
|
exports.shouldShowEmailTranscriptPane = shouldShowEmailTranscriptPane;
|
|
39
39
|
|
|
40
40
|
const shouldShowWebChatContainer = state => {
|
|
41
|
-
return state.appStates.conversationState === _ConversationState.ConversationState.Active;
|
|
41
|
+
return state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
exports.shouldShowWebChatContainer = shouldShowWebChatContainer;
|
|
45
45
|
|
|
46
46
|
const shouldShowLoadingPane = state => {
|
|
47
|
-
return !state.appStates.isMinimized &&
|
|
47
|
+
return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.Loading;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
exports.shouldShowLoadingPane = shouldShowLoadingPane;
|
|
@@ -56,7 +56,7 @@ const shouldShowReconnectChatPane = state => {
|
|
|
56
56
|
exports.shouldShowReconnectChatPane = shouldShowReconnectChatPane;
|
|
57
57
|
|
|
58
58
|
const shouldShowPostChatLoadingPane = state => {
|
|
59
|
-
return !state.appStates.isMinimized && state.appStates.
|
|
59
|
+
return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
exports.shouldShowPostChatLoadingPane = shouldShowPostChatLoadingPane;
|