@microsoft/omnichannel-chat-widget 1.5.0 → 1.5.1-main.6b98130

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 (84) hide show
  1. package/lib/cjs/common/Constants.js +19 -8
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +1 -2
  3. package/lib/cjs/common/utils.js +2 -1
  4. package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +31 -16
  5. package/lib/cjs/components/livechatwidget/common/endChat.js +16 -4
  6. package/lib/cjs/components/livechatwidget/common/startChat.js +19 -80
  7. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +219 -0
  8. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.spec.js +300 -0
  9. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +18 -16
  10. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  11. package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +82 -0
  12. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +17 -0
  13. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +17 -0
  14. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +15 -0
  15. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +17 -0
  16. package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +17 -0
  17. package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
  18. package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
  19. package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
  20. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -11
  21. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +1 -1
  22. package/lib/cjs/contexts/common/ConversationState.js +1 -0
  23. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +37 -36
  24. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
  25. package/lib/cjs/contexts/common/StartChatFailureType.js +13 -0
  26. package/lib/cjs/contexts/createReducer.js +8 -0
  27. package/lib/cjs/controller/componentController.js +5 -1
  28. package/lib/esm/common/Constants.js +15 -6
  29. package/lib/esm/common/telemetry/TelemetryConstants.js +1 -2
  30. package/lib/esm/common/utils.js +3 -2
  31. package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +31 -16
  32. package/lib/esm/components/livechatwidget/common/endChat.js +14 -3
  33. package/lib/esm/components/livechatwidget/common/startChat.js +20 -81
  34. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +212 -0
  35. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.spec.js +298 -0
  36. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +20 -18
  37. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  38. package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +71 -0
  39. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +10 -0
  40. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +10 -0
  41. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +8 -0
  42. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +10 -0
  43. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +10 -0
  44. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
  45. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
  46. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
  47. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -11
  48. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +1 -1
  49. package/lib/esm/contexts/common/ConversationState.js +1 -0
  50. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +37 -36
  51. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
  52. package/lib/esm/contexts/common/StartChatFailureType.js +6 -0
  53. package/lib/esm/contexts/createReducer.js +8 -0
  54. package/lib/esm/controller/componentController.js +3 -0
  55. package/lib/types/common/Constants.d.ts +17 -4
  56. package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -1
  57. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
  58. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +5 -0
  59. package/lib/types/components/livechatwidget/common/startChatErrorHandler.spec.d.ts +1 -0
  60. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  61. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
  62. package/lib/types/components/startchaterrorpanestateful/StartChatErrorPaneStateful.d.ts +3 -0
  63. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.d.ts +2 -0
  64. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.d.ts +2 -0
  65. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.d.ts +2 -0
  66. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.d.ts +2 -0
  67. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.d.ts +2 -0
  68. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.d.ts +5 -0
  69. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.d.ts +6 -0
  70. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +14 -0
  71. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +8 -0
  72. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.d.ts +10 -0
  73. package/lib/types/contexts/common/ConversationState.d.ts +2 -1
  74. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -0
  75. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +37 -36
  76. package/lib/types/contexts/common/StartChatFailureType.d.ts +5 -0
  77. package/lib/types/controller/componentController.d.ts +1 -0
  78. package/package.json +3 -3
  79. package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +0 -4
  80. package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +0 -4
  81. /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
  82. /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
  83. /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
  84. /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
