@microsoft/omnichannel-chat-widget 0.1.0-main.8b6c0d8 → 0.1.0-main.c461296

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 (142) hide show
  1. package/README.md +235 -0
  2. package/lib/cjs/assets/Audios.js +8 -0
  3. package/lib/cjs/assets/Icons.js +28 -0
  4. package/lib/cjs/common/Constants.js +6 -0
  5. package/lib/cjs/common/contextDataStore/DataStoreManager.js +14 -0
  6. package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
  7. package/lib/cjs/common/telemetry/TelemetryConstants.js +25 -3
  8. package/lib/cjs/common/telemetry/TelemetryHelper.js +9 -4
  9. package/lib/cjs/common/telemetry/TelemetryManager.js +12 -4
  10. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  11. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +14 -1
  12. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +3 -0
  13. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +8 -1
  14. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +24 -35
  15. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  16. package/lib/cjs/components/footerstateful/FooterStateful.js +3 -3
  17. package/lib/cjs/components/headerstateful/HeaderStateful.js +12 -3
  18. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
  19. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +38 -33
  20. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
  21. package/lib/cjs/components/livechatwidget/common/endChat.js +65 -49
  22. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
  23. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +26 -9
  24. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +18 -3
  25. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +26 -24
  26. package/lib/cjs/components/livechatwidget/common/startChat.js +77 -27
  27. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
  28. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -18
  29. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  30. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
  31. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +28 -11
  32. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +10 -4
  33. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  34. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  35. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  36. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +9 -46
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  39. package/lib/cjs/contexts/common/ConversationState.js +3 -2
  40. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +4 -0
  41. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +11 -4
  42. package/lib/cjs/contexts/createReducer.js +27 -0
  43. package/lib/cjs/controller/componentController.js +2 -2
  44. package/lib/cjs/plugins/newMessageEventHandler.js +102 -0
  45. package/lib/esm/assets/Audios.js +1 -0
  46. package/lib/esm/assets/Icons.js +11 -0
  47. package/lib/esm/common/Constants.js +6 -0
  48. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  49. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  50. package/lib/esm/common/telemetry/TelemetryConstants.js +21 -2
  51. package/lib/esm/common/telemetry/TelemetryHelper.js +9 -4
  52. package/lib/esm/common/telemetry/TelemetryManager.js +8 -4
  53. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  54. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +14 -1
  55. package/lib/esm/common/telemetry/loggers/consoleLogger.js +3 -0
  56. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +9 -1
  57. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +22 -34
  58. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  59. package/lib/esm/components/footerstateful/FooterStateful.js +3 -3
  60. package/lib/esm/components/headerstateful/HeaderStateful.js +13 -4
  61. package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
  62. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +36 -33
  63. package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
  64. package/lib/esm/components/livechatwidget/common/endChat.js +64 -45
  65. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
  66. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +23 -9
  67. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +18 -2
  68. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +23 -22
  69. package/lib/esm/components/livechatwidget/common/startChat.js +71 -23
  70. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  71. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +40 -17
  72. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  73. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
  74. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +26 -10
  75. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -5
  76. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  77. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  78. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  79. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -44
  80. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  81. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  82. package/lib/esm/contexts/common/ConversationState.js +3 -2
  83. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +4 -0
  84. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +11 -4
  85. package/lib/esm/contexts/createReducer.js +27 -0
  86. package/lib/esm/controller/componentController.js +2 -2
  87. package/lib/esm/plugins/newMessageEventHandler.js +84 -0
  88. package/lib/types/assets/Audios.d.ts +1 -0
  89. package/lib/types/assets/Icons.d.ts +11 -0
  90. package/lib/types/common/Constants.d.ts +3 -0
  91. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  92. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  93. package/lib/types/common/telemetry/TelemetryConstants.d.ts +17 -1
  94. package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
  95. package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
  96. package/lib/types/common/telemetry/definitions/Payload.d.ts +3 -0
  97. package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
  98. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
  99. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +12 -0
  100. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -1
  101. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -1
  102. package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
  103. package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
  104. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  105. package/lib/types/components/livechatwidget/common/startChat.d.ts +1 -1
  106. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  107. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
  108. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  109. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  110. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  111. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  112. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  113. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  114. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -0
  115. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +5 -1
  116. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  117. package/package.json +7 -6
  118. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  119. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  120. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  121. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  122. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  123. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  124. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  125. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  126. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  127. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  128. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  129. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  130. package/lib/esm/assets/assets.d.js +0 -0
  131. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  132. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  133. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  134. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  135. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  136. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  137. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  138. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  139. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  140. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  141. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  142. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -1,19 +1,25 @@
1
+ import { ChatSDKError, Constants } from "../../../common/Constants";
1
2
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
- import { ChatSDKError } from "../../../common/Constants";
3
3
  import { ConversationState } from "../../../contexts/common/ConversationState";
