@microsoft/omnichannel-chat-widget 0.1.0-main.1a61ea0 → 0.1.0-main.20562ae
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 +227 -0
- package/lib/cjs/assets/Audios.js +8 -0
- package/lib/cjs/assets/Icons.js +28 -0
- package/lib/cjs/common/Constants.js +6 -0
- 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/telemetry/TelemetryConstants.js +33 -3
- package/lib/cjs/common/telemetry/TelemetryHelper.js +9 -4
- package/lib/cjs/common/telemetry/TelemetryManager.js +18 -8
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +14 -1
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +3 -0
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -54
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/cjs/components/footerstateful/FooterStateful.js +3 -3
- package/lib/cjs/components/headerstateful/HeaderStateful.js +11 -8
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +38 -33
- package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +102 -50
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +26 -9
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +23 -7
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +26 -24
- package/lib/cjs/components/livechatwidget/common/startChat.js +77 -27
- package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +90 -25
- 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 +28 -11
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +10 -4
- package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +9 -46
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- package/lib/cjs/contexts/common/ConversationState.js +3 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +15 -13
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +9 -3
- package/lib/cjs/contexts/createReducer.js +20 -10
- package/lib/cjs/controller/componentController.js +2 -2
- package/lib/cjs/plugins/newMessageEventHandler.js +102 -0
- package/lib/esm/assets/Audios.js +1 -0
- package/lib/esm/assets/Icons.js +11 -0
- package/lib/esm/common/Constants.js +6 -0
- package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
- package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +29 -2
- package/lib/esm/common/telemetry/TelemetryHelper.js +9 -4
- package/lib/esm/common/telemetry/TelemetryManager.js +13 -8
- package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +14 -1
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +3 -0
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -50
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/esm/components/footerstateful/FooterStateful.js +3 -3
- package/lib/esm/components/headerstateful/HeaderStateful.js +12 -9
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +36 -33
- package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +100 -47
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +23 -9
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +20 -3
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +23 -22
- package/lib/esm/components/livechatwidget/common/startChat.js +71 -23
- package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +84 -25
- 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 +26 -10
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -5
- package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -44
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- package/lib/esm/contexts/common/ConversationState.js +3 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +15 -13
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +9 -3
- package/lib/esm/contexts/createReducer.js +20 -9
- package/lib/esm/controller/componentController.js +2 -2
- package/lib/esm/plugins/newMessageEventHandler.js +84 -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 +3 -0
- package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +20 -1
- 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 +3 -0
- 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/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -1
- 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/setPostChatContextAndLoadSurvey.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +1 -1
- 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/ILiveChatWidgetProps.d.ts +2 -0
- 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/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
- package/lib/types/contexts/common/ConversationState.d.ts +3 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +15 -13
- package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
- package/package.json +7 -6
- 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
|
@@ -3,71 +3,123 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.endChat = void 0;
|
|
6
|
+
exports.prepareEndChat = exports.endChat = void 0;
|
|
7
7
|
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
|
|
10
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
11
|
+
|
|
10
12
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
11
13
|
|
|
12
14
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
13
15
|
|
|
14
|
-
var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
|
|
15
|
-
|
|
16
|
-
var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
|
|
17
|
-
|
|
18
16
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
19
17
|
|
|
20
18
|
var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
|
|
21
19
|
|
|
22
20
|
var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
|
|
23
21
|
|
|
24
|
-
var
|
|
22
|
+
var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
|
|
23
|
+
|
|
24
|
+
var _Constants = require("../../../common/Constants");
|
|
25
25
|
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
setAdapter
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
27
|
+
const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
|
|
28
|
+
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
|
|
29
|
+
|
|
30
|
+
const isPostChatEnabled = (_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable;
|
|
31
|
+
const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
|
|
32
|
+
const conversationDetails = await chatSDK.getConversationDetails();
|
|
33
|
+
|
|
34
|
+
if (isPostChatEnabled === "true" && (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.canRenderPostChat) === _Constants.Constants.truePascal) {
|
|
35
|
+
const skipEndChatSDK = false;
|
|
36
|
+
const skipCloseChat = true;
|
|
37
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat);
|
|
38
|
+
|
|
39
|
+
if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
|
|
40
|
+
const loadPostChatEvent = {
|
|
41
|
+
eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
_omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
|
|
45
|
+
} else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
|
|
46
|
+
dispatch({
|
|
47
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
48
|
+
payload: _ConversationState.ConversationState.InActive
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
|
|
53
|
+
}
|
|
54
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
exports.prepareEndChat = prepareEndChat;
|
|
58
|
+
|
|
59
|
+
const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat) => {
|
|
60
|
+
if (!skipEndChatSDK) {
|
|
61
|
+
try {
|
|
62
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
63
|
+
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
67
|
+
} catch (ex) {
|
|
68
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
69
|
+
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCallFailed,
|
|
70
|
+
ExceptionDetails: {
|
|
71
|
+
exception: ex
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!skipCloseChat) {
|
|
78
|
+
try {
|
|
79
|
+
var _props$webChatContain;
|
|
80
|
+
|
|
81
|
+
adapter === null || adapter === void 0 ? void 0 : adapter.end();
|
|
82
|
+
setAdapter(undefined);
|
|
83
|
+
setWebChatStyles({ ..._defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles,
|
|
84
|
+
...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
|
|
85
|
+
});
|
|
86
|
+
_WebChatStoreLoader.WebChatStoreLoader.store = null;
|
|
87
|
+
dispatch({
|
|
88
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
89
|
+
payload: _ConversationState.ConversationState.Closed
|
|
90
|
+
});
|
|
91
|
+
dispatch({
|
|
92
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
|
|
93
|
+
payload: false
|
|
94
|
+
});
|
|
95
|
+
dispatch({
|
|
96
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
97
|
+
payload: undefined
|
|
98
|
+
});
|
|
99
|
+
dispatch({
|
|
100
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
|
|
101
|
+
payload: null
|
|
102
|
+
});
|
|
103
|
+
dispatch({
|
|
104
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
105
|
+
payload: undefined
|
|
106
|
+
});
|
|
107
|
+
dispatch({
|
|
108
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
109
|
+
payload: undefined
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
113
|
+
eventName: _TelemetryConstants.BroadcastEvent.EndChat
|
|
114
|
+
});
|
|
115
|
+
} catch (error) {
|
|
116
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
117
|
+
Event: _TelemetryConstants.TelemetryEvent.CloseChatMethodException,
|
|
118
|
+
ExceptionDetails: {
|
|
119
|
+
exception: `Failed to endChat: ${error}`
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
71
123
|
}
|
|
72
124
|
};
|
|
73
125
|
|
|
@@ -17,6 +17,11 @@ const initCallingSdk = async (chatSDK, setVoiceVideoCallingSDK) => {
|
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
18
|
const callingSDK = await chatSDK.getVoiceVideoCalling();
|
|
19
19
|
setVoiceVideoCallingSDK(callingSDK);
|
|
20
|
+
|
|
21
|
+
_TelemetryHelper.TelemetryHelper.logCallingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
22
|
+
Event: _TelemetryConstants.TelemetryEvent.CallingSDKLoadSuccess
|
|
23
|
+
});
|
|
24
|
+
|
|
20
25
|
return true;
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -5,14 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.initWebChatComposer = void 0;
|
|
7
7
|
|
|
8
|
+
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
|
+
|
|
8
10
|
var _botframeworkWebchat = require("botframework-webchat");
|
|
9
11
|
|
|
12
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
13
|
+
|
|
10
14
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
11
15
|
|
|
12
16
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
13
17
|
|
|
14
18
|
var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
|
|
15
19
|
|
|
20
|
+
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
21
|
+
|
|
16
22
|
var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
|
|
17
23
|
|
|
18
24
|
var _attachmentProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware"));
|
|
@@ -55,8 +61,6 @@ var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcont
|
|
|
55
61
|
|
|
56
62
|
var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
|
|
57
63
|
|
|
58
|
-
var _setPostChatContextAndLoadSurvey = require("./setPostChatContextAndLoadSurvey");
|
|
59
|
-
|
|
60
64
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
61
65
|
|
|
62
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -80,6 +84,11 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
80
84
|
const conversationEndCallback = async () => {
|
|
81
85
|
var _props$webChatContain4, _props$webChatContain5;
|
|
82
86
|
|
|
87
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
88
|
+
Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
|
|
89
|
+
Description: "Conversation is ended by agent side or by timeout."
|
|
90
|
+
});
|
|
91
|
+
|
|
83
92
|
if ((props === null || props === void 0 ? void 0 : (_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : (_props$webChatContain5 = _props$webChatContain4.renderingMiddlewareProps) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.hideSendboxOnConversationEnd) !== false) {
|
|
84
93
|
setWebChatStyles(styles => {
|
|
85
94
|
return { ...styles,
|
|
@@ -88,16 +97,24 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
88
97
|
});
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
if (isPostChatEnabled === "true"
|
|
100
|
+
if (isPostChatEnabled === "true") {
|
|
101
|
+
if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
|
|
102
|
+
const loadPostChatEvent = {
|
|
103
|
+
eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
_omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
|
|
107
|
+
} else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
|
|
108
|
+
dispatch({
|
|
109
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
110
|
+
payload: _ConversationState.ConversationState.InActive
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
92
114
|
dispatch({
|
|
93
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
115
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
|
|
94
116
|
payload: true
|
|
95
117
|
});
|
|
96
|
-
dispatch({
|
|
97
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
98
|
-
payload: _ConversationState.ConversationState.Loading
|
|
99
|
-
});
|
|
100
|
-
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch, true);
|
|
101
118
|
}
|
|
102
119
|
|
|
103
120
|
dispatch({
|
|
@@ -5,25 +5,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.registerTelemetryLoggers = void 0;
|
|
7
7
|
|
|
8
|
-
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
9
|
-
|
|
10
8
|
var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
11
9
|
|
|
10
|
+
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
11
|
+
|
|
12
12
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
13
13
|
|
|
14
|
+
var _package = require("@microsoft/omnichannel-chat-components/package.json");
|
|
15
|
+
|
|
16
|
+
var _package2 = require("@microsoft/omnichannel-chat-sdk/package.json");
|
|
17
|
+
|
|
14
18
|
var _defaultAriaConfig = require("../../../common/telemetry/defaultConfigs/defaultAriaConfig");
|
|
15
19
|
|
|
16
20
|
var _defaultTelemetryInternalData = require("../../../common/telemetry/defaultConfigs/defaultTelemetryInternalData");
|
|
17
21
|
|
|
18
22
|
var _defaultTelemetryConfiguration = require("../../../common/telemetry/defaultConfigs/defaultTelemetryConfiguration");
|
|
19
23
|
|
|
20
|
-
var _package = _interopRequireDefault(require("@microsoft/omnichannel-chat-sdk/package.json"));
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
24
|
const registerTelemetryLoggers = (props, dispatch) => {
|
|
25
25
|
var _props$liveChatContex, _props$liveChatContex2;
|
|
26
26
|
|
|
27
|
+
let widgetPackageInfo;
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
widgetPackageInfo = require("@microsoft/omnichannel-chat-widget/package.json");
|
|
31
|
+
} catch (error) {
|
|
32
|
+
widgetPackageInfo = "0.0.0-0";
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
const telemetryConfig = { ..._defaultTelemetryConfiguration.defaultTelemetryConfiguration,
|
|
28
36
|
...props.telemetryConfig
|
|
29
37
|
};
|
|
@@ -33,6 +41,8 @@ const registerTelemetryLoggers = (props, dispatch) => {
|
|
|
33
41
|
|
|
34
42
|
_TelemetryManager.TelemetryManager.InternalTelemetryData = (_props$liveChatContex3 = props.liveChatContextFromCache) === null || _props$liveChatContex3 === void 0 ? void 0 : (_props$liveChatContex4 = _props$liveChatContex3.domainStates) === null || _props$liveChatContex4 === void 0 ? void 0 : _props$liveChatContex4.telemetryInternalData;
|
|
35
43
|
} else {
|
|
44
|
+
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$chatSDK3, _props$chatSDK3$omnic;
|
|
45
|
+
|
|
36
46
|
let telemetryData = { ..._defaultTelemetryInternalData.defaultInternalTelemetryData,
|
|
37
47
|
telemetryConfig: Object.assign({}, _defaultTelemetryConfiguration.defaultTelemetryConfiguration, telemetryConfig),
|
|
38
48
|
ariaConfig: Object.assign({}, _defaultAriaConfig.defaultAriaConfig, telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.ariaConfigurations)
|
|
@@ -43,7 +53,13 @@ const registerTelemetryLoggers = (props, dispatch) => {
|
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
telemetryData = _TelemetryHelper.TelemetryHelper.addWidgetDataToTelemetry(telemetryConfig, telemetryData);
|
|
46
|
-
telemetryData.OCChatSDKVersion =
|
|
56
|
+
telemetryData.OCChatSDKVersion = _package2.version;
|
|
57
|
+
telemetryData.chatComponentVersion = _package.version;
|
|
58
|
+
telemetryData.chatWidgetVersion = widgetPackageInfo;
|
|
59
|
+
telemetryData.orgId = (_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;
|
|
60
|
+
telemetryData.widgetId = (_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;
|
|
61
|
+
telemetryData.orgUrl = (_props$chatSDK3 = props.chatSDK) === null || _props$chatSDK3 === void 0 ? void 0 : (_props$chatSDK3$omnic = _props$chatSDK3.omnichannelConfig) === null || _props$chatSDK3$omnic === void 0 ? void 0 : _props$chatSDK3$omnic.orgUrl;
|
|
62
|
+
_TelemetryManager.TelemetryManager.InternalTelemetryData = telemetryData;
|
|
47
63
|
dispatch({
|
|
48
64
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_TELEMETRY_DATA,
|
|
49
65
|
payload: telemetryData
|
|
@@ -7,27 +7,31 @@ exports.setPostChatContextAndLoadSurvey = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
|
|
10
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
11
|
+
|
|
12
|
+
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
13
|
+
|
|
10
14
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
11
15
|
|
|
12
16
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
13
17
|
|
|
14
|
-
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
15
|
-
|
|
16
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch,
|
|
19
|
+
const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, persistedChat) => {
|
|
18
20
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
if (!persistedChat) {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
const context = await chatSDK.getPostChatSurveyContext();
|
|
24
|
+
|
|
25
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
26
|
+
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallSucceed,
|
|
27
|
+
Description: "Postchat context call succeed."
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
dispatch({
|
|
31
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT,
|
|
32
|
+
payload: context
|
|
33
|
+
});
|
|
34
|
+
}
|
|
31
35
|
} catch (ex) {
|
|
32
36
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
33
37
|
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallFailed,
|
|
@@ -35,21 +39,19 @@ const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, loadSurvey) =>
|
|
|
35
39
|
exception: ex
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
|
-
}
|
|
39
|
-
/* -true: setPostChatContextAndLoadSurvey is called after passing all checks from ConfirmationPane and endChatMiddleware in usual scenario.
|
|
40
|
-
-false: Below if condition is needed for multi-tab scenarios. So when agent ends a chat and customer has opened chat in multiple tabs,
|
|
41
|
-
all tabs should show post chat survey as per existing functionality. But when an agent end a conversation, Omnichannel SDK
|
|
42
|
-
getPostChatSurveyContext returns as invalid conversation. To avoid that, caching the survey url is needed after chat starts and
|
|
43
|
-
in this case loadSurvey is false
|
|
44
|
-
*/
|
|
42
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
45
43
|
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName("LoadPostChatSurvey").subscribe(msg => {
|
|
46
|
+
dispatch({
|
|
47
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
48
|
+
payload: _ConversationState.ConversationState.Loading
|
|
49
|
+
});
|
|
48
50
|
dispatch({
|
|
49
51
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
50
52
|
payload: _ConversationState.ConversationState.Postchat
|
|
51
53
|
});
|
|
52
|
-
}
|
|
54
|
+
});
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
exports.setPostChatContextAndLoadSurvey = setPostChatContextAndLoadSurvey;
|
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.prepareStartChat = exports.initStartChat = void 0;
|
|
7
7
|
|
|
8
|
-
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
|
-
|
|
10
8
|
var _Constants = require("../../../common/Constants");
|
|
11
9
|
|
|
10
|
+
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
11
|
+
|
|
12
12
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
13
13
|
|
|
14
|
+
var _DataStoreManager = require("../../../common/contextDataStore/DataStoreManager");
|
|
15
|
+
|
|
14
16
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
17
|
|
|
16
18
|
var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
|
|
@@ -23,17 +25,23 @@ var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
|
23
25
|
|
|
24
26
|
var _createAdapter = require("./createAdapter");
|
|
25
27
|
|
|
28
|
+
var _newMessageEventHandler = require("../../../plugins/newMessageEventHandler");
|
|
29
|
+
|
|
26
30
|
var _utils = require("../../../common/utils");
|
|
27
31
|
|
|
28
32
|
var _reconnectChatHelper = require("./reconnectChatHelper");
|
|
29
33
|
|
|
30
|
-
var _updateSessionDataForTelemetry = require("./updateSessionDataForTelemetry");
|
|
31
|
-
|
|
32
34
|
var _setPostChatContextAndLoadSurvey = require("./setPostChatContextAndLoadSurvey");
|
|
33
35
|
|
|
36
|
+
var _updateSessionDataForTelemetry = require("./updateSessionDataForTelemetry");
|
|
37
|
+
|
|
34
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
39
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
36
|
-
|
|
40
|
+
if (await canConnectToExistingChat(props, chatSDK, state, dispatch, setAdapter)) {
|
|
41
|
+
return;
|
|
42
|
+
} // Getting PreChat Survey Context
|
|
43
|
+
|
|
44
|
+
|
|
37
45
|
const parseToJson = false;
|
|
38
46
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
39
47
|
const showPrechat = state.appStates.conversationState === _ConversationState.ConversationState.ProactiveChat ? preChatSurveyResponse && state.appStates.proactiveChatStates.proactiveChatEnablePrechat : preChatSurveyResponse; // Getting reconnectId for authenticated chat
|
|
@@ -70,19 +78,20 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
|
|
|
70
78
|
|
|
71
79
|
exports.prepareStartChat = prepareStartChat;
|
|
72
80
|
|
|
73
|
-
const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
|
|
81
|
+
const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedState) => {
|
|
74
82
|
try {
|
|
75
|
-
var _TelemetryTimers$Widg;
|
|
83
|
+
var _newAdapter$activity$, _TelemetryTimers$Widg;
|
|
76
84
|
|
|
77
85
|
try {
|
|
78
|
-
|
|
86
|
+
_TelemetryManager.TelemetryTimers.WidgetLoadTimer = (0, _utils.createTimer)();
|
|
87
|
+
|
|
88
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
79
89
|
Event: _TelemetryConstants.TelemetryEvent.StartChatSDKCall
|
|
80
90
|
});
|
|
81
91
|
|
|
82
92
|
await chatSDK.startChat(params);
|
|
83
|
-
_TelemetryManager.TelemetryTimers.WidgetLoadTimer = (0, _utils.createTimer)();
|
|
84
93
|
} catch (error) {
|
|
85
|
-
_TelemetryHelper.TelemetryHelper.
|
|
94
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
86
95
|
Event: _TelemetryConstants.TelemetryEvent.StartChatMethodException,
|
|
87
96
|
ExceptionDetails: {
|
|
88
97
|
exception: `Failed to setup startChat: ${error}`
|
|
@@ -91,24 +100,41 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
|
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
const newAdapter = await (0, _createAdapter.createAdapter)(chatSDK);
|
|
94
|
-
setAdapter(newAdapter);
|
|
103
|
+
setAdapter(newAdapter);
|
|
104
|
+
const chatToken = await chatSDK.getChatToken();
|
|
105
|
+
newAdapter === null || newAdapter === void 0 ? void 0 : (_newAdapter$activity$ = newAdapter.activity$) === null || _newAdapter$activity$ === void 0 ? void 0 : _newAdapter$activity$.subscribe((0, _newMessageEventHandler.createOnNewAdapterActivityHandler)(chatToken === null || chatToken === void 0 ? void 0 : chatToken.chatId, chatToken === null || chatToken === void 0 ? void 0 : chatToken.visitorId));
|
|
95
106
|
|
|
96
|
-
if (
|
|
107
|
+
if (!persistedState) {
|
|
97
108
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
-
|
|
109
|
+
if (chatSDK !== null && chatSDK !== void 0 && chatSDK.getVoiceVideoCalling) {
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
|
+
const chatToken = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatToken());
|
|
112
|
+
dispatch({
|
|
113
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
114
|
+
payload: chatToken
|
|
115
|
+
});
|
|
116
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
const liveChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getCurrentLiveChatContext());
|
|
99
120
|
dispatch({
|
|
100
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
101
|
-
payload:
|
|
121
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
122
|
+
payload: liveChatContext
|
|
102
123
|
});
|
|
103
|
-
|
|
124
|
+
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch);
|
|
125
|
+
await (0, _updateSessionDataForTelemetry.updateSessionDataForTelemetry)(chatSDK, dispatch); // Set app state to Active
|
|
104
126
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
dispatch({
|
|
128
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
129
|
+
payload: _ConversationState.ConversationState.Active
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
dispatch({
|
|
133
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_STATE,
|
|
134
|
+
payload: persistedState
|
|
135
|
+
});
|
|
136
|
+
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch, true);
|
|
137
|
+
}
|
|
112
138
|
|
|
113
139
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
114
140
|
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadComplete,
|
|
@@ -117,9 +143,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
|
|
|
117
143
|
});
|
|
118
144
|
} catch (ex) {
|
|
119
145
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
120
|
-
Event: _TelemetryConstants.TelemetryEvent.
|
|
146
|
+
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
121
147
|
ExceptionDetails: {
|
|
122
|
-
Exception: `
|
|
148
|
+
Exception: `Widget load Failed: ${ex}`
|
|
123
149
|
}
|
|
124
150
|
});
|
|
125
151
|
|
|
@@ -137,6 +163,30 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
|
|
|
137
163
|
});
|
|
138
164
|
}
|
|
139
165
|
}
|
|
140
|
-
};
|
|
166
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
|
+
|
|
141
168
|
|
|
142
|
-
exports.initStartChat = initStartChat;
|
|
169
|
+
exports.initStartChat = initStartChat;
|
|
170
|
+
|
|
171
|
+
const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
172
|
+
var _DataStoreManager$cli, _persistedState$domai;
|
|
173
|
+
|
|
174
|
+
const widgetStateFromCache = (_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(_Constants.Constants.widgetStateDataKey, "localStorage");
|
|
175
|
+
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
176
|
+
|
|
177
|
+
if (persistedState !== null && persistedState !== void 0 && (_persistedState$domai = persistedState.domainStates) !== null && _persistedState$domai !== void 0 && _persistedState$domai.liveChatContext) {
|
|
178
|
+
var _persistedState$domai2;
|
|
179
|
+
|
|
180
|
+
dispatch({
|
|
181
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
182
|
+
payload: _ConversationState.ConversationState.Loading
|
|
183
|
+
});
|
|
184
|
+
const optionalParams = {
|
|
185
|
+
liveChatContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai2 = persistedState.domainStates) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.liveChatContext
|
|
186
|
+
};
|
|
187
|
+
await initStartChat(chatSDK, dispatch, setAdapter, optionalParams, persistedState);
|
|
188
|
+
return true;
|
|
189
|
+
} else {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
@@ -16,12 +16,12 @@ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
|
16
16
|
var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
17
17
|
|
|
18
18
|
// Defines startProactiveChat callback
|
|
19
|
-
const startProactiveChat = (dispatch,
|
|
19
|
+
const startProactiveChat = (dispatch, notificationConfig, enablePreChat, inNewWindow) => {
|
|
20
20
|
dispatch({
|
|
21
21
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
|
|
22
22
|
payload: {
|
|
23
|
-
proactiveChatBodyTitle:
|
|
24
|
-
proactiveChatEnablePrechat:
|
|
23
|
+
proactiveChatBodyTitle: notificationConfig && notificationConfig.message ? notificationConfig.message : "",
|
|
24
|
+
proactiveChatEnablePrechat: enablePreChat ?? false,
|
|
25
25
|
proactiveChatInNewWindow: inNewWindow ?? false
|
|
26
26
|
}
|
|
27
27
|
});
|