@@ -0,0 +1,212 @@
1
+ import { ChatSDKErrorName, ChatSDKError } from "@microsoft/omnichannel-chat-sdk";
2
+ import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
4
+ import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
5
+ import { ConversationState } from "../../../contexts/common/ConversationState";
6
+ import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
7
+ import { callingStateCleanUp, endChatStateCleanUp, closeChatStateCleanUp, chatSDKStateCleanUp } from "./endChat";
8
+ import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
9
+ import { getWidgetCacheIdfromProps } from "../../../common/utils";
10
+ import { WidgetLoadCustomErrorString, WidgetLoadTelemetryMessage } from "../../../common/Constants";
11
+ import { StartChatFailureType } from "../../../contexts/common/StartChatFailureType";
12
+
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ export const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSuccessful) => {
15
+ var _props$controlProps;
16
+ if (!ex) {
17
+ logWidgetLoadFailed();
18
+ return;
19
+ }
20
+
21
+ // Handle internal or misc errors
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) {
30
+ logWidgetLoadCompleteWithError(ex);
31
+ }
32
+
33
+ // Handle ChatSDK errors
34
+ if (ex instanceof ChatSDKError) {
35
+ switch (ex.message) {
36
+ case ChatSDKErrorName.WidgetUseOutsideOperatingHour:
37
+ handleWidgetUseOutsideOperatingHour(dispatch);
38
+ return;
39
+ case ChatSDKErrorName.PersistentChatConversationRetrievalFailure:
40
+ handlePersistentChatConversationRetrievalFailure(ex);
41
+ break;
42
+ case ChatSDKErrorName.ConversationInitializationFailure:
43
+ handleConversationInitializationFailure(ex);
44
+ break;
45
+ case ChatSDKErrorName.ChatTokenRetrievalFailure:
46
+ handleChatTokenRetrievalFailure(dispatch, ex);
47
+ break;
48
+ case ChatSDKErrorName.UninitializedChatSDK:
49
+ handleUninitializedChatSDK(ex);
50
+ break;
51
+ case ChatSDKErrorName.InvalidConversation:
52
+ case ChatSDKErrorName.ClosedConversation:
53
+ handleInvalidOrClosedConversation(dispatch, chatSDK, props, ex);
54
+ return;
55
+ default:
56
+ logWidgetLoadFailed(ex);
57
+ }
58
+ }
59
+
60
+ // Show the error UI pane
61
+ dispatch({
62
+ type: LiveChatWidgetActionType.SET_START_CHAT_FAILING,
63
+ payload: true
64
+ });
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
67
+ // Set app state to failing start chat if hideErrorUI is not turned on
68
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
69
+ Event: TelemetryEvent.ErrorUIPaneLoaded,
70
+ Description: "Error UI Pane Loaded"
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
+ });
83
+ }
84
+
85
+ // If sessionInit was successful but LCW startchat failed due to some reason e.g adapter didn't load
86
+ // we need to directly endChat to avoid leaving ghost chats in OC, not disturbing any other UI state
87
+ if (isStartChatSuccessful === true) {
88
+ forceEndChat(chatSDK);
89
+ }
90
+ };
91
+ const logWidgetLoadFailed = ex => {
92
+ var _TelemetryTimers$Widg;
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
+ const exDetails = {
95
+ Exception: `Widget load complete with error: ${ex}`
96
+ };
97
+ if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
98
+ exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
99
+ }
100
+ TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
101
+ Event: TelemetryEvent.WidgetLoadFailed,
102
+ ExceptionDetails: exDetails,
103
+ ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg === void 0 ? void 0 : _TelemetryTimers$Widg.milliSecondsElapsed
104
+ });
105
+ };
106
+ export const logWidgetLoadComplete = additionalMessage => {
107
+ var _TelemetryTimers$Widg2;
108
+ let descriptionString = "Widget load complete";
109
+ if (additionalMessage) {
110
+ descriptionString += `. ${additionalMessage}`;
111
+ }
112
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
113
+ Event: TelemetryEvent.WidgetLoadComplete,
114
+ Description: descriptionString,
115
+ ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg2 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg2 === void 0 ? void 0 : _TelemetryTimers$Widg2.milliSecondsElapsed
116
+ });
117
+ };
118
+ const logWidgetLoadCompleteWithError = ex => {
119
+ var _TelemetryTimers$Widg3;
120
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
121
+ const exDetails = {
122
+ Exception: `Widget load complete with error: ${ex}`
123
+ };
124
+ if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
125
+ exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
126
+ }
127
+ TelemetryHelper.logLoadingEvent(LogLevel.WARN, {
128
+ Event: TelemetryEvent.WidgetLoadComplete,
129
+ Description: "Widget load complete with error",
130
+ ExceptionDetails: exDetails,
131
+ ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
132
+ });
133
+ };
134
+
135
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
136
+ const forceEndChat = chatSDK => {
137
+ TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
138
+ Event: TelemetryEvent.WidgetLoadFailed,
139
+ ExceptionDetails: {
140
+ Exception: "SessionInit was successful, but widget load failed."
141
+ }
142
+ });
143
+ chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat();
144
+ };
145
+ const handleWidgetUseOutsideOperatingHour = dispatch => {
146
+ dispatch({
147
+ type: LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS,
148
+ payload: true
149
+ });
150
+ dispatch({
151
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
152
+ payload: ConversationState.OutOfOffice
153
+ });
154
+ logWidgetLoadComplete(WidgetLoadTelemetryMessage.OOOHMessage);
155
+ };
156
+
157
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
158
+ const handlePersistentChatConversationRetrievalFailure = ex => {
159
+ if (ex.httpResponseStatusCode === 400) {
160
+ logWidgetLoadFailed(ex);
161
+ } else {
162
+ logWidgetLoadCompleteWithError(ex);
163
+ }
164
+ };
165
+
166
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
167
+ const handleConversationInitializationFailure = ex => {
168
+ if (ex.httpResponseStatusCode === 400) {
169
+ logWidgetLoadFailed(ex);
170
+ } else {
171
+ logWidgetLoadCompleteWithError(ex);
172
+ }
173
+ };
174
+
175
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
176
+ const handleChatTokenRetrievalFailure = (dispatch, ex) => {
177
+ if (ex.httpResponseStatusCode === 400) {
178
+ logWidgetLoadFailed(ex);
179
+ } else {
180
+ if (ex.httpResponseStatusCode === 401) {
181
+ dispatch({
182
+ type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
183
+ payload: StartChatFailureType.Unauthorized
184
+ });
185
+ }
186
+ logWidgetLoadCompleteWithError(ex);
187
+ }
188
+ };
189
+
190
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
191
+ const handleUninitializedChatSDK = ex => {
192
+ logWidgetLoadCompleteWithError(ex);
193
+ };
194
+
195
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
196
+ const handleInvalidOrClosedConversation = (dispatch, chatSDK, props, ex) => {
197
+ var _DataStoreManager$cli;
198
+ logWidgetLoadCompleteWithError(ex);
199
+
200
+ // Reset all internal states
201
+ callingStateCleanUp(dispatch);
202
+ endChatStateCleanUp(dispatch);
203
+ closeChatStateCleanUp(dispatch);
204
+ chatSDKStateCleanUp(chatSDK);
205
+ (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(getWidgetCacheIdfromProps(props));
206
+
207
+ // Starts new chat
208
+ dispatch({
209
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
210
+ payload: ConversationState.Closed
211
+ });
212
+ };
@@ -0,0 +1,298 @@
1
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
2
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
3
+ import { handleStartChatError } from "./startChatErrorHandler";
4
+ import { WidgetLoadCustomErrorString, WidgetLoadTelemetryMessage } from "../../../common/Constants";
5
+ import { ChatSDKError, ChatSDKErrorName } from "@microsoft/omnichannel-chat-sdk";
6
+ import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
7
+ import { ConversationState } from "../../../contexts/common/ConversationState";
8
+ describe("startChatErrorHandler unit test", () => {
9
+ it("handleStartChatError should log failed event and return if exception is undefined", () => {
10
+ const dispatch = jest.fn();
11
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
12
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
13
+ handleStartChatError(dispatch, {}, {}, undefined, false);
14
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(1);
15
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("ERROR", expect.objectContaining({
16
+ ExceptionDetails: expect.objectContaining({
17
+ Exception: "Widget load complete with error: undefined"
18
+ })
19
+ }));
20
+ expect(dispatch).not.toHaveBeenCalled();
21
+ });
22
+ it("handleStartChatError should log failed with error event for AuthenticationFailedErrorString", () => {
23
+ const dispatch = jest.fn();
24
+ const mockEx = new Error(WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
25
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
26
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
27
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
28
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
29
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
30
+ ExceptionDetails: expect.objectContaining({
31
+ Exception: `Widget load complete with error: Error: ${WidgetLoadCustomErrorString.AuthenticationFailedErrorString}`
32
+ })
33
+ }));
34
+ expect(dispatch).toHaveBeenCalledTimes(3);
35
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
36
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
37
+ }));
38
+ });
39
+ it("handleStartChatError should log failed with error event for NetworkErrorString", () => {
40
+ const dispatch = jest.fn();
41
+ const mockEx = new Error(WidgetLoadCustomErrorString.NetworkErrorString);
42
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
43
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
44
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
45
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
46
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
47
+ ExceptionDetails: expect.objectContaining({
48
+ Exception: `Widget load complete with error: Error: ${WidgetLoadCustomErrorString.NetworkErrorString}`
49
+ })
50
+ }));
51
+ expect(dispatch).toHaveBeenCalledTimes(2);
52
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
53
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
54
+ }));
55
+ });
56
+ it("handleStartChatError should log complete event for WidgetUseOutsideOperatingHour", () => {
57
+ const dispatch = jest.fn();
58
+ const mockEx = new ChatSDKError(ChatSDKErrorName.WidgetUseOutsideOperatingHour);
59
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
60
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
61
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
62
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(1);
63
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("INFO", expect.objectContaining({
64
+ Description: `Widget load complete. ${WidgetLoadTelemetryMessage.OOOHMessage}`
65
+ }));
66
+ expect(dispatch).toHaveBeenCalledTimes(2);
67
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
68
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
69
+ }));
70
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
71
+ type: LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS
72
+ }));
73
+ });
74
+ it("handleStartChatError should log failed with error event for PersistentChatConversationRetrievalFailure for non-400 status", () => {
75
+ const dispatch = jest.fn();
76
+ const mockEx = new ChatSDKError(ChatSDKErrorName.PersistentChatConversationRetrievalFailure, 429);
77
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
78
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
79
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
80
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
81
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
82
+ Description: "Widget load complete with error",
83
+ ExceptionDetails: expect.objectContaining({
84
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.PersistentChatConversationRetrievalFailure}`,
85
+ HttpResponseStatusCode: 429
86
+ })
87
+ }));
88
+ expect(dispatch).toHaveBeenCalledTimes(2);
89
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
90
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
91
+ }));
92
+ });
93
+ it("handleStartChatError should log failed event for PersistentChatConversationRetrievalFailure for 400 status", () => {
94
+ const dispatch = jest.fn();
95
+ const mockEx = new ChatSDKError(ChatSDKErrorName.PersistentChatConversationRetrievalFailure, 400);
96
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
97
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
98
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
99
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
100
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("ERROR", expect.objectContaining({
101
+ ExceptionDetails: expect.objectContaining({
102
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.PersistentChatConversationRetrievalFailure}`,
103
+ HttpResponseStatusCode: 400
104
+ })
105
+ }));
106
+ expect(dispatch).toHaveBeenCalledTimes(2);
107
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
108
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
109
+ }));
110
+ });
111
+ it("handleStartChatError should log failed with error event for ConversationInitializationFailure for non-400 status", () => {
112
+ const dispatch = jest.fn();
113
+ const mockEx = new ChatSDKError(ChatSDKErrorName.ConversationInitializationFailure, 429);
114
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
115
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
116
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
117
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
118
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
119
+ Description: "Widget load complete with error",
120
+ ExceptionDetails: expect.objectContaining({
121
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.ConversationInitializationFailure}`,
122
+ HttpResponseStatusCode: 429
123
+ })
124
+ }));
125
+ expect(dispatch).toHaveBeenCalledTimes(2);
126
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
127
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
128
+ }));
129
+ });
130
+ it("handleStartChatError should log failed event for ConversationInitializationFailure for 400 status", () => {
131
+ const dispatch = jest.fn();
132
+ const mockEx = new ChatSDKError(ChatSDKErrorName.ConversationInitializationFailure, 400);
133
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
134
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
135
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
136
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
137
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("ERROR", expect.objectContaining({
138
+ ExceptionDetails: expect.objectContaining({
139
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.ConversationInitializationFailure}`,
140
+ HttpResponseStatusCode: 400
141
+ })
142
+ }));
143
+ expect(dispatch).toHaveBeenCalledTimes(2);
144
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
145
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
146
+ }));
147
+ });
148
+ it("handleStartChatError should log failed with error event for ChatTokenRetrievalFailure for non-400 status", () => {
149
+ const dispatch = jest.fn();
150
+ const mockEx = new ChatSDKError(ChatSDKErrorName.ChatTokenRetrievalFailure, 429);
151
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
152
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
153
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
154
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
155
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
156
+ Description: "Widget load complete with error",
157
+ ExceptionDetails: expect.objectContaining({
158
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.ChatTokenRetrievalFailure}`,
159
+ HttpResponseStatusCode: 429
160
+ })
161
+ }));
162
+ expect(dispatch).toHaveBeenCalledTimes(2);
163
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
164
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
165
+ }));
166
+ });
167
+ it("handleStartChatError should log failed event for ChatTokenRetrievalFailure for 400 status", () => {
168
+ const dispatch = jest.fn();
169
+ const mockEx = new ChatSDKError(ChatSDKErrorName.ChatTokenRetrievalFailure, 400);
170
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
171
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
172
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
173
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
174
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("ERROR", expect.objectContaining({
175
+ ExceptionDetails: expect.objectContaining({
176
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.ChatTokenRetrievalFailure}`,
177
+ HttpResponseStatusCode: 400
178
+ })
179
+ }));
180
+ expect(dispatch).toHaveBeenCalledTimes(2);
181
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
182
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
183
+ }));
184
+ });
185
+ it("handleStartChatError should log failed with error event for ChatTokenRetrievalFailure for 401 status", () => {
186
+ const dispatch = jest.fn();
187
+ const mockEx = new ChatSDKError(ChatSDKErrorName.ChatTokenRetrievalFailure, 401);
188
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
189
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
190
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
191
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
192
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
193
+ ExceptionDetails: expect.objectContaining({
194
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.ChatTokenRetrievalFailure}`,
195
+ HttpResponseStatusCode: 401
196
+ })
197
+ }));
198
+ expect(dispatch).toHaveBeenCalledTimes(3);
199
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
200
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
201
+ }));
202
+ });
203
+ it("handleStartChatError should log failed with error event for UninitializedChatSDK", () => {
204
+ const dispatch = jest.fn();
205
+ const mockEx = new ChatSDKError(ChatSDKErrorName.UninitializedChatSDK);
206
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
207
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
208
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
209
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
210
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
211
+ Description: "Widget load complete with error",
212
+ ExceptionDetails: expect.objectContaining({
213
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.UninitializedChatSDK}`
214
+ })
215
+ }));
216
+ expect(dispatch).toHaveBeenCalledTimes(2);
217
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
218
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
219
+ }));
220
+ });
221
+ it("handleStartChatError should log failed with error event for InvalidConversation", () => {
222
+ const dispatch = jest.fn();
223
+ const mockEx = new ChatSDKError(ChatSDKErrorName.InvalidConversation);
224
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
225
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
226
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
227
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(1);
228
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
229
+ Description: "Widget load complete with error",
230
+ ExceptionDetails: expect.objectContaining({
231
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.InvalidConversation}`
232
+ })
233
+ }));
234
+ expect(dispatch).toHaveBeenCalledTimes(16);
235
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
236
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
237
+ payload: ConversationState.Closed
238
+ }));
239
+ });
240
+ it("handleStartChatError should log failed with error event for ClosedConversation", () => {
241
+ const dispatch = jest.fn();
242
+ const mockEx = new ChatSDKError(ChatSDKErrorName.ClosedConversation);
243
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
244
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
245
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
246
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(1);
247
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("WARN", expect.objectContaining({
248
+ Description: "Widget load complete with error",
249
+ ExceptionDetails: expect.objectContaining({
250
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.ClosedConversation}`
251
+ })
252
+ }));
253
+ expect(dispatch).toHaveBeenCalledTimes(16);
254
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
255
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
256
+ payload: ConversationState.Closed
257
+ }));
258
+ });
259
+ it("handleStartChatError should log failed event for any other errors", () => {
260
+ const dispatch = jest.fn();
261
+ const mockEx = new ChatSDKError(ChatSDKErrorName.ScriptLoadFailure, 405);
262
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
263
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
264
+ handleStartChatError(dispatch, {}, {}, mockEx, false);
265
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(2);
266
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("ERROR", expect.objectContaining({
267
+ ExceptionDetails: expect.objectContaining({
268
+ Exception: `Widget load complete with error: ${ChatSDKErrorName.ScriptLoadFailure}`,
269
+ HttpResponseStatusCode: 405
270
+ })
271
+ }));
272
+ expect(dispatch).toHaveBeenCalledTimes(2);
273
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
274
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
275
+ }));
276
+ });
277
+ it("handleStartChatError should force end chat if isStartChatSuccessful is true", () => {
278
+ const dispatch = jest.fn();
279
+ const mockEx = new ChatSDKError(ChatSDKErrorName.ScriptLoadFailure, 405);
280
+ const mockSDK = {
281
+ endChat: jest.fn()
282
+ };
283
+ spyOn(BroadcastService, "postMessage").and.callFake(() => false);
284
+ spyOn(TelemetryHelper, "logLoadingEvent").and.callFake(() => false);
285
+ handleStartChatError(dispatch, mockSDK, {}, mockEx, true);
286
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledTimes(3);
287
+ expect(TelemetryHelper.logLoadingEvent).toHaveBeenCalledWith("ERROR", expect.objectContaining({
288
+ ExceptionDetails: expect.objectContaining({
289
+ Exception: "SessionInit was successful, but widget load failed."
290
+ })
291
+ }));
292
+ expect(dispatch).toHaveBeenCalledTimes(2);
293
+ expect(dispatch).toHaveBeenCalledWith(expect.objectContaining({
294
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE
295
+ }));
296
+ expect(mockSDK.endChat).toHaveBeenCalled();
297
+ });
298
+ });
@@ -8,9 +8,9 @@ import React, { useEffect, useRef, useState } from "react";
8
8
  import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