4
+ import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
4
5
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
5
6
  import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
6
7
  import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
7
8
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
8
9
  import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
9
10
  import { createAdapter } from "./createAdapter";
11
+ import { createOnNewAdapterActivityHandler } from "../../../plugins/newMessageEventHandler";
10
12
  import { createTimer } from "../../../common/utils";
11
13
  import { getReconnectIdForAuthenticatedChat } from "./reconnectChatHelper";
12
- import { updateSessionDataForTelemetry } from "./updateSessionDataForTelemetry";
13
- import { setPostChatContextAndLoadSurvey } from "./setPostChatContextAndLoadSurvey"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ import { setPostChatContextAndLoadSurvey } from "./setPostChatContextAndLoadSurvey";
15
+ import { updateSessionDataForTelemetry } from "./updateSessionDataForTelemetry"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
16
 
15
17
  const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
16
- // Getting PreChat Survey Context
18
+ if (await canConnectToExistingChat(props, chatSDK, state, dispatch, setAdapter)) {
19
+ return;
20
+ } // Getting PreChat Survey Context
21
+
22
+
17
23
  const parseToJson = false;
18
24
  const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
19
25
  const showPrechat = state.appStates.conversationState === ConversationState.ProactiveChat ? preChatSurveyResponse && state.appStates.proactiveChatStates.proactiveChatEnablePrechat : preChatSurveyResponse; // Getting reconnectId for authenticated chat
@@ -48,18 +54,18 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
48
54
  }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
55
 
50
56
 
51
- const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
57
+ const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedState) => {
52
58
  try {
53
- var _TelemetryTimers$Widg;
59
+ var _newAdapter$activity$, _TelemetryTimers$Widg;
54
60
 
55
61
  try {
56
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
62
+ TelemetryTimers.WidgetLoadTimer = createTimer();
63
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
57
64
  Event: TelemetryEvent.StartChatSDKCall
58
65
  });
59
66
  await chatSDK.startChat(params);
60
- TelemetryTimers.WidgetLoadTimer = createTimer();
61
67
  } catch (error) {
62
- TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
68
+ TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
63
69
  Event: TelemetryEvent.StartChatMethodException,
64
70
  ExceptionDetails: {
65
71
  exception: `Failed to setup startChat: ${error}`
@@ -68,24 +74,42 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
68
74
  }
69
75
 
70
76
  const newAdapter = await createAdapter(chatSDK);
71
- setAdapter(newAdapter); // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
+ setAdapter(newAdapter);
78
+ const chatToken = await chatSDK.getChatToken();
79
+ newAdapter === null || newAdapter === void 0 ? void 0 : (_newAdapter$activity$ = newAdapter.activity$) === null || _newAdapter$activity$ === void 0 ? void 0 : _newAdapter$activity$.subscribe(createOnNewAdapterActivityHandler(chatToken === null || chatToken === void 0 ? void 0 : chatToken.chatId, chatToken === null || chatToken === void 0 ? void 0 : chatToken.visitorId));
72
80
 
73
- if (chatSDK !== null && chatSDK !== void 0 && chatSDK.getVoiceVideoCalling) {
81
+ if (!persistedState) {
74
82
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
- const chatToken = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatToken());
83
+ if (chatSDK !== null && chatSDK !== void 0 && chatSDK.getVoiceVideoCalling) {
84
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
+ const chatToken = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatToken());
86
+ dispatch({
87
+ type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
88
+ payload: chatToken
89
+ });
90
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
+
92
+
93
+ const liveChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getCurrentLiveChatContext());
76
94
  dispatch({
77
- type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
78
- payload: chatToken
95
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
96
+ payload: liveChatContext
79
97
  });
80
- }
98
+ await setPostChatContextAndLoadSurvey(chatSDK, dispatch);
99
+ await updateSessionDataForTelemetry(chatSDK, dispatch); // Set app state to Active
81
100
 
82
- await setPostChatContextAndLoadSurvey(chatSDK, dispatch, false);
83
- await updateSessionDataForTelemetry(chatSDK, dispatch); // Set app state to Active
101
+ dispatch({
102
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
103
+ payload: ConversationState.Active
104
+ });
105
+ } else {
106
+ dispatch({
107
+ type: LiveChatWidgetActionType.SET_WIDGET_STATE,
108
+ payload: persistedState
109
+ });
110
+ await setPostChatContextAndLoadSurvey(chatSDK, dispatch, true);
111
+ }
84
112
 
85
- dispatch({
86
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
87
- payload: ConversationState.Active
88
- });
89
113
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
90
114
  Event: TelemetryEvent.WidgetLoadComplete,
91
115
  Description: "Widget load complete",
@@ -93,9 +117,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
93
117
  });
