@microsoft/omnichannel-chat-widget 1.6.2-main.c7d45e8 → 1.6.3-main.0e66ed8
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/telemetry/TelemetryConstants.js +1 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +9 -10
- package/lib/cjs/common/utils.js +15 -6
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +29 -24
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +12 -6
- package/lib/cjs/components/livechatwidget/common/authHelper.js +4 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +9 -30
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +16 -6
- package/lib/cjs/components/livechatwidget/common/startChat.js +35 -19
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +5 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +53 -53
- package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +4 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +10 -0
- package/lib/cjs/contexts/createReducer.js +653 -345
- package/lib/esm/common/telemetry/TelemetryConstants.js +1 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +9 -10
- package/lib/esm/common/utils.js +12 -4
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +30 -25
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +12 -6
- package/lib/esm/components/livechatwidget/common/authHelper.js +4 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +10 -31
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +17 -7
- package/lib/esm/components/livechatwidget/common/startChat.js +35 -19
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +5 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +53 -53
- package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +4 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +10 -0
- package/lib/esm/contexts/createReducer.js +650 -343
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -1
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
- package/lib/types/common/utils.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +3 -2
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/lib/types/contexts/createReducer.d.ts +1 -0
- package/package.json +6 -4
|
@@ -64,6 +64,7 @@ exports.BroadcastEvent = BroadcastEvent;
|
|
|
64
64
|
BroadcastEvent["UpdateSessionDataForTelemetry"] = "UpdateSessionDataForTelemetry";
|
|
65
65
|
BroadcastEvent["UpdateConversationDataForTelemetry"] = "UpdateConversationDataForTelemetry";
|
|
66
66
|
BroadcastEvent["ContactIdNotFound"] = "ContactIdNotFound";
|
|
67
|
+
BroadcastEvent["SyncMinimize"] = "SyncMinimize";
|
|
67
68
|
})(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
|
|
68
69
|
let TelemetryEvent;
|
|
69
70
|
exports.TelemetryEvent = TelemetryEvent;
|
|
@@ -36,7 +36,7 @@ class TelemetryHelper {
|
|
|
36
36
|
static populateBasicProperties(level,
|
|
37
37
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
38
|
telemetryData) {
|
|
39
|
-
var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7, _TelemetryManager$Int8;
|
|
39
|
+
var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7, _TelemetryManager$Int8, _TelemetryManager$Int9, _TelemetryManager$Int10, _TelemetryManager$Int11;
|
|
40
40
|
return {
|
|
41
41
|
WidgetId: ((_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.widgetId) ?? "",
|
|
42
42
|
ChatId: ((_TelemetryManager$Int2 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.chatId) ?? "",
|
|
@@ -46,7 +46,10 @@ class TelemetryHelper {
|
|
|
46
46
|
OrganizationUrl: ((_TelemetryManager$Int6 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int6 === void 0 ? void 0 : _TelemetryManager$Int6.orgUrl) ?? "",
|
|
47
47
|
LCWRuntimeId: ((_TelemetryManager$Int7 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int7 === void 0 ? void 0 : _TelemetryManager$Int7.lcwRuntimeId) ?? "",
|
|
48
48
|
CurrentRequestId: ((_TelemetryManager$Int8 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int8 === void 0 ? void 0 : _TelemetryManager$Int8.currentRequestId) ?? "",
|
|
49
|
-
LogLevel: level
|
|
49
|
+
LogLevel: level,
|
|
50
|
+
OCChatSDKVersion: ((_TelemetryManager$Int9 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int9 === void 0 ? void 0 : _TelemetryManager$Int9.OCChatSDKVersion) ?? "",
|
|
51
|
+
OCChatWidgetVersion: ((_TelemetryManager$Int10 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int10 === void 0 ? void 0 : _TelemetryManager$Int10.chatWidgetVersion) ?? "",
|
|
52
|
+
OCChatComponentsVersion: ((_TelemetryManager$Int11 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int11 === void 0 ? void 0 : _TelemetryManager$Int11.chatComponentVersion) ?? ""
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
55
|
static populate(level, telemetryData, configure) {
|
|
@@ -80,22 +83,21 @@ class TelemetryHelper {
|
|
|
80
83
|
static conformToConfigValidationContract(level, input) {
|
|
81
84
|
const payload = input.payload;
|
|
82
85
|
return TelemetryHelper.populate(level, payload, event => {
|
|
83
|
-
var _TelemetryManager$
|
|
86
|
+
var _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14;
|
|
84
87
|
event.Event = payload.Event;
|
|
85
88
|
event.RequestId = payload.RequestId;
|
|
86
|
-
event.LCWVersion = (_TelemetryManager$
|
|
89
|
+
event.LCWVersion = (_TelemetryManager$Int12 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int12 === void 0 ? void 0 : _TelemetryManager$Int12.environmentVersion;
|
|
87
90
|
event.CloudType = payload.CloudType;
|
|
88
|
-
event.Domain = (_TelemetryManager$
|
|
91
|
+
event.Domain = (_TelemetryManager$Int13 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int13 === void 0 ? void 0 : _TelemetryManager$Int13.hostName;
|
|
89
92
|
event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
|
|
90
93
|
event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
|
|
91
|
-
event.Language = ((_TelemetryManager$
|
|
94
|
+
event.Language = ((_TelemetryManager$Int14 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int14 === void 0 ? void 0 : _TelemetryManager$Int14.chatWidgetLocaleLCID) || "";
|
|
92
95
|
event.Description = payload.Data;
|
|
93
96
|
});
|
|
94
97
|
}
|
|
95
98
|
static conformToLoadContract(level, input) {
|
|
96
99
|
const payload = input.payload;
|
|
97
100
|
return TelemetryHelper.populate(level, payload, event => {
|
|
98
|
-
var _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14;
|
|
99
101
|
event.Event = payload.Event;
|
|
100
102
|
event.Description = payload.Description;
|
|
101
103
|
event.ResourcePath = payload.ResourcePath;
|
|
@@ -104,9 +106,6 @@ class TelemetryHelper {
|
|
|
104
106
|
event.ChatType = payload.ChatType;
|
|
105
107
|
event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
|
|
106
108
|
event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
|
|
107
|
-
event.OCChatSDKVersion = ((_TelemetryManager$Int12 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int12 === void 0 ? void 0 : _TelemetryManager$Int12.OCChatSDKVersion) ?? "";
|
|
108
|
-
event.OCChatWidgetVersion = ((_TelemetryManager$Int13 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int13 === void 0 ? void 0 : _TelemetryManager$Int13.chatWidgetVersion) ?? "";
|
|
109
|
-
event.OCChatComponentsVersion = ((_TelemetryManager$Int14 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int14 === void 0 ? void 0 : _TelemetryManager$Int14.chatComponentVersion) ?? "";
|
|
110
109
|
});
|
|
111
110
|
}
|
|
112
111
|
static conformToIC3ClientContract(level, input) {
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
6
|
+
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseLowerCaseString = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
7
7
|
var _Constants = require("./Constants");
|
|
8
8
|
var _TelemetryConstants = require("./telemetry/TelemetryConstants");
|
|
9
9
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
@@ -383,15 +383,20 @@ const debounceLeading = function (fn) {
|
|
|
383
383
|
|
|
384
384
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
385
385
|
exports.debounceLeading = debounceLeading;
|
|
386
|
-
const getConversationDetailsCall = async chatSDK
|
|
387
|
-
|
|
388
|
-
let conversationDetails = undefined;
|
|
386
|
+
const getConversationDetailsCall = async function (chatSDK) {
|
|
387
|
+
let liveChatContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
388
|
+
let conversationDetails = undefined; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
389
|
+
const optionalParams = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
390
|
+
|
|
391
|
+
if (liveChatContext !== null && liveChatContext !== void 0 && liveChatContext.requestId && liveChatContext !== null && liveChatContext !== void 0 && liveChatContext.chatToken) {
|
|
392
|
+
optionalParams.liveChatContext = liveChatContext;
|
|
393
|
+
}
|
|
389
394
|
try {
|
|
390
395
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
391
396
|
Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsCallStarted,
|
|
392
397
|
Description: "Conversation details call started"
|
|
393
398
|
});
|
|
394
|
-
conversationDetails = await chatSDK.getConversationDetails();
|
|
399
|
+
conversationDetails = await chatSDK.getConversationDetails(optionalParams);
|
|
395
400
|
} catch (error) {
|
|
396
401
|
checkContactIdError(error);
|
|
397
402
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
@@ -449,4 +454,8 @@ const formatTemplateString = (templateMessage, values) => {
|
|
|
449
454
|
return typeof values[index] !== "undefined" ? values[index] : match;
|
|
450
455
|
});
|
|
451
456
|
};
|
|
452
|
-
exports.formatTemplateString = formatTemplateString;
|
|
457
|
+
exports.formatTemplateString = formatTemplateString;
|
|
458
|
+
const parseLowerCaseString = property => {
|
|
459
|
+
return String(property).toLowerCase();
|
|
460
|
+
};
|
|
461
|
+
exports.parseLowerCaseString = parseLowerCaseString;
|
|
@@ -45,33 +45,38 @@ const EmailTranscriptPaneStateful = props => {
|
|
|
45
45
|
});
|
|
46
46
|
(0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
|
|
47
47
|
};
|
|
48
|
+
const onSend = (0, _react.useCallback)(async email => {
|
|
49
|
+
var _state$domainStates;
|
|
50
|
+
const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
|
|
51
|
+
closeEmailTranscriptPane();
|
|
52
|
+
const chatTranscriptBody = {
|
|
53
|
+
emailAddress: email,
|
|
54
|
+
attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
|
|
55
|
+
};
|
|
56
|
+
try {
|
|
57
|
+
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody, {
|
|
58
|
+
liveChatContext
|
|
59
|
+
}));
|
|
60
|
+
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
|
|
61
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
62
|
+
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
|
|
63
|
+
Description: "Transcript sent to email successfully."
|
|
64
|
+
});
|
|
65
|
+
} catch (ex) {
|
|
66
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
67
|
+
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptFailed,
|
|
68
|
+
ExceptionDetails: {
|
|
69
|
+
exception: ex
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
73
|
+
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
|
|
74
|
+
}
|
|
75
|
+
}, [props.attachmentMessage, props.bannerMessageOnError, chatSDK, state.domainStates.liveChatContext]);
|
|
48
76
|
const controlProps = {
|
|
49
77
|
id: "oclcw-emailTranscriptDialogContainer",
|
|
50
78
|
dir: state.domainStates.globalDir,
|
|
51
|
-
onSend
|
|
52
|
-
closeEmailTranscriptPane();
|
|
53
|
-
const chatTranscriptBody = {
|
|
54
|
-
emailAddress: email,
|
|
55
|
-
attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
|
|
56
|
-
};
|
|
57
|
-
try {
|
|
58
|
-
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody));
|
|
59
|
-
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
|
|
60
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
61
|
-
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
|
|
62
|
-
Description: "Transcript sent to email successfully."
|
|
63
|
-
});
|
|
64
|
-
} catch (ex) {
|
|
65
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
66
|
-
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptFailed,
|
|
67
|
-
ExceptionDetails: {
|
|
68
|
-
exception: ex
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
72
|
-
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
|
|
73
|
-
}
|
|
74
|
-
},
|
|
79
|
+
onSend,
|
|
75
80
|
onCancel: () => {
|
|
76
81
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
77
82
|
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptCancelButtonClicked,
|
package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -12,6 +12,8 @@ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants"
|
|
|
12
12
|
var _createChatTranscript = _interopRequireDefault(require("../../../plugins/createChatTranscript"));
|
|
13
13
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
14
14
|
var _utils = require("../../../common/utils");
|
|
15
|
+
var _createReducer = require("../../../contexts/createReducer");
|
|
16
|
+
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
18
|
const processDisplayName = displayName => {
|
|
17
19
|
// if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
|
|
@@ -164,12 +166,16 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
164
166
|
|
|
165
167
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
166
168
|
const downloadTranscript = async (chatSDK, downloadTranscriptProps, state) => {
|
|
167
|
-
var _state$domainStates
|
|
168
|
-
// Need to keep existing
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
var _state$domainStates;
|
|
170
|
+
// Need to keep existing live chat context for scenarios when transcript is downloaded after endchat
|
|
171
|
+
let liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
|
|
172
|
+
if (!liveChatContext) {
|
|
173
|
+
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
174
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
175
|
+
payload: null
|
|
176
|
+
});
|
|
177
|
+
liveChatContext = inMemoryState.domainStates.liveChatContext;
|
|
178
|
+
}
|
|
173
179
|
let data = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getLiveChatTranscript({
|
|
174
180
|
liveChatContext
|
|
175
181
|
}));
|
|
@@ -7,6 +7,7 @@ exports.removeAuthTokenProvider = exports.handleAuthentication = exports.getAuth
|
|
|
7
7
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
8
8
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
9
9
|
var _utils = require("../../../common/utils");
|
|
10
|
+
var _Constants = require("../../../common/Constants");
|
|
10
11
|
const getAuthClientFunction = chatConfig => {
|
|
11
12
|
let authClientFunction = undefined;
|
|
12
13
|
if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
|
|
@@ -32,10 +33,12 @@ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
|
32
33
|
});
|
|
33
34
|
return true;
|
|
34
35
|
} else {
|
|
36
|
+
// instead of returning false, it's more appropiate to thrown an error to force error handling on the caller side
|
|
37
|
+
// this will help to avoid the error to be ignored and the chat to be started
|
|
35
38
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
36
39
|
Event: _TelemetryConstants.TelemetryEvent.ReceivedNullOrEmptyToken
|
|
37
40
|
});
|
|
38
|
-
|
|
41
|
+
throw new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
return false;
|
|
@@ -119,7 +119,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
|
|
|
119
119
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
|
|
120
120
|
});
|
|
121
121
|
//Get auth token again if chat continued for longer time, otherwise gets 401 error
|
|
122
|
-
await
|
|
122
|
+
await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
|
|
123
123
|
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
124
124
|
} catch (ex) {
|
|
125
125
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
@@ -200,10 +200,6 @@ const callingStateCleanUp = dispatch => {
|
|
|
200
200
|
exports.callingStateCleanUp = callingStateCleanUp;
|
|
201
201
|
const endChatStateCleanUp = dispatch => {
|
|
202
202
|
// Need to clear these states immediately when chat ended from OC.
|
|
203
|
-
dispatch({
|
|
204
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
205
|
-
payload: undefined
|
|
206
|
-
});
|
|
207
203
|
dispatch({
|
|
208
204
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
209
205
|
payload: undefined
|
|
@@ -248,6 +244,12 @@ const closeChatStateCleanUp = dispatch => {
|
|
|
248
244
|
proactiveChatInNewWindow: false
|
|
249
245
|
}
|
|
250
246
|
});
|
|
247
|
+
|
|
248
|
+
// Clear live chat context only if chat widget is fully closed to support transcript calls after sessionclose is called
|
|
249
|
+
dispatch({
|
|
250
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
251
|
+
payload: undefined
|
|
252
|
+
});
|
|
251
253
|
};
|
|
252
254
|
|
|
253
255
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -308,27 +310,6 @@ const closeChatWidget = (dispatch, props, state) => {
|
|
|
308
310
|
});
|
|
309
311
|
};
|
|
310
312
|
|
|
311
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
312
|
-
const handleAuthenticationIfEnabled = async (props, chatSDK) => {
|
|
313
|
-
//Unable to end chat if token has expired
|
|
314
|
-
if (props.getAuthToken) {
|
|
315
|
-
const authClientFunction = (0, _authHelper.getAuthClientFunction)(props.chatConfig);
|
|
316
|
-
if (props.getAuthToken && authClientFunction) {
|
|
317
|
-
// set auth token to chat sdk before end chat
|
|
318
|
-
const authSuccess = await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
|
|
319
|
-
if (!authSuccess) {
|
|
320
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
321
|
-
Event: _TelemetryConstants.TelemetryEvent.GetAuthTokenFailed,
|
|
322
|
-
ExceptionDetails: {
|
|
323
|
-
exception: "Unable to get auth token during end chat"
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
throw new Error("handleAuthenticationIfEnabled:Failed to get authentication token");
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
|
|
332
313
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
333
314
|
const chatTokenCleanUp = async dispatch => {
|
|
334
315
|
//Just do cleanup here
|
|
@@ -336,10 +317,8 @@ const chatTokenCleanUp = async dispatch => {
|
|
|
336
317
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
337
318
|
payload: undefined
|
|
338
319
|
});
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
payload: undefined
|
|
342
|
-
});
|
|
320
|
+
|
|
321
|
+
// Need to keep liveChatContext until chat is fully closed to for transcript download/email
|
|
343
322
|
};
|
|
344
323
|
|
|
345
324
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -13,6 +13,7 @@ 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
|
+
var _startChatErrorHandler = require("./startChatErrorHandler");
|
|
16
17
|
// Return value: should start normal chat flow when reconnect is enabled
|
|
17
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
19
|
const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
|
|
@@ -21,7 +22,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
21
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;
|
|
22
23
|
|
|
23
24
|
// Get chat reconnect context
|
|
24
|
-
const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat);
|
|
25
|
+
const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat, dispatch);
|
|
25
26
|
|
|
26
27
|
// Redirect if enabled
|
|
27
28
|
if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
|
|
@@ -30,9 +31,9 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
30
31
|
return false;
|
|
31
32
|
}
|
|
32
33
|
if (hasReconnectId(reconnectChatContext)) {
|
|
33
|
-
var _props$reconnectChatP2, _props$reconnectChatP3;
|
|
34
|
-
//if reconnect id is provided in props, don't show reconnect pane
|
|
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)) {
|
|
34
|
+
var _props$reconnectChatP2, _props$reconnectChatP3, _props$controlProps;
|
|
35
|
+
//if reconnect id is provided in props, or hideReconnectChatPane is true, don't show reconnect pane
|
|
36
|
+
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) {
|
|
36
37
|
await setReconnectIdAndStartChat(isAuthenticatedChat, chatSDK, state, props, dispatch, setAdapter, reconnectChatContext.reconnectId ?? "", initStartChat);
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
@@ -57,7 +58,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
57
58
|
|
|
58
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
60
|
exports.handleChatReconnect = handleChatReconnect;
|
|
60
|
-
const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticatedChat) => {
|
|
61
|
+
const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticatedChat, dispatch) => {
|
|
61
62
|
try {
|
|
62
63
|
var _props$reconnectChatP4;
|
|
63
64
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -69,6 +70,7 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
69
70
|
};
|
|
70
71
|
// Get auth token for getting chat reconnect context
|
|
71
72
|
if (isAuthenticatedChat) {
|
|
73
|
+
// handle authentication will throw error if auth token is not available, so no need to check for response
|
|
72
74
|
await (0, _authHelper.handleAuthentication)(chatSDK, chatConfig, props.getAuthToken);
|
|
73
75
|
}
|
|
74
76
|
const reconnectChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatReconnectContext(chatReconnectOptionalParams));
|
|
@@ -78,7 +80,9 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
78
80
|
(0, _authHelper.removeAuthTokenProvider)(chatSDK);
|
|
79
81
|
}
|
|
80
82
|
return reconnectChatContext;
|
|
81
|
-
}
|
|
83
|
+
}
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
+
catch (error) {
|
|
82
86
|
(0, _utils.checkContactIdError)(error);
|
|
83
87
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
84
88
|
Event: _TelemetryConstants.TelemetryEvent.GetChatReconnectContextSDKCallFailed,
|
|
@@ -86,6 +90,12 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
86
90
|
exception: error
|
|
87
91
|
}
|
|
88
92
|
});
|
|
93
|
+
|
|
94
|
+
// when auth token is not available, propagate the error to stop the execution and ensure error pane is loaded
|
|
95
|
+
if ((error === null || error === void 0 ? void 0 : error.message) == _Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
|
|
96
|
+
(0, _startChatErrorHandler.handleStartChatError)(dispatch, chatSDK, props, new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString), false);
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
89
99
|
}
|
|
90
100
|
};
|
|
91
101
|
|
|
@@ -32,7 +32,6 @@ let popoutWidgetInstanceId;
|
|
|
32
32
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
33
33
|
optionalParams = {}; //Resetting to ensure no stale values
|
|
34
34
|
widgetInstanceId = (0, _utils.getWidgetCacheIdfromProps)(props);
|
|
35
|
-
|
|
36
35
|
// reconnect > chat from cache
|
|
37
36
|
if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true && !(0, _reconnectChatHelper.isPersistentEnabled)(props.chatConfig)) {
|
|
38
37
|
const shouldStartChatNormally = await (0, _reconnectChatHelper.handleChatReconnect)(chatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
@@ -83,6 +82,7 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
83
82
|
});
|
|
84
83
|
return;
|
|
85
84
|
} else {
|
|
85
|
+
var _state$appStates;
|
|
86
86
|
dispatch({
|
|
87
87
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
88
88
|
payload: preChatSurveyResponse
|
|
@@ -91,6 +91,24 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
91
91
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
92
92
|
payload: _ConversationState.ConversationState.Prechat
|
|
93
93
|
});
|
|
94
|
+
|
|
95
|
+
// If minimized, maximize the chat, if the state is missing, consider it as minimized
|
|
96
|
+
if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) == undefined || (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.isMinimized) === true) {
|
|
97
|
+
var _state$domainStates2, _state$domainStates2$, _state$domainStates3, _state$domainStates3$;
|
|
98
|
+
dispatch({
|
|
99
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
100
|
+
payload: false
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// this event will notify the upper layer to maximize the widget, an event missing during multi-tab scenario.
|
|
104
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
105
|
+
eventName: _TelemetryConstants.BroadcastEvent.MaximizeChat,
|
|
106
|
+
payload: {
|
|
107
|
+
height: state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.widgetSize) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.height,
|
|
108
|
+
width: state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.widgetSize) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.width
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
94
112
|
return;
|
|
95
113
|
}
|
|
96
114
|
}
|
|
@@ -117,9 +135,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
117
135
|
(0, _endChat.chatSDKStateCleanUp)(chatSDK);
|
|
118
136
|
}
|
|
119
137
|
try {
|
|
120
|
-
var _state$
|
|
138
|
+
var _state$appStates2, _newAdapter$activity$;
|
|
121
139
|
// Clear disconnect state on start chat
|
|
122
|
-
(state === null || state === void 0 ? void 0 : (_state$
|
|
140
|
+
(state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.chatDisconnectEventReceived) && dispatch({
|
|
123
141
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
124
142
|
payload: false
|
|
125
143
|
});
|
|
@@ -214,7 +232,6 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
214
232
|
payload: liveChatContext
|
|
215
233
|
});
|
|
216
234
|
(0, _startChatErrorHandler.logWidgetLoadComplete)();
|
|
217
|
-
|
|
218
235
|
// Set post chat context in state
|
|
219
236
|
// Commenting this for now as post chat context is fetched during end chat
|
|
220
237
|
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch);
|
|
@@ -232,9 +249,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
232
249
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
233
250
|
exports.initStartChat = initStartChat;
|
|
234
251
|
const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
235
|
-
var _state$
|
|
252
|
+
var _state$appStates3, _persistedState$domai6, _persistedState$appSt;
|
|
236
253
|
// By pass this function in case of popout chat
|
|
237
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
254
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates3 = state.appStates) === null || _state$appStates3 === void 0 ? void 0 : _state$appStates3.hideStartChatButton) === true) {
|
|
238
255
|
return false;
|
|
239
256
|
}
|
|
240
257
|
const persistedState = (0, _utils.getStateFromCache)((0, _utils.getWidgetCacheIdfromProps)(props));
|
|
@@ -257,17 +274,17 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
257
274
|
|
|
258
275
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
259
276
|
const setCustomContextParams = async (state, props) => {
|
|
260
|
-
var _props$chatConfig, _props$chatConfig$Liv, _state$
|
|
277
|
+
var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates4, _persistedState$domai8;
|
|
261
278
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
262
279
|
const isAuthenticatedChat = props !== null && props !== void 0 && (_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;
|
|
263
280
|
//Should not set custom context for auth chat
|
|
264
281
|
if (isAuthenticatedChat) {
|
|
265
282
|
return;
|
|
266
283
|
}
|
|
267
|
-
if (state !== null && state !== void 0 && (_state$
|
|
268
|
-
var _state$
|
|
284
|
+
if (state !== null && state !== void 0 && (_state$domainStates4 = state.domainStates) !== null && _state$domainStates4 !== void 0 && _state$domainStates4.customContext) {
|
|
285
|
+
var _state$domainStates5;
|
|
269
286
|
optionalParams = Object.assign({}, optionalParams, {
|
|
270
|
-
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$
|
|
287
|
+
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates5 = state.domainStates) === null || _state$domainStates5 === void 0 ? void 0 : _state$domainStates5.customContext))
|
|
271
288
|
});
|
|
272
289
|
return;
|
|
273
290
|
}
|
|
@@ -315,12 +332,14 @@ const canStartPopoutChat = async props => {
|
|
|
315
332
|
|
|
316
333
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
317
334
|
const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
318
|
-
var _state$
|
|
319
|
-
const requestIdFromCache = (_state$
|
|
335
|
+
var _state$domainStates6, _state$domainStates6$, _state$domainStates7;
|
|
336
|
+
const requestIdFromCache = (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.liveChatContext) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.requestId;
|
|
337
|
+
const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates7 = state.domainStates) === null || _state$domainStates7 === void 0 ? void 0 : _state$domainStates7.liveChatContext;
|
|
338
|
+
|
|
320
339
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
321
340
|
let conversationDetails = undefined;
|
|
322
341
|
|
|
323
|
-
//Preserve current requestId
|
|
342
|
+
// Preserve current requestId
|
|
324
343
|
const currentRequestId = chatSDK.requestId ?? "";
|
|
325
344
|
dispatch({
|
|
326
345
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_INITIAL_CHAT_SDK_REQUEST_ID,
|
|
@@ -328,9 +347,8 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
|
328
347
|
});
|
|
329
348
|
try {
|
|
330
349
|
chatSDK.requestId = requestIdFromCache;
|
|
331
|
-
conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK);
|
|
350
|
+
conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK, liveChatContext);
|
|
332
351
|
if (Object.keys(conversationDetails).length === 0) {
|
|
333
|
-
chatSDK.requestId = currentRequestId;
|
|
334
352
|
return false;
|
|
335
353
|
}
|
|
336
354
|
if (conversationDetails.state === _Constants.LiveWorkItemState.Closed || conversationDetails.state === _Constants.LiveWorkItemState.WrapUp) {
|
|
@@ -338,18 +356,16 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
|
338
356
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
339
357
|
payload: undefined
|
|
340
358
|
});
|
|
341
|
-
chatSDK.requestId = currentRequestId;
|
|
342
359
|
return false;
|
|
343
360
|
}
|
|
344
361
|
return true;
|
|
345
|
-
} catch (
|
|
362
|
+
} catch (error) {
|
|
346
363
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
347
364
|
Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsException,
|
|
348
365
|
ExceptionDetails: {
|
|
349
|
-
exception: `Conversation is not valid: ${
|
|
366
|
+
exception: `Conversation is not valid: ${error}`
|
|
350
367
|
}
|
|
351
368
|
});
|
|
352
|
-
chatSDK.requestId = currentRequestId;
|
|
353
369
|
return false;
|
|
354
370
|
}
|
|
355
371
|
};
|
|
@@ -29,6 +29,11 @@ const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSuccessfu
|
|
|
29
29
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
|
|
30
30
|
payload: _StartChatFailureType.StartChatFailureType.AuthSetupError
|
|
31
31
|
});
|
|
32
|
+
// set conversation to error to enforce error UI pane
|
|
33
|
+
dispatch({
|
|
34
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
35
|
+
payload: _ConversationState.ConversationState.Error
|
|
36
|
+
});
|
|
32
37
|
logWidgetLoadCompleteWithError(ex);
|
|
33
38
|
}
|
|
34
39
|
if (ex.message === _Constants.WidgetLoadCustomErrorString.NetworkErrorString) {
|