@microsoft/omnichannel-chat-widget 1.5.1-main.e2be12d → 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 (91) hide show
  1. package/lib/cjs/common/Constants.js +23 -2
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +3 -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 +35 -13
  6. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +50 -6
  7. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  8. package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +82 -0
  9. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +17 -0
  10. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +17 -0
  11. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +15 -0
  12. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +17 -0
  13. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +17 -0
  14. package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
  15. package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
  16. package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
  17. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -3
  18. package/lib/cjs/contexts/common/ConversationState.js +1 -0
  19. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +37 -36
  20. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
  21. package/lib/cjs/contexts/common/StartChatFailureType.js +13 -0
  22. package/lib/cjs/contexts/createReducer.js +8 -0
  23. package/lib/cjs/controller/componentController.js +5 -1
  24. package/lib/esm/common/Constants.js +20 -1
  25. package/lib/esm/common/telemetry/TelemetryConstants.js +3 -0
  26. package/lib/esm/components/livechatwidget/common/endChat.js +26 -4
  27. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -4
  28. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +36 -14
  29. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +52 -8
  30. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  31. package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +71 -0
  32. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +10 -0
  33. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +10 -0
  34. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +8 -0
  35. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +10 -0
  36. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +10 -0
  37. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
  38. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
  39. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
  40. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -3
  41. package/lib/esm/contexts/common/ConversationState.js +1 -0
  42. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +37 -36
  43. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
  44. package/lib/esm/contexts/common/StartChatFailureType.js +6 -0
  45. package/lib/esm/contexts/createReducer.js +8 -0
  46. package/lib/esm/controller/componentController.js +3 -0
  47. package/lib/types/common/Constants.d.ts +21 -0
  48. package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -0
  49. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  50. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
  51. package/lib/types/components/startchaterrorpanestateful/StartChatErrorPaneStateful.d.ts +3 -0
  52. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.d.ts +2 -0
  53. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.d.ts +2 -0
  54. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.d.ts +2 -0
  55. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.d.ts +2 -0
  56. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.d.ts +2 -0
  57. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.d.ts +5 -0
  58. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.d.ts +6 -0
  59. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +14 -0
  60. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +8 -0
  61. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.d.ts +10 -0
  62. package/lib/types/contexts/common/ConversationState.d.ts +2 -1
  63. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -0
  64. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +37 -36
  65. package/lib/types/contexts/common/StartChatFailureType.d.ts +5 -0
  66. package/lib/types/controller/componentController.d.ts +1 -0
  67. package/package.json +5 -5
  68. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -71
  69. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -56
  70. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.spec.js +0 -282
  71. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -190
  72. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -82
  73. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -342
  74. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -69
  75. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -54
  76. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.spec.js +0 -280
  77. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -188
  78. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -80
  79. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -338
  80. package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.d.ts +0 -1
  81. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.d.ts +0 -1
  82. package/lib/types/components/livechatwidget/common/startChatErrorHandler.spec.d.ts +0 -1
  83. package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +0 -4
  84. package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +0 -4
  85. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.d.ts +0 -1
  86. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +0 -1
  87. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.d.ts +0 -1
  88. /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
  89. /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
  90. /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
  91. /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