9
9
  import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString, isNullOrUndefined, isUndefinedOrEmpty } from "../../../common/utils";
10
10
  import { defaultClientDataStoreProvider, isCookieAllowed } from "../../../common/storage/default/defaultClientDataStoreProvider";
11
- import { endChat, endChatStateCleanUp, prepareEndChat } from "../common/endChat";
11
+ import { chatSDKStateCleanUp, endChat, endChatStateCleanUp, prepareEndChat } from "../common/endChat";
12
12
  import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "../common/reconnectChatHelper";
13
- import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
13
+ import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowStartChatErrorPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
14
14
  import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
15
15
  import CallingContainerStateful from "../../callingcontainerstateful/CallingContainerStateful";
16
16
  import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
@@ -51,9 +51,10 @@ import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
51
51
  import useChatContextStore from "../../../hooks/useChatContextStore";
52
52
  import useChatSDKStore from "../../../hooks/useChatSDKStore";
53
53
  import { defaultAdaptiveCardStyles } from "../../webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles";
54
- import { uuidv4 } from "@microsoft/omnichannel-chat-sdk";
54
+ import StartChatErrorPaneStateful from "../../startchaterrorpanestateful/StartChatErrorPaneStateful";
55
+ import { StartChatFailureType } from "../../../contexts/common/StartChatFailureType";
55
56
  export const LiveChatWidgetStateful = props => {
56
- 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$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
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();
58
59
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
60
  const [adapter, setAdapter] = useChatAdapterStore();
@@ -186,6 +187,14 @@ export const LiveChatWidgetStateful = props => {
186
187
  };
187
188
  useEffect(() => {
188
189
  var _props$controlProps5, _props$controlProps6, _props$controlProps7, _props$chatConfig, _props$chatConfig$Liv, _props$controlProps9, _props$chatConfig2, _props$chatConfig2$Ch, _state$appStates5;
190
+ dispatch({
191
+ type: LiveChatWidgetActionType.SET_START_CHAT_FAILING,
192
+ payload: false
193
+ });
194
+ dispatch({
195
+ type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
196
+ payload: StartChatFailureType.Generic
197
+ });
189
198
  state.domainStates.confirmationPaneConfirmedOptionClicked = false;
190
199
  state.domainStates.confirmationState = ConfirmationState.NotSet;
191
200
  setupClientDataStore();
@@ -425,12 +434,7 @@ export const LiveChatWidgetStateful = props => {
425
434
  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) {
426
435
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
427
436
  endChatStateCleanUp(dispatch);
428
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
429
- chatSDK.requestId = uuidv4();
430
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
431
- chatSDK.chatToken = {};
432
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
433
- chatSDK.reconnectId = null;
437
+ chatSDKStateCleanUp(chatSDK);
434
438
  return;
435
439
  }
436
440
  });
@@ -608,9 +612,7 @@ export const LiveChatWidgetStateful = props => {
608
612
 
609
613
  // Handle Chat disconnect cases
610
614
  useEffect(() => {
611
- if (state.appStates.chatDisconnectEventReceived) {
612
- handleChatDisconnect(props, state, setWebChatStyles);
613
- }
615
+ handleChatDisconnect(props, state, setWebChatStyles);
614
616
  }, [state.appStates.chatDisconnectEventReceived]);
615
617
  const initiateEndChatOnBrowserUnload = () => {
616
618
  var _DataStoreManager$cli;
@@ -707,17 +709,17 @@ export const LiveChatWidgetStateful = props => {
707
709
  }, headerDraggableConfig))), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, {
708
710
  loadingPaneProps: livechatProps.loadingPaneProps,
709
711
  startChatErrorPaneProps: livechatProps.startChatErrorPaneProps
710
- })), !((_livechatProps$contro6 = livechatProps.controlProps) !== null && _livechatProps$contro6 !== void 0 && _livechatProps$contro6.hideOutOfOfficeHoursPane) && shouldShowOutOfOfficeHoursPane(state) && (decodeComponentString((_livechatProps$compon5 = livechatProps.componentOverrides) === null || _livechatProps$compon5 === void 0 ? void 0 : _livechatProps$compon5.outOfOfficeHoursPane) || /*#__PURE__*/React.createElement(OutOfOfficeHoursPaneStateful, livechatProps.outOfOfficeHoursPaneProps)), !((_livechatProps$contro7 = livechatProps.controlProps) !== null && _livechatProps$contro7 !== void 0 && _livechatProps$contro7.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_livechatProps$compon6 = livechatProps.componentOverrides) === null || _livechatProps$compon6 === void 0 ? void 0 : _livechatProps$compon6.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
712
+ })), !((_livechatProps$contro6 = livechatProps.controlProps) !== null && _livechatProps$contro6 !== void 0 && _livechatProps$contro6.hideErrorUIPane) && shouldShowStartChatErrorPane(state) && (decodeComponentString((_livechatProps$compon5 = livechatProps.componentOverrides) === null || _livechatProps$compon5 === void 0 ? void 0 : _livechatProps$compon5.startChatErrorPane) || /*#__PURE__*/React.createElement(StartChatErrorPaneStateful, livechatProps.startChatErrorPaneProps)), !((_livechatProps$contro7 = livechatProps.controlProps) !== null && _livechatProps$contro7 !== void 0 && _livechatProps$contro7.hideOutOfOfficeHoursPane) && shouldShowOutOfOfficeHoursPane(state) && (decodeComponentString((_livechatProps$compon6 = livechatProps.componentOverrides) === null || _livechatProps$compon6 === void 0 ? void 0 : _livechatProps$compon6.outOfOfficeHoursPane) || /*#__PURE__*/React.createElement(OutOfOfficeHoursPaneStateful, livechatProps.outOfOfficeHoursPaneProps)), !((_livechatProps$contro8 = livechatProps.controlProps) !== null && _livechatProps$contro8 !== void 0 && _livechatProps$contro8.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_livechatProps$compon7 = livechatProps.componentOverrides) === null || _livechatProps$compon7 === void 0 ? void 0 : _livechatProps$compon7.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
711
713
  reconnectChatProps: livechatProps.reconnectChatPaneProps,
