@microsoft/omnichannel-chat-widget 1.5.1-main.76c6a71 → 1.5.1-main.7897747

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/lib/cjs/common/Constants.js +31 -8
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +3 -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 +41 -7
  6. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -4
  7. package/lib/cjs/components/livechatwidget/common/startChat.js +16 -84
  8. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +220 -0
  9. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +52 -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/contexts/common/ConversationState.js +1 -0
  22. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +37 -36
  23. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
  24. package/lib/cjs/contexts/common/StartChatFailureType.js +13 -0
  25. package/lib/cjs/contexts/createReducer.js +8 -0
  26. package/lib/cjs/controller/componentController.js +5 -1
  27. package/lib/esm/common/Constants.js +26 -6
  28. package/lib/esm/common/telemetry/TelemetryConstants.js +3 -2
  29. package/lib/esm/common/utils.js +3 -2
  30. package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +31 -16
  31. package/lib/esm/components/livechatwidget/common/endChat.js +40 -7
  32. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -4
  33. package/lib/esm/components/livechatwidget/common/startChat.js +17 -85
  34. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +213 -0
  35. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +55 -19
  36. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  37. package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +71 -0
  38. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +10 -0
  39. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +10 -0
  40. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +8 -0
  41. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +10 -0
  42. package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +10 -0
  43. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
  44. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
  45. package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
  46. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -11
  47. package/lib/esm/contexts/common/ConversationState.js +1 -0
  48. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +37 -36
  49. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
  50. package/lib/esm/contexts/common/StartChatFailureType.js +6 -0
  51. package/lib/esm/contexts/createReducer.js +8 -0
  52. package/lib/esm/controller/componentController.js +3 -0
  53. package/lib/types/common/Constants.d.ts +29 -4
  54. package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -1
  55. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
  56. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +5 -0
  57. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  58. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
  59. package/lib/types/components/startchaterrorpanestateful/StartChatErrorPaneStateful.d.ts +3 -0
  60. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.d.ts +2 -0
  61. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.d.ts +2 -0
  62. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.d.ts +2 -0
  63. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.d.ts +2 -0
  64. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.d.ts +2 -0
  65. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.d.ts +5 -0
  66. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.d.ts +6 -0
  67. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +14 -0
  68. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +8 -0
  69. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.d.ts +10 -0
  70. package/lib/types/contexts/common/ConversationState.d.ts +2 -1
  71. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -0
  72. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +37 -36
  73. package/lib/types/contexts/common/StartChatFailureType.d.ts +5 -0
  74. package/lib/types/controller/componentController.d.ts +1 -0
  75. package/package.json +5 -5
  76. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -71
  77. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -56
  78. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -190
  79. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -82
  80. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -342
  81. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -69
  82. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -54
  83. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -188
  84. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -80
  85. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -338
  86. package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.d.ts +0 -1
  87. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.d.ts +0 -1
  88. package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +0 -4
  89. package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +0 -4
  90. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.d.ts +0 -1
  91. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +0 -1
  92. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.d.ts +0 -1
  93. /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
  94. /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
  95. /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
  96. /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
@@ -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
  };
@@ -174,11 +174,6 @@ export let ElementType;
174
174
  (function (ElementType) {
175
175
  ElementType["CallingContainerSDK"] = "CallingContainerSDK";
176
176
  })(ElementType || (ElementType = {}));
177
- export let ChatSDKError;
178
- (function (ChatSDKError) {
179
- ChatSDKError["WidgetUseOutsideOperatingHour"] = "WidgetUseOutsideOperatingHour";
180
- ChatSDKError["AuthContactIdNotFoundFailure"] = "AuthContactIdNotFoundFailure";
181
- })(ChatSDKError || (ChatSDKError = {}));
182
177
  export let EnvironmentVersion;
