@microsoft/omnichannel-chat-widget 0.1.0-main.07f52ee → 0.1.0-main.0ec5410

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 (92) hide show
  1. package/lib/cjs/assets/Audios.js +8 -0
  2. package/lib/cjs/assets/Icons.js +28 -0
  3. package/lib/cjs/common/Constants.js +2 -0
  4. package/lib/cjs/common/telemetry/TelemetryConstants.js +24 -3
  5. package/lib/cjs/common/telemetry/TelemetryManager.js +1 -1
  6. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +22 -20
  7. package/lib/cjs/components/footerstateful/FooterStateful.js +3 -3
  8. package/lib/cjs/components/headerstateful/HeaderStateful.js +12 -3
  9. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
  10. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +11 -7
  11. package/lib/cjs/components/livechatwidget/common/endChat.js +63 -55
  12. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +25 -7
  13. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -5
  14. package/lib/cjs/components/livechatwidget/common/startChat.js +5 -1
  15. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
  16. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +27 -14
  17. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -3
  18. package/lib/cjs/{assets/assets.d.js → components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js} +0 -0
  19. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  20. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  21. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +9 -46
  22. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  23. package/lib/cjs/contexts/common/ConversationState.js +3 -2
  24. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +5 -1
  25. package/lib/cjs/controller/componentController.js +2 -2
  26. package/lib/cjs/plugins/newMessageEventHandler.js +102 -0
  27. package/lib/esm/assets/Audios.js +1 -0
  28. package/lib/esm/assets/Icons.js +11 -0
  29. package/lib/esm/common/Constants.js +2 -0
  30. package/lib/esm/common/telemetry/TelemetryConstants.js +20 -2
  31. package/lib/esm/common/telemetry/TelemetryManager.js +1 -1
  32. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +21 -20
  33. package/lib/esm/components/footerstateful/FooterStateful.js +3 -3
  34. package/lib/esm/components/headerstateful/HeaderStateful.js +13 -4
  35. package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
  36. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +11 -9
  37. package/lib/esm/components/livechatwidget/common/endChat.js +62 -51
  38. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +23 -8
  39. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -5
  40. package/lib/esm/components/livechatwidget/common/startChat.js +4 -1
  41. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  42. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +23 -11
  43. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +8 -4
  44. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  45. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  46. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  47. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -44
  48. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  49. package/lib/esm/contexts/common/ConversationState.js +3 -2
  50. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +5 -1
  51. package/lib/esm/controller/componentController.js +2 -2
  52. package/lib/esm/plugins/newMessageEventHandler.js +84 -0
  53. package/lib/types/assets/Audios.d.ts +1 -0
  54. package/lib/types/assets/Icons.d.ts +11 -0
  55. package/lib/types/common/Constants.d.ts +1 -0
  56. package/lib/types/common/telemetry/TelemetryConstants.d.ts +16 -1
  57. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -1
  58. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -1
  59. package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
  60. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  61. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  62. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  63. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  64. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  65. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  66. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  67. package/package.json +5 -6
  68. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  69. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  70. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  71. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  72. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  73. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  74. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  75. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  76. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  77. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  78. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  79. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  80. package/lib/esm/assets/assets.d.js +0 -0
  81. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  82. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  83. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  84. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  85. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  86. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  87. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  88. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  89. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  90. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  91. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  92. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -5,12 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.initWebChatComposer = void 0;
7
7
 
8
+ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
9
+
8
10
  var _botframeworkWebchat = require("botframework-webchat");
9
11
 
12
+ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
13
+
14
+ var _ConversationState = require("../../../contexts/common/ConversationState");
15
+
10
16
  var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
11
17
 
12
18
  var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
13
19
 
20
+ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
21
+
14
22
  var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
15
23
 
16
24
  var _attachmentProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware"));
@@ -53,8 +61,6 @@ var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcont
53
61
 
54
62
  var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
55
63
 
56
- var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
57
-
58
64
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
59
65
 