@@ -54,7 +54,7 @@ const handleSystemMessage = (next, args, card, systemMessageStyleProps) => {
54
54
  return () => /*#__PURE__*/_react.default.createElement("div", {
55
55
  key: card.activity.id,
56
56
  style: systemMessageStyles,
57
- "aria-hidden": "true",
57
+ "aria-hidden": "false",
58
58
  dangerouslySetInnerHTML: {
59
59
  __html: (0, _utils.escapeHtml)(card.activity.text)
60
60
  }
@@ -100,8 +100,7 @@ const createActivityMiddleware = (systemMessageStyleProps, userMessageStyleProps
100
100
  return function () {
101
101
  return /*#__PURE__*/_react.default.createElement("div", {
102
102
  className: card.activity.from.role === _DirectLineSenderRole.DirectLineSenderRole.User ? _Constants.Constants.sentMessageClassName : _Constants.Constants.receivedMessageClassName,
103
- style: userMessageStyles,
104
- "aria-hidden": "true"
103
+ style: userMessageStyles
105
104
  }, next(...args)(...arguments));
106
105
  };
107
106
  }
@@ -17,4 +17,5 @@ exports.ConversationState = ConversationState;
17
17
  ConversationState[ConversationState["PostchatLoading"] = 7] = "PostchatLoading";
18
18
  ConversationState[ConversationState["Postchat"] = 8] = "Postchat";
19
19
  ConversationState[ConversationState["Closed"] = 9] = "Closed";
20
+ ConversationState[ConversationState["Error"] = 10] = "Error";
20
21
  })(ConversationState || (exports.ConversationState = ConversationState = {}));
@@ -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,
@@ -64,6 +66,7 @@ const getLiveChatWidgetContextInitialState = props => {
64
66
  },
65
67
  uiStates: {
66
68
  showConfirmationPane: false,
69
+ showStartChatErrorPane: false,
67
70
  showEmailTranscriptPane: false,
68
71
  showCallingPopup: false,
69
72
  isIncomingCall: true,
@@ -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,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.shouldShowWebChatContainer = exports.shouldShowReconnectChatPane = exports.shouldShowProactiveChatPane = exports.shouldShowPreChatSurveyPane = exports.shouldShowPostChatSurveyPane = exports.shouldShowPostChatLoadingPane = exports.shouldShowOutOfOfficeHoursPane = exports.shouldShowLoadingPane = exports.shouldShowHeader = exports.shouldShowFooter = exports.shouldShowEmailTranscriptPane = exports.shouldShowConfirmationPane = exports.shouldShowChatButton = exports.shouldShowCallingContainer = void 0;
6
+ exports.shouldShowWebChatContainer = exports.shouldShowStartChatErrorPane = exports.shouldShowReconnectChatPane = exports.shouldShowProactiveChatPane = exports.shouldShowPreChatSurveyPane = exports.shouldShowPostChatSurveyPane = exports.shouldShowPostChatLoadingPane = exports.shouldShowOutOfOfficeHoursPane = exports.shouldShowLoadingPane = exports.shouldShowHeader = exports.shouldShowFooter = exports.shouldShowEmailTranscriptPane = exports.shouldShowConfirmationPane = exports.shouldShowChatButton = exports.shouldShowCallingContainer = void 0;
7
7
  var _ConversationState = require("../contexts/common/ConversationState");
8
8
  const shouldShowChatButton = state => {
9
9
  var _state$appStates;
@@ -34,6 +34,10 @@ const shouldShowLoadingPane = state => {
34
34
  return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.Loading;
35
35
  };
36
36
  exports.shouldShowLoadingPane = shouldShowLoadingPane;
37
+ const shouldShowStartChatErrorPane = state => {
38
+ return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.Error;
39
+ };
40
+ exports.shouldShowStartChatErrorPane = shouldShowStartChatErrorPane;
37
41
  const shouldShowReconnectChatPane = state => {
38
42
  return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat;
39
43
  };
@@ -247,6 +247,14 @@ _defineProperty(NotificationPaneConstants, "IconText", "Notification Icon");
247
247
  _defineProperty(NotificationPaneConstants, "ChatDisconnectTitleText", "Chat disconnected");
248
248
  _defineProperty(NotificationPaneConstants, "ChatDisconnectSubtitleText", "For additional assistance, please close the chat and try again.");
249
249
  _defineProperty(NotificationPaneConstants, "ChromeCloseIconName", "ChromeClose");
250
+ export class StartChatErrorPaneConstants {}
251
+ _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorPaneId", "oc-lcw-start-chat-error-pane");
252
+ _defineProperty(StartChatErrorPaneConstants, "DefaultStartChatErrorTitleText", "We are unable to load chat at this time.");
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");
250
258
  export class AriaTelemetryConstants {}
251
259
  // Aria Endpoint for different environment types.
252
260
  _defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
@@ -266,4 +274,15 @@ _defineProperty(WidgetLoadTelemetryMessage, "OOOHMessage", "Widget is OOOH");
266
274
  _defineProperty(WidgetLoadTelemetryMessage, "PersistedStateRetrievedMessage", "Persisted state retrieved");
267
275
  export class WidgetLoadCustomErrorString {}
268
276
  _defineProperty(WidgetLoadCustomErrorString, "AuthenticationFailedErrorString", "Authentication was not successful");
269
- _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";
@@ -130,6 +131,7 @@ export let TelemetryEvent;
130
131
  TelemetryEvent["ConfirmationCancelButtonClicked"] = "ConfirmationCancelButtonClicked";
131
132
  TelemetryEvent["ConfirmationConfirmButtonClicked"] = "ConfirmationConfirmButtonClicked";
132
133
  TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
134
+ TelemetryEvent["StartChatErrorPaneLoaded"] = "StartChatErrorPaneLoaded";
133
135
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
134
136
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
135
137
  TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
@@ -283,6 +285,7 @@ export class TelemetryConstants {
283
285
  case TelemetryEvent.PostChatContextCallFailed:
284
286
  case TelemetryEvent.PostChatContextCallSucceed:
285
287
  case TelemetryEvent.GetConversationDetailsException:
288
+ case TelemetryEvent.PrepareEndChat:
286
289
  return ScenarioType.SDK;
287
290
  case TelemetryEvent.VideoCallAcceptButtonClick:
288
291
  case TelemetryEvent.CallAdded:
@@ -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);
@@ -55,17 +63,24 @@ export const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSu
55
63
  payload: true
56
64
  });
57
65
  if (!(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hideErrorUIPane)) {
66
+ // New flow of leveraging ConversationState.Error
58
67
  // Set app state to failing start chat if hideErrorUI is not turned on
59
68
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
60
69
  Event: TelemetryEvent.ErrorUIPaneLoaded,
61
70
  Description: "Error UI Pane Loaded"
62
71
  });
