@microsoft/omnichannel-chat-widget 1.5.1-main.ee4453c → 1.6.1

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.
Files changed (51) hide show
  1. package/lib/cjs/common/Constants.js +18 -2
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +2 -0
  3. package/lib/cjs/components/livechatwidget/common/endChat.js +25 -3
  4. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -4
  5. package/lib/cjs/components/livechatwidget/common/startChat.js +0 -5
  6. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +23 -8
  7. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +39 -0
  8. package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +20 -6
  9. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +3 -0
  10. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +37 -36
  11. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +3 -1
  12. package/lib/cjs/contexts/common/StartChatFailureType.js +13 -0
  13. package/lib/cjs/contexts/createReducer.js +8 -0
  14. package/lib/esm/common/Constants.js +16 -1
  15. package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
  16. package/lib/esm/components/livechatwidget/common/endChat.js +26 -4
  17. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -4
  18. package/lib/esm/components/livechatwidget/common/startChat.js +0 -5
  19. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +24 -9
  20. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +40 -1
  21. package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +20 -6
  22. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +3 -0
  23. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +37 -36
  24. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +3 -1
  25. package/lib/esm/contexts/common/StartChatFailureType.js +6 -0
  26. package/lib/esm/contexts/createReducer.js +8 -0
  27. package/lib/types/common/Constants.d.ts +16 -0
  28. package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -0
  29. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +4 -0
  30. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
  31. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +37 -36
  32. package/lib/types/contexts/common/StartChatFailureType.d.ts +5 -0
  33. package/package.json +3 -3
  34. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -71
  35. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -56
  36. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.spec.js +0 -282
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -190
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -82
  39. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -342
  40. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -69
  41. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -54
  42. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.spec.js +0 -280
  43. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -188
  44. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -80
  45. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -338
  46. package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.d.ts +0 -1
  47. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.d.ts +0 -1
  48. package/lib/types/components/livechatwidget/common/startChatErrorHandler.spec.d.ts +0 -1
  49. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.d.ts +0 -1
  50. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +0 -1
  51. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.d.ts +0 -1
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WidgetLoadTelemetryMessage = exports.WidgetLoadCustomErrorString = exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.StorageType = exports.StartChatErrorPaneConstants = 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.AriaTelemetryConstants = exports.AMSConstants = void 0;
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); }
@@ -279,6 +279,10 @@ exports.StartChatErrorPaneConstants = StartChatErrorPaneConstants;
279
279
  _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorPaneId", "oc-lcw-start-chat-error-pane");
280
280
  _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorTitleText", "We are unable to load chat at this time.");
281
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");
282
286
  class AriaTelemetryConstants {}
283
287
  exports.AriaTelemetryConstants = AriaTelemetryConstants;
284
288
  // Aria Endpoint for different environment types.
@@ -301,4 +305,16 @@ _defineProperty(WidgetLoadTelemetryMessage, "PersistedStateRetrievedMessage", "P
301
305
  class WidgetLoadCustomErrorString {}
302
306
  exports.WidgetLoadCustomErrorString = WidgetLoadCustomErrorString;
303
307
  _defineProperty(WidgetLoadCustomErrorString, "AuthenticationFailedErrorString", "Authentication was not successful");
304
- _defineProperty(WidgetLoadCustomErrorString, "NetworkErrorString", "Network Error");
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";
@@ -290,6 +291,7 @@ class TelemetryConstants {
290
291
  case TelemetryEvent.PostChatContextCallFailed:
291
292
  case TelemetryEvent.PostChatContextCallSucceed:
292
293
  case TelemetryEvent.GetConversationDetailsException:
294
+ case TelemetryEvent.PrepareEndChat:
293
295
  return ScenarioType.SDK;
294
296
  case TelemetryEvent.VideoCallAcceptButtonClick:
295
297
  case TelemetryEvent.CallAdded:
@@ -20,7 +20,7 @@ var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
20
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
21
  const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter) => {
22
22
  try {
23
- var _conversationDetails$, _state$domainStates;
23
+ var _conversationDetails$, _state$domainStates, _state$appStates3;
24
24
  // Use Case: If call is ongoing, end the call by simulating end call button click
25
25
  endVoiceVideoCallIfOngoing(chatSDK, dispatch);
26
26
  const conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK);
@@ -30,8 +30,13 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
30
30
  var _state$appStates;
31
31
  // If ended by customer, just close chat
32
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
+ });
33
37
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
34
38
  }
