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

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 (47) 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/startChatErrorHandler.js +23 -8
  6. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +39 -0
  7. package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +20 -6
  8. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +37 -36
  9. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +3 -1
  10. package/lib/cjs/contexts/common/StartChatFailureType.js +13 -0
  11. package/lib/cjs/contexts/createReducer.js +8 -0
  12. package/lib/esm/common/Constants.js +16 -1
  13. package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
  14. package/lib/esm/components/livechatwidget/common/endChat.js +26 -4
  15. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -4
  16. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +24 -9
  17. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +40 -1
  18. package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +20 -6
  19. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +37 -36
  20. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +3 -1
  21. package/lib/esm/contexts/common/StartChatFailureType.js +6 -0
  22. package/lib/esm/contexts/createReducer.js +8 -0
  23. package/lib/types/common/Constants.d.ts +16 -0
  24. package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -0
  25. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +4 -0
  26. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
  27. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +37 -36
  28. package/lib/types/contexts/common/StartChatFailureType.d.ts +5 -0
  29. package/package.json +3 -3
  30. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -71
  31. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -56
  32. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.spec.js +0 -282
  33. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -190
  34. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -82
  35. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -342
  36. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -69
  37. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -54
  38. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.spec.js +0 -280
  39. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -188
  40. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -80
  41. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -338
  42. package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.d.ts +0 -1
  43. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.d.ts +0 -1
  44. package/lib/types/components/livechatwidget/common/startChatErrorHandler.spec.d.ts +0 -1
  45. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.d.ts +0 -1
  46. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +0 -1
  47. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.d.ts +0 -1
@@ -1,4 +1,4 @@
1
- import { ConfirmationState, Constants, ConversationEndEntity, ParticipantType } from "../../../common/Constants";
1
+ import { ConfirmationState, Constants, ConversationEndEntity, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
2
2
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
3
  import { getAuthClientFunction, handleAuthentication } from "./authHelper";
4
4
  import { getConversationDetailsCall, getWidgetEndChatEventName } from "../../../common/utils";
@@ -15,7 +15,7 @@ import { uuidv4 } from "@microsoft/omnichannel-chat-sdk";
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
16
  const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter) => {
17
17
  try {
18
- var _conversationDetails$, _state$domainStates;
18
+ var _conversationDetails$, _state$domainStates, _state$appStates3;
19
19
  // Use Case: If call is ongoing, end the call by simulating end call button click
20
20
  endVoiceVideoCallIfOngoing(chatSDK, dispatch);
21
21
  const conversationDetails = await getConversationDetailsCall(chatSDK);
@@ -25,8 +25,13 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
25
25
  var _state$appStates;
26
26
  // If ended by customer, just close chat
27
27
  if ((state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.conversationEndedBy) === ConversationEndEntity.Customer) {
28
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
29
+ Event: TelemetryEvent.PrepareEndChat,
30
+ Description: PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithoutPostChat
31
+ });
28
32
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
29
33
  }
34
+
30
35
  // Use Case: If ended by Agent, stay chat in InActive state
31
36
  return;
32
37
  }
@@ -46,6 +51,10 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
46
51
  var _state$appStates2;
47
52
  // For Customer intiated conversations, just close chat widget
48
53
  if ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === ConversationEndEntity.Customer) {
54
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
55
+ Event: TelemetryEvent.PrepareEndChat,
56
+ Description: PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithInvalidPostChat
57
+ });
49
58
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
50
59
  return;
51
60
  }
@@ -57,6 +66,15 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
57
66
  });
58
67
  return;
59
68
  }
69
+
70
+ // Log PrepareEndChat if conversation ended by customer (bot and agent cases are handled in LiveChatWidgetStateful.tsx)
71
+ if (state !== null && state !== void 0 && (_state$appStates3 = state.appStates) !== null && _state$appStates3 !== void 0 && _state$appStates3.conversationEndedBy) {
72
+ var _state$appStates4;
73
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
74
+ Event: TelemetryEvent.PrepareEndChat,
75
+ Description: `${PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithInvalidPostChat} ${state === null || state === void 0 ? void 0 : (_state$appStates4 = state.appStates) === null || _state$appStates4 === void 0 ? void 0 : _state$appStates4.conversationEndedBy}.`
76
+ });
77
+ }
60
78
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, true, true);
61
79
 
62
80
  // Initiate post chat render
@@ -75,6 +93,10 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
75
93
 
76
94
  //Close chat widget for any failure in embedded to allow to show start chat button
