@microsoft/omnichannel-chat-widget 1.5.1-main.76c6a71 → 1.5.1-main.7897747
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/Constants.js +31 -8
- package/lib/cjs/common/telemetry/TelemetryConstants.js +3 -2
- package/lib/cjs/common/utils.js +2 -1
- package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +31 -16
- package/lib/cjs/components/livechatwidget/common/endChat.js +41 -7
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +16 -84
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +220 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +52 -16
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +82 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +17 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +17 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +15 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +17 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +17 -0
- package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
- package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
- package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -11
- package/lib/cjs/contexts/common/ConversationState.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +37 -36
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
- package/lib/cjs/contexts/common/StartChatFailureType.js +13 -0
- package/lib/cjs/contexts/createReducer.js +8 -0
- package/lib/cjs/controller/componentController.js +5 -1
- package/lib/esm/common/Constants.js +26 -6
- package/lib/esm/common/telemetry/TelemetryConstants.js +3 -2
- package/lib/esm/common/utils.js +3 -2
- package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +31 -16
- package/lib/esm/components/livechatwidget/common/endChat.js +40 -7
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +17 -85
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +213 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +55 -19
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +71 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +10 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +10 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +8 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +10 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +10 -0
- package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
- package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
- package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -11
- package/lib/esm/contexts/common/ConversationState.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +37 -36
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
- package/lib/esm/contexts/common/StartChatFailureType.js +6 -0
- package/lib/esm/contexts/createReducer.js +8 -0
- package/lib/esm/controller/componentController.js +3 -0
- package/lib/types/common/Constants.d.ts +29 -4
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +5 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
- package/lib/types/components/startchaterrorpanestateful/StartChatErrorPaneStateful.d.ts +3 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.d.ts +5 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.d.ts +6 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +14 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +8 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.d.ts +10 -0
- package/lib/types/contexts/common/ConversationState.d.ts +2 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +37 -36
- package/lib/types/contexts/common/StartChatFailureType.d.ts +5 -0
- package/lib/types/controller/componentController.d.ts +1 -0
- package/package.json +5 -5
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -71
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -56
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -190
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -82
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -342
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -69
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -54
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -188
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -80
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -338
- package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.d.ts +0 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.d.ts +0 -1
- package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +0 -4
- package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +0 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.d.ts +0 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +0 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.d.ts +0 -1
- /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
- /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
- /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
- /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.StorageType = exports.Regex = exports.ParticipantType = exports.NotificationPaneConstants = exports.MimeTypes = exports.LocaleConstants = exports.LiveWorkItemState = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.EnvironmentVersion = exports.ElementType = exports.E2VVOptions = exports.ConversationMode = exports.ConversationEndEntity = exports.Constants = exports.ConfirmationState = exports.
|
|
6
|
+
exports.WidgetLoadTelemetryMessage = exports.WidgetLoadCustomErrorString = exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.StorageType = exports.StartChatErrorPaneConstants = exports.Regex = exports.PrepareEndChatDescriptionConstants = exports.ParticipantType = exports.NotificationPaneConstants = exports.MimeTypes = exports.LocaleConstants = exports.LiveWorkItemState = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.EnvironmentVersion = exports.ElementType = exports.E2VVOptions = exports.ConversationMode = exports.ConversationEndEntity = exports.Constants = exports.ConfirmationState = exports.AriaTelemetryConstants = exports.AMSConstants = void 0;
|
|
7
7
|
var _class;
|
|
8
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
9
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
@@ -191,12 +191,6 @@ exports.ElementType = ElementType;
|
|
|
191
191
|
(function (ElementType) {
|
|
192
192
|
ElementType["CallingContainerSDK"] = "CallingContainerSDK";
|
|
193
193
|
})(ElementType || (exports.ElementType = ElementType = {}));
|
|
194
|
-
let ChatSDKError;
|
|
195
|
-
exports.ChatSDKError = ChatSDKError;
|
|
196
|
-
(function (ChatSDKError) {
|
|
197
|
-
ChatSDKError["WidgetUseOutsideOperatingHour"] = "WidgetUseOutsideOperatingHour";
|
|
198
|
-
ChatSDKError["AuthContactIdNotFoundFailure"] = "AuthContactIdNotFoundFailure";
|
|
199
|
-
})(ChatSDKError || (exports.ChatSDKError = ChatSDKError = {}));
|
|
200
194
|
let EnvironmentVersion;
|
|
201
195
|
exports.EnvironmentVersion = EnvironmentVersion;
|
|
202
196
|
(function (EnvironmentVersion) {
|
|
@@ -280,6 +274,15 @@ _defineProperty(NotificationPaneConstants, "IconText", "Notification Icon");
|
|
|
280
274
|
_defineProperty(NotificationPaneConstants, "ChatDisconnectTitleText", "Chat disconnected");
|
|
281
275
|
_defineProperty(NotificationPaneConstants, "ChatDisconnectSubtitleText", "For additional assistance, please close the chat and try again.");
|
|
282
276
|
_defineProperty(NotificationPaneConstants, "ChromeCloseIconName", "ChromeClose");
|
|
277
|
+
class StartChatErrorPaneConstants {}
|
|
278
|
+
exports.StartChatErrorPaneConstants = StartChatErrorPaneConstants;
|
|
279
|
+
_defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorPaneId", "oc-lcw-start-chat-error-pane");
|
|
280
|
+
_defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorTitleText", "We are unable to load chat at this time.");
|
|
281
|
+
_defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorSubtitleText", "Please try again later.");
|
|
282
|
+
_defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorUnauthorizedTitleText", "Chat authentication has failed.");
|
|
283
|
+
_defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorAuthSetupErrorTitleText", "Chat authentication has failed.");
|
|
284
|
+
_defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorUnauthorizedSubtitleText", "UNAUTHORIZED");
|
|
285
|
+
_defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorAuthSetupErrorSubtitleText", "AUTH SETUP ERROR");
|
|
283
286
|
class AriaTelemetryConstants {}
|
|
284
287
|
exports.AriaTelemetryConstants = AriaTelemetryConstants;
|
|
285
288
|
// Aria Endpoint for different environment types.
|
|
@@ -294,4 +297,24 @@ _defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
|
|
|
294
297
|
_defineProperty(AriaTelemetryConstants, "Public", "Public");
|
|
295
298
|
_defineProperty(AriaTelemetryConstants, "EU", "Europe");
|
|
296
299
|
// EUR: crm4; FRA: crm12; GER: crm16; CHE: crm17; NOR: crm19
|
|
297
|
-
_defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
|
|
300
|
+
_defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
|
|
301
|
+
class WidgetLoadTelemetryMessage {}
|
|
302
|
+
exports.WidgetLoadTelemetryMessage = WidgetLoadTelemetryMessage;
|
|
303
|
+
_defineProperty(WidgetLoadTelemetryMessage, "OOOHMessage", "Widget is OOOH");
|
|
304
|
+
_defineProperty(WidgetLoadTelemetryMessage, "PersistedStateRetrievedMessage", "Persisted state retrieved");
|
|
305
|
+
class WidgetLoadCustomErrorString {}
|
|
306
|
+
exports.WidgetLoadCustomErrorString = WidgetLoadCustomErrorString;
|
|
307
|
+
_defineProperty(WidgetLoadCustomErrorString, "AuthenticationFailedErrorString", "Authentication was not successful");
|
|
308
|
+
_defineProperty(WidgetLoadCustomErrorString, "NetworkErrorString", "Network Error");
|
|
309
|
+
class PrepareEndChatDescriptionConstants {}
|
|
310
|
+
exports.PrepareEndChatDescriptionConstants = PrepareEndChatDescriptionConstants;
|
|
311
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedByCustomerWithoutPostChat", "Conversation ended by customer. Post chat not configured or should not show.");
|
|
312
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedByCustomerWithInvalidPostChat", "Conversation ended by customer. Post chat context is invalid.");
|
|
313
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedBy", "Conversation ended by");
|
|
314
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "PrepareEndChatError", "There's an error while preparing to end chat. Closing chat widget.");
|
|
315
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "WidgetLoadFailedAfterSessionInit", "SessionInit was successful, but widget load failed. Ending chat to avoid ghost chats in OC.");
|
|
316
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "InitiateEndChatReceived", "Received InitiateEndChat BroadcastEvent while conversation state is not Active. Ending chat.");
|
|
317
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "EndChatReceivedFromOtherTabs", "Received EndChat BroadcastEvent from other tabs. Closing this chat.");
|
|
318
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseChatOnFailureOrPostChat", "Customer is trying to close chat widget on start chat failure or post chat pane.");
|
|
319
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseInactiveChat", "Chat was Inactive and customer is trying to close chat widget or refreshing the page.");
|
|
320
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "BrowserUnload", "Browser unload event received. Ending chat.");
|
|
@@ -123,6 +123,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
123
123
|
TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
|
|
124
124
|
TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
|
|
125
125
|
TelemetryEvent["EndChatSDKCall"] = "EndChatSDKCall";
|
|
126
|
+
TelemetryEvent["PrepareEndChat"] = "PrepareEndChat";
|
|
126
127
|
TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
|
|
127
128
|
TelemetryEvent["WindowClosed"] = "WindowClosed";
|
|
128
129
|
TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
|
|
@@ -133,10 +134,10 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
133
134
|
TelemetryEvent["ErrorUIPaneLoaded"] = "ErrorUIPaneLoaded";
|
|
134
135
|
TelemetryEvent["DownloadTranscriptFailed"] = "DownloadTranscriptFailed";
|
|
135
136
|
TelemetryEvent["StartChatFailed"] = "StartChatFailed";
|
|
136
|
-
TelemetryEvent["IC3ThreadUpdateEventReceived"] = "IC3ThreadUpdateEventReceived";
|
|
137
137
|
TelemetryEvent["ConfirmationCancelButtonClicked"] = "ConfirmationCancelButtonClicked";
|
|
138
138
|
TelemetryEvent["ConfirmationConfirmButtonClicked"] = "ConfirmationConfirmButtonClicked";
|
|
139
139
|
TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
|
|
140
|
+
TelemetryEvent["StartChatErrorPaneLoaded"] = "StartChatErrorPaneLoaded";
|
|
140
141
|
TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
|
|
141
142
|
TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
|
|
142
143
|
TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
|
|
@@ -250,7 +251,6 @@ class TelemetryConstants {
|
|
|
250
251
|
case TelemetryEvent.EmailTranscriptSent:
|
|
251
252
|
case TelemetryEvent.EmailTranscriptFailed:
|
|
252
253
|
case TelemetryEvent.DownloadTranscriptFailed:
|
|
253
|
-
case TelemetryEvent.IC3ThreadUpdateEventReceived:
|
|
254
254
|
case TelemetryEvent.ConfirmationCancelButtonClicked:
|
|
255
255
|
case TelemetryEvent.ConfirmationConfirmButtonClicked:
|
|
256
256
|
case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
|
|
@@ -291,6 +291,7 @@ class TelemetryConstants {
|
|
|
291
291
|
case TelemetryEvent.PostChatContextCallFailed:
|
|
292
292
|
case TelemetryEvent.PostChatContextCallSucceed:
|
|
293
293
|
case TelemetryEvent.GetConversationDetailsException:
|
|
294
|
+
case TelemetryEvent.PrepareEndChat:
|
|
294
295
|
return ScenarioType.SDK;
|
|
295
296
|
case TelemetryEvent.VideoCallAcceptButtonClick:
|
|
296
297
|
case TelemetryEvent.CallAdded:
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -11,6 +11,7 @@ var _DataStoreManager = require("./contextDataStore/DataStoreManager");
|
|
|
11
11
|
var _KeyCodes = require("./KeyCodes");
|
|
12
12
|
var _md5Typescript = require("md5-typescript");
|
|
13
13
|
var _TelemetryHelper = require("./telemetry/TelemetryHelper");
|
|
14
|
+
var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
|
|
14
15
|
var _this = void 0;
|
|
15
16
|
const getElementBySelector = selector => {
|
|
16
17
|
let element;
|
|
@@ -406,7 +407,7 @@ const getConversationDetailsCall = async chatSDK => {
|
|
|
406
407
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
407
408
|
exports.getConversationDetailsCall = getConversationDetailsCall;
|
|
408
409
|
const checkContactIdError = e => {
|
|
409
|
-
if ((e === null || e === void 0 ? void 0 : e.message) ===
|
|
410
|
+
if ((e === null || e === void 0 ? void 0 : e.message) === _omnichannelChatSdk.ChatSDKErrorName.AuthContactIdNotFoundFailure) {
|
|
410
411
|
const contactIdNotFoundErrorEvent = {
|
|
411
412
|
eventName: _TelemetryConstants.BroadcastEvent.ContactIdNotFound,
|
|
412
413
|
payload: {
|
|
@@ -11,23 +11,38 @@ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants"
|
|
|
11
11
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
13
|
const handleChatDisconnect = (props, state, setWebChatStyles) => {
|
|
14
|
-
var _state$appStates;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
var _state$appStates, _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
|
|
15
|
+
const chatDisconnectState = state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.chatDisconnectEventReceived;
|
|
16
|
+
const chatDisconnectMessage = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_CHAT_DISCONNECT) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT;
|
|
17
|
+
const hideSendBoxOnConversationEnd = props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd;
|
|
18
|
+
switch (chatDisconnectState) {
|
|
19
|
+
case true:
|
|
20
|
+
if (hideSendBoxOnConversationEnd !== false) {
|
|
21
|
+
setWebChatStyles(styles => {
|
|
22
|
+
return {
|
|
23
|
+
...styles,
|
|
24
|
+
hideSendBox: true
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
_NotificationHandler.NotificationHandler.notifyWarning(_NotificationScenarios.NotificationScenarios.ChatDisconnect, chatDisconnectMessage);
|
|
29
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
30
|
+
Event: _TelemetryConstants.TelemetryEvent.ChatDisconnectThreadEventReceived,
|
|
31
|
+
Description: "Chat disconnected due to timeout, left or removed."
|
|
24
32
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
break;
|
|
34
|
+
case false:
|
|
35
|
+
if (hideSendBoxOnConversationEnd !== false) {
|
|
36
|
+
setWebChatStyles(styles => {
|
|
37
|
+
return {
|
|
38
|
+
...styles,
|
|
39
|
+
hideSendBox: false
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
break;
|
|
31
46
|
}
|
|
32
47
|
};
|
|
33
48
|
exports.handleChatDisconnect = handleChatDisconnect;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.prepareEndChat = exports.endVoiceVideoCallIfOngoing = exports.endChatStateCleanUp = exports.endChat = exports.closeChatStateCleanUp = exports.callingStateCleanUp = void 0;
|
|
6
|
+
exports.prepareEndChat = exports.endVoiceVideoCallIfOngoing = exports.endChatStateCleanUp = exports.endChat = exports.closeChatStateCleanUp = exports.chatSDKStateCleanUp = exports.callingStateCleanUp = void 0;
|
|
7
7
|
var _Constants = require("../../../common/Constants");
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
var _authHelper = require("./authHelper");
|
|
@@ -16,10 +16,11 @@ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
|
16
16
|
var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
|
|
17
17
|
var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
|
|
18
18
|
var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
19
|
+
var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
|
|
19
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
21
|
const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter) => {
|
|
21
22
|
try {
|
|
22
|
-
var _conversationDetails$, _state$domainStates;
|
|
23
|
+
var _conversationDetails$, _state$domainStates, _state$appStates3;
|
|
23
24
|
// Use Case: If call is ongoing, end the call by simulating end call button click
|
|
24
25
|
endVoiceVideoCallIfOngoing(chatSDK, dispatch);
|
|
25
26
|
const conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK);
|
|
@@ -29,8 +30,13 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
29
30
|
var _state$appStates;
|
|
30
31
|
// If ended by customer, just close chat
|
|
31
32
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.conversationEndedBy) === _Constants.ConversationEndEntity.Customer) {
|
|
33
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
34
|
+
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
35
|
+
Description: _Constants.PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithoutPostChat
|
|
36
|
+
});
|
|
32
37
|
await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
33
38
|
}
|
|
39
|
+
|
|
34
40
|
// Use Case: If ended by Agent, stay chat in InActive state
|
|
35
41
|
return;
|
|
36
42
|
}
|
|
@@ -50,6 +56,10 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
50
56
|
var _state$appStates2;
|
|
51
57
|
// For Customer intiated conversations, just close chat widget
|
|
52
58
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === _Constants.ConversationEndEntity.Customer) {
|
|
59
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
60
|
+
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
61
|
+
Description: _Constants.PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithInvalidPostChat
|
|
62
|
+
});
|
|
53
63
|
await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
54
64
|
return;
|
|
55
65
|
}
|
|
@@ -61,6 +71,15 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
61
71
|
});
|
|
62
72
|
return;
|
|
63
73
|
}
|
|
74
|
+
|
|
75
|
+
// Log PrepareEndChat if conversation ended by customer (bot and agent cases are handled in LiveChatWidgetStateful.tsx)
|
|
76
|
+
if (state !== null && state !== void 0 && (_state$appStates3 = state.appStates) !== null && _state$appStates3 !== void 0 && _state$appStates3.conversationEndedBy) {
|
|
77
|
+
var _state$appStates4;
|
|
78
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
79
|
+
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
80
|
+
Description: `${_Constants.PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithInvalidPostChat} ${state === null || state === void 0 ? void 0 : (_state$appStates4 = state.appStates) === null || _state$appStates4 === void 0 ? void 0 : _state$appStates4.conversationEndedBy}.`
|
|
81
|
+
});
|
|
82
|
+
}
|
|
64
83
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, true, true);
|
|
65
84
|
|
|
66
85
|
// Initiate post chat render
|
|
@@ -79,6 +98,10 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
79
98
|
|
|
80
99
|
//Close chat widget for any failure in embedded to allow to show start chat button
|
|
81
100
|
if (((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.hideStartChatButton) === false) {
|
|
101
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
102
|
+
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
103
|
+
Description: _Constants.PrepareEndChatDescriptionConstants.PrepareEndChatError
|
|
104
|
+
});
|
|
82
105
|
await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
83
106
|
}
|
|
84
107
|
} finally {
|
|
@@ -152,7 +175,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
|
|
|
152
175
|
}
|
|
153
176
|
};
|
|
154
177
|
exports.endChat = endChat;
|
|
155
|
-
const callingStateCleanUp =
|
|
178
|
+
const callingStateCleanUp = dispatch => {
|
|
156
179
|
dispatch({
|
|
157
180
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SHOW_CALLING_CONTAINER,
|
|
158
181
|
payload: false
|
|
@@ -175,7 +198,7 @@ const callingStateCleanUp = async dispatch => {
|
|
|
175
198
|
});
|
|
176
199
|
};
|
|
177
200
|
exports.callingStateCleanUp = callingStateCleanUp;
|
|
178
|
-
const endChatStateCleanUp =
|
|
201
|
+
const endChatStateCleanUp = dispatch => {
|
|
179
202
|
// Need to clear these states immediately when chat ended from OC.
|
|
180
203
|
dispatch({
|
|
181
204
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
@@ -191,7 +214,7 @@ const endChatStateCleanUp = async dispatch => {
|
|
|
191
214
|
});
|
|
192
215
|
};
|
|
193
216
|
exports.endChatStateCleanUp = endChatStateCleanUp;
|
|
194
|
-
const closeChatStateCleanUp =
|
|
217
|
+
const closeChatStateCleanUp = dispatch => {
|
|
195
218
|
dispatch({
|
|
196
219
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
197
220
|
payload: undefined
|
|
@@ -229,6 +252,17 @@ const closeChatStateCleanUp = async dispatch => {
|
|
|
229
252
|
|
|
230
253
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
231
254
|
exports.closeChatStateCleanUp = closeChatStateCleanUp;
|
|
255
|
+
const chatSDKStateCleanUp = chatSDK => {
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
257
|
+
chatSDK.requestId = (0, _omnichannelChatSdk.uuidv4)();
|
|
258
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
259
|
+
chatSDK.chatToken = {};
|
|
260
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
261
|
+
chatSDK.reconnectId = null;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
265
|
+
exports.chatSDKStateCleanUp = chatSDKStateCleanUp;
|
|
232
266
|
const endVoiceVideoCallIfOngoing = async (chatSDK, dispatch) => {
|
|
233
267
|
let callId = "";
|
|
234
268
|
try {
|
|
@@ -253,8 +287,8 @@ const endVoiceVideoCallIfOngoing = async (chatSDK, dispatch) => {
|
|
|
253
287
|
};
|
|
254
288
|
exports.endVoiceVideoCallIfOngoing = endVoiceVideoCallIfOngoing;
|
|
255
289
|
const closeChatWidget = (dispatch, props, state) => {
|
|
256
|
-
var _state$
|
|
257
|
-
if (state !== null && state !== void 0 && (_state$
|
|
290
|
+
var _state$appStates5;
|
|
291
|
+
if (state !== null && state !== void 0 && (_state$appStates5 = state.appStates) !== null && _state$appStates5 !== void 0 && _state$appStates5.hideStartChatButton) {
|
|
258
292
|
var _props$controlProps2, _props$controlProps3;
|
|
259
293
|
// Only close chat if header is enabled for popout
|
|
260
294
|
// TODO : This condition needs to be removed eventually when the filler UX is ready for popout, removing this condition would show a blank screen for OOB Widget
|
|
@@ -59,11 +59,19 @@ const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
|
|
|
59
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
60
|
const conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK);
|
|
61
61
|
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.participantType) === _Constants.ParticipantType.Bot) {
|
|
62
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
63
|
+
Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
|
|
64
|
+
Description: "Conversation end by bot or timeout event received."
|
|
65
|
+
});
|
|
62
66
|
dispatch({
|
|
63
67
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
|
|
64
68
|
payload: _Constants.ConversationEndEntity.Bot
|
|
65
69
|
});
|
|
66
70
|
} else {
|
|
71
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
72
|
+
Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
|
|
73
|
+
Description: "Conversation end by agent or timeout event received."
|
|
74
|
+
});
|
|
67
75
|
dispatch({
|
|
68
76
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
|
|
69
77
|
payload: _Constants.ConversationEndEntity.Agent
|
|
@@ -75,10 +83,6 @@ const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
|
|
|
75
83
|
payload: conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.participantType
|
|
76
84
|
});
|
|
77
85
|
}
|
|
78
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
79
|
-
Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
|
|
80
|
-
Description: "Conversation end by agent side or by timeout event received."
|
|
81
|
-
});
|
|
82
86
|
};
|
|
83
87
|
webChatStore = (0, _botframeworkWebchat.createStore)({},
|
|
84
88
|
//initial state
|
|
@@ -12,8 +12,6 @@ var _ActivityStreamHandler = require("./ActivityStreamHandler");
|
|
|
12
12
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
13
13
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
14
14
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
|
-
var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
|
|
16
|
-
var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
|
|
17
15
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
18
16
|
var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
19
17
|
var _createAdapter = require("./createAdapter");
|
|
@@ -21,7 +19,8 @@ var _newMessageEventHandler = require("../../../plugins/newMessageEventHandler")
|
|
|
21
19
|
var _reconnectChatHelper = require("./reconnectChatHelper");
|
|
22
20
|
var _setPostChatContextAndLoadSurvey = require("./setPostChatContextAndLoadSurvey");
|
|
23
21
|
var _updateSessionDataForTelemetry = require("./updateSessionDataForTelemetry");
|
|
24
|
-
var
|
|
22
|
+
var _startChatErrorHandler = require("./startChatErrorHandler");
|
|
23
|
+
var _endChat = require("./endChat");
|
|
25
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
25
|
let optionalParams = {};
|
|
27
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -115,19 +114,21 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
115
114
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
115
|
exports.setPreChatAndInitiateChat = setPreChatAndInitiateChat;
|
|
117
116
|
const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params, persistedState) => {
|
|
118
|
-
var _props$controlProps2;
|
|
119
117
|
let isStartChatSuccessful = false;
|
|
120
118
|
const chatConfig = props === null || props === void 0 ? void 0 : props.chatConfig;
|
|
121
119
|
const getAuthToken = props === null || props === void 0 ? void 0 : props.getAuthToken;
|
|
122
|
-
const hideErrorUIPane = props === null || props === void 0 ? void 0 : (_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.hideErrorUIPane;
|
|
123
120
|
if ((state === null || state === void 0 ? void 0 : state.appStates.conversationState) === _ConversationState.ConversationState.Closed) {
|
|
124
121
|
// Preventive reset to avoid starting chat with previous requestId which could potentially cause problems
|
|
125
|
-
|
|
126
|
-
chatSDK.chatToken = {};
|
|
127
|
-
chatSDK.reconnectId = null;
|
|
122
|
+
(0, _endChat.chatSDKStateCleanUp)(chatSDK);
|
|
128
123
|
}
|
|
129
124
|
try {
|
|
130
|
-
var _newAdapter$activity
|
|
125
|
+
var _state$appStates, _newAdapter$activity$;
|
|
126
|
+
// Clear disconnect state on start chat
|
|
127
|
+
(state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.chatDisconnectEventReceived) && dispatch({
|
|
128
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
129
|
+
payload: false
|
|
130
|
+
});
|
|
131
|
+
|
|
131
132
|
//Start widget load timer
|
|
132
133
|
_TelemetryManager.TelemetryTimers.WidgetLoadTimer = (0, _utils.createTimer)();
|
|
133
134
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -139,8 +140,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
139
140
|
// set auth token to chat sdk before start chat
|
|
140
141
|
const authSuccess = await (0, _authHelper.handleAuthentication)(chatSDK, chatConfig, getAuthToken);
|
|
141
142
|
if (!authSuccess) {
|
|
142
|
-
|
|
143
|
-
throw new Error("Authentication was not successful");
|
|
143
|
+
throw new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -203,16 +203,11 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
if (persistedState) {
|
|
206
|
-
var _TelemetryTimers$Widg;
|
|
207
206
|
dispatch({
|
|
208
207
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_STATE,
|
|
209
208
|
payload: persistedState
|
|
210
209
|
});
|
|
211
|
-
|
|
212
|
-
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadComplete,
|
|
213
|
-
Description: "Widget load complete. Persisted state retrieved",
|
|
214
|
-
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg === void 0 ? void 0 : _TelemetryTimers$Widg.milliSecondsElapsed
|
|
215
|
-
});
|
|
210
|
+
(0, _startChatErrorHandler.logWidgetLoadComplete)(_Constants.WidgetLoadTelemetryMessage.PersistedStateRetrievedMessage);
|
|
216
211
|
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch, true);
|
|
217
212
|
return;
|
|
218
213
|
}
|
|
@@ -223,11 +218,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
223
218
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
224
219
|
payload: liveChatContext
|
|
225
220
|
});
|
|
226
|
-
|
|
227
|
-
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadComplete,
|
|
228
|
-
Description: "Widget load complete",
|
|
229
|
-
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg2 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg2 === void 0 ? void 0 : _TelemetryTimers$Widg2.milliSecondsElapsed
|
|
230
|
-
});
|
|
221
|
+
(0, _startChatErrorHandler.logWidgetLoadComplete)();
|
|
231
222
|
|
|
232
223
|
// Set post chat context in state
|
|
233
224
|
// Commenting this for now as post chat context is fetched during end chat
|
|
@@ -236,55 +227,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
236
227
|
// Updating chat session detail for telemetry
|
|
237
228
|
await (0, _updateSessionDataForTelemetry.updateSessionDataForTelemetry)(chatSDK, dispatch);
|
|
238
229
|
} catch (ex) {
|
|
239
|
-
|
|
240
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
241
|
-
if (ex.message === _Constants.ChatSDKError.WidgetUseOutsideOperatingHour) {
|
|
242
|
-
var _TelemetryTimers$Widg3;
|
|
243
|
-
dispatch({
|
|
244
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS,
|
|
245
|
-
payload: true
|
|
246
|
-
});
|
|
247
|
-
dispatch({
|
|
248
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
249
|
-
payload: _ConversationState.ConversationState.OutOfOffice
|
|
250
|
-
});
|
|
251
|
-
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
252
|
-
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadComplete,
|
|
253
|
-
Description: "Widget load complete. Widget is OOOH.",
|
|
254
|
-
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
|
|
255
|
-
});
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
259
|
-
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
260
|
-
ExceptionDetails: {
|
|
261
|
-
Exception: `Widget load Failed: ${ex}`
|
|
262
|
-
},
|
|
263
|
-
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed
|
|
264
|
-
});
|
|
265
|
-
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.Connection, "Start Chat Failed: " + ex);
|
|
266
|
-
dispatch({
|
|
267
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILING,
|
|
268
|
-
payload: true
|
|
269
|
-
});
|
|
270
|
-
if (!hideErrorUIPane) {
|
|
271
|
-
// Set app state to failing start chat if hideErrorUI is not turned on
|
|
272
|
-
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
273
|
-
Event: _TelemetryConstants.TelemetryEvent.ErrorUIPaneLoaded,
|
|
274
|
-
Description: "Error UI Pane Loaded"
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
// Show the loading pane in other cases for failure, this will help for both hideStartChatButton case
|
|
278
|
-
dispatch({
|
|
279
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
280
|
-
payload: _ConversationState.ConversationState.Loading
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
// If sessionInit was successful but LCW startchat failed due to some reason e.g adapter didn't load
|
|
284
|
-
// we need to directly endChat to avoid leaving ghost chats in OC, not disturbing any other UI state
|
|
285
|
-
if (isStartChatSuccessful === true) {
|
|
286
|
-
await forceEndChat(chatSDK);
|
|
287
|
-
}
|
|
230
|
+
(0, _startChatErrorHandler.handleStartChatError)(dispatch, chatSDK, props, ex, isStartChatSuccessful);
|
|
288
231
|
} finally {
|
|
289
232
|
optionalParams = {};
|
|
290
233
|
widgetInstanceId = "";
|
|
@@ -293,21 +236,10 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
293
236
|
|
|
294
237
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
295
238
|
exports.initStartChat = initStartChat;
|
|
296
|
-
const forceEndChat = async chatSDK => {
|
|
297
|
-
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
298
|
-
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
299
|
-
ExceptionDetails: {
|
|
300
|
-
Exception: "SessionInit was successful, but widget load failed."
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat();
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
307
239
|
const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
308
|
-
var _state$
|
|
240
|
+
var _state$appStates2, _persistedState$domai6, _persistedState$appSt;
|
|
309
241
|
// By pass this function in case of popout chat
|
|
310
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
242
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.hideStartChatButton) === true) {
|
|
311
243
|
return false;
|
|
312
244
|
}
|
|
313
245
|
const persistedState = (0, _utils.getStateFromCache)((0, _utils.getWidgetCacheIdfromProps)(props));
|