60
66
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -78,6 +84,11 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
78
84
  const conversationEndCallback = async () => {
79
85
  var _props$webChatContain4, _props$webChatContain5;
80
86
 
87
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
88
+ Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
89
+ Description: "Conversation is ended by agent side or by timeout."
90
+ });
91
+
81
92
  if ((props === null || props === void 0 ? void 0 : (_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : (_props$webChatContain5 = _props$webChatContain4.renderingMiddlewareProps) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.hideSendboxOnConversationEnd) !== false) {
82
93
  setWebChatStyles(styles => {
83
94
  return { ...styles,
@@ -86,12 +97,19 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
86
97
  });
87
98
  }
88
99
 
89
- if (isPostChatEnabled === "true" && postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
90
- const loadPostChatEvent = {
91
- eventName: "LoadPostChatSurvey"
92
- };
100
+ if (isPostChatEnabled === "true") {
101
+ if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
102
+ const loadPostChatEvent = {
103
+ eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
104
+ };
93
105
 
94
- _omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
106
+ _omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
107
+ } else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
108
+ dispatch({
109
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
110
+ payload: _ConversationState.ConversationState.InActive
111
+ });
112
+ }
95
113
  } else {
96
114
  dispatch({
97
115
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
@@ -7,13 +7,13 @@ exports.setPostChatContextAndLoadSurvey = void 0;
7
7
 
8
8
  var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
9
9
 
10
- var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
11
-
12
- var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
10
+ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
13
11
 
14
12
  var _ConversationState = require("../../../contexts/common/ConversationState");
15
13
 
16
- var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
14
+ var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
15
+
16
+ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
17
17
 
18
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
19
  const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, persistedChat) => {
@@ -39,7 +39,8 @@ const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, persistedChat)
39
39
  exception: ex
40
40
  }
41
41
  });
42
- }
42
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars
43
+
43
44
 