183
178
  (function (EnvironmentVersion) {
184
179
  EnvironmentVersion["prod"] = "prod";
@@ -252,6 +247,14 @@ _defineProperty(NotificationPaneConstants, "IconText", "Notification Icon");
252
247
  _defineProperty(NotificationPaneConstants, "ChatDisconnectTitleText", "Chat disconnected");
253
248
  _defineProperty(NotificationPaneConstants, "ChatDisconnectSubtitleText", "For additional assistance, please close the chat and try again.");
254
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");
255
258
  export class AriaTelemetryConstants {}
256
259
  // Aria Endpoint for different environment types.
257
260
  _defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
@@ -265,4 +268,21 @@ _defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
265
268
  _defineProperty(AriaTelemetryConstants, "Public", "Public");
266
269
  _defineProperty(AriaTelemetryConstants, "EU", "Europe");
267
270
  // EUR: crm4; FRA: crm12; GER: crm16; CHE: crm17; NOR: crm19
268
- _defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
271
+ _defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
272
+ export class WidgetLoadTelemetryMessage {}
273
+ _defineProperty(WidgetLoadTelemetryMessage, "OOOHMessage", "Widget is OOOH");
274
+ _defineProperty(WidgetLoadTelemetryMessage, "PersistedStateRetrievedMessage", "Persisted state retrieved");
275
+ export class WidgetLoadCustomErrorString {}
276
+ _defineProperty(WidgetLoadCustomErrorString, "AuthenticationFailedErrorString", "Authentication was not successful");
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";
@@ -127,10 +128,10 @@ export let TelemetryEvent;
127
128
  TelemetryEvent["ErrorUIPaneLoaded"] = "ErrorUIPaneLoaded";
128
129
  TelemetryEvent["DownloadTranscriptFailed"] = "DownloadTranscriptFailed";
129
130
  TelemetryEvent["StartChatFailed"] = "StartChatFailed";
130
- TelemetryEvent["IC3ThreadUpdateEventReceived"] = "IC3ThreadUpdateEventReceived";
131
131
  TelemetryEvent["ConfirmationCancelButtonClicked"] = "ConfirmationCancelButtonClicked";
132
132
  TelemetryEvent["ConfirmationConfirmButtonClicked"] = "ConfirmationConfirmButtonClicked";
133
133
  TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
134
+ TelemetryEvent["StartChatErrorPaneLoaded"] = "StartChatErrorPaneLoaded";
134
135
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
135
136
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
136
137
  TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
@@ -244,7 +245,6 @@ export class TelemetryConstants {
244
245
  case TelemetryEvent.EmailTranscriptSent:
245
246
  case TelemetryEvent.EmailTranscriptFailed:
246
247
  case TelemetryEvent.DownloadTranscriptFailed:
247
- case TelemetryEvent.IC3ThreadUpdateEventReceived:
248
248
  case TelemetryEvent.ConfirmationCancelButtonClicked:
249
249
  case TelemetryEvent.ConfirmationConfirmButtonClicked:
250
250
  case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
@@ -285,6 +285,7 @@ export class TelemetryConstants {
285
285
  case TelemetryEvent.PostChatContextCallFailed:
286
286
  case TelemetryEvent.PostChatContextCallSucceed:
287
287
  case TelemetryEvent.GetConversationDetailsException:
288
+ case TelemetryEvent.PrepareEndChat:
288
289
  return ScenarioType.SDK;
289
290
  case TelemetryEvent.VideoCallAcceptButtonClick:
290
291
  case TelemetryEvent.CallAdded:
@@ -1,11 +1,12 @@
1
1
  var _this = this;
2
- import { AriaTelemetryConstants, ChatSDKError, Constants, HtmlAttributeNames, LocaleConstants } from "./Constants";
2
+ import { AriaTelemetryConstants, Constants, HtmlAttributeNames, LocaleConstants } from "./Constants";
3
3
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "./telemetry/TelemetryConstants";
4
4
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
5
5
  import { DataStoreManager } from "./contextDataStore/DataStoreManager";
6
6
  import { KeyCodes } from "./KeyCodes";
7
7
  import { Md5 } from "md5-typescript";
8
8
  import { TelemetryHelper } from "./telemetry/TelemetryHelper";
9
+ import { ChatSDKErrorName } from "@microsoft/omnichannel-chat-sdk";
9
10
  const getElementBySelector = selector => {
10
11
  let element;
11
12
  if (typeof selector === "string") {
@@ -373,7 +374,7 @@ export const getConversationDetailsCall = async chatSDK => {
373
374
 
374
375
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
375
376
  export const checkContactIdError = e => {
376
- if ((e === null || e === void 0 ? void 0 : e.message) === ChatSDKError.AuthContactIdNotFoundFailure) {
377
+ if ((e === null || e === void 0 ? void 0 : e.message) === ChatSDKErrorName.AuthContactIdNotFoundFailure) {
377
378
  const contactIdNotFoundErrorEvent = {
378
379
  eventName: BroadcastEvent.ContactIdNotFound,
379
380
  payload: {
@@ -5,23 +5,38 @@ import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryCon
5
5
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
6
6
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
7
  const handleChatDisconnect = (props, state, setWebChatStyles) => {
8
- var _state$appStates;
9
- if (state !== null && state !== void 0 && (_state$appStates = state.appStates) !== null && _state$appStates !== void 0 && _state$appStates.chatDisconnectEventReceived) {
10
- var _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
11
- const chatDisconnectMessage = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_CHAT_DISCONNECT) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT;
12
- if ((props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd) !== false) {
13
- setWebChatStyles(styles => {
14
- return {
15
- ...styles,
16
- hideSendBox: true
17
- };
8
+ var _state$appStates, _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
9
+ const chatDisconnectState = state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.chatDisconnectEventReceived;
10
+ const chatDisconnectMessage = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_CHAT_DISCONNECT) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT;
11
+ const hideSendBoxOnConversationEnd = props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd;
12
+ switch (chatDisconnectState) {
13
+ case true:
14
+ if (hideSendBoxOnConversationEnd !== false) {
15
+ setWebChatStyles(styles => {
16
+ return {
17
+ ...styles,
18
+ hideSendBox: true
19
+ };
20
+ });
21
+ }
22
+ NotificationHandler.notifyWarning(NotificationScenarios.ChatDisconnect, chatDisconnectMessage);
23
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
24
+ Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
25
+ Description: "Chat disconnected due to timeout, left or removed."
18
26
  });
19
- }
20
- NotificationHandler.notifyWarning(NotificationScenarios.ChatDisconnect, chatDisconnectMessage);
21
- TelemetryHelper.logActionEvent(LogLevel.INFO, {
22
- Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
23
- Description: "Chat disconnected due to timeout, left or removed."
24
- });
27
+ break;
28
+ case false:
29
+ if (hideSendBoxOnConversationEnd !== false) {
30
+ setWebChatStyles(styles => {
31
+ return {
32
+ ...styles,
33
+ hideSendBox: false
34
+ };
35
+ });
36
+ }
37
+ break;
38
+ default:
39
+ break;
25
40
  }
26
41
  };
27
42
  export { handleChatDisconnect };
@@ -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";
@@ -10,11 +10,12 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
10
10
  import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
11
11
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
12
12
  import { TelemetryManager } from "../../../common/telemetry/TelemetryManager";
13
+ import { uuidv4 } from "@microsoft/omnichannel-chat-sdk";
13
14
 
14
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
16
  const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter) => {
16
17
  try {
17
- var _conversationDetails$, _state$domainStates;
18
+ var _conversationDetails$, _state$domainStates, _state$appStates3;
18
19
  // Use Case: If call is ongoing, end the call by simulating end call button click
19
20
  endVoiceVideoCallIfOngoing(chatSDK, dispatch);
20
21
  const conversationDetails = await getConversationDetailsCall(chatSDK);
@@ -24,8 +25,13 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
24
25
  var _state$appStates;
25
26
  // If ended by customer, just close chat
26
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
+ });
27
32
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
28
33
  }
34
+
29
35
  // Use Case: If ended by Agent, stay chat in InActive state
30
36
  return;
31
37
  }
@@ -45,6 +51,10 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
45
51
  var _state$appStates2;
46
52
  // For Customer intiated conversations, just close chat widget
47
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
+ });
48
58
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
49
59
  return;
50
60
  }
@@ -56,6 +66,15 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
56
66
  });
57
67
  return;
58
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
+ }
59
78
  endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, true, true);
60
79
 
61
80
  // Initiate post chat render
@@ -74,6 +93,10 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
74
93
 
75
94
  //Close chat widget for any failure in embedded to allow to show start chat button
76
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
+ });
77
100
  await endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