72
+ dispatch({
73
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
74
+ payload: ConversationState.Error
75
+ });
76
+ } else {
77
+ // Old flow of leveraging ConversationState.Loading
78
+ // Show the loading pane in other cases for failure, this will help for both hideStartChatButton case
79
+ dispatch({
80
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
81
+ payload: ConversationState.Loading
82
+ });
63
83
  }
64
- // Show the loading pane in other cases for failure, this will help for both hideStartChatButton case
65
- dispatch({
66
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
67
- payload: ConversationState.Loading
68
- });
69
84
 
70
85
  // If sessionInit was successful but LCW startchat failed due to some reason e.g adapter didn't load
71
86
  // we need to directly endChat to avoid leaving ghost chats in OC, not disturbing any other UI state
@@ -119,11 +134,12 @@ const logWidgetLoadCompleteWithError = ex => {
119
134
 
120
135
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
121
136
  const forceEndChat = chatSDK => {
122
- TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
123
- Event: TelemetryEvent.WidgetLoadFailed,
124
- ExceptionDetails: {
125
- Exception: "SessionInit was successful, but widget load failed."
126
- }
137
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
138
+ Event: TelemetryEvent.PrepareEndChat,
139
+ Description: PrepareEndChatDescriptionConstants.WidgetLoadFailedAfterSessionInit
140
+ });
141
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
142
+ Event: TelemetryEvent.EndChatSDKCall
127
143
  });
128
144
  chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat();
129
145
  };
@@ -158,10 +174,16 @@ const handleConversationInitializationFailure = ex => {
158
174
  };
159
175
 
160
176
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
161
- const handleChatTokenRetrievalFailure = ex => {
177
+ const handleChatTokenRetrievalFailure = (dispatch, ex) => {
162
178
  if (ex.httpResponseStatusCode === 400) {
163
179
  logWidgetLoadFailed(ex);
164
180
  } else {
181
+ if (ex.httpResponseStatusCode === 401) {
182
+ dispatch({
183
+ type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
184
+ payload: StartChatFailureType.Unauthorized
185
+ });
186
+ }
165
187
  logWidgetLoadCompleteWithError(ex);
166
188
  }
167
189
  };