77
95
  if (((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.hideStartChatButton) === false) {
96
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
97
+ Event: TelemetryEvent.PrepareEndChat,
98
+ Description: PrepareEndChatDescriptionConstants.PrepareEndChatError
99
+ });
78
100
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
79
101
  }
80
102
  } finally {
@@ -253,8 +275,8 @@ export const endVoiceVideoCallIfOngoing = async (chatSDK, dispatch) => {
253
275
  }
254
276
  };
255
277
  const closeChatWidget = (dispatch, props, state) => {
256
- var _state$appStates3;
257
- if (state !== null && state !== void 0 && (_state$appStates3 = state.appStates) !== null && _state$appStates3 !== void 0 && _state$appStates3.hideStartChatButton) {
278
+ var _state$appStates5;
279
+ if (state !== null && state !== void 0 && (_state$appStates5 = state.appStates) !== null && _state$appStates5 !== void 0 && _state$appStates5.hideStartChatButton) {
258
280
  var _props$controlProps2, _props$controlProps3;
259
281
  // Only close chat if header is enabled for popout
260
282
  // 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
@@ -53,11 +53,19 @@ export const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) =>
53
53
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
54
  const conversationDetails = await getConversationDetailsCall(chatSDK);
55
55
  if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.participantType) === ParticipantType.Bot) {
56
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
57
+ Event: TelemetryEvent.ConversationEndedThreadEventReceived,
58
+ Description: "Conversation end by bot or timeout event received."
59
+ });
56
60
  dispatch({
57
61
  type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
58
62
  payload: ConversationEndEntity.Bot
59
63
  });
60
64
  } else {
65
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
66
+ Event: TelemetryEvent.ConversationEndedThreadEventReceived,
67
+ Description: "Conversation end by agent or timeout event received."
68
+ });
61
69
  dispatch({
62
70
  type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
63
71
  payload: ConversationEndEntity.Agent
@@ -69,10 +77,6 @@ export const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) =>
69
77
  payload: conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.participantType
70
78
  });
71
79
  }
72
- TelemetryHelper.logActionEvent(LogLevel.INFO, {
73
- Event: TelemetryEvent.ConversationEndedThreadEventReceived,
74
- Description: "Conversation end by agent side or by timeout event received."
75
- });
76
80
  };
77
81
  webChatStore = createStore({},
78
82
  //initial state
@@ -7,7 +7,8 @@ import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidge
7
7
  import { callingStateCleanUp, endChatStateCleanUp, closeChatStateCleanUp, chatSDKStateCleanUp } from "./endChat";
8
8
  import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
9
9
  import { getWidgetCacheIdfromProps } from "../../../common/utils";
10
- import { WidgetLoadCustomErrorString, WidgetLoadTelemetryMessage } from "../../../common/Constants";
10
+ import { PrepareEndChatDescriptionConstants, WidgetLoadCustomErrorString, WidgetLoadTelemetryMessage } from "../../../common/Constants";
11
+ import { StartChatFailureType } from "../../../contexts/common/StartChatFailureType";
11
12
 
12
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
14
  export const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSuccessful) => {
@@ -18,7 +19,14 @@ export const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSu
18
19
  }
19
20
 
20
21
  // Handle internal or misc errors
21
- if (ex.message === WidgetLoadCustomErrorString.AuthenticationFailedErrorString || ex.message === WidgetLoadCustomErrorString.NetworkErrorString) {
22
+ if (ex.message === WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
23
+ dispatch({
24
+ type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
25
+ payload: StartChatFailureType.AuthSetupError
26
+ });
27
+ logWidgetLoadCompleteWithError(ex);
28
+ }
29
+ if (ex.message === WidgetLoadCustomErrorString.NetworkErrorString) {
22
30
  logWidgetLoadCompleteWithError(ex);
23
31
  }
24
32
 
@@ -35,7 +43,7 @@ export const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSu
35
43
  handleConversationInitializationFailure(ex);
36
44
  break;
37
45
  case ChatSDKErrorName.ChatTokenRetrievalFailure:
38
- handleChatTokenRetrievalFailure(ex);
46
+ handleChatTokenRetrievalFailure(dispatch, ex);
39
47
  break;
40
48
  case ChatSDKErrorName.UninitializedChatSDK:
41
49
  handleUninitializedChatSDK(ex);
@@ -126,11 +134,12 @@ const logWidgetLoadCompleteWithError = ex => {
126
134
 
127
135
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
136
  const forceEndChat = chatSDK => {
129
- TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
130
- Event: TelemetryEvent.WidgetLoadFailed,
131
- ExceptionDetails: {
132
- Exception: "SessionInit was successful, but widget load failed."
133
- }
137
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
138
+ Event: TelemetryEvent.PrepareEndChat,
139
+ Description: PrepareEndChatDescriptionConstants.WidgetLoadFailedAfterSessionInit
140
+ });
141
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
142
+ Event: TelemetryEvent.EndChatSDKCall
134
143
  });