94
118
  } catch (ex) {
95
119
  TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
96
- Event: TelemetryEvent.StartChatFailed,
120
+ Event: TelemetryEvent.WidgetLoadFailed,
97
121
  ExceptionDetails: {
98
- Exception: `Start Chat Failed: ${ex}`
122
+ Exception: `Widget load Failed: ${ex}`
99
123
  }
100
124
  });
101
125
  NotificationHandler.notifyError(NotificationScenarios.Connection, "Start Chat Failed: " + ex); // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -111,6 +135,30 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params) => {
111
135
  });
112
136
  }
113
137
  }
138
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
+
140
+
141
+ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdapter) => {
142
+ var _DataStoreManager$cli, _persistedState$domai;
143
+
144
+ const widgetStateFromCache = (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(Constants.widgetStateDataKey, "localStorage");
145
+ const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
146
+
147
+ if (persistedState !== null && persistedState !== void 0 && (_persistedState$domai = persistedState.domainStates) !== null && _persistedState$domai !== void 0 && _persistedState$domai.liveChatContext) {
148
+ var _persistedState$domai2;
149
+
150
+ dispatch({
151
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
152
+ payload: ConversationState.Loading
153
+ });
154
+ const optionalParams = {
155
+ liveChatContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai2 = persistedState.domainStates) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.liveChatContext
156
+ };
157
+ await initStartChat(chatSDK, dispatch, setAdapter, optionalParams, persistedState);
158
+ return true;
159
+ } else {
160
+ return false;
161
+ }
114
162
  };
115
163
 
116
164
  export { prepareStartChat, initStartChat };
@@ -2,14 +2,14 @@ import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryCon
2
2
  import { ConversationState } from "../../../contexts/common/ConversationState";
3
3
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
4
4
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
5
- import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager"; // Defines startProactiveChat callback
6
-
7
- export const startProactiveChat = (dispatch, bodyTitle, showPrechat, inNewWindow) => {
5
+ import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
6
+ // Defines startProactiveChat callback
7
+ export const startProactiveChat = (dispatch, notificationConfig, enablePreChat, inNewWindow) => {
8
8
  dispatch({
9
9
  type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
10
10
  payload: {
11
- proactiveChatBodyTitle: bodyTitle ?? "",
12
- proactiveChatEnablePrechat: showPrechat ?? false,
11
+ proactiveChatBodyTitle: notificationConfig && notificationConfig.message ? notificationConfig.message : "",
12
+ proactiveChatEnablePrechat: enablePreChat ?? false,
13
13
  proactiveChatInNewWindow: inNewWindow ?? false
14
14
  }
15
15
  });
@@ -1,5 +1,6 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
4
  import { BroadcastService, decodeComponentString } from "@microsoft/omnichannel-chat-components";
4
5
  import { Stack } from "@fluentui/react";
5
6
  import React, { useEffect, useRef, useState } from "react";
@@ -12,6 +13,7 @@ import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
12
13
  import { Components } from "botframework-webchat";
13
14
  import ConfirmationPaneStateful from "../../confirmationpanestateful/ConfirmationPaneStateful";
14
15
  import { ConversationState } from "../../../contexts/common/ConversationState";
16
+ import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
15
17
  import { ElementType } from "@microsoft/omnichannel-chat-components";
16
18
  import EmailTranscriptPaneStateful from "../../emailtranscriptpanestateful/EmailTranscriptPaneStateful";
17
19
  import HeaderStateful from "../../headerstateful/HeaderStateful";
@@ -23,11 +25,13 @@ import PostChatSurveyPaneStateful from "../../postchatsurveypanestateful/PostCha
23
25
  import PreChatSurveyPaneStateful from "../../prechatsurveypanestateful/PreChatSurveyPaneStateful";
24
26
  import ProactiveChatPaneStateful from "../../proactivechatpanestateful/ProactiveChatPaneStateful";
25
27
  import ReconnectChatPaneStateful from "../../reconnectchatpanestateful/ReconnectChatPaneStateful";
28
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
26
29
  import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
27
30
  import WebChatContainerStateful from "../../webchatcontainerstateful/WebChatContainerStateful";
28
31
  import { createFooter } from "../common/createFooter";
29
32
  import { createInternetConnectionChangeHandler } from "../common/createInternetConnectionChangeHandler";
30
33
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
34
+ import { disposeTelemetryLoggers } from "../common/disposeTelemetryLoggers";
31
35
  import { endChat } from "../common/endChat";
32
36
  import { getGeneralStylesForButton } from "../common/getGeneralStylesForButton";
33
37
  import { initCallingSdk } from "../common/initCallingSdk";
@@ -67,6 +71,7 @@ export const LiveChatWidgetStateful = props => {
67
71
 
68
72
  registerTelemetryLoggers(props, dispatch);
69
73
  createInternetConnectionChangeHandler();
74
+ DataStoreManager.clientDataStore = props.contextDataStore ?? undefined;
70
75
  dispatch({
71
76
  type: LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
72
77
  payload: widgetElementId
@@ -138,28 +143,43 @@ export const LiveChatWidgetStateful = props => {
138
143
  }, [state.appStates.skipChatButtonRendering]);
139
144
  useEffect(() => {
140
145
  BroadcastService.getMessageByEventName("StartProactiveChat").subscribe(msg => {
146
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
147
+ Event: TelemetryEvent.StartProactiveChatEventReceived,
148
+ Description: "Start proactive chat event received."
149
+ });
150
+
141
151
  if (canStartProactiveChat.current) {
142
152
  var _msg$payload, _msg$payload2, _msg$payload3;
143
153
 
144
- startProactiveChat(dispatch, msg === null || msg === void 0 ? void 0 : (_msg$payload = msg.payload) === null || _msg$payload === void 0 ? void 0 : _msg$payload.bodyTitle, msg === null || msg === void 0 ? void 0 : (_msg$payload2 = msg.payload) === null || _msg$payload2 === void 0 ? void 0 : _msg$payload2.showPrechat, msg === null || msg === void 0 ? void 0 : (_msg$payload3 = msg.payload) === null || _msg$payload3 === void 0 ? void 0 : _msg$payload3.inNewWindow);
154
+ startProactiveChat(dispatch, msg === null || msg === void 0 ? void 0 : (_msg$payload = msg.payload) === null || _msg$payload === void 0 ? void 0 : _msg$payload.notificationConfig, msg === null || msg === void 0 ? void 0 : (_msg$payload2 = msg.payload) === null || _msg$payload2 === void 0 ? void 0 : _msg$payload2.enablePreChat, msg === null || msg === void 0 ? void 0 : (_msg$payload3 = msg.payload) === null || _msg$payload3 === void 0 ? void 0 : _msg$payload3.inNewWindow);
155
+ } else {
156
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
157
+ Event: TelemetryEvent.ChatAlreadyTriggered,
158
+ Description: "Start proactive chat method called, when chat was already triggered."
159
+ });
145
160
  }
146
161
  });
162
+ window.addEventListener("beforeunload", () => {
163
+ disposeTelemetryLoggers();
164
+ });
165
+
166
+ if (state.appStates.conversationEndedByAgent) {
167
+ endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
168
+ }
147
169
  }, []);