39
+
35
40
  // Use Case: If ended by Agent, stay chat in InActive state
36
41
  return;
37
42
  }
@@ -51,6 +56,10 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
51
56
  var _state$appStates2;
52
57
  // For Customer intiated conversations, just close chat widget
53
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
+ });
54
63
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
55
64
  return;
56
65
  }
@@ -62,6 +71,15 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
62
71
  });
63
72
  return;
64
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
+ }
65
83
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, true, true);
66
84
 
67
85
  // Initiate post chat render
@@ -80,6 +98,10 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
80
98
 
81
99
  //Close chat widget for any failure in embedded to allow to show start chat button
82
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
+ });
83
105
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
84
106
  }
85
107
  } finally {
@@ -265,8 +287,8 @@ const endVoiceVideoCallIfOngoing = async (chatSDK, dispatch) => {
265
287
  };
266
288
  exports.endVoiceVideoCallIfOngoing = endVoiceVideoCallIfOngoing;
267
289
  const closeChatWidget = (dispatch, props, state) => {
268
- var _state$appStates3;
269
- if (state !== null && state !== void 0 && (_state$appStates3 = state.appStates) !== null && _state$appStates3 !== void 0 && _state$appStates3.hideStartChatButton) {
290
+ var _state$appStates5;
291
+ if (state !== null && state !== void 0 && (_state$appStates5 = state.appStates) !== null && _state$appStates5 !== void 0 && _state$appStates5.hideStartChatButton) {
270
292
  var _props$controlProps2, _props$controlProps3;
271
293
  // Only close chat if header is enabled for popout
272
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
@@ -41,11 +41,6 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
41
41
  }
42
42
  }
43
43
 
44
- // If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
45
- if (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat) {
46
- return;
47
- }
48
-
49
44
  // Check if there is any active popout chats in cache
50
45
  if (await canStartPopoutChat(props)) {
51
46
  return;
@@ -14,6 +14,7 @@ var _endChat = require("./endChat");
14
14
  var _DataStoreManager = require("../../../common/contextDataStore/DataStoreManager");
15
15
  var _utils = require("../../../common/utils");
16
16
  var _Constants = require("../../../common/Constants");
17
+ var _StartChatFailureType = require("../../../contexts/common/StartChatFailureType");
17
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
19
  const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSuccessful) => {
19
20
  var _props$controlProps;
@@ -23,7 +24,14 @@ const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSuccessfu
23
24
  }
24
25
 
25
26
  // Handle internal or misc errors
26
- if (ex.message === _Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString || ex.message === _Constants.WidgetLoadCustomErrorString.NetworkErrorString) {
27
+ if (ex.message === _Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
28
+ dispatch({
29
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
30
+ payload: _StartChatFailureType.StartChatFailureType.AuthSetupError
31
+ });
32
+ logWidgetLoadCompleteWithError(ex);
33
+ }
34
+ if (ex.message === _Constants.WidgetLoadCustomErrorString.NetworkErrorString) {
27
35
  logWidgetLoadCompleteWithError(ex);
28
36
  }
29
37
 
@@ -40,7 +48,7 @@ const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSuccessfu
40
48
  handleConversationInitializationFailure(ex);
41
49
  break;
42
50
  case _omnichannelChatSdk.ChatSDKErrorName.ChatTokenRetrievalFailure:
43
- handleChatTokenRetrievalFailure(ex);
51
+ handleChatTokenRetrievalFailure(dispatch, ex);
44
52
  break;
45
53
  case _omnichannelChatSdk.ChatSDKErrorName.UninitializedChatSDK:
46
54
  handleUninitializedChatSDK(ex);
@@ -133,11 +141,12 @@ const logWidgetLoadCompleteWithError = ex => {
133
141
 
134
142
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
135
143
  const forceEndChat = chatSDK => {
136
- _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.ERROR, {
137
- Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
138
- ExceptionDetails: {
139
- Exception: "SessionInit was successful, but widget load failed."
140
- }
144
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
145
+ Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
146
+ Description: _Constants.PrepareEndChatDescriptionConstants.WidgetLoadFailedAfterSessionInit
147
+ });
148
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
149
+ Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
141
150
  });
142
151
  chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat();
143
152
  };
@@ -172,10 +181,16 @@ const handleConversationInitializationFailure = ex => {
172
181
  };
173
182
 
174
183
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
175
- const handleChatTokenRetrievalFailure = ex => {
184
+ const handleChatTokenRetrievalFailure = (dispatch, ex) => {
176
185
  if (ex.httpResponseStatusCode === 400) {
177
186
  logWidgetLoadFailed(ex);
178
187
  } else {
188
+ if (ex.httpResponseStatusCode === 401) {
189
+ dispatch({
190
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
191
+ payload: _StartChatFailureType.StartChatFailureType.Unauthorized
192
+ });
193
+ }
179
194
  logWidgetLoadCompleteWithError(ex);
180
195
  }
181
196
  };
@@ -56,6 +56,7 @@ var _useChatContextStore = _interopRequireDefault(require("../../../hooks/useCha
56
56
  var _useChatSDKStore = _interopRequireDefault(require("../../../hooks/useChatSDKStore"));
57
57
  var _defaultAdaptiveCardStyles = require("../../webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles");
58
58
  var _StartChatErrorPaneStateful = _interopRequireDefault(require("../../startchaterrorpanestateful/StartChatErrorPaneStateful"));
59
+ var _StartChatFailureType = require("../../../contexts/common/StartChatFailureType");
59
60
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
60
61
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
61
62
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -198,6 +199,10 @@ const LiveChatWidgetStateful = props => {
198
199
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILING,
199
200
  payload: false
200
201
  });
202
+ dispatch({
203
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
204
+ payload: _StartChatFailureType.StartChatFailureType.Generic
205
+ });
201
206
  state.domainStates.confirmationPaneConfirmedOptionClicked = false;
202
207
  state.domainStates.confirmationState = _Constants.ConfirmationState.NotSet;
203
208
  setupClientDataStore();
@@ -408,9 +413,23 @@ const LiveChatWidgetStateful = props => {
408
413
 
409
414
  // End chat
410
415
  _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.InitiateEndChat).subscribe(async () => {
416
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
417
+ Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
418
+ Description: "Received InitiateEndChat BroadcastEvent."
419
+ });
420
+
411
421
  // This is to ensure to get latest state from cache in multitab
412
422
  const persistedState = (0, _utils.getStateFromCache)((0, _utils.getWidgetCacheIdfromProps)(props));
413
423
  if (persistedState && persistedState.appStates.conversationState === _ConversationState.ConversationState.Active) {
424
+ // We need to simulate states for closing chat, in order to messup with close confirmation pane.
425
+ dispatch({
426
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
427
+ payload: _Constants.ConfirmationState.Ok
428
+ });
429
+ dispatch({
430
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
431
+ payload: false
432
+ });
414
433
  dispatch({
415
434
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
416
435
  payload: _Constants.ConversationEndEntity.Customer
@@ -418,6 +437,10 @@ const LiveChatWidgetStateful = props => {
418
437
  } else {
419
438
  const skipEndChatSDK = true;
420
439
  const skipCloseChat = false;
440
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
441
+ Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
442
+ Description: _Constants.PrepareEndChatDescriptionConstants.InitiateEndChatReceived
443
+ });
421
444
  (0, _endChat.endChat)(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
422
445
  }
423
446
  _omnichannelChatComponents.BroadcastService.postMessage({
@@ -435,6 +458,10 @@ const LiveChatWidgetStateful = props => {
435
458
  _omnichannelChatComponents.BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
436
459
  var _msg$payload9;
437
460
  if ((msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.runtimeId) !== _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
461
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
462
+ Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
463
+ Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
464
+ });
438
465
  (0, _endChat.endChat)(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
439
466
  (0, _endChat.endChatStateCleanUp)(dispatch);
440
467
  (0, _endChat.chatSDKStateCleanUp)(chatSDK);
@@ -565,12 +592,20 @@ const LiveChatWidgetStateful = props => {
565
592
 
566
593
  // If start chat failed, and C2 is trying to close chat widget
567
594
  if (state !== null && state !== void 0 && (_state$appStates9 = state.appStates) !== null && _state$appStates9 !== void 0 && _state$appStates9.startChatFailed || (state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationState) === _ConversationState.ConversationState.Postchat) {
595
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
596
+ Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
597
+ Description: _Constants.PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
598
+ });
568
599
  (0, _endChat.endChat)(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true);
569
600
  return;
570
601
  }
571
602
 
572
603
  // Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
573
604
  if ((state === null || state === void 0 ? void 0 : (_state$appStates11 = state.appStates) === null || _state$appStates11 === void 0 ? void 0 : _state$appStates11.conversationState) === _ConversationState.ConversationState.InActive) {
605
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
606
+ Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
607
+ Description: _Constants.PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
608
+ });
574
609
  (0, _endChat.endChat)(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
575
610
  return;
576
611
  }
@@ -623,6 +658,10 @@ const LiveChatWidgetStateful = props => {
623
658
  Event: _TelemetryConstants.TelemetryEvent.BrowserUnloadEventStarted,
624
659
  Description: "Browser unload event received."
625
660
  });
661
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
662
+ Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
663
+ Description: _Constants.PrepareEndChatDescriptionConstants.BrowserUnload
664
+ });
626
665
  (0, _endChat.endChat)(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, false);
627
666
  // Clean local storage
628
667
  (_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventId);
@@ -16,11 +16,12 @@ var _defaultStartChatErrorPaneSubtitleStyleProps = require("./common/defaultStar
16
16
  var _defaultStartChatErrorPaneIconStyleProps = require("./common/defaultStartChatErrorPaneIconStyleProps");
17
17
  var _defaultStartChatErrorPaneIconImageProps = require("./common/defaultStartChatErrorPaneIconImageProps");
18
18
  var _Constants = require("../../common/Constants");
19
+ var _StartChatFailureType = require("../../contexts/common/StartChatFailureType");
19
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
21
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
23
  const StartChatErrorPaneStateful = startChatErrorPaneProps => {
23
- var _startChatErrorPanePr, _startChatErrorPanePr2, _startChatErrorPanePr3, _startChatErrorPanePr4, _startChatErrorPanePr5, _startChatErrorPanePr6, _startChatErrorPanePr7;
24
+ var _startChatErrorPanePr, _startChatErrorPanePr2, _startChatErrorPanePr3, _startChatErrorPanePr4, _startChatErrorPanePr5, _startChatErrorPanePr6, _startChatErrorPanePr7, _startChatErrorPanePr8, _startChatErrorPanePr9, _startChatErrorPanePr10, _startChatErrorPanePr11;
24
25
  const [state] = (0, _useChatContextStore.default)();
25
26
  const generalStyleProps = Object.assign({}, _defaultStartChatErrorPaneGeneralStyleProps.defaultStartChatErrorPaneGeneralStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr === void 0 ? void 0 : _startChatErrorPanePr.generalStyleProps);
26
27
  const titleStyleProps = Object.assign({}, _defaultStartChatErrorPaneTitleStyleProps.defaultStartChatErrorPaneTitleStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr2 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr2 === void 0 ? void 0 : _startChatErrorPanePr2.titleStyleProps);
@@ -34,16 +35,29 @@ const StartChatErrorPaneStateful = startChatErrorPaneProps => {
34
35
  iconStyleProps: iconStyleProps,
35
36
  iconImageProps: iconImageProps
36
37
  };
37
- const errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr6 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr6 === void 0 ? void 0 : _startChatErrorPanePr6.titleText) ?? _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorTitleText;
38
- const errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr7 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr7 === void 0 ? void 0 : _startChatErrorPanePr7.subtitleText) ?? _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorSubtitleText;
38
+ let errorPaneTitleText;
39
+ let errorPaneSubtitleText;
40
+ switch (state.domainStates.startChatFailureType) {
41
+ case _StartChatFailureType.StartChatFailureType.Unauthorized:
42
+ errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr6 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr6 === void 0 ? void 0 : _startChatErrorPanePr6.unauthorizedTitleText) ?? _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorUnauthorizedTitleText;
43
+ errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr7 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr7 === void 0 ? void 0 : _startChatErrorPanePr7.unauthorizedSubtitleText) ?? _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorUnauthorizedSubtitleText;
44
+ break;
45
+ case _StartChatFailureType.StartChatFailureType.AuthSetupError:
46
+ errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr8 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr8 === void 0 ? void 0 : _startChatErrorPanePr8.authSetupErrorTitleText) ?? _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorAuthSetupErrorTitleText;
47
+ errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr9 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr9 === void 0 ? void 0 : _startChatErrorPanePr9.authSetupErrorSubtitleText) ?? _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorAuthSetupErrorSubtitleText;
48
+ break;
49
+ default:
50
+ errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr10 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr10 === void 0 ? void 0 : _startChatErrorPanePr10.titleText) ?? _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorTitleText;
51
+ errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr11 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr11 === void 0 ? void 0 : _startChatErrorPanePr11.subtitleText) ?? _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorSubtitleText;
52
+ }
39
53
  const errorUIControlProps = {
40
54
  id: _Constants.StartChatErrorPaneConstants.DefaultStartChatErrorPaneId,
41
55
  dir: state.domainStates.globalDir,
42
- titleText: errorPaneTitleText,
43
- subtitleText: errorPaneSubtitleText,
44
56
  hideSpinner: true,
45
57
  hideSpinnerText: true,
46
- ...(startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : startChatErrorPaneProps.controlProps)
58
+ ...(startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : startChatErrorPaneProps.controlProps),
59
+ titleText: errorPaneTitleText,
60
+ subtitleText: errorPaneSubtitleText
47
61
  };