135
144
  chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat();
136
145
  };
@@ -165,10 +174,16 @@ const handleConversationInitializationFailure = ex => {
165
174
  };
166
175
 
167
176
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
168
- const handleChatTokenRetrievalFailure = ex => {
177
+ const handleChatTokenRetrievalFailure = (dispatch, ex) => {
169
178
  if (ex.httpResponseStatusCode === 400) {
170
179
  logWidgetLoadFailed(ex);
171
180
  } else {
181
+ if (ex.httpResponseStatusCode === 401) {
182
+ dispatch({
183
+ type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
184
+ payload: StartChatFailureType.Unauthorized
185
+ });
186
+ }
172
187
  logWidgetLoadCompleteWithError(ex);
173
188
  }
174
189
  };
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
3
  import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
4
4
  import { Components } from "botframework-webchat";
5
- import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, StorageType } from "../../../common/Constants";
5
+ import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, PrepareEndChatDescriptionConstants, StorageType } from "../../../common/Constants";
6
6
  import { Stack } from "@fluentui/react";
7
7
  import React, { useEffect, useRef, useState } from "react";
8
8
  import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
@@ -52,6 +52,7 @@ import useChatContextStore from "../../../hooks/useChatContextStore";
52
52
  import useChatSDKStore from "../../../hooks/useChatSDKStore";
53
53
  import { defaultAdaptiveCardStyles } from "../../webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles";
54
54
  import StartChatErrorPaneStateful from "../../startchaterrorpanestateful/StartChatErrorPaneStateful";
55
+ import { StartChatFailureType } from "../../../contexts/common/StartChatFailureType";
55
56
  export const LiveChatWidgetStateful = props => {
56
57
  var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$webChatContain10, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
57
58
  const [state, dispatch] = useChatContextStore();
@@ -190,6 +191,10 @@ export const LiveChatWidgetStateful = props => {
190
191
  type: LiveChatWidgetActionType.SET_START_CHAT_FAILING,
191
192
  payload: false
192
193
  });
194
+ dispatch({
195
+ type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
196
+ payload: StartChatFailureType.Generic
197
+ });
193
198
  state.domainStates.confirmationPaneConfirmedOptionClicked = false;
194
199
  state.domainStates.confirmationState = ConfirmationState.NotSet;
195
200
  setupClientDataStore();
@@ -400,9 +405,23 @@ export const LiveChatWidgetStateful = props => {
400
405
 
401
406
  // End chat
402
407
  BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async () => {
408
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
409
+ Event: TelemetryEvent.EndChatEventReceived,
410
+ Description: "Received InitiateEndChat BroadcastEvent."
411
+ });
412
+
403
413
  // This is to ensure to get latest state from cache in multitab
404
414
  const persistedState = getStateFromCache(getWidgetCacheIdfromProps(props));
405
415
  if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
416
+ // We need to simulate states for closing chat, in order to messup with close confirmation pane.
417
+ dispatch({
418
+ type: LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
419
+ payload: ConfirmationState.Ok
420
+ });
421
+ dispatch({
422
+ type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
423
+ payload: false
424
+ });
406
425
  dispatch({
407
426
  type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
408
427
  payload: ConversationEndEntity.Customer
@@ -410,6 +429,10 @@ export const LiveChatWidgetStateful = props => {
410
429
  } else {
411
430
  const skipEndChatSDK = true;
412
431
  const skipCloseChat = false;
432
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
433
+ Event: TelemetryEvent.PrepareEndChat,
434
+ Description: PrepareEndChatDescriptionConstants.InitiateEndChatReceived
435
+ });
413
436
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
414
437
  }