148
170
  useEffect(() => {
149
- if (state.appStates.conversationState !== ConversationState.Closed) {
150
- canStartProactiveChat.current = false;
151
- }
171
+ canStartProactiveChat.current = state.appStates.conversationState === ConversationState.Closed;
152
172
 
153
173
  if (state.appStates.conversationState === ConversationState.Active) {
154
174
  chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.onNewMessage(() => {
155
175
  BroadcastService.postMessage({
156
- eventName: "NewMessageNotification"
176
+ eventName: BroadcastEvent.NewMessageNotification
157
177
  });
158
178
  });
159
179
  } // Track the message count
160
180
 
161
181
 
162
- if (state.appStates.conversationState == ConversationState.Active) {
182
+ if (state.appStates.conversationState === ConversationState.Active) {
163
183
  chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.onNewMessage(() => {
164
184
  currentMessageCountRef.current++;
165
185
  dispatch({
@@ -178,7 +198,7 @@ export const LiveChatWidgetStateful = props => {
178
198
  });
179
199
  const customEvent = {
180
200
  elementType: ElementType.Custom,
181
- eventName: "UnreadMessageCount",
201
+ eventName: BroadcastEvent.UnreadMessageCount,
182
202
  payload: 0
183
203
  };
184
204
  BroadcastService.postMessage(customEvent);
@@ -188,7 +208,7 @@ export const LiveChatWidgetStateful = props => {
188
208
  if (state.appStates.isMinimized && state.appStates.unreadMessageCount > 0) {
189
209
  const customEvent = {
190
210
  elementType: ElementType.Custom,
191
- eventName: "UnreadMessageCount",
211
+ eventName: BroadcastEvent.UnreadMessageCount,
192
212
  payload: `${state.appStates.unreadMessageCount}`
193
213
  };
194
214
  BroadcastService.postMessage(customEvent);
@@ -203,23 +223,26 @@ export const LiveChatWidgetStateful = props => {
203
223
  }, [(_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.webChatStyles]);
204
224
  const webChatProps = initWebChatComposer(props, chatSDK, state, dispatch, setWebChatStyles);
205
225
 
206
- const setPostChatContextRelay = () => setPostChatContextAndLoadSurvey(chatSDK, dispatch, true);
226
+ const setPostChatContextRelay = () => setPostChatContextAndLoadSurvey(chatSDK, dispatch); // eslint-disable-next-line @typescript-eslint/no-explicit-any
227
+
207
228
 
208
- const endChatRelay = () => endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
229
+ const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat) => endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat);
209
230
 
210
231
  const prepareStartChatRelay = () => prepareStartChat(props, chatSDK, state, dispatch, setAdapter); // eslint-disable-next-line @typescript-eslint/no-explicit-any
211
232
 
212
233
 
213
- const initStartChatRelay = optionalParams => initStartChat(chatSDK, dispatch, setAdapter, optionalParams);
234
+ const initStartChatRelay = (optionalParams, persistedState) => initStartChat(chatSDK, dispatch, setAdapter, optionalParams, persistedState);
214
235
 
215
236
  const confirmationPaneProps = initConfirmationPropsComposer(props); // publish chat widget state
216
237
 
217
- const chatWidgetStateChangeEvent = {
218
- eventName: "ChatWidgetStateChanged",
219
- payload: { ...state
220
- }
221
- };
222
- BroadcastService.postMessage(chatWidgetStateChangeEvent);
238
+ useEffect(() => {
239
+ const chatWidgetStateChangeEvent = {
240
+ eventName: BroadcastEvent.ChatWidgetStateChanged,
241
+ payload: { ...state
242
+ }
243
+ };
244
+ BroadcastService.postMessage(chatWidgetStateChangeEvent);
245
+ }, [state]);
223
246
  return /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
224
247
  styleOptions: webChatStyles,
225
248
  directLine: ((_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine
@@ -26,7 +26,7 @@ export const LoadingPaneStateful = props => {
26
26
  firstElement[0].focus();
27
27
  }
28
28
 
29
- TelemetryHelper.logActionEvent(LogLevel.INFO, {
29
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
30
30
  Event: TelemetryEvent.LoadingPaneLoaded,
31
31
  Description: "Loading pane loaded."
32
32
  });
@@ -1,5 +1,7 @@
1
+ import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
1
2
  import React, { useEffect } from "react";
2
3
  import { OutOfOfficeHoursPane } from "@microsoft/omnichannel-chat-components";
4
+ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
3
5
  import { defaultGeneralStyleProps } from "./common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps";
4
6
  import { findAllFocusableElement } from "../../common/utils";
5
7
  import useChatContextStore from "../../hooks/useChatContextStore";
@@ -23,6 +25,10 @@ export const OutOfOfficeHoursPaneStateful = props => {
23
25
  if (firstElement && firstElement[0]) {
24
26
  firstElement[0].focus();
25
27
  }
28
+
29
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
30
+ Event: TelemetryEvent.OutOfOfficePaneLoaded
31
+ });
26
32
  }, []);
27
33
  return /*#__PURE__*/React.createElement(OutOfOfficeHoursPane, {
28
34
  componentOverrides: props.componentOverrides,
@@ -1,10 +1,11 @@
1
+ import { Constants, HtmlAttributeNames, Regex } from "../../common/Constants";
1
2
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
3
  import React, { useEffect } from "react";
3
4
  import { extractPreChatSurveyResponseValues, findAllFocusableElement, parseAdaptiveCardPayload } from "../../common/utils";
4
5
  import { ConversationState } from "../../contexts/common/ConversationState";
6
+ import { DataStoreManager } from "../../common/contextDataStore/DataStoreManager";
5
7
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
6
8
  import { PreChatSurveyPane } from "@microsoft/omnichannel-chat-components";
7
- import { HtmlAttributeNames, Regex } from "../../common/Constants";
8
9
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
9
10
  import { defaultGeneralPreChatSurveyPaneStyleProps } from "./common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps";
10
11
  import { defaultPreChatSurveyLocalizedTexts } from "./common/defaultProps/defaultPreChatSurveyLocalizedTexts";
@@ -39,7 +40,7 @@ export const PreChatSurveyPaneStateful = props => {
39
40
  try {
40
41
  return parseAdaptiveCardPayload(payload, requiredFieldMissingMessage);
41
42
  } catch (ex) {
42
- TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
43
+ TelemetryHelper.logConfigDataEvent(LogLevel.ERROR, {
43
44
  Event: TelemetryEvent.ParseAdaptiveCardFailed,
44
45
  Description: "Adaptive Card JSON Parse Failed.",
45
46
  ExceptionDetails: {
@@ -66,14 +67,29 @@ export const PreChatSurveyPaneStateful = props => {
66
67
  });
67
68
 
68
69
  try {
69
- const prechatResponseValues = extractPreChatSurveyResponseValues(state.domainStates.preChatSurveyResponse, values);
70
- const optionalParams = {
71
- initContext: {
72
- preChatResponse: prechatResponseValues
73
- }
74
- };
75
- setPreChatResponseEmail(values);
76
- await initStartChat(optionalParams);
70
+ var _DataStoreManager$cli, _persistedState$domai;
71
+
72
+ const widgetStateFromCache = (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(Constants.widgetStateDataKey, "localStorage");
73
+ const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
74
+ let optionalParams = {};
75
+
76
+ if (persistedState !== null && persistedState !== void 0 && (_persistedState$domai = persistedState.domainStates) !== null && _persistedState$domai !== void 0 && _persistedState$domai.liveChatContext) {
77
+ var _persistedState$domai2;
78
+
79
+ optionalParams = {
80
+ liveChatContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai2 = persistedState.domainStates) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.liveChatContext
81
+ };
82
+ await initStartChat(optionalParams, persistedState);
83
+ } else {
84
+ const prechatResponseValues = extractPreChatSurveyResponseValues(state.domainStates.preChatSurveyResponse, values);
85
+ optionalParams = {
86
+ initContext: {
87
+ preChatResponse: prechatResponseValues
88
+ }
89
+ };
90
+ setPreChatResponseEmail(values);
91
+ await initStartChat(optionalParams);
92
+ }
77
93
  } catch (ex) {
78
94
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
79
95
  Event: TelemetryEvent.PreChatSurveyStartChatMethodFailed,
@@ -1,4 +1,4 @@
1
- import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
2
  import React, { useEffect, useState } from "react";
3
3
  import { createTimer, setFocusOnElement } from "../../common/utils";
4
4
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
@@ -28,7 +28,7 @@ export const ProactiveChatPaneStateful = props => {
28
28
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
29
29
  payload: ConversationState.Closed
30
30
  });
31
- TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
31
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
32
32
  Event: TelemetryEvent.ProactiveChatRejected,
33
33
  ElapsedTimeInMilliseconds: TelemetryTimers.LcwLoadToChatButtonTimer.milliSecondsElapsed,
34
34
  Description: "Proactive chat invitation timed out."
@@ -51,12 +51,12 @@ export const ProactiveChatPaneStateful = props => {
51
51
  if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
52
52
  // TODO: BroadcastService: replace with the sdk broadcast service, when in place
53
53
  const startPopoutChatEvent = {
54
- eventName: "StartPopoutChat"
54
+ eventName: BroadcastEvent.ProactiveChatStartPopoutChat
55
55
  };
56
56
  BroadcastService.postMessage(startPopoutChatEvent);
57
57
  dispatch({
58
- type: LiveChatWidgetActionType.SET_SKIP_CHAT_BUTTON_RENDERING,
59
- payload: true
58
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
59
+ payload: ConversationState.Closed
60
60
  });
61
61
  } else if (((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True") {
62
62
  dispatch({
@@ -68,6 +68,10 @@ export const ProactiveChatPaneStateful = props => {
68
68
  payload: ConversationState.OutOfOffice
69
69
  });
70
70
  } else {
71
+ const proactiveChatStarted = {
72
+ eventName: BroadcastEvent.ProactiveChatStartChat
73
+ };
74
+ BroadcastService.postMessage(proactiveChatStarted);
71
75
  await startChat();
72
76
  }
73
77
  },
@@ -14,6 +14,10 @@ export class MockChatSDK {
14
14
  return null;
15
15
  }
16
16
 
17
+ getChatToken() {
18
+ return null;
19
+ }
20
+
17
21
  createChatAdapter() {
18
22
  return new MockAdapter();
19
23
  } // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1,16 +1,6 @@
1
- import { BrowserVendor } from "../../webchatcontroller/enums/BrowserVendor";
1
+ import { ArchiveIcon, AudioIcon, BlankIcon, ExcelIcon, ImageIcon, OneNoteIcon, PDFIcon, PowerpointIcon, VideoIcon, VisioIcon, WordIcon } from "../../../../assets/Icons";
2
2
  import { getBrowserName, isChromiumEdge } from "./BrowserInfo";
3
- import ArchiveIcon from "../../../../assets/icons/archiveIcon.svg";
4
- import AudioIcon from "../../../../assets/icons/audioIcon.svg";
5
- import BlankIcon from "../../../../assets/icons/blankIcon.svg";
6
- import VideoIcon from "../../../../assets/icons/videoIcon.svg";
7
- import ImageIcon from "../../../../assets/icons/imageIcon.svg";
8
- import WordIcon from "../../../../assets/icons/wordIcon.svg";
9
- import OneNoteIcon from "../../../../assets/icons/oneNoteIcon.svg";
10
- import PowerpointIcon from "../../../../assets/icons/powerpointIcon.svg";
11
- import VisioIcon from "../../../../assets/icons/visioIcon.svg";
12
- import PDFIcon from "../../../../assets/icons/pdfIcon.svg";
13
- import ExcelIcon from "../../../../assets/icons/excelIcon.svg";
3
+ import { BrowserVendor } from "../../webchatcontroller/enums/BrowserVendor";
14
4
  import { Constants } from "../../../../common/Constants";
15
5
  const FileAttachmentIconMap = {
16
6
  "aac": AudioIcon,
@@ -5,59 +5,19 @@
5
5
  * 1. Renders system messages differently, according to Microsoft LiveChatWidget styles
6
6
  * 2. Changes the font size of user messages
7
7
  * 3. Decodes certain html characters that came through from chat services
8
- * 4. Triggers end conversation sequence when the chat thread is deleted
9
8
  ******/
10
- import React from "react";
9
+ import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
11
10
  import { Constants } from "../../../../../common/Constants";
12
11
  import { DirectLineActivityType } from "../../enums/DirectLineActivityType";
13
12
  import { DirectLineSenderRole } from "../../enums/DirectLineSenderRole";
14
13
  import { MessageTypes } from "../../enums/MessageType";
14
+ import React from "react";
15
+ import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
15
16
  import { defaultSystemMessageStyles } from "./defaultStyles/defaultSystemMessageStyles";
16
17
  import { defaultUserMessageStyles } from "./defaultStyles/defaultUserMessageStyles";
17
18
  import { escapeHtml } from "../../../../../common/utils";
18
- import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
19
- import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
20
19
  const loggedSystemMessages = new Array(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
20
 
22
- const handleThreadUpdate = channelData => {
23
- var _channelData$properti, _channelData$properti2;
24
-
25
- TelemetryHelper.logActionEvent(LogLevel.INFO, {
26
- Event: TelemetryEvent.IC3ThreadUpdateEventReceived,
27
- Description: "IC3 ThreadUpdateEvent Received"
28
- });
29
-
30
- const postConversationEndedAction = () => {
31
- TelemetryHelper.logActionEvent(LogLevel.INFO, {
32
- Event: TelemetryEvent.ConversationEndedThreadEventReceived,
33
- Description: "Conversation is ended by agent side or by timeout."
34
- });
35
- }; // If the Thread is deleted, then display post conversation survey if enabled.
36
-
37
-
38
- const isThreadDeleted = (channelData === null || channelData === void 0 ? void 0 : (_channelData$properti = channelData.properties) === null || _channelData$properti === void 0 ? void 0 : (_channelData$properti2 = _channelData$properti.isdeleted) === null || _channelData$properti2 === void 0 ? void 0 : _channelData$properti2.toLowerCase()) === Constants.true;
39
-
40
- if (isThreadDeleted) {
41
- postConversationEndedAction();
42
- return;
43
- } //check if customer is still in the thread
44
-
45
-
46
- if (channelData.members && channelData.members.length > 0) {
47
- for (let i = 0; i < channelData.members.length; i++) {
48
- const id = channelData.members[i].id;
49
- const tag = channelData.members[i].tag; // In case of ACS customer is not removed from thread and has "left" tag
50
-
51
- if (id.startsWith(Constants.visitorIdPrefix) && tag !== Constants.left) {
52
- return;
53
- }
54
- }
55
- }
56
-
57
- postConversationEndedAction();
58
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
-
60
-
61
21
  const handleSystemMessage = (next, args, card, systemMessageStyleProps) => {
62
22
  var _card$activity, _card$activity$channe, _card$activity$channe2, _card$activity2, _card$activity2$chann, _card$activity3, _card$activity3$chann, _card$activity3$chann2, _card$activity4, _card$activity4$chann, _card$activity5, _card$activity5$chann, _card$nextVisibleActi, _card$nextVisibleActi2, _card$activity6, _card$activity6$chann, _card$activity7, _card$nextVisibleActi3, _card$activity8;
63
23
 
@@ -108,7 +68,10 @@ export const createActivityMiddleware = (systemMessageStyleProps, userMessageSty
108
68
  var _card$activity$channe3;
109
69
 
110
70
  if (((_card$activity$channe3 = card.activity.channelData) === null || _card$activity$channe3 === void 0 ? void 0 : _card$activity$channe3.type) === MessageTypes.Thread) {
111
- handleThreadUpdate(card.activity.channelData);
71
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
72
+ Event: TelemetryEvent.IC3ThreadUpdateEventReceived,
73
+ Description: "IC3 ThreadUpdateEvent Received"
74
+ });
112
75
  }
113
76
 
114
77
  return () => false;
@@ -8,6 +8,7 @@
8
8
  import { Constants, MimeTypes, WebChatMiddlewareConstants } from "../../../../../common/Constants";
9
9
  import React from "react";
10
10
  import { getFileAttachmentIconData, isInlineMediaSupported } from "../../../common/utils/FileAttachmentIconManager";
11
+ import { BroadcastEvent } from "../../../../../common/telemetry/TelemetryConstants";
11
12
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
12
13
  import { WebChatActionType } from "../../enums/WebChatActionType";
13
14
  import { defaultAttachmentAdaptiveCardStyles } from "./defaultStyles/defaultAtttachmentAdaptiveCardStyles";
@@ -187,7 +188,7 @@ const createAttachmentMiddleware = enableInlinePlaying => {
187
188
  } catch (e) {
188
189
  const errorData = "Unable to parse the adaptive card format";
189
190
  BroadcastService.postMessage({
190
- eventName: "InvalidAdaptiveCardFormat",
191
+ eventName: BroadcastEvent.InvalidAdaptiveCardFormat,
191
192
  payload: {
192
193
  Message: errorData,
193
194
  ExceptionDetails: e
@@ -17,22 +17,22 @@ const createConversationEndMiddleware = conversationEndCallback => _ref => {
17
17
  var _action$payload;
18
18
 
19
19
  if ((action === null || action === void 0 ? void 0 : action.type) == WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
20
- var _activity$from, _activity$from2, _activity$channelData5, _activity$channelData6;
20
+ var _activity$from, _activity$from2, _activity$channelData7, _activity$channelData8;
21
21
 
22
22
  const activity = action.payload.activity;
23
23
 
24
24
  if (((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === DirectLineSenderRole.Bot && activity.channelId === "ACS_CHANNEL") {
25
- var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4;
25
+ var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
26
26
 
27
27
  // ACS
28
- if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(Constants.systemMessageTag) && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(Constants.agentEndConversationMessageTag)) {
28
+ if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(Constants.systemMessageTag) && ((_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(Constants.agentEndConversationMessageTag) || (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(Constants.supervisorForceCloseMessageTag))) {
29
29
  conversationEndCallback();
30
30
  }
31
- } else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === DirectLineSenderRole.Channel && ((_activity$channelData5 = activity.channelData) === null || _activity$channelData5 === void 0 ? void 0 : _activity$channelData5.type) === MessageTypes.Thread && (_activity$channelData6 = activity.channelData) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.properties) {
32
- var _activity$channelData7, _activity$channelData8, _activity$channelData9, _activity$channelData10;
31
+ } else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === DirectLineSenderRole.Channel && ((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.type) === MessageTypes.Thread && (_activity$channelData8 = activity.channelData) !== null && _activity$channelData8 !== void 0 && _activity$channelData8.properties) {
32
+ var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
33
33
 
34
34
  // IC3
35
- if (((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : (_activity$channelData8 = _activity$channelData7.properties) === null || _activity$channelData8 === void 0 ? void 0 : _activity$channelData8.isdeleted) === Constants.truePascal || !((_activity$channelData9 = activity.channelData) !== null && _activity$channelData9 !== void 0 && (_activity$channelData10 = _activity$channelData9.properties) !== null && _activity$channelData10 !== void 0 && _activity$channelData10.containsExternalEntitiesListeningAll)) {
35
+ if (((_activity$channelData9 = activity.channelData) === null || _activity$channelData9 === void 0 ? void 0 : (_activity$channelData10 = _activity$channelData9.properties) === null || _activity$channelData10 === void 0 ? void 0 : _activity$channelData10.isdeleted) === Constants.truePascal || !((_activity$channelData11 = activity.channelData) !== null && _activity$channelData11 !== void 0 && (_activity$channelData12 = _activity$channelData11.properties) !== null && _activity$channelData12 !== void 0 && _activity$channelData12.containsExternalEntitiesListeningAll)) {
36
36
  conversationEndCallback();
37
37
  }
38
38
  }
@@ -7,6 +7,7 @@ export let ConversationState;
7
7
  ConversationState[ConversationState["OutOfOffice"] = 3] = "OutOfOffice";
8
8
  ConversationState[ConversationState["ProactiveChat"] = 4] = "ProactiveChat";
9
9
  ConversationState[ConversationState["Active"] = 5] = "Active";
10
- ConversationState[ConversationState["Postchat"] = 6] = "Postchat";
11
- ConversationState[ConversationState["Closed"] = 7] = "Closed";
10
+ ConversationState[ConversationState["InActive"] = 6] = "InActive";
11
+ ConversationState[ConversationState["Postchat"] = 7] = "Postchat";
12
+ ConversationState[ConversationState["Closed"] = 8] = "Closed";
12
13
  })(ConversationState || (ConversationState = {}));
@@ -28,4 +28,8 @@ export let LiveChatWidgetActionType;
28
28
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 24] = "SET_TELEMETRY_DATA";
29
29
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
30
30
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 26] = "SET_UNREAD_MESSAGE_COUNT";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 27] = "SET_FOCUS_CHAT_BUTTON";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
31
35
  })(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));