@microsoft/omnichannel-chat-widget 0.1.0-main.89c6531 → 0.1.0-main.eb80fb1
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 +235 -0
- package/lib/cjs/assets/Audios.js +8 -0
- package/lib/cjs/assets/Icons.js +28 -0
- package/lib/cjs/common/Constants.js +2 -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 +5 -1
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +15 -28
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/cjs/components/footerstateful/FooterStateful.js +3 -3
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +11 -7
- package/lib/cjs/components/livechatwidget/common/endChat.js +11 -3
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -9
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +20 -3
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +23 -22
- package/lib/cjs/components/livechatwidget/common/startChat.js +72 -26
- package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +32 -14
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.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/utils/FileAttachmentIconManager.js +51 -73
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +3 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
- package/lib/cjs/contexts/createReducer.js +20 -0
- package/lib/esm/assets/Audios.js +1 -0
- package/lib/esm/assets/Icons.js +11 -0
- package/lib/esm/common/Constants.js +2 -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 +5 -1
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +15 -28
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/esm/components/footerstateful/FooterStateful.js +3 -3
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +11 -9
- package/lib/esm/components/livechatwidget/common/endChat.js +11 -3
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -9
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +18 -3
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +22 -22
- package/lib/esm/components/livechatwidget/common/startChat.js +67 -22
- package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +31 -14
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +26 -10
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +8 -4
- package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +3 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
- package/lib/esm/contexts/createReducer.js +20 -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 +1 -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 +4 -0
- 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/ILiveChatWidgetProps.d.ts +3 -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/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +4 -1
- package/package.json +4 -2
- 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
|
@@ -7,6 +7,8 @@ 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");
|
|
@@ -21,14 +23,12 @@ var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontrol
|
|
|
21
23
|
|
|
22
24
|
var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
|
|
23
25
|
|
|
24
|
-
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
25
|
-
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
27
|
const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter) => {
|
|
28
28
|
try {
|
|
29
29
|
var _props$webChatContain;
|
|
30
30
|
|
|
31
|
-
_TelemetryHelper.TelemetryHelper.
|
|
31
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
32
32
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
|
|
33
33
|
});
|
|
34
34
|
|
|
@@ -43,6 +43,10 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
43
43
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
44
44
|
payload: _ConversationState.ConversationState.Closed
|
|
45
45
|
});
|
|
46
|
+
dispatch({
|
|
47
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
|
|
48
|
+
payload: false
|
|
49
|
+
});
|
|
46
50
|
dispatch({
|
|
47
51
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
48
52
|
payload: undefined
|
|
@@ -55,6 +59,10 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
55
59
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
56
60
|
payload: undefined
|
|
57
61
|
});
|
|
62
|
+
dispatch({
|
|
63
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
64
|
+
payload: undefined
|
|
65
|
+
});
|
|
58
66
|
|
|
59
67
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
60
68
|
eventName: "EndChat"
|
|
@@ -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.ERROR, {
|
|
22
|
+
Event: _TelemetryConstants.TelemetryEvent.CallingSDKLoadSuccess
|
|
23
|
+
});
|
|
24
|
+
|
|
20
25
|
return true;
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -7,8 +7,6 @@ exports.initWebChatComposer = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _botframeworkWebchat = require("botframework-webchat");
|
|
9
9
|
|
|
10
|
-
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
11
|
-
|
|
12
10
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
13
11
|
|
|
14
12
|
var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
|
|
@@ -55,7 +53,7 @@ var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcont
|
|
|
55
53
|
|
|
56
54
|
var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
|
|
57
55
|
|
|
58
|
-
var
|
|
56
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
59
57
|
|
|
60
58
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
61
59
|
|
|
@@ -89,15 +87,16 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
if (isPostChatEnabled === "true" && postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
|
|
90
|
+
const loadPostChatEvent = {
|
|
91
|
+
eventName: "LoadPostChatSurvey"
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
_omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
|
|
95
|
+
} else {
|
|
92
96
|
dispatch({
|
|
93
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
97
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
|
|
94
98
|
payload: true
|
|
95
99
|
});
|
|
96
|
-
dispatch({
|
|
97
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
98
|
-
payload: _ConversationState.ConversationState.Loading
|
|
99
|
-
});
|
|
100
|
-
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch, true);
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
dispatch({
|
|
@@ -17,9 +17,21 @@ var _defaultTelemetryInternalData = require("../../../common/telemetry/defaultCo
|
|
|
17
17
|
|
|
18
18
|
var _defaultTelemetryConfiguration = require("../../../common/telemetry/defaultConfigs/defaultTelemetryConfiguration");
|
|
19
19
|
|
|
20
|
+
var _package = require("@microsoft/omnichannel-chat-components/package.json");
|
|
21
|
+
|
|
22
|
+
var _package2 = require("@microsoft/omnichannel-chat-sdk/package.json");
|
|
23
|
+
|
|
20
24
|
const registerTelemetryLoggers = (props, dispatch) => {
|
|
21
25
|
var _props$liveChatContex, _props$liveChatContex2;
|
|
22
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
|
+
|
|
23
35
|
const telemetryConfig = { ..._defaultTelemetryConfiguration.defaultTelemetryConfiguration,
|
|
24
36
|
...props.telemetryConfig
|
|
25
37
|
};
|
|
@@ -29,6 +41,8 @@ const registerTelemetryLoggers = (props, dispatch) => {
|
|
|
29
41
|
|
|
30
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;
|
|
31
43
|
} else {
|
|
44
|
+
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$chatSDK3, _props$chatSDK3$omnic;
|
|
45
|
+
|
|
32
46
|
let telemetryData = { ..._defaultTelemetryInternalData.defaultInternalTelemetryData,
|
|
33
47
|
telemetryConfig: Object.assign({}, _defaultTelemetryConfiguration.defaultTelemetryConfiguration, telemetryConfig),
|
|
34
48
|
ariaConfig: Object.assign({}, _defaultAriaConfig.defaultAriaConfig, telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.ariaConfigurations)
|
|
@@ -39,9 +53,12 @@ const registerTelemetryLoggers = (props, dispatch) => {
|
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
telemetryData = _TelemetryHelper.TelemetryHelper.addWidgetDataToTelemetry(telemetryConfig, telemetryData);
|
|
42
|
-
telemetryData.OCChatSDKVersion =
|
|
43
|
-
telemetryData.chatComponentVersion =
|
|
44
|
-
telemetryData.chatWidgetVersion =
|
|
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;
|
|
45
62
|
dispatch({
|
|
46
63
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_TELEMETRY_DATA,
|
|
47
64
|
payload: telemetryData
|
|
@@ -13,21 +13,25 @@ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
|
13
13
|
|
|
14
14
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
15
15
|
|
|
16
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
17
|
+
|
|
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,
|
|
@@ -36,20 +40,17 @@ const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, loadSurvey) =>
|
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
42
|
}
|
|
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
|
-
*/
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName("LoadPostChatSurvey").subscribe(msg => {
|
|
45
|
+
dispatch({
|
|
46
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
47
|
+
payload: _ConversationState.ConversationState.Loading
|
|
48
|
+
});
|
|
48
49
|
dispatch({
|
|
49
50
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
50
51
|
payload: _ConversationState.ConversationState.Postchat
|
|
51
52
|
});
|
|
52
|
-
}
|
|
53
|
+
});
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
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");
|
|
@@ -27,13 +29,17 @@ var _utils = require("../../../common/utils");
|
|
|
27
29
|
|
|
28
30
|
var _reconnectChatHelper = require("./reconnectChatHelper");
|
|
29
31
|
|
|
30
|
-
var _updateSessionDataForTelemetry = require("./updateSessionDataForTelemetry");
|
|
31
|
-
|
|
32
32
|
var _setPostChatContextAndLoadSurvey = require("./setPostChatContextAndLoadSurvey");
|
|
33
33
|
|
|
34
|
+
var _updateSessionDataForTelemetry = require("./updateSessionDataForTelemetry");
|
|
35
|
+
|
|
34
36
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
37
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
36
|
-
|
|
38
|
+
if (await canConnectToExistingChat(props, chatSDK, state, dispatch, setAdapter)) {
|
|
39
|
+
return;
|
|
40
|
+
} // Getting PreChat Survey Context
|
|
41
|
+
|
|
42
|
+
|
|
37
43
|
const parseToJson = false;
|
|
38
44
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
39
45
|
const showPrechat = state.appStates.conversationState === _ConversationState.ConversationState.ProactiveChat ? preChatSurveyResponse && state.appStates.proactiveChatStates.proactiveChatEnablePrechat : preChatSurveyResponse; // Getting reconnectId for authenticated chat
|
|
@@ -70,19 +76,20 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
|
|
|
70
76
|
|
|
71
77
|
exports.prepareStartChat = prepareStartChat;
|
|
72
78
|
|
|
73
|
-
const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
|
|
79
|
+
const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedState) => {
|
|
74
80
|
try {
|
|
75
81
|
var _TelemetryTimers$Widg;
|
|
76
82
|
|
|
77
83
|
try {
|
|
78
|
-
|
|
84
|
+
_TelemetryManager.TelemetryTimers.WidgetLoadTimer = (0, _utils.createTimer)();
|
|
85
|
+
|
|
86
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
79
87
|
Event: _TelemetryConstants.TelemetryEvent.StartChatSDKCall
|
|
80
88
|
});
|
|
81
89
|
|
|
82
90
|
await chatSDK.startChat(params);
|
|
83
|
-
_TelemetryManager.TelemetryTimers.WidgetLoadTimer = (0, _utils.createTimer)();
|
|
84
91
|
} catch (error) {
|
|
85
|
-
_TelemetryHelper.TelemetryHelper.
|
|
92
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
86
93
|
Event: _TelemetryConstants.TelemetryEvent.StartChatMethodException,
|
|
87
94
|
ExceptionDetails: {
|
|
88
95
|
exception: `Failed to setup startChat: ${error}`
|
|
@@ -91,24 +98,39 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
|
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
const newAdapter = await (0, _createAdapter.createAdapter)(chatSDK);
|
|
94
|
-
setAdapter(newAdapter);
|
|
101
|
+
setAdapter(newAdapter);
|
|
95
102
|
|
|
96
|
-
if (
|
|
103
|
+
if (!persistedState) {
|
|
97
104
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
-
|
|
105
|
+
if (chatSDK !== null && chatSDK !== void 0 && chatSDK.getVoiceVideoCalling) {
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
+
const chatToken = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatToken());
|
|
108
|
+
dispatch({
|
|
109
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
110
|
+
payload: chatToken
|
|
111
|
+
});
|
|
112
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
const liveChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getCurrentLiveChatContext());
|
|
99
116
|
dispatch({
|
|
100
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
101
|
-
payload:
|
|
117
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
118
|
+
payload: liveChatContext
|
|
102
119
|
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch, false);
|
|
106
|
-
await (0, _updateSessionDataForTelemetry.updateSessionDataForTelemetry)(chatSDK, dispatch); // Set app state to Active
|
|
120
|
+
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch);
|
|
121
|
+
await (0, _updateSessionDataForTelemetry.updateSessionDataForTelemetry)(chatSDK, dispatch); // Set app state to Active
|
|
107
122
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
123
|
+
dispatch({
|
|
124
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
125
|
+
payload: _ConversationState.ConversationState.Active
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
dispatch({
|
|
129
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_STATE,
|
|
130
|
+
payload: persistedState
|
|
131
|
+
});
|
|
132
|
+
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch, true);
|
|
133
|
+
}
|
|
112
134
|
|
|
113
135
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
114
136
|
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadComplete,
|
|
@@ -117,9 +139,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
|
|
|
117
139
|
});
|
|
118
140
|
} catch (ex) {
|
|
119
141
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
120
|
-
Event: _TelemetryConstants.TelemetryEvent.
|
|
142
|
+
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
121
143
|
ExceptionDetails: {
|
|
122
|
-
Exception: `
|
|
144
|
+
Exception: `Widget load Failed: ${ex}`
|
|
123
145
|
}
|
|
124
146
|
});
|
|
125
147
|
|
|
@@ -137,6 +159,30 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
|
|
|
137
159
|
});
|
|
138
160
|
}
|
|
139
161
|
}
|
|
140
|
-
};
|
|
162
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
exports.initStartChat = initStartChat;
|
|
141
166
|
|
|
142
|
-
|
|
167
|
+
const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
168
|
+
var _DataStoreManager$cli, _persistedState$domai;
|
|
169
|
+
|
|
170
|
+
const widgetStateFromCache = (_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(_Constants.Constants.widgetStateDataKey, "localStorage");
|
|
171
|
+
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
172
|
+
|
|
173
|
+
if (persistedState !== null && persistedState !== void 0 && (_persistedState$domai = persistedState.domainStates) !== null && _persistedState$domai !== void 0 && _persistedState$domai.liveChatContext) {
|
|
174
|
+
var _persistedState$domai2;
|
|
175
|
+
|
|
176
|
+
dispatch({
|
|
177
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
178
|
+
payload: _ConversationState.ConversationState.Loading
|
|
179
|
+
});
|
|
180
|
+
const optionalParams = {
|
|
181
|
+
liveChatContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai2 = persistedState.domainStates) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.liveChatContext
|
|
182
|
+
};
|
|
183
|
+
await initStartChat(chatSDK, dispatch, setAdapter, optionalParams, persistedState);
|
|
184
|
+
return true;
|
|
185
|
+
} else {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
@@ -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
|
});
|
|
@@ -85,6 +85,10 @@ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants"
|
|
|
85
85
|
|
|
86
86
|
var _disposeTelemetryLoggers = require("../common/disposeTelemetryLoggers");
|
|
87
87
|
|
|
88
|
+
var _DataStoreManager = require("../../../common/contextDataStore/DataStoreManager");
|
|
89
|
+
|
|
90
|
+
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
91
|
+
|
|
88
92
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
89
93
|
|
|
90
94
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -121,6 +125,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
121
125
|
|
|
122
126
|
(0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
|
|
123
127
|
(0, _createInternetConnectionChangeHandler.createInternetConnectionChangeHandler)();
|
|
128
|
+
_DataStoreManager.DataStoreManager.clientDataStore = props.contextDataStore ?? undefined;
|
|
124
129
|
dispatch({
|
|
125
130
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
|
|
126
131
|
payload: widgetElementId
|
|
@@ -192,21 +197,33 @@ const LiveChatWidgetStateful = props => {
|
|
|
192
197
|
}, [state.appStates.skipChatButtonRendering]);
|
|
193
198
|
(0, _react2.useEffect)(() => {
|
|
194
199
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName("StartProactiveChat").subscribe(msg => {
|
|
200
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
201
|
+
Event: _TelemetryConstants.TelemetryEvent.StartProactiveChatEventReceived,
|
|
202
|
+
Description: "Start proactive chat event received."
|
|
203
|
+
});
|
|
204
|
+
|
|
195
205
|
if (canStartProactiveChat.current) {
|
|
196
206
|
var _msg$payload, _msg$payload2, _msg$payload3;
|
|
197
207
|
|
|
198
|
-
(0, _startProactiveChat.startProactiveChat)(dispatch, msg === null || msg === void 0 ? void 0 : (_msg$payload = msg.payload) === null || _msg$payload === void 0 ? void 0 : _msg$payload.
|
|
208
|
+
(0, _startProactiveChat.startProactiveChat)(dispatch, msg === null || msg === void 0 ? void 0 : (_msg$payload = msg.payload) === null || _msg$payload === void 0 ? void 0 : _msg$payload.notificationConfig, msg === null || msg === void 0 ? void 0 : (_msg$payload2 = msg.payload) === null || _msg$payload2 === void 0 ? void 0 : _msg$payload2.enablePreChat, msg === null || msg === void 0 ? void 0 : (_msg$payload3 = msg.payload) === null || _msg$payload3 === void 0 ? void 0 : _msg$payload3.inNewWindow);
|
|
209
|
+
} else {
|
|
210
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
211
|
+
Event: _TelemetryConstants.TelemetryEvent.ChatAlreadyTriggered,
|
|
212
|
+
Description: "Start proactive chat method called, when chat was already triggered."
|
|
213
|
+
});
|
|
199
214
|
}
|
|
200
215
|
});
|
|
201
216
|
|
|
202
217
|
window.addEventListener("beforeunload", event => {
|
|
203
218
|
(0, _disposeTelemetryLoggers.disposeTelemetryLoggers)();
|
|
204
219
|
});
|
|
220
|
+
|
|
221
|
+
if (state.appStates.conversationEndedByAgent) {
|
|
222
|
+
(0, _endChat.endChat)(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
|
|
223
|
+
}
|
|
205
224
|
}, []);
|
|
206
225
|
(0, _react2.useEffect)(() => {
|
|
207
|
-
|
|
208
|
-
canStartProactiveChat.current = false;
|
|
209
|
-
}
|
|
226
|
+
canStartProactiveChat.current = state.appStates.conversationState === _ConversationState.ConversationState.Closed;
|
|
210
227
|
|
|
211
228
|
if (state.appStates.conversationState === _ConversationState.ConversationState.Active) {
|
|
212
229
|
chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.onNewMessage(() => {
|
|
@@ -217,7 +234,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
217
234
|
} // Track the message count
|
|
218
235
|
|
|
219
236
|
|
|
220
|
-
if (state.appStates.conversationState
|
|
237
|
+
if (state.appStates.conversationState === _ConversationState.ConversationState.Active) {
|
|
221
238
|
chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.onNewMessage(() => {
|
|
222
239
|
currentMessageCountRef.current++;
|
|
223
240
|
dispatch({
|
|
@@ -263,25 +280,26 @@ const LiveChatWidgetStateful = props => {
|
|
|
263
280
|
}, [(_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.webChatStyles]);
|
|
264
281
|
const webChatProps = (0, _initWebChatComposer.initWebChatComposer)(props, chatSDK, state, dispatch, setWebChatStyles);
|
|
265
282
|
|
|
266
|
-
const setPostChatContextRelay = () => (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch
|
|
283
|
+
const setPostChatContextRelay = () => (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch);
|
|
267
284
|
|
|
268
285
|
const endChatRelay = () => (0, _endChat.endChat)(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
|
|
269
286
|
|
|
270
287
|
const prepareStartChatRelay = () => (0, _startChat.prepareStartChat)(props, chatSDK, state, dispatch, setAdapter); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
271
288
|
|
|
272
289
|
|
|
273
|
-
const initStartChatRelay = optionalParams => (0, _startChat.initStartChat)(chatSDK, dispatch, setAdapter, optionalParams);
|
|
290
|
+
const initStartChatRelay = (optionalParams, persistedState) => (0, _startChat.initStartChat)(chatSDK, dispatch, setAdapter, optionalParams, persistedState);
|
|
274
291
|
|
|
275
292
|
const confirmationPaneProps = (0, _initConfirmationPropsComposer.initConfirmationPropsComposer)(props); // publish chat widget state
|
|
276
293
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
_omnichannelChatComponents.BroadcastService.postMessage(chatWidgetStateChangeEvent);
|
|
294
|
+
(0, _react2.useEffect)(() => {
|
|
295
|
+
const chatWidgetStateChangeEvent = {
|
|
296
|
+
eventName: _TelemetryConstants.TelemetryEvent.ChatWidgetStateChanged,
|
|
297
|
+
payload: { ...state
|
|
298
|
+
}
|
|
299
|
+
};
|
|
284
300
|
|
|
301
|
+
_omnichannelChatComponents.BroadcastService.postMessage(chatWidgetStateChangeEvent);
|
|
302
|
+
}, [state]);
|
|
285
303
|
return /*#__PURE__*/_react2.default.createElement(Composer, _extends({}, webChatProps, {
|
|
286
304
|
styleOptions: webChatStyles,
|
|
287
305
|
directLine: ((_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.directLine) ?? adapter ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.directLine
|
|
@@ -46,7 +46,7 @@ const LoadingPaneStateful = props => {
|
|
|
46
46
|
firstElement[0].focus();
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
_TelemetryHelper.TelemetryHelper.
|
|
49
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
50
50
|
Event: _TelemetryConstants.TelemetryEvent.LoadingPaneLoaded,
|
|
51
51
|
Description: "Loading pane loaded."
|
|
52
52
|
});
|
|
@@ -5,10 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.OutOfOfficeHoursPaneStateful = void 0;
|
|
7
7
|
|
|
8
|
+
var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
12
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
11
13
|
|
|
14
|
+
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
15
|
+
|
|
12
16
|
var _defaultgeneralOOOHPaneStyleProps = require("./common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps");
|
|
13
17
|
|
|
14
18
|
var _utils = require("../../common/utils");
|
|
@@ -41,6 +45,10 @@ const OutOfOfficeHoursPaneStateful = props => {
|
|
|
41
45
|
if (firstElement && firstElement[0]) {
|
|
42
46
|
firstElement[0].focus();
|
|
43
47
|
}
|
|
48
|
+
|
|
49
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
50
|
+
Event: _TelemetryConstants.TelemetryEvent.OutOfOfficePaneLoaded
|
|
51
|
+
});
|
|
44
52
|
}, []);
|
|
45
53
|
return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.OutOfOfficeHoursPane, {
|
|
46
54
|
componentOverrides: props.componentOverrides,
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.PreChatSurveyPaneStateful = void 0;
|
|
7
7
|
|
|
8
|
+
var _Constants = require("../../common/Constants");
|
|
9
|
+
|
|
8
10
|
var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
|
|
9
11
|
|
|
10
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -13,12 +15,12 @@ var _utils = require("../../common/utils");
|
|
|
13
15
|
|
|
14
16
|
var _ConversationState = require("../../contexts/common/ConversationState");
|
|
15
17
|
|
|
18
|
+
var _DataStoreManager = require("../../common/contextDataStore/DataStoreManager");
|
|
19
|
+
|
|
16
20
|
var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
|
|
17
21
|
|
|
18
22
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
19
23
|
|
|
20
|
-
var _Constants = require("../../common/Constants");
|
|
21
|
-
|
|
22
24
|
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
23
25
|
|
|
24
26
|
var _defaultGeneralPreChatSurveyPaneStyleProps = require("./common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps");
|
|
@@ -63,7 +65,7 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
63
65
|
try {
|
|
64
66
|
return (0, _utils.parseAdaptiveCardPayload)(payload, requiredFieldMissingMessage);
|
|
65
67
|
} catch (ex) {
|
|
66
|
-
_TelemetryHelper.TelemetryHelper.
|
|
68
|
+
_TelemetryHelper.TelemetryHelper.logConfigDataEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
67
69
|
Event: _TelemetryConstants.TelemetryEvent.ParseAdaptiveCardFailed,
|
|
68
70
|
Description: "Adaptive Card JSON Parse Failed.",
|
|
69
71
|
ExceptionDetails: {
|
|
@@ -91,14 +93,29 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
91
93
|
});
|
|
92
94
|
|
|
93
95
|
try {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
var _DataStoreManager$cli, _persistedState$domai;
|
|
97
|
+
|
|
98
|
+
const widgetStateFromCache = (_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(_Constants.Constants.widgetStateDataKey, "localStorage");
|
|
99
|
+
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
100
|
+
let optionalParams = {};
|
|
101
|
+
|
|
102
|
+
if (persistedState !== null && persistedState !== void 0 && (_persistedState$domai = persistedState.domainStates) !== null && _persistedState$domai !== void 0 && _persistedState$domai.liveChatContext) {
|
|
103
|
+
var _persistedState$domai2;
|
|
104
|
+
|
|
105
|
+
optionalParams = {
|
|
106
|
+
liveChatContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai2 = persistedState.domainStates) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.liveChatContext
|
|
107
|
+
};
|
|
108
|
+
await initStartChat(optionalParams, persistedState);
|
|
109
|
+
} else {
|
|
110
|
+
const prechatResponseValues = (0, _utils.extractPreChatSurveyResponseValues)(state.domainStates.preChatSurveyResponse, values);
|
|
111
|
+
optionalParams = {
|
|
112
|
+
initContext: {
|
|
113
|
+
preChatResponse: prechatResponseValues
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
setPreChatResponseEmail(values);
|
|
117
|
+
await initStartChat(optionalParams);
|
|
118
|
+
}
|
|
102
119
|
} catch (ex) {
|
|
103
120
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
104
121
|
Event: _TelemetryConstants.TelemetryEvent.PreChatSurveyStartChatMethodFailed,
|
|
@@ -51,7 +51,7 @@ const ProactiveChatPaneStateful = props => {
|
|
|
51
51
|
payload: _ConversationState.ConversationState.Closed
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
_TelemetryHelper.TelemetryHelper.
|
|
54
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
55
55
|
Event: _TelemetryConstants.TelemetryEvent.ProactiveChatRejected,
|
|
56
56
|
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers.LcwLoadToChatButtonTimer.milliSecondsElapsed,
|
|
57
57
|
Description: "Proactive chat invitation timed out."
|
|
@@ -75,14 +75,14 @@ const ProactiveChatPaneStateful = props => {
|
|
|
75
75
|
if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
|
|
76
76
|
// TODO: BroadcastService: replace with the sdk broadcast service, when in place
|
|
77
77
|
const startPopoutChatEvent = {
|
|
78
|
-
eventName:
|
|
78
|
+
eventName: _TelemetryConstants.TelemetryEvent.ProactiveChatStartPopoutChat
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
_omnichannelChatComponents.BroadcastService.postMessage(startPopoutChatEvent);
|
|
82
82
|
|
|
83
83
|
dispatch({
|
|
84
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
85
|
-
payload:
|
|
84
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
85
|
+
payload: _ConversationState.ConversationState.Closed
|
|
86
86
|
});
|
|
87
87
|
} else if (((_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.OutOfOperatingHours) === "True") {
|
|
88
88
|
dispatch({
|
|
@@ -94,6 +94,12 @@ const ProactiveChatPaneStateful = props => {
|
|
|
94
94
|
payload: _ConversationState.ConversationState.OutOfOffice
|
|
95
95
|
});
|
|
96
96
|
} else {
|
|
97
|
+
const proactiveChatStarted = {
|
|
98
|
+
eventName: _TelemetryConstants.TelemetryEvent.ProactiveChatStartChat
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
_omnichannelChatComponents.BroadcastService.postMessage(proactiveChatStarted);
|
|
102
|
+
|
|
97
103
|
await startChat();
|
|
98
104
|
}
|
|
99
105
|
},
|
package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|