415
438
  BroadcastService.postMessage({
@@ -427,6 +450,10 @@ export const LiveChatWidgetStateful = props => {
427
450
  BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
428
451
  var _msg$payload9;
429
452
  if ((msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
453
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
454
+ Event: TelemetryEvent.PrepareEndChat,
455
+ Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
456
+ });
430
457
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
431
458
  endChatStateCleanUp(dispatch);
432
459
  chatSDKStateCleanUp(chatSDK);
@@ -557,12 +584,20 @@ export const LiveChatWidgetStateful = props => {
557
584
 
558
585
  // If start chat failed, and C2 is trying to close chat widget
559
586
  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.Postchat) {
587
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
588
+ Event: TelemetryEvent.PrepareEndChat,
589
+ Description: PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
590
+ });
560
591
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true);
561
592
  return;
562
593
  }
563
594
 
564
595
  // Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
565
596
  if ((state === null || state === void 0 ? void 0 : (_state$appStates11 = state.appStates) === null || _state$appStates11 === void 0 ? void 0 : _state$appStates11.conversationState) === ConversationState.InActive) {
597
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
598
+ Event: TelemetryEvent.PrepareEndChat,
599
+ Description: PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
600
+ });
566
601
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
567
602
  return;
568
603
  }
@@ -615,6 +650,10 @@ export const LiveChatWidgetStateful = props => {
615
650
  Event: TelemetryEvent.BrowserUnloadEventStarted,
616
651
  Description: "Browser unload event received."
617
652
  });
653
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
654
+ Event: TelemetryEvent.PrepareEndChat,
655
+ Description: PrepareEndChatDescriptionConstants.BrowserUnload
656
+ });
618
657
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, false);
619
658
  // Clean local storage
620
659
  (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventId);
@@ -10,8 +10,9 @@ import { defaultStartChatErrorPaneSubtitleStyleProps } from "./common/defaultSta
10
10
  import { defaultStartChatErrorPaneIconStyleProps } from "./common/defaultStartChatErrorPaneIconStyleProps";
11
11
  import { defaultStartChatErrorPaneIconImageStyleProps } from "./common/defaultStartChatErrorPaneIconImageProps";
12
12
  import { StartChatErrorPaneConstants } from "../../common/Constants";