44
45
  _omnichannelChatComponents.BroadcastService.getMessageByEventName("LoadPostChatSurvey").subscribe(msg => {
45
46
  dispatch({
@@ -25,6 +25,8 @@ var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
25
25
 
26
26
  var _createAdapter = require("./createAdapter");
27
27
 
28
+ var _newMessageEventHandler = require("../../../plugins/newMessageEventHandler");
29
+
28
30
  var _utils = require("../../../common/utils");
29
31
 
30
32
  var _reconnectChatHelper = require("./reconnectChatHelper");
@@ -78,7 +80,7 @@ exports.prepareStartChat = prepareStartChat;
78
80
 
79
81
  const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedState) => {
80
82
  try {
81
- var _TelemetryTimers$Widg;
83
+ var _newAdapter$activity$, _TelemetryTimers$Widg;
82
84
 
83
85
  try {
84
86
  _TelemetryManager.TelemetryTimers.WidgetLoadTimer = (0, _utils.createTimer)();
@@ -99,6 +101,8 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedSta
99
101
 
100
102
  const newAdapter = await (0, _createAdapter.createAdapter)(chatSDK);
101
103
  setAdapter(newAdapter);
104
+ const chatToken = await chatSDK.getChatToken();
105
+ newAdapter === null || newAdapter === void 0 ? void 0 : (_newAdapter$activity$ = newAdapter.activity$) === null || _newAdapter$activity$ === void 0 ? void 0 : _newAdapter$activity$.subscribe((0, _newMessageEventHandler.createOnNewAdapterActivityHandler)(chatToken === null || chatToken === void 0 ? void 0 : chatToken.chatId, chatToken === null || chatToken === void 0 ? void 0 : chatToken.visitorId));
102
106
 
103
107
  if (!persistedState) {
104
108
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -16,12 +16,12 @@ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
16
16
  var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
17
17
 
18
18
  // Defines startProactiveChat callback
19
- const startProactiveChat = (dispatch, bodyTitle, showPrechat, inNewWindow) => {
19
+ const startProactiveChat = (dispatch, notificationConfig, enablePreChat, inNewWindow) => {
20
20
  dispatch({
21
21
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
22
22
  payload: {
23
- proactiveChatBodyTitle: bodyTitle ?? "",
24
- proactiveChatEnablePrechat: showPrechat ?? false,
23
+ proactiveChatBodyTitle: notificationConfig && notificationConfig.message ? notificationConfig.message : "",
24
+ proactiveChatEnablePrechat: enablePreChat ?? false,
25
25
  proactiveChatInNewWindow: inNewWindow ?? false
26
26
  }
27
27
  });
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.LiveChatWidgetStateful = void 0;
7
7
 
8
+ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
9
+
8
10
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
9
11
 
10
12
  var _react = require("@fluentui/react");
@@ -29,6 +31,8 @@ var _ConfirmationPaneStateful = _interopRequireDefault(require("../../confirmati
29
31
 
30
32
  var _ConversationState = require("../../../contexts/common/ConversationState");
31
33
 
34
+ var _DataStoreManager = require("../../../common/contextDataStore/DataStoreManager");
35
+
32
36
  var _EmailTranscriptPaneStateful = _interopRequireDefault(require("../../emailtranscriptpanestateful/EmailTranscriptPaneStateful"));
33
37
 
34
38
  var _HeaderStateful = _interopRequireDefault(require("../../headerstateful/HeaderStateful"));
@@ -49,6 +53,8 @@ var _ProactiveChatPaneStateful = _interopRequireDefault(require("../../proactive
49
53
 
50
54
  var _ReconnectChatPaneStateful = _interopRequireDefault(require("../../reconnectchatpanestateful/ReconnectChatPaneStateful"));
51
55
 
56
+ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
57
+
52
58
  var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
53
59
 
54
60
  var _WebChatContainerStateful = _interopRequireDefault(require("../../webchatcontainerstateful/WebChatContainerStateful"));
@@ -59,6 +65,8 @@ var _createInternetConnectionChangeHandler = require("../common/createInternetCo
59
65
 
60
66
  var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
61
67
 
68
+ var _disposeTelemetryLoggers = require("../common/disposeTelemetryLoggers");
69
+
62
70
  var _endChat = require("../common/endChat");
63
71
 
64
72
  var _getGeneralStylesForButton = require("../common/getGeneralStylesForButton");
@@ -81,12 +89,6 @@ var _useChatContextStore = _interopRequireDefault(require("../../../hooks/useCha
81
89
 
82
90
  var _useChatSDKStore = _interopRequireDefault(require("../../../hooks/useChatSDKStore"));
83
91
 
84
- var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
85
-
86
- var _disposeTelemetryLoggers = require("../common/disposeTelemetryLoggers");
87
-
88
- var _DataStoreManager = require("../../../common/contextDataStore/DataStoreManager");
89
-
90
92
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
91
93
 
92
94
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -195,14 +197,24 @@ const LiveChatWidgetStateful = props => {
195
197
  }, [state.appStates.skipChatButtonRendering]);
196
198
  (0, _react2.useEffect)(() => {
197
199
  _omnichannelChatComponents.BroadcastService.getMessageByEventName("StartProactiveChat").subscribe(msg => {
200
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
201
+ Event: _TelemetryConstants.TelemetryEvent.StartProactiveChatEventReceived,
202
+ Description: "Start proactive chat event received."
203
+ });
204
+
198
205
  if (canStartProactiveChat.current) {
199
206
  var _msg$payload, _msg$payload2, _msg$payload3;
200
207
 
201
- (0, _startProactiveChat.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);
208
+ (0, _startProactiveChat.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);
209
+ } else {
210
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
211
+ Event: _TelemetryConstants.TelemetryEvent.ChatAlreadyTriggered,
212
+ Description: "Start proactive chat method called, when chat was already triggered."
213
+ });
202
214
  }
203
215
  });
204
216
 
205
- window.addEventListener("beforeunload", event => {
217
+ window.addEventListener("beforeunload", () => {
206
218
  (0, _disposeTelemetryLoggers.disposeTelemetryLoggers)();
207
219
  });
208
220
 
@@ -216,7 +228,7 @@ const LiveChatWidgetStateful = props => {
216
228
  if (state.appStates.conversationState === _ConversationState.ConversationState.Active) {
217
229
  chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.onNewMessage(() => {
218
230
  _omnichannelChatComponents.BroadcastService.postMessage({
219
- eventName: "NewMessageNotification"
231
+ eventName: _TelemetryConstants.BroadcastEvent.NewMessageNotification
220
232
  });
221
233
  });
222
234
  } // Track the message count
@@ -241,7 +253,7 @@ const LiveChatWidgetStateful = props => {
241
253
  });
242
254
  const customEvent = {
243
255
  elementType: _omnichannelChatComponents.ElementType.Custom,
244
- eventName: "UnreadMessageCount",
256
+ eventName: _TelemetryConstants.BroadcastEvent.UnreadMessageCount,
245
257
  payload: 0
246
258
  };
247
259
 
@@ -252,7 +264,7 @@ const LiveChatWidgetStateful = props => {
252
264
  if (state.appStates.isMinimized && state.appStates.unreadMessageCount > 0) {
253
265
  const customEvent = {
254
266
  elementType: _omnichannelChatComponents.ElementType.Custom,
255
- eventName: "UnreadMessageCount",
267
+ eventName: _TelemetryConstants.BroadcastEvent.UnreadMessageCount,
256
268
  payload: `${state.appStates.unreadMessageCount}`
257
269
  };
258
270
 
@@ -268,9 +280,10 @@ const LiveChatWidgetStateful = props => {
268
280
  }, [(_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.webChatStyles]);
269
281
  const webChatProps = (0, _initWebChatComposer.initWebChatComposer)(props, chatSDK, state, dispatch, setWebChatStyles);
270
282
 
271
- const setPostChatContextRelay = () => (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch);
283
+ const setPostChatContextRelay = () => (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch); // eslint-disable-next-line @typescript-eslint/no-explicit-any
284
+
272
285
 
273
- const endChatRelay = () => (0, _endChat.endChat)(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
286
+ const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat) => (0, _endChat.endChat)(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat);
274
287
 
275
288
  const prepareStartChatRelay = () => (0, _startChat.prepareStartChat)(props, chatSDK, state, dispatch, setAdapter); // eslint-disable-next-line @typescript-eslint/no-explicit-any
276
289
 
@@ -281,7 +294,7 @@ const LiveChatWidgetStateful = props => {
281
294
 
282
295
  (0, _react2.useEffect)(() => {
283
296
  const chatWidgetStateChangeEvent = {
284
- eventName: _TelemetryConstants.TelemetryEvent.ChatWidgetStateChanged,
297
+ eventName: _TelemetryConstants.BroadcastEvent.ChatWidgetStateChanged,
285
298
  payload: { ...state
286
299
  }
287
300
  };
@@ -75,14 +75,14 @@ const ProactiveChatPaneStateful = props => {
75
75
  if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
76
76
  // TODO: BroadcastService: replace with the sdk broadcast service, when in place
77
77
  const startPopoutChatEvent = {
78
- eventName: "StartPopoutChat"
78
+ eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatStartPopoutChat
79
79
  };
80
80
 
81
81
  _omnichannelChatComponents.BroadcastService.postMessage(startPopoutChatEvent);
82
82
 
83
83
  dispatch({
84
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SKIP_CHAT_BUTTON_RENDERING,
85
- payload: true
84
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
85
+ payload: _ConversationState.ConversationState.Closed
86
86
  });
87
87
  } 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") {
88
88
  dispatch({
@@ -94,6 +94,12 @@ const ProactiveChatPaneStateful = props => {
94
94
  payload: _ConversationState.ConversationState.OutOfOffice
95
95
  });
96
96
  } else {
97
+ const proactiveChatStarted = {
98
+ eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatStartChat
99
+ };
100
+
101
+ _omnichannelChatComponents.BroadcastService.postMessage(proactiveChatStarted);
102
+
97
103
  await startChat();
98
104
  }
99
105
  },
@@ -24,6 +24,10 @@ class MockChatSDK {
24
24
  return null;
25
25
  }
26
26
 
27
+ getChatToken() {
28
+ return null;
29
+ }
30
+
27
31
  createChatAdapter() {
28
32
  return new _mockadapter.default();
29
33
  } // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -5,85 +5,63 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isInlineMediaSupported = exports.getFileAttachmentIconData = void 0;
7
7
 
8
- var _BrowserVendor = require("../../webchatcontroller/enums/BrowserVendor");
8
+ var _Icons = require("../../../../assets/Icons");
9
9
 
10
10
  var _BrowserInfo = require("./BrowserInfo");
11
11
 
12
- var _archiveIcon = _interopRequireDefault(require("../../../../assets/icons/archiveIcon.svg"));
13
-
14
- var _audioIcon = _interopRequireDefault(require("../../../../assets/icons/audioIcon.svg"));
15
-
16
- var _blankIcon = _interopRequireDefault(require("../../../../assets/icons/blankIcon.svg"));
17
-
18
- var _videoIcon = _interopRequireDefault(require("../../../../assets/icons/videoIcon.svg"));
19
-
20
- var _imageIcon = _interopRequireDefault(require("../../../../assets/icons/imageIcon.svg"));
21
-
22
- var _wordIcon = _interopRequireDefault(require("../../../../assets/icons/wordIcon.svg"));
23
-
24
- var _oneNoteIcon = _interopRequireDefault(require("../../../../assets/icons/oneNoteIcon.svg"));
25
-
26
- var _powerpointIcon = _interopRequireDefault(require("../../../../assets/icons/powerpointIcon.svg"));
27
-
28
- var _visioIcon = _interopRequireDefault(require("../../../../assets/icons/visioIcon.svg"));
29
-
30
- var _pdfIcon = _interopRequireDefault(require("../../../../assets/icons/pdfIcon.svg"));
31
-
32
- var _excelIcon = _interopRequireDefault(require("../../../../assets/icons/excelIcon.svg"));
12
+ var _BrowserVendor = require("../../webchatcontroller/enums/BrowserVendor");
33
13
 
34
14
  var _Constants = require("../../../../common/Constants");
35
15
 
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
16
  const FileAttachmentIconMap = {
39
- "aac": _audioIcon.default,
40
- "aiff": _audioIcon.default,
41
- "alac": _audioIcon.default,
42
- "avchd": _videoIcon.default,
43
- "avi": _videoIcon.default,
44
- "bmp": _imageIcon.default,
45
- "doc": _wordIcon.default,
46
- "docx": _wordIcon.default,
47
- "flac": _audioIcon.default,
48
- "flv": _videoIcon.default,
49
- "gif": _imageIcon.default,
50
- "jiff": _imageIcon.default,
51
- "jpeg": _imageIcon.default,
52
- "jpg": _imageIcon.default,
53
- "mpe": _videoIcon.default,
54
- "mpeg": _videoIcon.default,
55
- "mpg": _videoIcon.default,
56
- "mpv": _videoIcon.default,
57
- "mp2": _audioIcon.default,
58
- "mp3": _audioIcon.default,
59
- "mp4": _videoIcon.default,
60
- "m4p": _videoIcon.default,
61
- "m4v": _videoIcon.default,
62
- "mov": _videoIcon.default,
63
- "one": _oneNoteIcon.default,
64
- "pcm": _audioIcon.default,
65
- "pdf": _pdfIcon.default,
66
- "png": _imageIcon.default,
67
- "ppt": _powerpointIcon.default,
68
- "pptx": _powerpointIcon.default,
69
- "qt": _videoIcon.default,
70
- "rar": _archiveIcon.default,
71
- "swf": _videoIcon.default,
72
- "tar": _archiveIcon.default,
73
- "tar.gz": _archiveIcon.default,
74
- "tgz": _archiveIcon.default,
75
- "txt": _blankIcon.default,
76
- "vsd": _visioIcon.default,
77
- "vsdx": _visioIcon.default,
78
- "wav": _audioIcon.default,
79
- "webm": _videoIcon.default,
80
- "wma": _audioIcon.default,
81
- "wmv": _videoIcon.default,
82
- "xls": _excelIcon.default,
83
- "xlsx": _excelIcon.default,
84
- "zip": _archiveIcon.default,
85
- "zipx": _archiveIcon.default,
86
- "7z": _archiveIcon.default
17
+ "aac": _Icons.AudioIcon,
18
+ "aiff": _Icons.AudioIcon,
19
+ "alac": _Icons.AudioIcon,
20
+ "avchd": _Icons.VideoIcon,
21
+ "avi": _Icons.VideoIcon,
22
+ "bmp": _Icons.ImageIcon,
23
+ "doc": _Icons.WordIcon,
24
+ "docx": _Icons.WordIcon,
25
+ "flac": _Icons.AudioIcon,
26
+ "flv": _Icons.VideoIcon,
27
+ "gif": _Icons.ImageIcon,
28
+ "jiff": _Icons.ImageIcon,
29
+ "jpeg": _Icons.ImageIcon,
30
+ "jpg": _Icons.ImageIcon,
31
+ "mpe": _Icons.VideoIcon,
32
+ "mpeg": _Icons.VideoIcon,
33
+ "mpg": _Icons.VideoIcon,
34
+ "mpv": _Icons.VideoIcon,
35
+ "mp2": _Icons.AudioIcon,
36
+ "mp3": _Icons.AudioIcon,
37
+ "mp4": _Icons.VideoIcon,
38
+ "m4p": _Icons.VideoIcon,
39
+ "m4v": _Icons.VideoIcon,
40
+ "mov": _Icons.VideoIcon,
41
+ "one": _Icons.OneNoteIcon,
42
+ "pcm": _Icons.AudioIcon,
43
+ "pdf": _Icons.PDFIcon,
44
+ "png": _Icons.ImageIcon,
45
+ "ppt": _Icons.PowerpointIcon,
46
+ "pptx": _Icons.PowerpointIcon,
47
+ "qt": _Icons.VideoIcon,
48
+ "rar": _Icons.ArchiveIcon,
49
+ "swf": _Icons.VideoIcon,
50
+ "tar": _Icons.ArchiveIcon,
51
+ "tar.gz": _Icons.ArchiveIcon,
52
+ "tgz": _Icons.ArchiveIcon,
53
+ "txt": _Icons.BlankIcon,
54
+ "vsd": _Icons.VisioIcon,
55
+ "vsdx": _Icons.VisioIcon,
56
+ "wav": _Icons.AudioIcon,
57
+ "webm": _Icons.VideoIcon,
58
+ "wma": _Icons.AudioIcon,
59
+ "wmv": _Icons.VideoIcon,
60
+ "xls": _Icons.ExcelIcon,
61
+ "xlsx": _Icons.ExcelIcon,
62
+ "zip": _Icons.ArchiveIcon,
63
+ "zipx": _Icons.ArchiveIcon,
64
+ "7z": _Icons.ArchiveIcon
87
65
  };
88
66
  /**
89
67
  * Get file attachment icon image depending on extension.
@@ -94,7 +72,7 @@ const FileAttachmentIconMap = {
94
72
  const getFileAttachmentIconData = extension => {
95
73
  const key = extension.startsWith(".") ? extension.slice(1) : extension || "";
96
74
 
97
- const icon = FileAttachmentIconMap[key.toLowerCase()] || _blankIcon.default;
75
+ const icon = FileAttachmentIconMap[key.toLowerCase()] || _Icons.BlankIcon;
98
76
 
99
77
  return icon;
100
78
  }; // Check if browser supports inline media playing for current media format
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createActivityMiddleware = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
9
9
 
10
10
  var _Constants = require("../../../../../common/Constants");
11
11
 
@@ -15,16 +15,16 @@ var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
15
15
 
16
16
  var _MessageType = require("../../enums/MessageType");
17
17
 
18
+ var _react = _interopRequireDefault(require("react"));
19
+
20
+ var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
21
+
18
22
  var _defaultSystemMessageStyles = require("./defaultStyles/defaultSystemMessageStyles");
19
23
 
20
24
  var _defaultUserMessageStyles = require("./defaultStyles/defaultUserMessageStyles");
21
25
 
22
26
  var _utils = require("../../../../../common/utils");
23
27
 
24
- var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
25
-
26
- var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
27
-
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
29
 
30
30
  /******
@@ -34,49 +34,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
34
34
  * 1. Renders system messages differently, according to Microsoft LiveChatWidget styles
35
35
  * 2. Changes the font size of user messages
36
36
  * 3. Decodes certain html characters that came through from chat services
37
- * 4. Triggers end conversation sequence when the chat thread is deleted
38
37
  ******/
39
38
  const loggedSystemMessages = new Array(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
39
 
41
- const handleThreadUpdate = channelData => {
42
- var _channelData$properti, _channelData$properti2;
43
-
44
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
45
- Event: _TelemetryConstants.TelemetryEvent.IC3ThreadUpdateEventReceived,
46
- Description: "IC3 ThreadUpdateEvent Received"
47
- });
48
-
49
- const postConversationEndedAction = () => {
50
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
51
- Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
52
- Description: "Conversation is ended by agent side or by timeout."
53
- });
54
- }; // If the Thread is deleted, then display post conversation survey if enabled.
55
-
56
-
57
- 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.Constants.true;
58
-
59
- if (isThreadDeleted) {
60
- postConversationEndedAction();
61
- return;
62
- } //check if customer is still in the thread
63
-
64
-
65
- if (channelData.members && channelData.members.length > 0) {
66
- for (let i = 0; i < channelData.members.length; i++) {
67
- const id = channelData.members[i].id;
68
- const tag = channelData.members[i].tag; // In case of ACS customer is not removed from thread and has "left" tag
69
-
70
- if (id.startsWith(_Constants.Constants.visitorIdPrefix) && tag !== _Constants.Constants.left) {
71
- return;
72
- }
73
- }
74
- }
75
-
76
- postConversationEndedAction();
77
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
-
79
-
80
40
  const handleSystemMessage = (next, args, card, systemMessageStyleProps) => {
81
41
  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;
82
42
 
@@ -129,7 +89,10 @@ const createActivityMiddleware = (systemMessageStyleProps, userMessageStyleProps
129
89
  var _card$activity$channe3;
130
90
 
131
91
  if (((_card$activity$channe3 = card.activity.channelData) === null || _card$activity$channe3 === void 0 ? void 0 : _card$activity$channe3.type) === _MessageType.MessageTypes.Thread) {
132
- handleThreadUpdate(card.activity.channelData);
92
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
93
+ Event: _TelemetryConstants.TelemetryEvent.IC3ThreadUpdateEventReceived,
94
+ Description: "IC3 ThreadUpdateEvent Received"
95
+ });
133
96
  }
134
97
 
135
98
  return () => false;
@@ -11,6 +11,8 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _FileAttachmentIconManager = require("../../../common/utils/FileAttachmentIconManager");
13
13
 
14
+ var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
15
+
14
16
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
15
17
 
16
18
  var _WebChatActionType = require("../../enums/WebChatActionType");
@@ -211,7 +213,7 @@ const createAttachmentMiddleware = enableInlinePlaying => {
211
213
  const errorData = "Unable to parse the adaptive card format";
212
214
 
213
215
  _omnichannelChatComponents.BroadcastService.postMessage({
214
- eventName: "InvalidAdaptiveCardFormat",
216
+ eventName: _TelemetryConstants.BroadcastEvent.InvalidAdaptiveCardFormat,
215
217
  payload: {
216
218
  Message: errorData,
217
219
  ExceptionDetails: e
@@ -14,6 +14,7 @@ exports.ConversationState = ConversationState;
14
14
  ConversationState[ConversationState["OutOfOffice"] = 3] = "OutOfOffice";
15
15
  ConversationState[ConversationState["ProactiveChat"] = 4] = "ProactiveChat";
16
16
  ConversationState[ConversationState["Active"] = 5] = "Active";
17
- ConversationState[ConversationState["Postchat"] = 6] = "Postchat";
18
- ConversationState[ConversationState["Closed"] = 7] = "Closed";
17
+ ConversationState[ConversationState["InActive"] = 6] = "InActive";
18
+ ConversationState[ConversationState["Postchat"] = 7] = "Postchat";
19
+ ConversationState[ConversationState["Closed"] = 8] = "Closed";
19
20
  })(ConversationState || (exports.ConversationState = ConversationState = {}));
@@ -12,6 +12,10 @@ var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontaine
12
12
  const getLiveChatWidgetContextInitialState = props => {
13
13
  var _props$webChatContain;
14
14
 
15
+ if (props !== null && props !== void 0 && props.liveChatContextFromCache) {
16
+ return props === null || props === void 0 ? void 0 : props.liveChatContextFromCache;
17
+ }
18
+
15
19
  const LiveChatWidgetContextInitialState = {
16
20
  domainStates: {
17
21
  liveChatConfig: props.chatConfig,
@@ -56,7 +60,7 @@ const getLiveChatWidgetContextInitialState = props => {
56
60
  focusChatButton: false
57
61
  }
58
62
  };
59
- return props.liveChatContextFromCache ?? LiveChatWidgetContextInitialState;
63
+ return LiveChatWidgetContextInitialState;
60
64
  };
61
65
 
62
66
  exports.getLiveChatWidgetContextInitialState = getLiveChatWidgetContextInitialState;
@@ -26,7 +26,7 @@ const shouldShowHeader = state => {
26
26
  exports.shouldShowHeader = shouldShowHeader;
27
27
 
28
28
  const shouldShowFooter = state => {
29
- return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.Active;
29
+ return !state.appStates.isMinimized && (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive);
30
30
  };
31
31
 
32
32
  exports.shouldShowFooter = shouldShowFooter;
@@ -38,7 +38,7 @@ const shouldShowEmailTranscriptPane = state => {
38
38
  exports.shouldShowEmailTranscriptPane = shouldShowEmailTranscriptPane;
39
39
 
40
40
  const shouldShowWebChatContainer = state => {
41
- return state.appStates.conversationState === _ConversationState.ConversationState.Active;
41
+ return state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive;
42
42
  };
43
43
 
44
44
  exports.shouldShowWebChatContainer = shouldShowWebChatContainer;