@microsoft/omnichannel-chat-widget 0.1.0-main.488d6f1 → 0.1.0-main.592da7b

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 (115) hide show
  1. package/README.md +35 -11
  2. package/lib/cjs/common/Constants.js +50 -6
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +52 -6
  4. package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
  5. package/lib/cjs/common/telemetry/TelemetryManager.js +17 -6
  6. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  7. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  8. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
  9. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
  10. package/lib/cjs/common/utils.js +30 -2
  11. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  12. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
  13. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -41
  14. package/lib/cjs/components/footerstateful/FooterStateful.js +1 -2
  15. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  16. package/lib/cjs/components/headerstateful/HeaderStateful.js +1 -7
  17. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +12 -15
  18. package/lib/cjs/components/livechatwidget/common/endChat.js +68 -13
  19. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
  20. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +27 -6
  21. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +105 -20
  22. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +6 -17
  23. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -5
  24. package/lib/cjs/components/livechatwidget/common/startChat.js +95 -27
  25. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +213 -56
  26. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  27. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -6
  28. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +19 -3
  29. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
  30. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  31. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  32. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  33. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
  34. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  35. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  36. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  39. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  40. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +9 -7
  41. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +8 -2
  42. package/lib/cjs/contexts/createReducer.js +16 -10
  43. package/lib/cjs/controller/componentController.js +1 -1
  44. package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
  45. package/lib/esm/common/Constants.js +46 -5
  46. package/lib/esm/common/telemetry/TelemetryConstants.js +48 -5
  47. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  48. package/lib/esm/common/telemetry/TelemetryManager.js +15 -6
  49. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  50. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  51. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
  52. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
  53. package/lib/esm/common/utils.js +19 -1
  54. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  55. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
  56. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -36
  57. package/lib/esm/components/footerstateful/FooterStateful.js +1 -2
  58. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  59. package/lib/esm/components/headerstateful/HeaderStateful.js +1 -7
  60. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +12 -16
  61. package/lib/esm/components/livechatwidget/common/endChat.js +65 -15
  62. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
  63. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +22 -6
  64. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +94 -20
  65. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +5 -14
  66. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -5
  67. package/lib/esm/components/livechatwidget/common/startChat.js +94 -31
  68. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +197 -55
  69. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  70. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -8
  71. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +20 -4
  72. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
  73. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  74. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  75. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  76. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
  77. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  78. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  79. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  80. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  81. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  82. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  83. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +9 -7
  84. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +8 -2
  85. package/lib/esm/contexts/createReducer.js +16 -9
  86. package/lib/esm/controller/componentController.js +1 -1
  87. package/lib/esm/plugins/newMessageEventHandler.js +82 -0
  88. package/lib/types/common/Constants.d.ts +25 -2
  89. package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
  90. package/lib/types/common/telemetry/TelemetryConstants.d.ts +37 -4
  91. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  92. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  93. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  94. package/lib/types/common/utils.d.ts +3 -0
  95. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -4
  96. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  97. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  98. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -2
  99. package/lib/types/components/livechatwidget/common/startChat.d.ts +2 -1
  100. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  101. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
  102. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -0
  103. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  104. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  105. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  106. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  107. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  108. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  109. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  110. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  111. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  112. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
  113. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +10 -8
  114. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  115. package/package.json +9 -11
@@ -1,5 +1,6 @@
1
- import { Constants, LocaleConstants } from "./Constants";
1
+ import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
2
2
  import { KeyCodes } from "./KeyCodes";
3
+ import { BroadcastEvent } from "./telemetry/TelemetryConstants";
3
4
 
4
5
  const getElementBySelector = selector => {
5
6
  let element;
@@ -276,4 +277,21 @@ export const createTimer = () => {
276
277
  }
277
278
 
278
279
  };