78
101
  }
79
102
  } finally {
@@ -145,7 +168,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
145
168
  });
146
169
  }
147
170
  };
148
- export const callingStateCleanUp = async dispatch => {
171
+ export const callingStateCleanUp = dispatch => {
149
172
  dispatch({
150
173
  type: LiveChatWidgetActionType.SHOW_CALLING_CONTAINER,
151
174
  payload: false
@@ -167,7 +190,7 @@ export const callingStateCleanUp = async dispatch => {
167
190
  payload: true
168
191
  });
169
192
  };
170
- export const endChatStateCleanUp = async dispatch => {
193
+ export const endChatStateCleanUp = dispatch => {
171
194
  // Need to clear these states immediately when chat ended from OC.
172
195
  dispatch({
173
196
  type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
@@ -182,7 +205,7 @@ export const endChatStateCleanUp = async dispatch => {
182
205
  payload: false
183
206
  });
184
207
  };
185
- export const closeChatStateCleanUp = async dispatch => {
208
+ export const closeChatStateCleanUp = dispatch => {
186
209
  dispatch({
187
210
  type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
188
211
  payload: undefined
@@ -218,6 +241,16 @@ export const closeChatStateCleanUp = async dispatch => {
218
241
  });
219
242
  };
220
243
 
244
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
245
+ export const chatSDKStateCleanUp = chatSDK => {
246
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
247
+ chatSDK.requestId = uuidv4();
248
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
249
+ chatSDK.chatToken = {};
250
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
251
+ chatSDK.reconnectId = null;
252
+ };
253
+
221
254
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
222
255
  export const endVoiceVideoCallIfOngoing = async (chatSDK, dispatch) => {
223
256
  let callId = "";
@@ -242,8 +275,8 @@ export const endVoiceVideoCallIfOngoing = async (chatSDK, dispatch) => {
242
275
  }
243
276
  };
244
277
  const closeChatWidget = (dispatch, props, state) => {
245
- var _state$appStates3;
246
- 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) {
247
280
  var _props$controlProps2, _props$controlProps3;
248
281
  // Only close chat if header is enabled for popout
249
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