48
62
 
49
63
  // Move focus to the first button
@@ -152,6 +152,9 @@ const WebChatContainerStateful = props => {
152
152
  magicCodeBroadcastChannel.addEventListener(broadcastChannelMessageEvent, eventListener);
153
153
  }, []);
154
154
  return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement("style", null, `
155
+ .webchat__stacked-layout__content .ac-pushButton {
156
+ cursor: pointer;
157
+ }
155
158
 
156
159
  .webchat__bubble__content>div#ms_lcw_webchat_adaptive_card {
157
160
  background: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp === void 0 ? void 0 : _webChatContainerProp.background) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.background};
@@ -15,40 +15,41 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
15
15
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
16
16
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
17
17
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 7] = "SET_START_CHAT_FAILING";
18
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 8] = "SET_OUTSIDE_OPERATING_HOURS";
19
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 9] = "SET_PRE_CHAT_SURVEY_RESPONSE";
20
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 10] = "SET_CUSTOM_CONTEXT";
21
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 11] = "SET_SHOW_CONFIRMATION";
22
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 12] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
23
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 13] = "SET_PRECHAT_RESPONSE_EMAIL";
24
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 14] = "SET_AUDIO_NOTIFICATION";
25
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 15] = "SET_E2VV_ENABLED";
26
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 16] = "SET_POST_CHAT_CONTEXT";
27
- LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 17] = "SHOW_CALLING_CONTAINER";
28
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 18] = "SET_INCOMING_CALL";
29
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 19] = "DISABLE_VIDEO_CALL";
30
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 20] = "DISABLE_LOCAL_VIDEO";
31
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 21] = "DISABLE_REMOTE_VIDEO";
32
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 22] = "SET_CHAT_TOKEN";
33
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 23] = "SET_START_CHAT_BUTTON_DISPLAY";
34
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 24] = "SET_PROACTIVE_CHAT_PARAMS";
35
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 25] = "SET_TELEMETRY_DATA";
36
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 26] = "SET_RECONNECT_ID";
37
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 27] = "SET_UNREAD_MESSAGE_COUNT";
38
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 28] = "SET_FOCUS_CHAT_BUTTON";
39
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 29] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
40
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 30] = "SET_CONVERSATION_ENDED_BY";
41
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 31] = "SET_WIDGET_STATE";
42
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 32] = "SET_LIVE_CHAT_CONTEXT";
43
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 33] = "SET_BOT_OAUTH_SIGNIN_ID";
44
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 34] = "SET_WIDGET_SIZE";
45
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 35] = "SET_WIDGET_INSTANCE_ID";
46
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 36] = "SET_LIVE_CHAT_CONFIG";
47
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 37] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
48
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 38] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
49
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 39] = "SET_SHOULD_USE_BOT_SURVEY";
50
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 40] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
51
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 41] = "SET_SURVEY_MODE";
52
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 42] = "SET_CONFIRMATION_STATE";
53
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 43] = "SET_POST_CHAT_PARTICIPANT_TYPE";
18
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 8] = "SET_START_CHAT_FAILURE_TYPE";
19
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 9] = "SET_OUTSIDE_OPERATING_HOURS";
20
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 10] = "SET_PRE_CHAT_SURVEY_RESPONSE";
21
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 11] = "SET_CUSTOM_CONTEXT";
22
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 12] = "SET_SHOW_CONFIRMATION";
23
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 13] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
24
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 14] = "SET_PRECHAT_RESPONSE_EMAIL";
25
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 15] = "SET_AUDIO_NOTIFICATION";
26
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 16] = "SET_E2VV_ENABLED";
27
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 17] = "SET_POST_CHAT_CONTEXT";
28
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 18] = "SHOW_CALLING_CONTAINER";
29
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 19] = "SET_INCOMING_CALL";
30
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 20] = "DISABLE_VIDEO_CALL";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 21] = "DISABLE_LOCAL_VIDEO";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 22] = "DISABLE_REMOTE_VIDEO";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 23] = "SET_CHAT_TOKEN";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 24] = "SET_START_CHAT_BUTTON_DISPLAY";
35
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 25] = "SET_PROACTIVE_CHAT_PARAMS";
36
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 26] = "SET_TELEMETRY_DATA";
37
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 27] = "SET_RECONNECT_ID";
38
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 28] = "SET_UNREAD_MESSAGE_COUNT";
39
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 29] = "SET_FOCUS_CHAT_BUTTON";
40
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 30] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
41
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 31] = "SET_CONVERSATION_ENDED_BY";
42
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 32] = "SET_WIDGET_STATE";
43
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 33] = "SET_LIVE_CHAT_CONTEXT";
44
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 34] = "SET_BOT_OAUTH_SIGNIN_ID";
45
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 35] = "SET_WIDGET_SIZE";
46
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 36] = "SET_WIDGET_INSTANCE_ID";
47
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 37] = "SET_LIVE_CHAT_CONFIG";
48
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 38] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
49
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 39] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
50
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 40] = "SET_SHOULD_USE_BOT_SURVEY";
51
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 41] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
52
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 42] = "SET_SURVEY_MODE";
53
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 43] = "SET_CONFIRMATION_STATE";
54
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 44] = "SET_POST_CHAT_PARTICIPANT_TYPE";
54
55
  })(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
@@ -9,6 +9,7 @@ var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontaine
9
9
  var _utils = require("../../common/utils");
10
10
  var _defaultClientDataStoreProvider = require("../../common/storage/default/defaultClientDataStoreProvider");
11
11
  var _Constants = require("../../common/Constants");
12
+ var _StartChatFailureType = require("./StartChatFailureType");
12
13
  const getLiveChatWidgetContextInitialState = props => {
13
14
  var _props$controlProps, _props$webChatContain;
14
15
  const widgetCacheId = (0, _utils.getWidgetCacheIdfromProps)(props);
@@ -37,7 +38,8 @@ const getLiveChatWidgetContextInitialState = props => {
37
38
  initialChatSdkRequestId: "",
38
39
  transcriptRequestId: "",
39
40
  confirmationPaneConfirmedOptionClicked: false,
40
- confirmationState: _Constants.ConfirmationState.NotSet
41
+ confirmationState: _Constants.ConfirmationState.NotSet,
42
+ startChatFailureType: _StartChatFailureType.StartChatFailureType.Generic
41
43
  },
42
44
  appStates: {
43
45
  conversationState: _ConversationState.ConversationState.Closed,
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StartChatFailureType = void 0;
7
+ let StartChatFailureType;
8
+ exports.StartChatFailureType = StartChatFailureType;
9
+ (function (StartChatFailureType) {
10
+ StartChatFailureType["Unauthorized"] = "unauthorized";
11
+ StartChatFailureType["AuthSetupError"] = "authSetupError";
12
+ StartChatFailureType["Generic"] = "generic";
13
+ })(StartChatFailureType || (exports.StartChatFailureType = StartChatFailureType = {}));
@@ -67,6 +67,14 @@ const createReducer = () => {
67
67
  startChatFailed: action.payload
68
68
  }
69
69
  };
70
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE:
71
+ return {
72
+ ...state,
73
+ domainStates: {
74
+ ...state.domainStates,
75
+ startChatFailureType: action.payload
76
+ }
77
+ };
70
78
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
71
79
  return {
72
80
  ...state,
@@ -251,6 +251,10 @@ export class StartChatErrorPaneConstants {}
251
251
  _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorPaneId", "oc-lcw-start-chat-error-pane");
252
252
  _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorTitleText", "We are unable to load chat at this time.");
253
253
  _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorSubtitleText", "Please try again later.");
254
+ _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorUnauthorizedTitleText", "Chat authentication has failed.");
255
+ _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorAuthSetupErrorTitleText", "Chat authentication has failed.");
256
+ _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorUnauthorizedSubtitleText", "UNAUTHORIZED");
257
+ _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorAuthSetupErrorSubtitleText", "AUTH SETUP ERROR");
254
258
  export class AriaTelemetryConstants {}
255
259
  // Aria Endpoint for different environment types.
256
260
  _defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
@@ -270,4 +274,15 @@ _defineProperty(WidgetLoadTelemetryMessage, "OOOHMessage", "Widget is OOOH");
270
274
  _defineProperty(WidgetLoadTelemetryMessage, "PersistedStateRetrievedMessage", "Persisted state retrieved");
271
275
  export class WidgetLoadCustomErrorString {}
272
276
  _defineProperty(WidgetLoadCustomErrorString, "AuthenticationFailedErrorString", "Authentication was not successful");
273
- _defineProperty(WidgetLoadCustomErrorString, "NetworkErrorString", "Network Error");
277
+ _defineProperty(WidgetLoadCustomErrorString, "NetworkErrorString", "Network Error");
278
+ export class PrepareEndChatDescriptionConstants {}
279
+ _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedByCustomerWithoutPostChat", "Conversation ended by customer. Post chat not configured or should not show.");
280
+ _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedByCustomerWithInvalidPostChat", "Conversation ended by customer. Post chat context is invalid.");
281
+ _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedBy", "Conversation ended by");
282
+ _defineProperty(PrepareEndChatDescriptionConstants, "PrepareEndChatError", "There's an error while preparing to end chat. Closing chat widget.");
283
+ _defineProperty(PrepareEndChatDescriptionConstants, "WidgetLoadFailedAfterSessionInit", "SessionInit was successful, but widget load failed. Ending chat to avoid ghost chats in OC.");
284
+ _defineProperty(PrepareEndChatDescriptionConstants, "InitiateEndChatReceived", "Received InitiateEndChat BroadcastEvent while conversation state is not Active. Ending chat.");
285
+ _defineProperty(PrepareEndChatDescriptionConstants, "EndChatReceivedFromOtherTabs", "Received EndChat BroadcastEvent from other tabs. Closing this chat.");
286
+ _defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseChatOnFailureOrPostChat", "Customer is trying to close chat widget on start chat failure or post chat pane.");
287
+ _defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseInactiveChat", "Chat was Inactive and customer is trying to close chat widget or refreshing the page.");
288
+ _defineProperty(PrepareEndChatDescriptionConstants, "BrowserUnload", "Browser unload event received. Ending chat.");
@@ -117,6 +117,7 @@ export let TelemetryEvent;
117
117
  TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
118
118
  TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
119
119
  TelemetryEvent["EndChatSDKCall"] = "EndChatSDKCall";
120
+ TelemetryEvent["PrepareEndChat"] = "PrepareEndChat";
120
121
  TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
121
122
  TelemetryEvent["WindowClosed"] = "WindowClosed";
122
123
  TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
@@ -284,6 +285,7 @@ export class TelemetryConstants {
284
285
  case TelemetryEvent.PostChatContextCallFailed:
285
286
  case TelemetryEvent.PostChatContextCallSucceed:
286
287
  case TelemetryEvent.GetConversationDetailsException:
288
+ case TelemetryEvent.PrepareEndChat:
287
289
  return ScenarioType.SDK;
288
290
  case TelemetryEvent.VideoCallAcceptButtonClick:
289
291
  case TelemetryEvent.CallAdded: