@microsoft/omnichannel-chat-widget 0.1.0-main.a7e4e7d → 0.1.0-main.b59a07c

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.
@@ -37,17 +37,22 @@ exports.BroadcastEvent = BroadcastEvent;
37
37
 
38
38
  (function (BroadcastEvent) {
39
39
  BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
40
- BroadcastEvent["EndChat"] = "ChatEnded";
40
+ BroadcastEvent["ChatEnded"] = "ChatEnded";
41
41
  BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
42
42
  BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
43
+ BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
43
44
  BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
44
45
  BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
46
+ BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
47
+ BroadcastEvent["ClosePopoutWindow"] = "ClosePopoutWindow";
45
48
  BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
46
49
  BroadcastEvent["NewMessageSent"] = "NewMessageSent";
47
50
  BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
48
51
  BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
52
+ BroadcastEvent["StartChat"] = "StartChat";
49
53
  BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
50
54
  BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
55
+ BroadcastEvent["EndChat"] = "EndChat";
51
56
  BroadcastEvent["SetCustomContext"] = "SetCustomContext";
52
57
  BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
53
58
  })(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
@@ -104,6 +109,7 @@ exports.TelemetryEvent = TelemetryEvent;
104
109
  TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
105
110
  TelemetryEvent["EndChatSDKCall"] = "EndChatCall";
106
111
  TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
112
+ TelemetryEvent["ClosePopoutWindowEventRecevied"] = "ClosePopoutWindowEventRecevied";
107
113
  TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
108
114
  TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
109
115
  TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
@@ -359,7 +359,7 @@ const getWidgetCacheId = (orgId, widgetId) => {
359
359
  exports.getWidgetCacheId = getWidgetCacheId;
360
360
 
361
361
  const getWidgetEndChatEventName = (orgId, widgetId) => {
362
- return `${_TelemetryConstants.BroadcastEvent.EndChat}_${orgId}_${widgetId}`;
362
+ return `${_TelemetryConstants.BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
363
363
  };
364
364
 
365
365
  exports.getWidgetEndChatEventName = getWidgetEndChatEventName;
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
34
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
35
 
36
36
  const ChatButtonStateful = props => {
37
- var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
37
+ var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
38
38
 
39
39
  const [state, dispatch] = (0, _useChatContextStore.default)();
40
40
  const {
@@ -51,13 +51,19 @@ const ChatButtonStateful = props => {
51
51
  titleText: "Let's Chat!",
52
52
  subtitleText: "We're online.",
53
53
  hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
54
- unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? _Constants.Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
54
+ unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
55
55
  onClick: async () => {
56
56
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
57
57
  Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
58
58
  });
59
59
 
60
- if (state.appStates.isMinimized) {
60
+ if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
61
+ const proactiveChatIsInPopoutModeEvent = {
62
+ eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatIsInPopoutMode
63
+ };
64
+
65
+ _omnichannelChatComponents.BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
66
+ } else if (state.appStates.isMinimized) {
61
67
  dispatch({
62
68
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
63
69
  payload: false
@@ -66,6 +72,7 @@ const ChatButtonStateful = props => {
66
72
  await startChat();
67
73
  }
68
74
  },
75
+ unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
69
76
  ...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
70
77
  };
71
78
  const outOfOfficeControlProps = {
@@ -86,6 +93,7 @@ const ChatButtonStateful = props => {
86
93
  });
87
94
  }
88
95
  },
96
+ unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
89
97
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
90
98
  };
91
99
  (0, _react.useEffect)(() => {
@@ -337,7 +337,9 @@ const dummyDefaultProps = {
337
337
  hideChatTextContainer: false,
338
338
  hideChatSubtitle: false,
339
339
  hideChatTitle: false,
340
- hideNotificationBubble: true
340
+ hideNotificationBubble: true,
341
+ unreadMessageString: "new messages",
342
+ largeUnreadMessageString: "99+"
341
343
  },
342
344
  styleProps: {
343
345
  generalStyleProps: {
@@ -115,7 +115,7 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
115
115
  });
116
116
 
117
117
  _omnichannelChatComponents.BroadcastService.postMessage({
118
- eventName: _TelemetryConstants.BroadcastEvent.EndChat
118
+ eventName: _TelemetryConstants.BroadcastEvent.ChatEnded
119
119
  });
120
120
 
121
121
  if (postMessageToOtherTab) {
@@ -221,7 +221,7 @@ const LiveChatWidgetStateful = props => {
221
221
  });
222
222
  });
223
223
 
224
- _omnichannelChatComponents.BroadcastService.getMessageByEventName("StartProactiveChat").subscribe(msg => {
224
+ _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartProactiveChat).subscribe(msg => {
225
225
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
226
226
  Event: _TelemetryConstants.TelemetryEvent.StartProactiveChatEventReceived,
227
227
  Description: "Start proactive chat event received."
@@ -240,7 +240,7 @@ const LiveChatWidgetStateful = props => {
240
240
  }); // start chat from SDK Event
241
241
 
242
242
 
243
- _omnichannelChatComponents.BroadcastService.getMessageByEventName("StartChat").subscribe(() => {
243
+ _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(() => {
244
244
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
245
245
  Event: _TelemetryConstants.TelemetryEvent.StartChatEventRecevied,
246
246
  Description: "Start chat event received."
@@ -257,7 +257,7 @@ const LiveChatWidgetStateful = props => {
257
257
  }); // end chat from SDK Event
258
258
 
259
259
 
260
- _omnichannelChatComponents.BroadcastService.getMessageByEventName("EndChat").subscribe(async () => {
260
+ _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.EndChat).subscribe(async () => {
261
261
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
262
262
  Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
263
263
  Description: "End chat event received."
@@ -277,6 +277,23 @@ const LiveChatWidgetStateful = props => {
277
277
 
278
278
  _omnichannelChatComponents.BroadcastService.getMessageByEventName(endChatEventName).subscribe(async () => {
279
279
  (0, _endChat.endChat)(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, false);
280
+ }); // Close popout window
281
+
282
+
283
+ _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.ClosePopoutWindow).subscribe(() => {
284
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
285
+ Event: _TelemetryConstants.TelemetryEvent.ClosePopoutWindowEventRecevied,
286
+ Description: "Close popout window event received."
287
+ });
288
+
289
+ dispatch({
290
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
291
+ payload: {
292
+ proactiveChatBodyTitle: "",
293
+ proactiveChatEnablePrechat: false,
294
+ proactiveChatInNewWindow: false
295
+ }
296
+ });
280
297
  });
281
298
 
282
299
  window.addEventListener("beforeunload", () => {
@@ -46,6 +46,14 @@ const ProactiveChatPaneStateful = props => {
46
46
  const handleProactiveChatInviteTimeout = () => {
47
47
  if (!timeoutRemoved) {
48
48
  setTimeoutRemoved(true);
49
+ dispatch({
50
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
51
+ payload: {
52
+ proactiveChatBodyTitle: "",
53
+ proactiveChatEnablePrechat: false,
54
+ proactiveChatInNewWindow: false
55
+ }
56
+ });
49
57
  dispatch({
50
58
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
51
59
  payload: _ConversationState.ConversationState.Closed
@@ -111,6 +119,14 @@ const ProactiveChatPaneStateful = props => {
111
119
  Description: "Proactive chat closed."
112
120
  });
113
121
 
122
+ dispatch({
123
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
124
+ payload: {
125
+ proactiveChatBodyTitle: "",
126
+ proactiveChatEnablePrechat: false,
127
+ proactiveChatInNewWindow: false
128
+ }
129
+ });
114
130
  dispatch({
115
131
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
116
132
  payload: _ConversationState.ConversationState.Closed
@@ -26,17 +26,22 @@ export let BroadcastEvent; // Events being logged
26
26
 
27
27
  (function (BroadcastEvent) {
28
28
  BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
29
- BroadcastEvent["EndChat"] = "ChatEnded";
29
+ BroadcastEvent["ChatEnded"] = "ChatEnded";
30
30
  BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
31
31
  BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
32
+ BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
32
33
  BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
33
34
  BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
35
+ BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
36
+ BroadcastEvent["ClosePopoutWindow"] = "ClosePopoutWindow";
34
37
  BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
35
38
  BroadcastEvent["NewMessageSent"] = "NewMessageSent";
36
39
  BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
37
40
  BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
41
+ BroadcastEvent["StartChat"] = "StartChat";
38
42
  BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
39
43
  BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
44
+ BroadcastEvent["EndChat"] = "EndChat";
40
45
  BroadcastEvent["SetCustomContext"] = "SetCustomContext";
41
46
  BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
42
47
  })(BroadcastEvent || (BroadcastEvent = {}));
@@ -92,6 +97,7 @@ export let TelemetryEvent;
92
97
  TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
93
98
  TelemetryEvent["EndChatSDKCall"] = "EndChatCall";
94
99
  TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
100
+ TelemetryEvent["ClosePopoutWindowEventRecevied"] = "ClosePopoutWindowEventRecevied";
95
101
  TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
96
102
  TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
97
103
  TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
@@ -293,5 +293,5 @@ export const getWidgetCacheId = (orgId, widgetId) => {
293
293
  return `${Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
294
294
  };
295
295
  export const getWidgetEndChatEventName = (orgId, widgetId) => {
296
- return `${BroadcastEvent.EndChat}_${orgId}_${widgetId}`;
296
+ return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
297
297
  };
@@ -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 { ChatButton } from "@microsoft/omnichannel-chat-components";
4
4
  import { Constants } from "../../common/Constants";
@@ -9,8 +9,9 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
9
9
  import { TelemetryTimers } from "../../common/telemetry/TelemetryManager";
10
10
  import { defaultOutOfOfficeChatButtonStyleProps } from "./common/styleProps/defaultOutOfOfficeChatButtonStyleProps";
11
11
  import useChatContextStore from "../../hooks/useChatContextStore";
12
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
12
13
  export const ChatButtonStateful = props => {
13
- var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
14
+ var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
14
15
 
15
16
  const [state, dispatch] = useChatContextStore();
16
17
  const {
@@ -27,13 +28,18 @@ export const ChatButtonStateful = props => {
27
28
  titleText: "Let's Chat!",
28
29
  subtitleText: "We're online.",
29
30
  hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
30
- unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ? Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
31
+ unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
31
32
  onClick: async () => {
32
33
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
33
34
  Event: TelemetryEvent.LCWChatButtonClicked
34
35
  });
35
36
 
36
- if (state.appStates.isMinimized) {
37
+ if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
38
+ const proactiveChatIsInPopoutModeEvent = {
39
+ eventName: BroadcastEvent.ProactiveChatIsInPopoutMode
40
+ };
41
+ BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
42
+ } else if (state.appStates.isMinimized) {
37
43
  dispatch({
38
44
  type: LiveChatWidgetActionType.SET_MINIMIZED,
39
45
  payload: false
@@ -42,6 +48,7 @@ export const ChatButtonStateful = props => {
42
48
  await startChat();
43
49
  }
44
50
  },
51
+ unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
45
52
  ...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
46
53
  };
47
54
  const outOfOfficeControlProps = {
@@ -62,6 +69,7 @@ export const ChatButtonStateful = props => {
62
69
  });
63
70
  }
64
71
  },
72
+ unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
65
73
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
66
74
  };
67
75
  useEffect(() => {
@@ -316,7 +316,9 @@ export const dummyDefaultProps = {
316
316
  hideChatTextContainer: false,
317
317
  hideChatSubtitle: false,
318
318
  hideChatTitle: false,
319
- hideNotificationBubble: true
319
+ hideNotificationBubble: true,
320
+ unreadMessageString: "new messages",
321
+ largeUnreadMessageString: "99+"
320
322
  },
321
323
  styleProps: {
322
324
  generalStyleProps: {
@@ -92,7 +92,7 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
92
92
  payload: null
93
93
  });
94
94
  BroadcastService.postMessage({
95
- eventName: BroadcastEvent.EndChat
95
+ eventName: BroadcastEvent.ChatEnded
96
96
  });
97
97
 
98
98
  if (postMessageToOtherTab) {
@@ -163,7 +163,7 @@ export const LiveChatWidgetStateful = props => {
163
163
  payload: msg === null || msg === void 0 ? void 0 : msg.payload
164
164
  });
165
165
  });
166
- BroadcastService.getMessageByEventName("StartProactiveChat").subscribe(msg => {
166
+ BroadcastService.getMessageByEventName(BroadcastEvent.StartProactiveChat).subscribe(msg => {
167
167
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
168
168
  Event: TelemetryEvent.StartProactiveChatEventReceived,
169
169
  Description: "Start proactive chat event received."
@@ -181,7 +181,7 @@ export const LiveChatWidgetStateful = props => {
181
181
  }
182
182
  }); // start chat from SDK Event
183
183
 
184
- BroadcastService.getMessageByEventName("StartChat").subscribe(() => {
184
+ BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(() => {
185
185
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
186
186
  Event: TelemetryEvent.StartChatEventRecevied,
187
187
  Description: "Start chat event received."
@@ -197,7 +197,7 @@ export const LiveChatWidgetStateful = props => {
197
197
  }
198
198
  }); // end chat from SDK Event
199
199
 
200
- BroadcastService.getMessageByEventName("EndChat").subscribe(async () => {
200
+ BroadcastService.getMessageByEventName(BroadcastEvent.EndChat).subscribe(async () => {
201
201
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
202
202
  Event: TelemetryEvent.EndChatEventReceived,
203
203
  Description: "End chat event received."
@@ -215,6 +215,21 @@ export const LiveChatWidgetStateful = props => {
215
215
  const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId);
216
216
  BroadcastService.getMessageByEventName(endChatEventName).subscribe(async () => {
217
217
  endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, false);
218
+ }); // Close popout window
219
+
220
+ BroadcastService.getMessageByEventName(BroadcastEvent.ClosePopoutWindow).subscribe(() => {
221
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
222
+ Event: TelemetryEvent.ClosePopoutWindowEventRecevied,
223
+ Description: "Close popout window event received."
224
+ });
225
+ dispatch({
226
+ type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
227
+ payload: {
228
+ proactiveChatBodyTitle: "",
229
+ proactiveChatEnablePrechat: false,
230
+ proactiveChatInNewWindow: false
231
+ }
232
+ });
218
233
  });
219
234
  window.addEventListener("beforeunload", () => {
220
235
  disposeTelemetryLoggers();
@@ -24,6 +24,14 @@ export const ProactiveChatPaneStateful = props => {
24
24
  const handleProactiveChatInviteTimeout = () => {
25
25
  if (!timeoutRemoved) {
26
26
  setTimeoutRemoved(true);
27
+ dispatch({
28
+ type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
29
+ payload: {
30
+ proactiveChatBodyTitle: "",
31
+ proactiveChatEnablePrechat: false,
32
+ proactiveChatInNewWindow: false
33
+ }
34
+ });
27
35
  dispatch({
28
36
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
29
37
  payload: ConversationState.Closed
@@ -81,6 +89,14 @@ export const ProactiveChatPaneStateful = props => {
81
89
  Event: TelemetryEvent.ProactiveChatClosed,
82
90
  Description: "Proactive chat closed."
83
91
  });
92
+ dispatch({
93
+ type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
94
+ payload: {
95
+ proactiveChatBodyTitle: "",
96
+ proactiveChatEnablePrechat: false,
97
+ proactiveChatInNewWindow: false
98
+ }
99
+ });
84
100
  dispatch({
85
101
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
86
102
  payload: ConversationState.Closed
@@ -19,17 +19,22 @@ export declare enum LogLevel {
19
19
  }
20
20
  export declare enum BroadcastEvent {
21
21
  LoadPostChatSurvey = "LoadPostChatSurvey",
22
- EndChat = "ChatEnded",
22
+ ChatEnded = "ChatEnded",
23
23
  NewMessageNotification = "NewMessageNotification",
24
24
  UnreadMessageCount = "UnreadMessageCount",
25
+ StartProactiveChat = "StartProactiveChat",
25
26
  ProactiveChatStartChat = "ProactiveChatStartChat",
26
27
  ProactiveChatStartPopoutChat = "ProactiveChatStartPopoutChat",
28
+ ProactiveChatIsInPopoutMode = "ProactiveChatIsInPopoutMode",
29
+ ClosePopoutWindow = "ClosePopoutWindow",
27
30
  InvalidAdaptiveCardFormat = "InvalidAdaptiveCardFormat",
28
31
  NewMessageSent = "NewMessageSent",
29
32
  NewMessageReceived = "NewMessageReceived",
30
33
  RedirectPageRequest = "RedirectPageRequest",
34
+ StartChat = "StartChat",
31
35
  StartChatSkippingChatButtonRendering = "StartChatSkippingChatButtonRendering",
32
36
  StartUnauthenticatedReconnectChat = "StartUnauthenticatedReconnectChat",
37
+ EndChat = "EndChat",
33
38
  SetCustomContext = "SetCustomContext",
34
39
  ChatRetrievedFromCache = "ChatRetrievedFromCache"
35
40
  }
@@ -82,6 +87,7 @@ export declare enum TelemetryEvent {
82
87
  StartChatEventRecevied = "StartChatEventReceived",
83
88
  EndChatSDKCall = "EndChatCall",
84
89
  EndChatEventReceived = "EndChatEventReceived",
90
+ ClosePopoutWindowEventRecevied = "ClosePopoutWindowEventRecevied",
85
91
  OnNewMessageFailed = "OnNewMessageFailed",
86
92
  OnNewMessageAudioNotificationFailed = "OnNewMessageAudioNotificationFailed",
87
93
  DownloadTranscriptResponseNullOrUndefined = "DownloadTranscriptResponseNullOrUndefined",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "0.1.0-main.a7e4e7d",
3
+ "version": "0.1.0-main.b59a07c",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@fluentui/react": "^8.49.1",
77
- "@microsoft/omnichannel-chat-components": "^0.1.0-main.91dd060",
77
+ "@microsoft/omnichannel-chat-components": "^0.1.0-main.353ecff",
78
78
  "@microsoft/omnichannel-chat-sdk": "1.0.1-main.077d17c",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.3.4",