280
+ }; // Returns the domain of the org
281
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
282
+
283
+ export const getDomain = hostValue => {
284
+ for (let i = 0; i < AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
285
+ if (hostValue.endsWith(AriaTelemetryConstants.lcwEUDomainNames[i])) {
286
+ return AriaTelemetryConstants.EU;
287
+ }
288
+ }
289
+
290
+ return AriaTelemetryConstants.Public;
291
+ };
292
+ export const getWidgetCacheId = (orgId, widgetId) => {
293
+ return `${Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
294
+ };
295
+ export const getWidgetEndChatEventName = (orgId, widgetId) => {
296
+ return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
279
297
  };
@@ -177,6 +177,20 @@ export const CallingContainerStateful = props => {
177
177
  });
178
178
  }
179
179
  });
180
+ window.addEventListener("beforeunload", () => {
181
+ if (state.uiStates.isIncomingCall) {
182
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
183
+ } else {
184
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
185
+ }
186
+
187
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
188
+ dispatch({
189
+ type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
190
+ payload: false
191
+ });
192
+ resetCallingStates(true);
193
+ });
180
194
  }, []);
181
195
  const controlProps = {
182
196
  id: "oc-lcw-callingcontainer",
@@ -1,6 +1,6 @@
1
- import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
- import React, { useEffect, useState } from "react";
3
- import { ChatButton } from "@microsoft/omnichannel-chat-components";
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
+ import React, { useEffect, useRef, useState } from "react";
3
+ import { BroadcastService, ChatButton } from "@microsoft/omnichannel-chat-components";
4
4
  import { Constants } from "../../common/Constants";
5
5
  import { setFocusOnElement } from "../../common/utils";
6
6
  import { ConversationState } from "../../contexts/common/ConversationState";
@@ -10,7 +10,7 @@ import { TelemetryTimers } from "../../common/telemetry/TelemetryManager";
10
10
  import { defaultOutOfOfficeChatButtonStyleProps } from "./common/styleProps/defaultOutOfOfficeChatButtonStyleProps";
11
11
  import useChatContextStore from "../../hooks/useChatContextStore";
12
12
  export const ChatButtonStateful = props => {
13
- var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
13
+ 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
14
 
15
15
  const [state, dispatch] = useChatContextStore();
16
16
  const {
@@ -20,20 +20,26 @@ export const ChatButtonStateful = props => {
20
20
  } = props; //Setting OutOfOperatingHours Flag
21
21
 
22
22
  const [outOfOperatingHours, setOutOfOperatingHours] = useState(((_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");
23
+ const proactiveChatInNewWindow = useRef(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
23
24
  const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
24
25
  const controlProps = {
25
26
  id: "oc-lcw-chat-button",
26
27
  dir: state.domainStates.globalDir,
27
28
  titleText: "Let's Chat!",
28
29
  subtitleText: "We're online.",
29
- hideNotificationBubble: !(state.appStates.isMinimized === true && state.appStates.unreadMessageCount > 0) || (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true,
30
- unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ? Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
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,
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 (proactiveChatInNewWindow.current) {
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 = {
@@ -50,6 +57,10 @@ export const ChatButtonStateful = props => {
50
57
  titleText: "We're Offline",
51
58
  subtitleText: "No agents available",
52
59
  onClick: async () => {
60
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
61
+ Event: TelemetryEvent.LCWChatButtonClicked
62
+ });
63
+
53
64
  if (state.appStates.isMinimized) {
54
65
  dispatch({
55
66
  type: LiveChatWidgetActionType.SET_MINIMIZED,
@@ -62,6 +73,7 @@ export const ChatButtonStateful = props => {
62
73
  });
63
74
  }
64
75
  },
76
+ 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
77
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
66
78
  };
67
79
  useEffect(() => {
@@ -83,6 +95,9 @@ export const ChatButtonStateful = props => {
83
95
  });
84
96
  }
85
97
  }, []);
98
+ useEffect(() => {
99
+ proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
100
+ }, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
86
101
  return /*#__PURE__*/React.createElement(ChatButton, {
87
102
  componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
88
103
  controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
@@ -1,35 +1,25 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
+ import { ConfirmationPane } from "@microsoft/omnichannel-chat-components";
2
3
  import React, { useEffect } from "react";
3
4
  import { findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, preventFocusToMoveOutOfElement, setFocusOnElement, setFocusOnSendBox, setTabIndices } from "../../common/utils";
4
- import { BroadcastService, ConfirmationPane } from "@microsoft/omnichannel-chat-components";
5
5
  import { DimLayer } from "../dimlayer/DimLayer";
6
6
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
7
7
  import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
8
8
  import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
9
- import { PostChatSurveyMode } from "../postchatsurveypanestateful/enums/PostChatSurveyMode";
10
9
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
11
10
  import useChatAdapterStore from "../../hooks/useChatAdapterStore";
12
- import useChatContextStore from "../../hooks/useChatContextStore";
13
- import useChatSDKStore from "../../hooks/useChatSDKStore";
14
- import { Constants } from "../../common/Constants";
15
- import { ConversationState } from "../../contexts/common/ConversationState"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ import useChatContextStore from "../../hooks/useChatContextStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
12
 
17
13
  export const ConfirmationPaneStateful = props => {
18
- var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
19
-
20
14
  const initialTabIndexMap = new Map();
21
- let elements = []; // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
-
23
- const chatSDK = useChatSDKStore();
15
+ let elements = [];
24
16
  const [state, dispatch] = useChatContextStore();
25
17
  const {
26
- endChat
18
+ prepareEndChat
27
19
  } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
21
 
30
22
  const [adapter] = useChatAdapterStore();
31
- const isPostChatEnabled = (_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.msdyn_postconversationsurveyenable;
32
- const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
33
23
  const controlProps = {
34
24
  id: "oc-lcw-confirmation-pane",
35
25
  dir: state.domainStates.globalDir,
@@ -44,28 +34,8 @@ export const ConfirmationPaneStateful = props => {
44
34
  });
45
35
 
46
36
  try {
47
- // check agent has joined conversation
48
- const conversationDetails = await chatSDK.getConversationDetails();
49
-
50
- if (isPostChatEnabled === "true" && conversationDetails.canRenderPostChat === Constants.truePascal) {
51
- if (postChatSurveyMode === PostChatSurveyMode.Embed) {
52
- const loadPostChatEvent = {
53
- eventName: "LoadPostChatSurvey"
54
- };
55
- BroadcastService.postMessage(loadPostChatEvent);
56
- } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
57
- const skipEndChatSDK = false;
58
- const skipCloseChat = true;
59
- await endChat(adapter, skipEndChatSDK, skipCloseChat);
60
- dispatch({
61
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
62
- payload: ConversationState.InActive
63
- });
64
- }
65
- } else {
66
- setTabIndices(elements, initialTabIndexMap, true);
67
- await endChat(adapter);
68
- }
37
+ setTabIndices(elements, initialTabIndexMap, true);
38
+ await prepareEndChat(adapter, state);
69
39
  } catch (ex) {
70
40
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
71
41
  Event: TelemetryEvent.GetConversationDetailsCallFailed,
@@ -97,8 +97,7 @@ export const FooterStateful = props => {
97
97
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
98
98
  }), /*#__PURE__*/React.createElement(AudioNotificationStateful, {
99
99
  audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? NewMessageNotificationSoundBase64,
100
- hideAudioNotificationButton: (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false,
101
- isAudioMuted: state.appStates.isAudioMuted ?? false
100
+ isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
102
101
  }));
103
102
  };
104
103
  export default FooterStateful;
@@ -105,8 +105,14 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
105
105
  let fileAttachmentName = TranscriptConstants.DefaultFileAttachmentName;
106
106
  let dialogColor = TranscriptConstants.CustomerDialogColor;
107
107
  let fontColor = TranscriptConstants.CustomerFontColor;
108
-
109
- if (value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1 || value.isControlMessage && value.isControlMessage === true || value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType || value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode) {
108
+ const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1;
109
+ const isControlMessage = value.isControlMessage && value.isControlMessage === true;
110
+ const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType;
111
+ const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode;
112
+ const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.hiddenTag.toLowerCase()) !== -1;
113
+ const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
114
+
115
+ if (shouldIgnoreMessage) {
110
116
  return;
111
117
  } else if (value.from) {
112
118
  if (value.from.application) {
@@ -127,7 +133,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
127
133
 
128
134
  if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
129
135
  fileAttachmentName = value.attachments[0].name;
130
- value.content = attachmentMessage ?? "The following attachment was uploaded during the conversation:" + fileAttachmentName;
136
+ value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
131
137
  }
132
138
  }
133
139
 
@@ -46,13 +46,7 @@ export const HeaderStateful = props => {
46
46
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
47
47
  payload: true
48
48
  });
49
- } else if (conversationState.current === ConversationState.Postchat) {
50
- dispatch({
51
- type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
52
- payload: false
53
- });
54
- await endChat(adapter);
55
- } else if (conversationState.current === ConversationState.InActive) {
49
+ } else {
56
50
  const skipEndChatSDK = true;
57
51
  const skipCloseChat = false;
58
52
  await endChat(adapter, skipEndChatSDK, skipCloseChat);
@@ -9,7 +9,8 @@ import createAttachmentMiddleware from "../../../webchatcontainerstateful/webcha
9
9
  import { createAvatarMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware";
10
10
  import { createMarkdown } from "../createMarkdown";
11
11
  import { groupActivitiesMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware";
12
- import { typingIndicatorMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware"; // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
+ import { typingIndicatorMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware";
13
+ import { createWebChatTelemetry } from "../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger"; // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
14
 
14
15
  export const dummyDefaultProps = {
15
16
  audioNotificationProps: {
@@ -252,18 +253,6 @@ export const dummyDefaultProps = {
252
253
  width: "50px",
253
254
  fontSize: "18px"
254
255
  },
255
- currentCallTimerStyleProps: {
256
- borderRadius: "2px",
257
- margin: "1px",
258
- color: "#FFFFFF",
259
- paddingTop: "18px",
260
- fontSize: 12,
261
- fontFamily: "Segoe UI, Arial, sans-serif",
262
- backgroundColor: "darkgrey",
263
- height: "45px",
264
- width: "50px",
265
- textAlign: "center"
266
- },
267
256
  videoTileStyleProps: {
268
257
  width: "100%",
269
258
  marginLeft: "auto",
@@ -327,7 +316,9 @@ export const dummyDefaultProps = {
327
316
  hideChatTextContainer: false,
328
317
  hideChatSubtitle: false,
329
318
  hideChatTitle: false,
330
- hideNotificationBubble: true
319
+ hideNotificationBubble: true,
320
+ unreadMessageString: "new messages",
321
+ largeUnreadMessageString: "99+"
331
322
  },
332
323
  styleProps: {
333
324
  generalStyleProps: {
@@ -1424,7 +1415,8 @@ export const dummyDefaultProps = {
1424
1415
  },
1425
1416
  authClientFunction: undefined,
1426
1417
  isReconnectEnabled: undefined,
1427
- reconnectId: undefined
1418
+ reconnectId: undefined,
1419
+ redirectInSameWindow: undefined
1428
1420
  },
1429
1421
  styleProps: {
1430
1422
  generalStyles: {
@@ -1496,7 +1488,7 @@ export const dummyDefaultProps = {
1496
1488
  internalErrorBoxClass: undefined,
1497
1489
  internalRenderErrorBox: undefined,
1498
1490
  locale: "en-US",
1499
- onTelemetry: undefined,
1491
+ onTelemetry: createWebChatTelemetry(),
1500
1492
  overrideLocalizedStrings: undefined,
1501
1493
  renderMarkdown: createMarkdown(false, false),
1502
1494
  scrollToEndButtonMiddleware: undefined,
@@ -1686,6 +1678,10 @@ export const dummyDefaultProps = {
1686
1678
  MIDDLEWARE_MESSAGE_RETRY: "Retry",
1687
1679
  PRECHAT_REQUIRED_FIELD_MISSING_MESSAGE: "{0} field is required",
1688
1680
  MARKDOWN_EXTERNAL_LINK_ALT: "Opens in a new window; external."
1681
+ },
1682
+ botMagicCode: {
1683
+ disabled: false,
1684
+ fwdUrl: ""
1689
1685
  }
1690
1686
  },
1691
1687
  telemetryConfig: undefined
@@ -1,18 +1,63 @@
1
- import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
2
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
3
3
  import { ConversationState } from "../../../contexts/common/ConversationState";
4
4
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
5
5
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
6
6
  import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
7
- import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
8
+ import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
9
+ import { Constants } from "../../../common/Constants";
10
+ import { getWidgetEndChatEventName } from "../../../common/utils"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
11
 
9
- export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat) => {
12
+ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
13
+ var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
14
+
15
+ const isPostChatEnabled = (_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.msdyn_postconversationsurveyenable;
16
+ const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
17
+ const conversationDetails = await chatSDK.getConversationDetails();
18
+
19
+ if (isPostChatEnabled === "true" && (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.canRenderPostChat) === Constants.truePascal) {
20
+ const skipEndChatSDK = false;
21
+ const skipCloseChat = true;
22
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, true);
23
+
24
+ if (postChatSurveyMode === PostChatSurveyMode.Embed) {
25
+ const loadPostChatEvent = {
26
+ eventName: BroadcastEvent.LoadPostChatSurvey
27
+ };
28
+ BroadcastService.postMessage(loadPostChatEvent);
29
+ } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
30
+ dispatch({
31
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
32
+ payload: ConversationState.InActive
33
+ });
34
+ }
35
+ } else {
36
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
37
+ }
38
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
+
40
+
41
+ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
10
42
  if (!skipEndChatSDK) {
11
43
  try {
12
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
44
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
13
45
  Event: TelemetryEvent.EndChatSDKCall
14
46
  });
15
- await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
47
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat()); // Need to clear these states immediately when chat ended from OC.
48
+
49
+ dispatch({
50
+ type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
51
+ payload: undefined
52
+ });
53
+ dispatch({
54
+ type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
55
+ payload: undefined
56
+ });
57
+ dispatch({
58
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
59
+ payload: undefined
60
+ });
16
61
  } catch (ex) {
17
62
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
18
63
  Event: TelemetryEvent.EndChatSDKCallFailed,
@@ -20,6 +65,7 @@ export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
20
65
  exception: ex
21
66
  }
22
67
  });
68
+ postMessageToOtherTab = false;
23
69
  }
24
70
  }
25
71
 
@@ -50,16 +96,18 @@ export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
50
96
  payload: null
51
97
  });
52
98
  dispatch({
53
- type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
54
- payload: undefined
55
- });
56
- dispatch({
57
- type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
58
- payload: undefined
59
- });
60
- BroadcastService.postMessage({
61
- eventName: "EndChat"
99
+ type: LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
100
+ payload: 0
62
101
  });
102
+
103
+ if (postMessageToOtherTab) {
104
+ var _chatSDK$omnichannelC, _chatSDK$omnichannelC2;
105
+
106
+ 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);
107
+ BroadcastService.postMessage({
108
+ eventName: endChatEventName
109
+ });
110
+ }
63
111
  } catch (error) {
64
112
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
65
113
  Event: TelemetryEvent.CloseChatMethodException,
@@ -69,4 +117,6 @@ export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
69
117
  });
70
118
  }
71
119
  }
72
- };
120
+ };
121
+
122
+ export { prepareEndChat, endChat };
@@ -8,7 +8,7 @@ export const initCallingSdk = async (chatSDK, setVoiceVideoCallingSDK) => {
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
9
  const callingSDK = await chatSDK.getVoiceVideoCalling();
10
10
  setVoiceVideoCallingSDK(callingSDK);
11
- TelemetryHelper.logCallingEvent(LogLevel.ERROR, {
11
+ TelemetryHelper.logCallingEvent(LogLevel.INFO, {
12
12
  Event: TelemetryEvent.CallingSDKLoadSuccess
13
13
  });
14
14
  return true;
@@ -1,6 +1,10 @@
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
1
2
  import { createStore } from "botframework-webchat";
3
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
4
+ import { ConversationState } from "../../../contexts/common/ConversationState";
2
5
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
3
6
  import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
7
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
4
8
  import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
5
9
  import attachmentProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware";
6
10
  import { changeLanguageCodeFormatForWebChat } from "../../../common/utils";
@@ -13,6 +17,7 @@ import createConversationEndMiddleware from "../../webchatcontainerstateful/webc
13
17
  import createDataMaskingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware";
14
18
  import { createMarkdown } from "./createMarkdown";
15
19
  import createMaxMessageSizeValidator from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator";
20
+ import { createWebChatTelemetry } from "../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
16
21
  import { defaultAttachmentProps } from "../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps";
17
22
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
18
23
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
@@ -22,11 +27,11 @@ import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroll
22
27
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
23
28
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
24
29
  import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
25
- import { BroadcastService } from "@microsoft/omnichannel-chat-components";
26
- import { ConversationState } from "../../../contexts/common/ConversationState"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ import { createCardActionMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware";
31
+ import createMessageTimeStampMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
32
 
28
33
  export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
29
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21;
34
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
30
35
 
31
36
  const localizedTexts = { ...defaultMiddlewareLocalizedTexts,
32
37
  ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.localizedTexts)
@@ -45,6 +50,11 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
45
50
  const conversationEndCallback = async () => {
46
51
  var _props$webChatContain4, _props$webChatContain5;
47
52
 
53
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
54
+ Event: TelemetryEvent.ConversationEndedThreadEventReceived,
55
+ Description: "Conversation is ended by agent side or by timeout."
56
+ });
57
+
48
58
  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) {
49
59
  setWebChatStyles(styles => {
50
60
  return { ...styles,
@@ -56,7 +66,7 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
56
66
  if (isPostChatEnabled === "true") {
57
67
  if (postChatSurveyMode === PostChatSurveyMode.Embed) {
58
68
  const loadPostChatEvent = {
59
- eventName: "LoadPostChatSurvey"
69
+ eventName: BroadcastEvent.LoadPostChatSurvey
60
70
  };
61
71
  BroadcastService.postMessage(loadPostChatEvent);
62
72
  } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
@@ -76,10 +86,14 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
76
86
  type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
77
87
  payload: undefined
78
88
  });
89
+ dispatch({
90
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
91
+ payload: undefined
92
+ });
79
93
  };
80
94
 
81
95
  webChatStore = createStore({}, //initial state
82
- preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), channelDataMiddleware, createConversationEndMiddleware(conversationEndCallback), createDataMaskingMiddleware((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware, createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
+ preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), channelDataMiddleware, createConversationEndMiddleware(conversationEndCallback), createDataMaskingMiddleware((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), createMessageTimeStampMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware, createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
97
  ...(((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.storeMiddlewares) ?? []));
84
98
  WebChatStoreLoader.store = webChatStore;
85
99
  } // Initialize the remaining Web Chat props
@@ -96,7 +110,9 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
96
110
  avatarMiddleware: (_props$webChatContain15 = props.webChatContainerProps) !== null && _props$webChatContain15 !== void 0 && (_props$webChatContain16 = _props$webChatContain15.renderingMiddlewareProps) !== null && _props$webChatContain16 !== void 0 && _props$webChatContain16.disableAvatarMiddleware ? undefined : createAvatarMiddleware((_state$domainStates$r5 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r5 === void 0 ? void 0 : _state$domainStates$r5.avatarStyleProps, (_state$domainStates$r6 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r6 === void 0 ? void 0 : _state$domainStates$r6.avatarTextStyleProps),
97
111
  groupActivitiesMiddleware: (_props$webChatContain17 = props.webChatContainerProps) !== null && _props$webChatContain17 !== void 0 && (_props$webChatContain18 = _props$webChatContain17.renderingMiddlewareProps) !== null && _props$webChatContain18 !== void 0 && _props$webChatContain18.disableGroupActivitiesMiddleware ? undefined : (_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.groupActivitiesMiddleware,
98
112
  typingIndicatorMiddleware: (_props$webChatContain19 = props.webChatContainerProps) !== null && _props$webChatContain19 !== void 0 && (_props$webChatContain20 = _props$webChatContain19.renderingMiddlewareProps) !== null && _props$webChatContain20 !== void 0 && _props$webChatContain20.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai3 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.typingIndicatorMiddleware,
99
- ...((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.webChatProps)
113
+ onTelemetry: createWebChatTelemetry(),
114
+ cardActionMiddleware: createCardActionMiddleware(((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.botMagicCode) || undefined),
115
+ ...((_props$webChatContain22 = props.webChatContainerProps) === null || _props$webChatContain22 === void 0 ? void 0 : _props$webChatContain22.webChatProps)
100
116
  };
101
117
  return webChatProps;
102
118
  };