@microsoft/omnichannel-chat-widget 1.7.4-main.a36bdf2 → 1.7.4-main.b7b6783
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/lib/cjs/common/facades/FacadeChatSDK.js +298 -0
- package/lib/cjs/common/facades/types/IFacadeChatSDKInput.js +1 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +5 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +12 -0
- package/lib/cjs/common/utils.js +2 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +4 -8
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -6
- package/lib/cjs/components/footerstateful/FooterStateful.js +4 -5
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -10
- package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -0
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +26 -3
- package/lib/cjs/components/livechatwidget/common/authHelper.js +14 -5
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +9 -9
- package/lib/cjs/components/livechatwidget/common/endChat.js +33 -30
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +3 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +3 -3
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +2 -3
- package/lib/cjs/components/livechatwidget/common/persistentChatHelper.js +4 -4
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +11 -12
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +5 -5
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +45 -39
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +7 -7
- package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +8 -8
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +33 -33
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -2
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +4 -4
- package/lib/cjs/contexts/FacadeChatSDKStore.js +10 -0
- package/lib/cjs/hooks/useFacadeChatSDKStore.js +17 -0
- package/lib/cjs/index.js +9 -2
- package/lib/cjs/plugins/createChatTranscript.js +2 -2
- package/lib/esm/common/facades/FacadeChatSDK.js +291 -0
- package/lib/esm/common/facades/types/IFacadeChatSDKInput.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +5 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +12 -0
- package/lib/esm/common/utils.js +2 -2
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +4 -8
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -6
- package/lib/esm/components/footerstateful/FooterStateful.js +4 -5
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -10
- package/lib/esm/components/headerstateful/HeaderStateful.js +4 -0
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +26 -3
- package/lib/esm/components/livechatwidget/common/authHelper.js +14 -5
- package/lib/esm/components/livechatwidget/common/createAdapter.js +9 -9
- package/lib/esm/components/livechatwidget/common/endChat.js +33 -30
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +3 -3
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +2 -4
- package/lib/esm/components/livechatwidget/common/persistentChatHelper.js +4 -4
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +11 -12
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +5 -5
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +46 -40
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +7 -7
- package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +8 -8
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +33 -33
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -2
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +4 -4
- package/lib/esm/contexts/FacadeChatSDKStore.js +4 -0
- package/lib/esm/hooks/useFacadeChatSDKStore.js +10 -0
- package/lib/esm/index.js +5 -4
- package/lib/esm/plugins/createChatTranscript.js +2 -2
- package/lib/types/common/facades/FacadeChatSDK.d.ts +71 -0
- package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +13 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +6 -1
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +7 -0
- package/lib/types/common/utils.d.ts +2 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +3 -2
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +14 -1
- package/lib/types/components/livechatwidget/common/createAdapter.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
- package/lib/types/components/livechatwidget/common/initCallingSdk.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/persistentChatHelper.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +3 -2
- package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -4
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/updateSessionDataForTelemetry.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -1
- package/lib/types/contexts/FacadeChatSDKStore.d.ts +1 -0
- package/lib/types/hooks/useFacadeChatSDKStore.d.ts +3 -0
- package/lib/types/index.d.ts +4 -3
- package/lib/types/plugins/createChatTranscript.d.ts +2 -1
- package/package.json +4 -2
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.removeAuthTokenProvider = exports.handleAuthentication = exports.getAuthClientFunction = void 0;
|
|
7
7
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
8
8
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
9
|
-
var _utils = require("../../../common/utils");
|
|
10
9
|
var _Constants = require("../../../common/Constants");
|
|
10
|
+
var _utils = require("../../../common/utils");
|
|
11
11
|
const getAuthClientFunction = chatConfig => {
|
|
12
12
|
let authClientFunction = undefined;
|
|
13
13
|
if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
|
|
@@ -16,8 +16,6 @@ const getAuthClientFunction = chatConfig => {
|
|
|
16
16
|
}
|
|
17
17
|
return authClientFunction;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
19
|
exports.getAuthClientFunction = getAuthClientFunction;
|
|
22
20
|
const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
23
21
|
const authClientFunction = getAuthClientFunction(chatConfig);
|
|
@@ -31,7 +29,10 @@ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
|
31
29
|
chatSDK.setAuthTokenProvider(async () => {
|
|
32
30
|
return token;
|
|
33
31
|
});
|
|
34
|
-
return
|
|
32
|
+
return {
|
|
33
|
+
"result": true,
|
|
34
|
+
"token": token
|
|
35
|
+
};
|
|
35
36
|
} else {
|
|
36
37
|
// instead of returning false, it's more appropiate to thrown an error to force error handling on the caller side
|
|
37
38
|
// this will help to avoid the error to be ignored and the chat to be started
|
|
@@ -41,7 +42,15 @@ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
|
41
42
|
throw new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
return
|
|
45
|
+
return {
|
|
46
|
+
"result": false,
|
|
47
|
+
"token": null,
|
|
48
|
+
"error": {
|
|
49
|
+
"message": "No auth client function or getAuthToken function provided",
|
|
50
|
+
"getAuthTokenPresent": getAuthToken ? true : false,
|
|
51
|
+
"authClientFunctionPresent": authClientFunction ? true : false
|
|
52
|
+
}
|
|
53
|
+
};
|
|
45
54
|
};
|
|
46
55
|
|
|
47
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -4,21 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createAdapter = void 0;
|
|
7
|
+
var _BotAuthActivitySubscriber = require("./ActivitySubscriber/BotAuthActivitySubscriber");
|
|
8
|
+
var _ChatAdapterShim = require("./ChatAdapterShim");
|
|
9
|
+
var _HiddenAdaptiveCardActivitySubscriber = require("./ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber");
|
|
10
|
+
var _mockchatsdk = require("../../webchatcontainerstateful/common/mockchatsdk");
|
|
7
11
|
var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
|
|
8
12
|
var _NotificationLevel = require("../../webchatcontainerstateful/webchatcontroller/enums/NotificationLevel");
|
|
9
13
|
var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
|
|
10
|
-
var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
11
|
-
var _ChatAdapterShim = require("./ChatAdapterShim");
|
|
12
14
|
var _PauseActivitySubscriber = require("./ActivitySubscriber/PauseActivitySubscriber");
|
|
13
|
-
var
|
|
14
|
-
var _HiddenAdaptiveCardActivitySubscriber = require("./ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber");
|
|
15
|
+
var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
15
16
|
const defaultBotAuthConfig = {
|
|
16
17
|
fetchBotAuthConfigRetries: 3,
|
|
17
18
|
fetchBotAuthConfigRetryInterval: 1000
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
const createAdapter = async (chatSDK, props) => {
|
|
20
|
+
const createAdapter = async (facadeChatSDK, props) => {
|
|
22
21
|
const chatAdapterOptionalParams = {
|
|
23
22
|
IC3Adapter: {
|
|
24
23
|
options: {
|
|
@@ -41,9 +40,10 @@ const createAdapter = async (chatSDK, props) => {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
};
|
|
44
|
-
let adapter = await
|
|
43
|
+
let adapter = await facadeChatSDK.createChatAdapter(chatAdapterOptionalParams);
|
|
45
44
|
//so far, there is no need to convert to the shim adapter when using visual tests
|
|
46
|
-
|
|
45
|
+
const isMocked = facadeChatSDK.getChatSDK() instanceof _mockchatsdk.MockChatSDK;
|
|
46
|
+
if (isMocked !== true) {
|
|
47
47
|
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4;
|
|
48
48
|
const botAuthActivitySubscriberOptionalParams = {
|
|
49
49
|
fetchBotAuthConfigRetries: (props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.botAuthConfig) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.fetchBotAuthConfigRetries) || defaultBotAuthConfig.fetchBotAuthConfigRetries,
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.prepareEndChat = exports.endVoiceVideoCallIfOngoing = exports.endChatStateCleanUp = exports.endChat = exports.closeChatStateCleanUp = exports.chatSDKStateCleanUp = exports.callingStateCleanUp = void 0;
|
|
7
|
-
var _Constants = require("../../../common/Constants");
|
|
8
7
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
8
|
+
var _Constants = require("../../../common/Constants");
|
|
9
9
|
var _utils = require("../../../common/utils");
|
|
10
10
|
var _renderSurveyHelpers = require("./renderSurveyHelpers");
|
|
11
11
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
@@ -16,11 +16,10 @@ var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
|
16
16
|
var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
|
|
17
17
|
var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
|
|
18
18
|
var _createReducer = require("../../../contexts/createReducer");
|
|
19
|
-
var _authHelper = require("./authHelper");
|
|
20
19
|
var _reconnectChatHelper = require("./reconnectChatHelper");
|
|
21
20
|
var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
|
|
22
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
const prepareEndChat = async (props,
|
|
22
|
+
const prepareEndChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter) => {
|
|
24
23
|
try {
|
|
25
24
|
var _conversationDetails$, _state$domainStates, _state$appStates3;
|
|
26
25
|
const {
|
|
@@ -28,8 +27,8 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
28
27
|
} = props;
|
|
29
28
|
|
|
30
29
|
// Use Case: If call is ongoing, end the call by simulating end call button click
|
|
31
|
-
endVoiceVideoCallIfOngoing(
|
|
32
|
-
const conversationDetails = await (0, _utils.getConversationDetailsCall)(
|
|
30
|
+
endVoiceVideoCallIfOngoing(facadeChatSDK, dispatch);
|
|
31
|
+
const conversationDetails = await (0, _utils.getConversationDetailsCall)(facadeChatSDK);
|
|
33
32
|
|
|
34
33
|
// Use Case: When post chat is not configured
|
|
35
34
|
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : (_conversationDetails$ = conversationDetails.canRenderPostChat) === null || _conversationDetails$ === void 0 ? void 0 : _conversationDetails$.toLowerCase()) === _Constants.Constants.false) {
|
|
@@ -40,7 +39,7 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
40
39
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
41
40
|
Description: _Constants.PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithoutPostChat
|
|
42
41
|
});
|
|
43
|
-
await endChat(props,
|
|
42
|
+
await endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
// Use Case: If ended by Agent, stay chat in InActive state
|
|
@@ -57,7 +56,7 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
57
56
|
|
|
58
57
|
// Use Case: Can render post chat scenarios
|
|
59
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
-
const postchatContext = (await (0, _renderSurveyHelpers.getPostChatContext)(
|
|
59
|
+
const postchatContext = (await (0, _renderSurveyHelpers.getPostChatContext)(facadeChatSDK, state, dispatch)) ?? (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.postChatContext);
|
|
61
60
|
if (postchatContext === undefined) {
|
|
62
61
|
var _state$appStates2;
|
|
63
62
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
@@ -73,7 +72,7 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
73
72
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
74
73
|
Description: _Constants.PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithInvalidPostChat
|
|
75
74
|
});
|
|
76
|
-
await endChat(props,
|
|
75
|
+
await endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
|
|
@@ -103,7 +102,7 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
103
102
|
const endedByCustomer = (appStates === null || appStates === void 0 ? void 0 : appStates.conversationEndedBy) === "Customer";
|
|
104
103
|
|
|
105
104
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
-
const commonParams = [props,
|
|
105
|
+
const commonParams = [props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter];
|
|
107
106
|
if (persistentEnabled && endedByCustomer) {
|
|
108
107
|
await endChat(...commonParams, true, false, true);
|
|
109
108
|
} else {
|
|
@@ -128,7 +127,7 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
128
127
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
129
128
|
Description: _Constants.PrepareEndChatDescriptionConstants.PrepareEndChatError
|
|
130
129
|
});
|
|
131
|
-
await endChat(props,
|
|
130
|
+
await endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
132
131
|
}
|
|
133
132
|
} finally {
|
|
134
133
|
//Chat token clean up
|
|
@@ -138,23 +137,26 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
138
137
|
|
|
139
138
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
140
139
|
exports.prepareEndChat = prepareEndChat;
|
|
141
|
-
const endChat = async (props,
|
|
142
|
-
|
|
140
|
+
const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
|
|
141
|
+
var _facadeChatSDK$getCha;
|
|
142
|
+
if (!skipEndChatSDK && facadeChatSDK !== null && facadeChatSDK !== void 0 && (_facadeChatSDK$getCha = facadeChatSDK.getChatSDK()) !== null && _facadeChatSDK$getCha !== void 0 && _facadeChatSDK$getCha.conversation) {
|
|
143
|
+
var _inMemoryState$appSta;
|
|
144
|
+
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
145
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
146
|
+
payload: null
|
|
147
|
+
});
|
|
148
|
+
const endChatOptionalParameters = {
|
|
149
|
+
isSessionEnded: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.chatDisconnectEventReceived
|
|
150
|
+
};
|
|
143
151
|
try {
|
|
144
152
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
145
153
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
|
|
146
154
|
});
|
|
147
|
-
|
|
148
|
-
await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
|
|
149
|
-
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
155
|
+
await (facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.endChat(endChatOptionalParameters));
|
|
150
156
|
} catch (ex) {
|
|
151
|
-
var _inMemoryState$
|
|
152
|
-
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
153
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
154
|
-
payload: null
|
|
155
|
-
});
|
|
157
|
+
var _inMemoryState$appSta2;
|
|
156
158
|
// if the chat was disconnected or ended by the agent, we don't want to log the error
|
|
157
|
-
if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$
|
|
159
|
+
if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta2 = inMemoryState.appStates) !== null && _inMemoryState$appSta2 !== void 0 && _inMemoryState$appSta2.chatDisconnectEventReceived)) {
|
|
158
160
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
159
161
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCallFailed,
|
|
160
162
|
ExceptionDetails: {
|
|
@@ -171,7 +173,8 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
|
|
|
171
173
|
}
|
|
172
174
|
postMessageToOtherTab = false;
|
|
173
175
|
} finally {
|
|
174
|
-
|
|
176
|
+
endChatStateCleanUp(dispatch);
|
|
177
|
+
facadeChatSDK.destroy();
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
if (!skipCloseChat) {
|
|
@@ -207,10 +210,11 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
|
|
|
207
210
|
});
|
|
208
211
|
// Always allow to close the chat for embedded mode irrespective of end chat errors
|
|
209
212
|
closeChatWidget(dispatch, props, state);
|
|
213
|
+
facadeChatSDK.destroy();
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
if (postMessageToOtherTab) {
|
|
213
|
-
const endChatEventName = await getEndChatEventName(
|
|
217
|
+
const endChatEventName = await getEndChatEventName(facadeChatSDK, props);
|
|
214
218
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
215
219
|
eventName: endChatEventName,
|
|
216
220
|
payload: {
|
|
@@ -310,11 +314,11 @@ const chatSDKStateCleanUp = chatSDK => {
|
|
|
310
314
|
|
|
311
315
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
312
316
|
exports.chatSDKStateCleanUp = chatSDKStateCleanUp;
|
|
313
|
-
const endVoiceVideoCallIfOngoing = async (
|
|
317
|
+
const endVoiceVideoCallIfOngoing = async (facadeChatSDK, dispatch) => {
|
|
314
318
|
let callId = "";
|
|
315
319
|
try {
|
|
316
|
-
if (
|
|
317
|
-
const voiceVideoCallingSdk = await
|
|
320
|
+
if (facadeChatSDK.getChatSDK().isVoiceVideoCallingEnabled()) {
|
|
321
|
+
const voiceVideoCallingSdk = await facadeChatSDK.getVoiceVideoCalling();
|
|
318
322
|
if (voiceVideoCallingSdk && voiceVideoCallingSdk.isInACall()) {
|
|
319
323
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
320
324
|
callId = voiceVideoCallingSdk.callId;
|
|
@@ -368,8 +372,7 @@ const chatTokenCleanUp = async dispatch => {
|
|
|
368
372
|
// Need to keep liveChatContext until chat is fully closed to for transcript download/email
|
|
369
373
|
};
|
|
370
374
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
return (0, _utils.getWidgetEndChatEventName)(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.widgetInstanceId) ?? "");
|
|
375
|
+
const getEndChatEventName = async (facadeChatSDK, props) => {
|
|
376
|
+
var _facadeChatSDK$getCha2, _facadeChatSDK$getCha3, _facadeChatSDK$getCha4, _facadeChatSDK$getCha5, _props$controlProps4;
|
|
377
|
+
return (0, _utils.getWidgetEndChatEventName)((_facadeChatSDK$getCha2 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha2 === void 0 ? void 0 : (_facadeChatSDK$getCha3 = _facadeChatSDK$getCha2.omnichannelConfig) === null || _facadeChatSDK$getCha3 === void 0 ? void 0 : _facadeChatSDK$getCha3.orgId, (_facadeChatSDK$getCha4 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha4 === void 0 ? void 0 : (_facadeChatSDK$getCha5 = _facadeChatSDK$getCha4.omnichannelConfig) === null || _facadeChatSDK$getCha5 === void 0 ? void 0 : _facadeChatSDK$getCha5.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.widgetInstanceId) ?? "");
|
|
375
378
|
};
|
|
@@ -7,12 +7,12 @@ exports.initCallingSdk = void 0;
|
|
|
7
7
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
8
8
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
const initCallingSdk = async (
|
|
10
|
+
const initCallingSdk = async (facadeChatSDK, setVoiceVideoCallingSDK) => {
|
|
11
11
|
try {
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
if (
|
|
13
|
+
if (facadeChatSDK.getChatSDK().getVoiceVideoCalling) {
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
const callingSDK = await
|
|
15
|
+
const callingSDK = await facadeChatSDK.getChatSDK().getVoiceVideoCalling();
|
|
16
16
|
setVoiceVideoCallingSDK(callingSDK);
|
|
17
17
|
_TelemetryHelper.TelemetryHelper.logCallingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
18
18
|
Event: _TelemetryConstants.TelemetryEvent.CallingSDKLoadSuccess
|
|
@@ -39,7 +39,7 @@ var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcont
|
|
|
39
39
|
var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
|
|
40
40
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
const initWebChatComposer = (props, state, dispatch,
|
|
42
|
+
const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) => {
|
|
43
43
|
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain13, _props$webChatContain14, _defaultWebChatContai, _props$webChatContain15, _props$webChatContain16, _props$webChatContain17, _props$webChatContain18, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai2, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai3, _props$webChatContain23, _props$webChatContain24;
|
|
44
44
|
// Add a hook to make all links open a new window
|
|
45
45
|
postDomPurifyActivities();
|
|
@@ -58,7 +58,7 @@ const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
|
|
|
58
58
|
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _props$webChatContain5;
|
|
59
59
|
const conversationEndCallback = async () => {
|
|
60
60
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
-
const conversationDetails = await (0, _utils.getConversationDetailsCall)(
|
|
61
|
+
const conversationDetails = await (0, _utils.getConversationDetailsCall)(facadeChatSDK);
|
|
62
62
|
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.participantType) === _Constants.ParticipantType.Bot) {
|
|
63
63
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
64
64
|
Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
|
|
@@ -107,7 +107,7 @@ const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
|
|
|
107
107
|
text = renderer.render(text);
|
|
108
108
|
});
|
|
109
109
|
const config = {
|
|
110
|
-
FORBID_TAGS: ["form", "button", "script", "div"],
|
|
110
|
+
FORBID_TAGS: ["form", "button", "script", "div", "input"],
|
|
111
111
|
FORBID_ATTR: ["action"]
|
|
112
112
|
};
|
|
113
113
|
text = _dompurify.default.sanitize(text, config);
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.isPostChatSurveyEnabled = exports.isPersistentChatEnabled = void 0;
|
|
7
7
|
var _Constants = require("../../../common/Constants");
|
|
8
8
|
var _utils = require("../../../common/utils");
|
|
9
|
-
|
|
10
|
-
const isPostChatSurveyEnabled = async chatSDK => {
|
|
9
|
+
const isPostChatSurveyEnabled = async facadeChatSDK => {
|
|
11
10
|
var _chatConfig$LiveWSAnd;
|
|
12
|
-
const chatConfig = await
|
|
11
|
+
const chatConfig = await facadeChatSDK.getLiveChatConfig();
|
|
13
12
|
const postChatEnabled = (_chatConfig$LiveWSAnd = chatConfig.LiveWSAndLiveChatEngJoin) === null || _chatConfig$LiveWSAnd === void 0 ? void 0 : _chatConfig$LiveWSAnd.msdyn_postconversationsurveyenable.toString().toLowerCase();
|
|
14
13
|
return postChatEnabled === "true";
|
|
15
14
|
};
|
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.shouldSetPreChatIfPersistentChat = void 0;
|
|
7
7
|
var _liveChatConfigUtils = require("./liveChatConfigUtils");
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
const shouldSetPreChatIfPersistentChat = async (
|
|
9
|
+
const shouldSetPreChatIfPersistentChat = async (facadeChatSDK, conversationMode, showPreChat) => {
|
|
10
10
|
const persistentEnabled = await (0, _liveChatConfigUtils.isPersistentChatEnabled)(conversationMode);
|
|
11
11
|
let skipPreChat = false;
|
|
12
12
|
if (persistentEnabled) {
|
|
13
13
|
const reconnectableChatsParams = {
|
|
14
|
-
authenticatedUserToken:
|
|
15
|
-
requestId:
|
|
14
|
+
authenticatedUserToken: facadeChatSDK.getChatSDK().authenticatedUserToken,
|
|
15
|
+
requestId: facadeChatSDK.getChatSDK().requestId
|
|
16
16
|
};
|
|
17
17
|
try {
|
|
18
|
-
const reconnectableChatsResponse = await
|
|
18
|
+
const reconnectableChatsResponse = await facadeChatSDK.getChatSDK().OCClient.getReconnectableChats(reconnectableChatsParams);
|
|
19
19
|
if (reconnectableChatsResponse && reconnectableChatsResponse.reconnectid) {
|
|
20
20
|
// Skip rendering prechat on existing persistent chat session
|
|
21
21
|
skipPreChat = true;
|
|
@@ -6,23 +6,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.isReconnectEnabled = exports.isPersistentEnabled = exports.handleChatReconnect = exports.getChatReconnectContext = void 0;
|
|
7
7
|
require("regenerator-runtime/runtime");
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
|
+
var _Constants = require("../../../common/Constants");
|
|
9
10
|
var _utils = require("../../../common/utils");
|
|
10
11
|
var _authHelper = require("./authHelper");
|
|
11
12
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
12
|
-
var _Constants = require("../../../common/Constants");
|
|
13
13
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
14
14
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
15
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
16
16
|
var _startChatErrorHandler = require("./startChatErrorHandler");
|
|
17
17
|
// Return value: should start normal chat flow when reconnect is enabled
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
const handleChatReconnect = async (
|
|
19
|
+
const handleChatReconnect = async (facadeChatSDK, props, dispatch, setAdapter, initStartChat, state) => {
|
|
20
20
|
var _props$chatConfig, _props$chatConfig$Liv;
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
22
|
const isAuthenticatedChat = (_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction ? true : false;
|
|
23
|
-
|
|
24
23
|
// Get chat reconnect context
|
|
25
|
-
const reconnectChatContext = await getChatReconnectContext(
|
|
24
|
+
const reconnectChatContext = (await getChatReconnectContext(facadeChatSDK, props.chatConfig, props, isAuthenticatedChat, dispatch)) ?? {};
|
|
26
25
|
|
|
27
26
|
// Redirect if enabled
|
|
28
27
|
if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
|
|
@@ -34,7 +33,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
34
33
|
var _props$reconnectChatP2, _props$reconnectChatP3, _props$controlProps;
|
|
35
34
|
//if reconnect id is provided in props, or hideReconnectChatPane is true, don't show reconnect pane
|
|
36
35
|
if ((_props$reconnectChatP2 = props.reconnectChatPaneProps) !== null && _props$reconnectChatP2 !== void 0 && _props$reconnectChatP2.reconnectId && !(0, _utils.isNullOrEmptyString)((_props$reconnectChatP3 = props.reconnectChatPaneProps) === null || _props$reconnectChatP3 === void 0 ? void 0 : _props$reconnectChatP3.reconnectId) || (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hideReconnectChatPane) {
|
|
37
|
-
await setReconnectIdAndStartChat(isAuthenticatedChat,
|
|
36
|
+
await setReconnectIdAndStartChat(isAuthenticatedChat, facadeChatSDK, state, props, dispatch, setAdapter, reconnectChatContext.reconnectId ?? "", initStartChat);
|
|
38
37
|
return false;
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -58,7 +57,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
58
57
|
|
|
59
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
59
|
exports.handleChatReconnect = handleChatReconnect;
|
|
61
|
-
const getChatReconnectContext = async (
|
|
60
|
+
const getChatReconnectContext = async (facadeChatSDK, chatConfig, props, isAuthenticatedChat, dispatch) => {
|
|
62
61
|
try {
|
|
63
62
|
var _props$reconnectChatP4;
|
|
64
63
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -71,13 +70,13 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
71
70
|
// Get auth token for getting chat reconnect context
|
|
72
71
|
if (isAuthenticatedChat) {
|
|
73
72
|
// handle authentication will throw error if auth token is not available, so no need to check for response
|
|
74
|
-
await (0, _authHelper.handleAuthentication)(
|
|
73
|
+
await (0, _authHelper.handleAuthentication)(facadeChatSDK.getChatSDK(), chatConfig, props.getAuthToken);
|
|
75
74
|
}
|
|
76
|
-
const reconnectChatContext = await (
|
|
75
|
+
const reconnectChatContext = await (facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.getChatReconnectContext(chatReconnectOptionalParams));
|
|
77
76
|
if (isAuthenticatedChat) {
|
|
78
77
|
// remove auth token after reconnectId is fetched
|
|
79
78
|
// AuthToken will be reset later at start chat
|
|
80
|
-
(0, _authHelper.removeAuthTokenProvider)(
|
|
79
|
+
(0, _authHelper.removeAuthTokenProvider)(facadeChatSDK.getChatSDK());
|
|
81
80
|
}
|
|
82
81
|
return reconnectChatContext;
|
|
83
82
|
}
|
|
@@ -93,7 +92,7 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
93
92
|
|
|
94
93
|
// when auth token is not available, propagate the error to stop the execution and ensure error pane is loaded
|
|
95
94
|
if ((error === null || error === void 0 ? void 0 : error.message) == _Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
|
|
96
|
-
(0, _startChatErrorHandler.handleStartChatError)(dispatch,
|
|
95
|
+
(0, _startChatErrorHandler.handleStartChatError)(dispatch, facadeChatSDK, props, new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString), false);
|
|
97
96
|
throw error;
|
|
98
97
|
}
|
|
99
98
|
}
|
|
@@ -101,7 +100,7 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
101
100
|
|
|
102
101
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
102
|
exports.getChatReconnectContext = getChatReconnectContext;
|
|
104
|
-
const setReconnectIdAndStartChat = async (isAuthenticatedChat,
|
|
103
|
+
const setReconnectIdAndStartChat = async (isAuthenticatedChat, facadeChatSDK, state, props, dispatch, setAdapter, reconnectId, initStartChat) => {
|
|
105
104
|
if (!isAuthenticatedChat) {
|
|
106
105
|
const startUnauthenticatedReconnectChat = {
|
|
107
106
|
eventName: _TelemetryConstants.BroadcastEvent.StartUnauthenticatedReconnectChat
|
|
@@ -119,7 +118,7 @@ const setReconnectIdAndStartChat = async (isAuthenticatedChat, chatSDK, state, p
|
|
|
119
118
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
120
119
|
payload: _ConversationState.ConversationState.Loading
|
|
121
120
|
});
|
|
122
|
-
await initStartChat(
|
|
121
|
+
await initStartChat(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams);
|
|
123
122
|
};
|
|
124
123
|
const redirectPage = (redirectURL, redirectInSameWindow) => {
|
|
125
124
|
const redirectPageRequest = {
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.setWidgetStateToInactive = exports.initiatePostChat = exports.getPostChatContext = exports.checkPostChatEnabled = void 0;
|
|
7
7
|
var _Constants = require("../../../common/Constants");
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
|
-
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
10
|
-
var _utils = require("../../../common/utils");
|
|
11
9
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
12
10
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
13
11
|
var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
|
|
12
|
+
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
13
|
+
var _utils = require("../../../common/utils");
|
|
14
14
|
var _liveChatConfigUtils = require("./liveChatConfigUtils");
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
16
|
let conversationDetails = undefined;
|
|
@@ -107,14 +107,14 @@ const isPostChatEnabled = (props, state) => {
|
|
|
107
107
|
|
|
108
108
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
109
109
|
exports.checkPostChatEnabled = isPostChatEnabled;
|
|
110
|
-
const getPostChatContext = async (
|
|
110
|
+
const getPostChatContext = async (facadeChatSDK, state, dispatch) => {
|
|
111
111
|
try {
|
|
112
|
-
const postChatEnabled = await (0, _liveChatConfigUtils.isPostChatSurveyEnabled)(
|
|
112
|
+
const postChatEnabled = await (0, _liveChatConfigUtils.isPostChatSurveyEnabled)(facadeChatSDK);
|
|
113
113
|
if (postChatEnabled) {
|
|
114
114
|
var _state$domainStates2;
|
|
115
115
|
if ((state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.postChatContext) === undefined) {
|
|
116
116
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
-
const context = await
|
|
117
|
+
const context = await facadeChatSDK.getPostChatSurveyContext();
|
|
118
118
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
119
119
|
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallSucceed,
|
|
120
120
|
Description: _Constants.PostChatSurveyTelemetryMessage.PostChatContextCallSucceed
|
|
@@ -8,17 +8,17 @@ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants"
|
|
|
8
8
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
9
9
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
10
10
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
11
|
-
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
12
11
|
var _Constants = require("../../../common/Constants");
|
|
12
|
+
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
13
13
|
var _liveChatConfigUtils = require("./liveChatConfigUtils");
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
const setPostChatContextAndLoadSurvey = async (
|
|
15
|
+
const setPostChatContextAndLoadSurvey = async (facadeChatSDK, dispatch, persistedChat) => {
|
|
16
16
|
try {
|
|
17
|
-
const postChatEnabled = await (0, _liveChatConfigUtils.isPostChatSurveyEnabled)(
|
|
17
|
+
const postChatEnabled = await (0, _liveChatConfigUtils.isPostChatSurveyEnabled)(facadeChatSDK);
|
|
18
18
|
if (postChatEnabled) {
|
|
19
19
|
if (!persistedChat) {
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
const context = await
|
|
21
|
+
const context = await facadeChatSDK.getPostChatSurveyContext();
|
|
22
22
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
23
23
|
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallSucceed,
|
|
24
24
|
Description: _Constants.PostChatSurveyTelemetryMessage.PostChatContextCallSucceed
|