712
714
  initStartChat: initStartChatRelay
713
- })), !((_livechatProps$contro8 = livechatProps.controlProps) !== null && _livechatProps$contro8 !== void 0 && _livechatProps$contro8.hidePreChatSurveyPane) && shouldShowPreChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon7 = livechatProps.componentOverrides) === null || _livechatProps$compon7 === void 0 ? void 0 : _livechatProps$compon7.preChatSurveyPane) || /*#__PURE__*/React.createElement(PreChatSurveyPaneStateful, {
715
+ })), !((_livechatProps$contro9 = livechatProps.controlProps) !== null && _livechatProps$contro9 !== void 0 && _livechatProps$contro9.hidePreChatSurveyPane) && shouldShowPreChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon8 = livechatProps.componentOverrides) === null || _livechatProps$compon8 === void 0 ? void 0 : _livechatProps$compon8.preChatSurveyPane) || /*#__PURE__*/React.createElement(PreChatSurveyPaneStateful, {
714
716
  surveyProps: livechatProps.preChatSurveyPaneProps,
715
717
  initStartChat: initStartChatRelay
716
- })), !((_livechatProps$contro9 = livechatProps.controlProps) !== null && _livechatProps$contro9 !== void 0 && _livechatProps$contro9.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
718
+ })), !((_livechatProps$contro10 = livechatProps.controlProps) !== null && _livechatProps$contro10 !== void 0 && _livechatProps$contro10.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
717
719
  voiceVideoCallingSdk: voiceVideoCallingSDK
718
- }, livechatProps.callingContainerProps)), !((_livechatProps$contro10 = livechatProps.controlProps) !== null && _livechatProps$contro10 !== void 0 && _livechatProps$contro10.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon8 = livechatProps.componentOverrides) === null || _livechatProps$compon8 === void 0 ? void 0 : _livechatProps$compon8.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
720
+ }, livechatProps.callingContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps)), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
719
721
  setPostChatContext: setPostChatContextRelay,
720
722
  prepareEndChat: prepareEndChatRelay
721
- }))), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane))))));
723
+ }))), !((_livechatProps$contro13 = livechatProps.controlProps) !== null && _livechatProps$contro13 !== void 0 && _livechatProps$contro13.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon13 = livechatProps.componentOverrides) === null || _livechatProps$compon13 === void 0 ? void 0 : _livechatProps$compon13.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane))))));
722
724
  };
723
725
  export default LiveChatWidgetStateful;
@@ -3,10 +3,10 @@ import React, { useEffect } from "react";
3
3
  import { LoadingPane } from "@microsoft/omnichannel-chat-components";
4
4
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
5
5
  import { defaultGeneralLoadingPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralLoadingPaneStyleProps";
6
- import { errorUILoadingPaneStyleProps } from "./common/errorUIStyleProps/errorUILoadingPaneStyleProps";
7
6
  import { findAllFocusableElement } from "../../common/utils";
8
7
  import useChatContextStore from "../../hooks/useChatContextStore";
9
8
  import useWindowDimensions from "../../hooks/useWindowDimensions";
9
+ import { errorUILoadingPaneStyleProps } from "./common/errorUIStyleProps/errorUILoadingPaneStyleProps";
10
10
 
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  export const LoadingPaneStateful = props => {