13
+ import { StartChatFailureType } from "../../contexts/common/StartChatFailureType";
13
14
  export const StartChatErrorPaneStateful = startChatErrorPaneProps => {
14
- var _startChatErrorPanePr, _startChatErrorPanePr2, _startChatErrorPanePr3, _startChatErrorPanePr4, _startChatErrorPanePr5, _startChatErrorPanePr6, _startChatErrorPanePr7;
15
+ var _startChatErrorPanePr, _startChatErrorPanePr2, _startChatErrorPanePr3, _startChatErrorPanePr4, _startChatErrorPanePr5, _startChatErrorPanePr6, _startChatErrorPanePr7, _startChatErrorPanePr8, _startChatErrorPanePr9, _startChatErrorPanePr10, _startChatErrorPanePr11;
15
16
  const [state] = useChatContextStore();
16
17
  const generalStyleProps = Object.assign({}, defaultStartChatErrorPaneGeneralStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr === void 0 ? void 0 : _startChatErrorPanePr.generalStyleProps);
17
18
  const titleStyleProps = Object.assign({}, defaultStartChatErrorPaneTitleStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr2 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr2 === void 0 ? void 0 : _startChatErrorPanePr2.titleStyleProps);
@@ -25,16 +26,29 @@ export const StartChatErrorPaneStateful = startChatErrorPaneProps => {
25
26
  iconStyleProps: iconStyleProps,
26
27
  iconImageProps: iconImageProps
27
28
  };
28
- const errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr6 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr6 === void 0 ? void 0 : _startChatErrorPanePr6.titleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorTitleText;
29
- const errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr7 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr7 === void 0 ? void 0 : _startChatErrorPanePr7.subtitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorSubtitleText;
29
+ let errorPaneTitleText;
30
+ let errorPaneSubtitleText;
31
+ switch (state.domainStates.startChatFailureType) {
32
+ case StartChatFailureType.Unauthorized:
33
+ errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr6 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr6 === void 0 ? void 0 : _startChatErrorPanePr6.unauthorizedTitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorUnauthorizedTitleText;
34
+ errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr7 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr7 === void 0 ? void 0 : _startChatErrorPanePr7.unauthorizedSubtitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorUnauthorizedSubtitleText;
35
+ break;
36
+ case StartChatFailureType.AuthSetupError:
37
+ errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr8 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr8 === void 0 ? void 0 : _startChatErrorPanePr8.authSetupErrorTitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorAuthSetupErrorTitleText;
38
+ errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr9 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr9 === void 0 ? void 0 : _startChatErrorPanePr9.authSetupErrorSubtitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorAuthSetupErrorSubtitleText;
39
+ break;
40
+ default:
41
+ errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr10 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr10 === void 0 ? void 0 : _startChatErrorPanePr10.titleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorTitleText;
42
+ errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr11 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr11 === void 0 ? void 0 : _startChatErrorPanePr11.subtitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorSubtitleText;
43
+ }
30
44
  const errorUIControlProps = {
31
45
  id: StartChatErrorPaneConstants.DefaultStartChatErrorPaneId,
32
46
  dir: state.domainStates.globalDir,
33
- titleText: errorPaneTitleText,
34
- subtitleText: errorPaneSubtitleText,
35
47
  hideSpinner: true,
36
48
  hideSpinnerText: true,
37
- ...(startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : startChatErrorPaneProps.controlProps)
49
+ ...(startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : startChatErrorPaneProps.controlProps),
50
+ titleText: errorPaneTitleText,
51
+ subtitleText: errorPaneSubtitleText
38
52
  };
39
53
 
40
54
  // Move focus to the first button
@@ -8,40 +8,41 @@ export let LiveChatWidgetActionType;
8
8
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
9
9
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
10
10
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 7] = "SET_START_CHAT_FAILING";
11
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 8] = "SET_OUTSIDE_OPERATING_HOURS";
12
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 9] = "SET_PRE_CHAT_SURVEY_RESPONSE";
13
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 10] = "SET_CUSTOM_CONTEXT";
14
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 11] = "SET_SHOW_CONFIRMATION";
15
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 12] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
16
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 13] = "SET_PRECHAT_RESPONSE_EMAIL";
17
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 14] = "SET_AUDIO_NOTIFICATION";
18
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 15] = "SET_E2VV_ENABLED";
19
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 16] = "SET_POST_CHAT_CONTEXT";
20
- LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 17] = "SHOW_CALLING_CONTAINER";
21
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 18] = "SET_INCOMING_CALL";
22
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 19] = "DISABLE_VIDEO_CALL";
23
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 20] = "DISABLE_LOCAL_VIDEO";
24
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 21] = "DISABLE_REMOTE_VIDEO";
25
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 22] = "SET_CHAT_TOKEN";
26
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 23] = "SET_START_CHAT_BUTTON_DISPLAY";
27
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 24] = "SET_PROACTIVE_CHAT_PARAMS";
28
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 25] = "SET_TELEMETRY_DATA";
29
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 26] = "SET_RECONNECT_ID";
30
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 27] = "SET_UNREAD_MESSAGE_COUNT";
31
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 28] = "SET_FOCUS_CHAT_BUTTON";
32
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 29] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
33
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 30] = "SET_CONVERSATION_ENDED_BY";
34
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 31] = "SET_WIDGET_STATE";
35
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 32] = "SET_LIVE_CHAT_CONTEXT";
36
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 33] = "SET_BOT_OAUTH_SIGNIN_ID";
37
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 34] = "SET_WIDGET_SIZE";
38
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 35] = "SET_WIDGET_INSTANCE_ID";
39
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 36] = "SET_LIVE_CHAT_CONFIG";
40
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 37] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
41
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 38] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
42
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 39] = "SET_SHOULD_USE_BOT_SURVEY";
43
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 40] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
44
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 41] = "SET_SURVEY_MODE";
45
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 42] = "SET_CONFIRMATION_STATE";
46
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 43] = "SET_POST_CHAT_PARTICIPANT_TYPE";
11
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 8] = "SET_START_CHAT_FAILURE_TYPE";
12
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 9] = "SET_OUTSIDE_OPERATING_HOURS";
13
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 10] = "SET_PRE_CHAT_SURVEY_RESPONSE";
14
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 11] = "SET_CUSTOM_CONTEXT";
15
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 12] = "SET_SHOW_CONFIRMATION";
16
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 13] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
17
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 14] = "SET_PRECHAT_RESPONSE_EMAIL";
18
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 15] = "SET_AUDIO_NOTIFICATION";
19
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 16] = "SET_E2VV_ENABLED";
20
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 17] = "SET_POST_CHAT_CONTEXT";
21
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 18] = "SHOW_CALLING_CONTAINER";
22
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 19] = "SET_INCOMING_CALL";
23
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 20] = "DISABLE_VIDEO_CALL";
24
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 21] = "DISABLE_LOCAL_VIDEO";
25
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 22] = "DISABLE_REMOTE_VIDEO";
26
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 23] = "SET_CHAT_TOKEN";
27
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 24] = "SET_START_CHAT_BUTTON_DISPLAY";
28
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 25] = "SET_PROACTIVE_CHAT_PARAMS";
29
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 26] = "SET_TELEMETRY_DATA";
30
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 27] = "SET_RECONNECT_ID";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 28] = "SET_UNREAD_MESSAGE_COUNT";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 29] = "SET_FOCUS_CHAT_BUTTON";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 30] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 31] = "SET_CONVERSATION_ENDED_BY";
35
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 32] = "SET_WIDGET_STATE";
36
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 33] = "SET_LIVE_CHAT_CONTEXT";
37
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 34] = "SET_BOT_OAUTH_SIGNIN_ID";
38
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 35] = "SET_WIDGET_SIZE";
39
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 36] = "SET_WIDGET_INSTANCE_ID";
40
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 37] = "SET_LIVE_CHAT_CONFIG";
41
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 38] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
42
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 39] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
43
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 40] = "SET_SHOULD_USE_BOT_SURVEY";
44
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 41] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
45
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 42] = "SET_SURVEY_MODE";
46
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 43] = "SET_CONFIRMATION_STATE";
47
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 44] = "SET_POST_CHAT_PARTICIPANT_TYPE";
47
48
  })(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));
@@ -3,6 +3,7 @@ import { defaultMiddlewareLocalizedTexts } from "../../components/webchatcontain
3
3
  import { getWidgetCacheIdfromProps, isNullOrUndefined } from "../../common/utils";
4
4
  import { defaultClientDataStoreProvider } from "../../common/storage/default/defaultClientDataStoreProvider";
5
5
  import { ConfirmationState, Constants, ConversationEndEntity, StorageType } from "../../common/Constants";
6
+ import { StartChatFailureType } from "./StartChatFailureType";
6
7
  export const getLiveChatWidgetContextInitialState = props => {
7
8
  var _props$controlProps, _props$webChatContain;
8
9
  const widgetCacheId = getWidgetCacheIdfromProps(props);
@@ -31,7 +32,8 @@ export const getLiveChatWidgetContextInitialState = props => {
31
32
  initialChatSdkRequestId: "",
32
33
  transcriptRequestId: "",
33
34
  confirmationPaneConfirmedOptionClicked: false,
34
- confirmationState: ConfirmationState.NotSet
35
+ confirmationState: ConfirmationState.NotSet,
36
+ startChatFailureType: StartChatFailureType.Generic
35
37
  },
36
38
  appStates: {
37
39
  conversationState: ConversationState.Closed,
@@ -0,0 +1,6 @@
1
+ export let StartChatFailureType;
2
+ (function (StartChatFailureType) {
3
+ StartChatFailureType["Unauthorized"] = "unauthorized";
4
+ StartChatFailureType["AuthSetupError"] = "authSetupError";
5
+ StartChatFailureType["Generic"] = "generic";
6
+ })(StartChatFailureType || (StartChatFailureType = {}));
@@ -61,6 +61,14 @@ export const createReducer = () => {
61
61
  startChatFailed: action.payload
62
62
  }
63
63
  };
64
+ case LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE:
65
+ return {
66
+ ...state,
67
+ domainStates: {
68
+ ...state.domainStates,
69
+ startChatFailureType: action.payload
70
+ }
71
+ };
64
72
  case LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
65
73
  return {
66
74
  ...state,
@@ -231,6 +231,10 @@ export declare class StartChatErrorPaneConstants {
231
231
  static readonly DefaultStartChatErrorPaneId = "oc-lcw-start-chat-error-pane";
232
232
  static readonly DefaultStartChatErrorTitleText = "We are unable to load chat at this time.";
233
233
  static readonly DefaultStartChatErrorSubtitleText = "Please try again later.";
234
+ static readonly DefaultStartChatErrorUnauthorizedTitleText = "Chat authentication has failed.";
235
+ static readonly DefaultStartChatErrorAuthSetupErrorTitleText = "Chat authentication has failed.";
236
+ static readonly DefaultStartChatErrorUnauthorizedSubtitleText = "UNAUTHORIZED";
237
+ static readonly DefaultStartChatErrorAuthSetupErrorSubtitleText = "AUTH SETUP ERROR";
234
238
  }
235
239
  export declare class AriaTelemetryConstants {
236
240
  static readonly GERMANY_ENDPOINT: string;
@@ -250,3 +254,15 @@ export declare class WidgetLoadCustomErrorString {
250
254
  static readonly AuthenticationFailedErrorString = "Authentication was not successful";
251
255
  static readonly NetworkErrorString = "Network Error";
252
256
  }
257
+ export declare class PrepareEndChatDescriptionConstants {
258
+ static readonly ConversationEndedByCustomerWithoutPostChat = "Conversation ended by customer. Post chat not configured or should not show.";
259
+ static readonly ConversationEndedByCustomerWithInvalidPostChat = "Conversation ended by customer. Post chat context is invalid.";
260
+ static readonly ConversationEndedBy = "Conversation ended by";
261
+ static readonly PrepareEndChatError = "There's an error while preparing to end chat. Closing chat widget.";
262
+ static readonly WidgetLoadFailedAfterSessionInit = "SessionInit was successful, but widget load failed. Ending chat to avoid ghost chats in OC.";
263
+ static readonly InitiateEndChatReceived = "Received InitiateEndChat BroadcastEvent while conversation state is not Active. Ending chat.";
264
+ static readonly EndChatReceivedFromOtherTabs = "Received EndChat BroadcastEvent from other tabs. Closing this chat.";
265
+ static readonly CustomerCloseChatOnFailureOrPostChat = "Customer is trying to close chat widget on start chat failure or post chat pane.";
266
+ static readonly CustomerCloseInactiveChat = "Chat was Inactive and customer is trying to close chat widget or refreshing the page.";
267
+ static readonly BrowserUnload = "Browser unload event received. Ending chat.";
268
+ }
@@ -110,6 +110,7 @@ export declare enum TelemetryEvent {
110
110
  StartChatSDKCall = "StartChatCall",
111
111
  StartChatEventRecevied = "StartChatEventReceived",
112
112
  EndChatSDKCall = "EndChatSDKCall",
113
+ PrepareEndChat = "PrepareEndChat",
113
114
  EndChatEventReceived = "EndChatEventReceived",
114
115
  WindowClosed = "WindowClosed",
115
116
  OnNewMessageFailed = "OnNewMessageFailed",
@@ -7,4 +7,8 @@ export interface IStartChatErrorPaneControlProps {
7
7
  hideSubtitle?: boolean;
8
8
  titleText?: string;
9
9
  subtitleText?: string;
10
+ unauthorizedTitleText?: string;
11
+ unauthorizedSubtitleText?: string;
12
+ authSetupErrorTitleText?: string;
13
+ authSetupErrorSubtitleText?: string;
10
14
  }
@@ -4,6 +4,7 @@ import { IInternalTelemetryData } from "../../common/telemetry/interfaces/IInter
4
4
  import { ILiveChatWidgetLocalizedTexts } from "./ILiveChatWidgetLocalizedTexts";
5
5
  import { IRenderingMiddlewareProps } from "../../components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps";
6
6
  import { ConfirmationState, ConversationEndEntity, ParticipantType } from "../../common/Constants";
7
+ import { StartChatFailureType } from "./StartChatFailureType";
7
8
  export interface ILiveChatWidgetContext {
8
9
  domainStates: {
9
10
  liveChatConfig: ChatConfig | undefined;
@@ -23,6 +24,7 @@ export interface ILiveChatWidgetContext {
23
24
  transcriptRequestId: string;
24
25
  confirmationPaneConfirmedOptionClicked: boolean;
25
26
  confirmationState: ConfirmationState;
27
+ startChatFailureType: StartChatFailureType;
26
28
  };
27
29
  appStates: {
28
30
  conversationState: ConversationState;
@@ -7,40 +7,41 @@ export declare enum LiveChatWidgetActionType {
7
7
  SET_CONVERSATION_STATE = 5,
8
8
  SET_PREVIOUS_FOCUSED_ELEMENT_ID = 6,
9
9
  SET_START_CHAT_FAILING = 7,
10
- SET_OUTSIDE_OPERATING_HOURS = 8,
11
- SET_PRE_CHAT_SURVEY_RESPONSE = 9,
12
- SET_CUSTOM_CONTEXT = 10,
13
- SET_SHOW_CONFIRMATION = 11,
14
- SET_SHOW_EMAIL_TRANSCRIPT_PANE = 12,
15
- SET_PRECHAT_RESPONSE_EMAIL = 13,
16
- SET_AUDIO_NOTIFICATION = 14,
17
- SET_E2VV_ENABLED = 15,
18
- SET_POST_CHAT_CONTEXT = 16,
19
- SHOW_CALLING_CONTAINER = 17,
20
- SET_INCOMING_CALL = 18,
21
- DISABLE_VIDEO_CALL = 19,
22
- DISABLE_LOCAL_VIDEO = 20,
23
- DISABLE_REMOTE_VIDEO = 21,
24
- SET_CHAT_TOKEN = 22,
25
- SET_START_CHAT_BUTTON_DISPLAY = 23,
26
- SET_PROACTIVE_CHAT_PARAMS = 24,
27
- SET_TELEMETRY_DATA = 25,
28
- SET_RECONNECT_ID = 26,
29
- SET_UNREAD_MESSAGE_COUNT = 27,
30
- SET_FOCUS_CHAT_BUTTON = 28,
31
- SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED = 29,
32
- SET_CONVERSATION_ENDED_BY = 30,
33
- SET_WIDGET_STATE = 31,
34
- SET_LIVE_CHAT_CONTEXT = 32,
35
- SET_BOT_OAUTH_SIGNIN_ID = 33,
36
- SET_WIDGET_SIZE = 34,
37
- SET_WIDGET_INSTANCE_ID = 35,
38
- SET_LIVE_CHAT_CONFIG = 36,
39
- SET_POST_CHAT_WORKFLOW_IN_PROGRESS = 37,
40
- SET_INITIAL_CHAT_SDK_REQUEST_ID = 38,
41
- SET_SHOULD_USE_BOT_SURVEY = 39,
42
- SET_CHAT_DISCONNECT_EVENT_RECEIVED = 40,
43
- SET_SURVEY_MODE = 41,
44
- SET_CONFIRMATION_STATE = 42,
45
- SET_POST_CHAT_PARTICIPANT_TYPE = 43
10
+ SET_START_CHAT_FAILURE_TYPE = 8,
11
+ SET_OUTSIDE_OPERATING_HOURS = 9,
12
+ SET_PRE_CHAT_SURVEY_RESPONSE = 10,
13
+ SET_CUSTOM_CONTEXT = 11,
14
+ SET_SHOW_CONFIRMATION = 12,
15
+ SET_SHOW_EMAIL_TRANSCRIPT_PANE = 13,
16
+ SET_PRECHAT_RESPONSE_EMAIL = 14,
17
+ SET_AUDIO_NOTIFICATION = 15,
18
+ SET_E2VV_ENABLED = 16,
19
+ SET_POST_CHAT_CONTEXT = 17,
20
+ SHOW_CALLING_CONTAINER = 18,
21
+ SET_INCOMING_CALL = 19,
22
+ DISABLE_VIDEO_CALL = 20,
23
+ DISABLE_LOCAL_VIDEO = 21,
24
+ DISABLE_REMOTE_VIDEO = 22,
25
+ SET_CHAT_TOKEN = 23,
26
+ SET_START_CHAT_BUTTON_DISPLAY = 24,
27
+ SET_PROACTIVE_CHAT_PARAMS = 25,
28
+ SET_TELEMETRY_DATA = 26,
29
+ SET_RECONNECT_ID = 27,
30
+ SET_UNREAD_MESSAGE_COUNT = 28,
31
+ SET_FOCUS_CHAT_BUTTON = 29,
32
+ SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED = 30,
33
+ SET_CONVERSATION_ENDED_BY = 31,
34
+ SET_WIDGET_STATE = 32,
35
+ SET_LIVE_CHAT_CONTEXT = 33,
36
+ SET_BOT_OAUTH_SIGNIN_ID = 34,
37
+ SET_WIDGET_SIZE = 35,
38
+ SET_WIDGET_INSTANCE_ID = 36,
39
+ SET_LIVE_CHAT_CONFIG = 37,
40
+ SET_POST_CHAT_WORKFLOW_IN_PROGRESS = 38,
41
+ SET_INITIAL_CHAT_SDK_REQUEST_ID = 39,
42
+ SET_SHOULD_USE_BOT_SURVEY = 40,
43
+ SET_CHAT_DISCONNECT_EVENT_RECEIVED = 41,
44
+ SET_SURVEY_MODE = 42,
45
+ SET_CONFIRMATION_STATE = 43,
46
+ SET_POST_CHAT_PARTICIPANT_TYPE = 44
46
47
  }
@@ -0,0 +1,5 @@
1
+ export declare enum StartChatFailureType {
2
+ Unauthorized = "unauthorized",
3
+ AuthSetupError = "authSetupError",
4
+ Generic = "generic"
5
+ }