@microsoft/omnichannel-chat-widget 0.1.0-main.7338c17 → 0.1.0-main.7375e33

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 (162) hide show
  1. package/README.md +35 -11
  2. package/lib/cjs/assets/Audios.js +8 -0
  3. package/lib/cjs/assets/Icons.js +28 -0
  4. package/lib/cjs/common/Constants.js +52 -6
  5. package/lib/cjs/common/telemetry/TelemetryConstants.js +56 -6
  6. package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
  7. package/lib/cjs/common/telemetry/TelemetryManager.js +17 -6
  8. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  9. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  10. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
  11. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
  12. package/lib/cjs/common/utils.js +76 -2
  13. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  14. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
  15. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -40
  16. package/lib/cjs/components/footerstateful/FooterStateful.js +4 -5
  17. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  18. package/lib/cjs/components/headerstateful/HeaderStateful.js +13 -10
  19. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
  20. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +27 -23
  21. package/lib/cjs/components/livechatwidget/common/endChat.js +141 -50
  22. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
  23. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +47 -9
  24. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +107 -22
  25. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +6 -17
  26. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -9
  27. package/lib/cjs/components/livechatwidget/common/startChat.js +143 -51
  28. package/lib/cjs/{assets/assets.d.js → components/livechatwidget/interfaces/IAuthProps.js} +0 -0
  29. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +235 -79
  30. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  31. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -10
  32. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +19 -3
  33. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
  34. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  35. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  36. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
  39. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  40. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  41. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  42. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  43. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  44. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  45. package/lib/cjs/contexts/common/ConversationState.js +4 -2
  46. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +9 -7
  47. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +8 -3
  48. package/lib/cjs/contexts/createReducer.js +16 -10
  49. package/lib/cjs/controller/componentController.js +5 -5
  50. package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
  51. package/lib/esm/assets/Audios.js +1 -0
  52. package/lib/esm/assets/Icons.js +11 -0
  53. package/lib/esm/common/Constants.js +48 -5
  54. package/lib/esm/common/telemetry/TelemetryConstants.js +52 -5
  55. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  56. package/lib/esm/common/telemetry/TelemetryManager.js +15 -6
  57. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  58. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  59. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
  60. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
  61. package/lib/esm/common/utils.js +55 -1
  62. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  63. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
  64. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -36
  65. package/lib/esm/components/footerstateful/FooterStateful.js +4 -5
  66. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  67. package/lib/esm/components/headerstateful/HeaderStateful.js +14 -11
  68. package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
  69. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +25 -24
  70. package/lib/esm/components/livechatwidget/common/endChat.js +139 -50
  71. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
  72. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +42 -11
  73. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +98 -23
  74. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +5 -14
  75. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -9
  76. package/lib/esm/components/livechatwidget/common/startChat.js +142 -54
  77. package/lib/esm/components/livechatwidget/interfaces/IAuthProps.js +1 -0
  78. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +221 -79
  79. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  80. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -11
  81. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +20 -4
  82. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
  83. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  84. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  85. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  86. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  87. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
  88. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  89. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  90. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  91. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  92. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  93. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  94. package/lib/esm/contexts/common/ConversationState.js +4 -2
  95. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +9 -7
  96. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +8 -3
  97. package/lib/esm/contexts/createReducer.js +16 -9
  98. package/lib/esm/controller/componentController.js +5 -5
  99. package/lib/esm/plugins/newMessageEventHandler.js +82 -0
  100. package/lib/types/assets/Audios.d.ts +1 -0
  101. package/lib/types/assets/Icons.d.ts +11 -0
  102. package/lib/types/common/Constants.d.ts +26 -2
  103. package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
  104. package/lib/types/common/telemetry/TelemetryConstants.d.ts +40 -4
  105. package/lib/types/common/telemetry/TelemetryHelper.d.ts +3 -1
  106. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  107. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  108. package/lib/types/common/utils.d.ts +6 -0
  109. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
  110. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  111. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
  112. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -1
  113. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  114. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  115. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  116. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  117. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +1 -1
  118. package/lib/types/components/livechatwidget/interfaces/IAuthProps.d.ts +4 -0
  119. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  120. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
  121. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  122. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  123. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  124. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  125. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  126. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  127. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -2
  128. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
  129. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  130. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  131. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  132. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  133. package/lib/types/contexts/common/ConversationState.d.ts +4 -2
  134. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -1
  135. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +10 -8
  136. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  137. package/package.json +9 -11
  138. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  139. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  140. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  141. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  142. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  143. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  144. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  145. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  146. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  147. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  148. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  149. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  150. package/lib/esm/assets/assets.d.js +0 -0
  151. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  152. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  153. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  154. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  155. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  156. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  157. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  158. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  159. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  160. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  161. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  162. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -1,34 +1,24 @@
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"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ import useChatContextStore from "../../hooks/useChatContextStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
12
 
16
13
  export const ConfirmationPaneStateful = props => {
17
- var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
18
-
19
14
  const initialTabIndexMap = new Map();
20
- let elements = []; // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
-
22
- const chatSDK = useChatSDKStore();
15
+ let elements = [];
23
16
  const [state, dispatch] = useChatContextStore();
24
17
  const {
25
- endChat
18
+ prepareEndChat
26
19
  } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
20
 
29
21
  const [adapter] = useChatAdapterStore();
30
- 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;
31
- 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;
32
22
  const controlProps = {
33
23
  id: "oc-lcw-confirmation-pane",
34
24
  dir: state.domainStates.globalDir,
@@ -43,28 +33,8 @@ export const ConfirmationPaneStateful = props => {
43
33
  });
44
34
 
45
35
  try {
46
- // check agent has joined conversation
47
- const conversationDetails = await chatSDK.getConversationDetails();
48
-
49
- if (isPostChatEnabled === "true" && postChatSurveyMode === PostChatSurveyMode.Embed && conversationDetails.canRenderPostChat === Constants.truePascal) {
50
- const loadPostChatEvent = {
51
- eventName: "LoadPostChatSurvey"
52
- };
53
- BroadcastService.postMessage(loadPostChatEvent);
54
- } else {
55
- setTabIndices(elements, initialTabIndexMap, true);
56
-
57
- try {
58
- await endChat(adapter);
59
- } catch (error) {
60
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
61
- Event: TelemetryEvent.CloseChatMethodException,
62
- ExceptionDetails: {
63
- exception: `Failed to endChat: ${error}`
64
- }
65
- });
66
- }
67
- }
36
+ setTabIndices(elements, initialTabIndexMap, true);
37
+ await prepareEndChat(adapter, state);
68
38
  } catch (ex) {
69
39
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
70
40
  Event: TelemetryEvent.GetConversationDetailsCallFailed,
@@ -4,13 +4,13 @@ import AudioNotificationStateful from "./audionotificationstateful/AudioNotifica
4
4
  import { Constants } from "../../common/Constants";
5
5
  import { Footer } from "@microsoft/omnichannel-chat-components";
6
6
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
7
+ import { NewMessageNotificationSoundBase64 } from "../../assets/Audios";
7
8
  import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
8
9
  import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
9
10
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
10
11
  import { downloadTranscript } from "./downloadtranscriptstateful/DownloadTranscriptStateful";
11
12
  import useChatContextStore from "../../hooks/useChatContextStore";
12
- import useChatSDKStore from "../../hooks/useChatSDKStore";
13
- import newMessageNotification from "../../assets/audios/newMessageNotification.mp3"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ import useChatSDKStore from "../../hooks/useChatSDKStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
14
 
15
15
  export const FooterStateful = props => {
16
16
  var _footerProps$controlP3, _footerProps$controlP4;
@@ -96,9 +96,8 @@ export const FooterStateful = props => {
96
96
  controlProps: controlProps,
97
97
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
98
98
  }), /*#__PURE__*/React.createElement(AudioNotificationStateful, {
99
- audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? newMessageNotification,
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
99
+ audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? NewMessageNotificationSoundBase64,
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
 
@@ -1,5 +1,5 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
- import React, { useEffect, useState } from "react";
2
+ import React, { useEffect, useRef, useState } from "react";
3
3
  import { ConversationState } from "../../contexts/common/ConversationState";
4
4
  import { Header } from "@microsoft/omnichannel-chat-components";
5
5
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
@@ -21,6 +21,7 @@ export const HeaderStateful = props => {
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
23
  const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
24
+ const conversationState = useRef(state.appStates.conversationState);
24
25
  const controlProps = {
25
26
  id: "oc-lcw-header",
26
27
  dir: state.domainStates.globalDir,
@@ -40,17 +41,15 @@ export const HeaderStateful = props => {
40
41
  Description: "Header Close button clicked."
41
42
  });
42
43
 
43
- if (state.appStates.conversationState === ConversationState.Active) {
44
+ if (conversationState.current === ConversationState.Active) {
44
45
  dispatch({
45
46
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
46
47
  payload: true
47
48
  });
48
- } else if (state.appStates.conversationState === ConversationState.Postchat) {
49
- dispatch({
50
- type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
51
- payload: false
52
- });
53
- await endChat(adapter);
49
+ } else {
50
+ const skipEndChatSDK = true;
51
+ const skipCloseChat = false;
52
+ await endChat(adapter, skipEndChatSDK, skipCloseChat);
54
53
  }
55
54
 
56
55
  dispatch({
@@ -59,8 +58,8 @@ export const HeaderStateful = props => {
59
58
  });
60
59
  },
61
60
  ...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
62
- hideTitle: state.appStates.conversationState === ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
63
- hideIcon: state.appStates.conversationState === ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
61
+ hideTitle: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
62
+ hideIcon: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
64
63
  hideCloseButton: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.Prechat || state.appStates.conversationState === ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
65
64
  };
66
65
  const outOfOfficeControlProps = {
@@ -82,7 +81,11 @@ export const HeaderStateful = props => {
82
81
  if (state.appStates.outsideOperatingHours) {
83
82
  setOutOfOperatingHours(true);
84
83
  }
85
- }, []);
84
+
85
+ if (state.appStates.conversationState) {
86
+ conversationState.current = state.appStates.conversationState;
87
+ }
88
+ }, [state.appStates]);
86
89
  return /*#__PURE__*/React.createElement(Header, {
87
90
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
88
91
  controlProps: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
@@ -1,5 +1,4 @@
1
1
  import MarkdownIt from "markdown-it";
2
- import MarkdownSlack from "slack-markdown-it";
3
2
  import MarkdownItForInline from "markdown-it-for-inline";
4
3
  import { defaultMarkdownLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMarkdownLocalizedTexts";
5
4
  import { Constants } from "../../../common/Constants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -12,8 +11,9 @@ export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineM
12
11
  html: true,
13
12
  linkify: true,
14
13
  breaks: !disableNewLineMarkdownSupport
15
- });
16
- markdown.use(MarkdownSlack); // Markdown override for open link in new tab
14
+ }); // ToDo: Commenting below usage of plugin until deferred bug is resolved: https://github.com/mayashavin/markdown-it-slack/issues/1
15
+ // markdown.use(MarkdownSlack);
16
+ // Markdown override for open link in new tab
17
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, quotes
18
18
 
19
19
  markdown.use(MarkdownItForInline, "url_new_win", "link_open", function (tokens, idx, env) {
@@ -1,5 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any */
2
+ import { ChatReconnectIconBase64, CloseChatButtonIconBase64, ModernChatIconBase64, ProactiveChatBannerBase64 } from "@microsoft/omnichannel-chat-components";
2
3
  import MockAdapter from "../../../webchatcontainerstateful/common/mockadapter";
4
+ import { NewMessageNotificationSoundBase64 } from "../../../../assets/Audios";
3
5
  import { WebChatStoreLoader } from "../../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
4
6
  import { activityStatusMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware";
5
7
  import { createActivityMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware";
@@ -8,10 +10,11 @@ import { createAvatarMiddleware } from "../../../webchatcontainerstateful/webcha
8
10
  import { createMarkdown } from "../createMarkdown";
9
11
  import { groupActivitiesMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware";
10
12
  import { typingIndicatorMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware";
11
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+ import { createWebChatTelemetry } from "../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger"; // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+
12
15
  export const dummyDefaultProps = {
13
16
  audioNotificationProps: {
14
- audioSrc: "assets/audios/newMessageNotification.mp3"
17
+ audioSrc: NewMessageNotificationSoundBase64
15
18
  },
16
19
  callingContainerProps: {
17
20
  controlProps: {
@@ -250,18 +253,6 @@ export const dummyDefaultProps = {
250
253
  width: "50px",
251
254
  fontSize: "18px"
252
255
  },
253
- currentCallTimerStyleProps: {
254
- borderRadius: "2px",
255
- margin: "1px",
256
- color: "#FFFFFF",
257
- paddingTop: "18px",
258
- fontSize: 12,
259
- fontFamily: "Segoe UI, Arial, sans-serif",
260
- backgroundColor: "darkgrey",
261
- height: "45px",
262
- width: "50px",
263
- textAlign: "center"
264
- },
265
256
  videoTileStyleProps: {
266
257
  width: "100%",
267
258
  marginLeft: "auto",
@@ -325,7 +316,9 @@ export const dummyDefaultProps = {
325
316
  hideChatTextContainer: false,
326
317
  hideChatSubtitle: false,
327
318
  hideChatTitle: false,
328
- hideNotificationBubble: true
319
+ hideNotificationBubble: true,
320
+ unreadMessageString: "new messages",
321
+ largeUnreadMessageString: "99+"
329
322
  },
330
323
  styleProps: {
331
324
  generalStyleProps: {
@@ -366,7 +359,7 @@ export const dummyDefaultProps = {
366
359
  margin: "-2px -2px -2px -3px",
367
360
  justifyContent: "center",
368
361
  backgroundSize: "65% 65%",
369
- backgroundImage: "assets/imgs/chat.svg",
362
+ backgroundImage: `url(${ModernChatIconBase64})`,
370
363
  display: "flex",
371
364
  backgroundRepeat: "no-repeat",
372
365
  backgroundPosition: "center"
@@ -887,7 +880,7 @@ export const dummyDefaultProps = {
887
880
  },
888
881
  headerIconProps: {
889
882
  id: "oc-lcw-header-icon",
890
- src: "assets/imgs/chatIcon.svg",
883
+ src: ModernChatIconBase64,
891
884
  alt: "Chat Icon",
892
885
  className: undefined
893
886
  },
@@ -1012,7 +1005,7 @@ export const dummyDefaultProps = {
1012
1005
  alignSelf: "auto"
1013
1006
  },
1014
1007
  iconImageProps: {
1015
- src: "assets/imgs/chat.svg",
1008
+ src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM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eCIgdmFsdWVzPSIwIDAgMCAwIDEgMCAwIDAgMCAxIDAgMCAwIDAgMSAwIDAgMCAwLjE2IDAiLz4NCjxmZUJsZW5kIG1vZGU9Im5vcm1hbCIgaW4yPSJlZmZlY3QyX2lubmVyU2hhZG93IiByZXN1bHQ9ImVmZmVjdDNfaW5uZXJTaGFkb3ciLz4NCjwvZmlsdGVyPg0KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyIiB4MT0iLTAuMzk1MDAxIiB5MT0iMjMuMTI4MiIgeDI9IjIwLjEwNTgiIHkyPSIzNy44NDc0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+DQo8c3RvcCBzdG9wLWNvbG9yPSIjRUZFRkVGIi8+DQo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+DQo8L2xpbmVhckdyYWRpZW50Pg0KPC9kZWZzPg0KPC9zdmc+DQo=",
1016
1009
  imageFit: 0,
1017
1010
  width: "86px",
1018
1011
  height: "86px",
@@ -1220,7 +1213,7 @@ export const dummyDefaultProps = {
1220
1213
  },
1221
1214
  headerContainerStyleProps: {
1222
1215
  backgroundColor: "rgb(49, 95, 162)",
1223
- backgroundImage: "assets/imgs/Proactive_banner.png",
1216
+ backgroundImage: `url(${ProactiveChatBannerBase64})`,
1224
1217
  backgroundPosition: "initial",
1225
1218
  backgroundRepeat: "no-repeat",
1226
1219
  borderTopLeftRadius: "inherit",
@@ -1248,7 +1241,7 @@ export const dummyDefaultProps = {
1248
1241
  fontWeight: "600"
1249
1242
  },
1250
1243
  closeButtonStyleProps: {
1251
- backgroundImage: "assets/imgs/closeChatButton.svg",
1244
+ backgroundImage: `url(${CloseChatButtonIconBase64})`,
1252
1245
  backgroundPosition: "center",
1253
1246
  backgroundRepeat: "no-repeat",
1254
1247
  color: "#605e5c",
@@ -1371,7 +1364,7 @@ export const dummyDefaultProps = {
1371
1364
  lineHeight: "19px"
1372
1365
  },
1373
1366
  iconStyleProps: {
1374
- backgroundImage: "assets/imgs//ChatReconnectPopupIcon.png",
1367
+ backgroundImage: `url(${ChatReconnectIconBase64})`,
1375
1368
  backgroundPosition: "center",
1376
1369
  backgroundRepeat: "no-repeat",
1377
1370
  backgroundSize: "200px",
@@ -1420,9 +1413,9 @@ export const dummyDefaultProps = {
1420
1413
  startNewChatButtonClassName: undefined
1421
1414
  }
1422
1415
  },
1423
- authClientFunction: undefined,
1424
1416
  isReconnectEnabled: undefined,
1425
- reconnectId: undefined
1417
+ reconnectId: undefined,
1418
+ redirectInSameWindow: undefined
1426
1419
  },
1427
1420
  styleProps: {
1428
1421
  generalStyles: {
@@ -1494,7 +1487,7 @@ export const dummyDefaultProps = {
1494
1487
  internalErrorBoxClass: undefined,
1495
1488
  internalRenderErrorBox: undefined,
1496
1489
  locale: "en-US",
1497
- onTelemetry: undefined,
1490
+ onTelemetry: createWebChatTelemetry(),
1498
1491
  overrideLocalizedStrings: undefined,
1499
1492
  renderMarkdown: createMarkdown(false, false),
1500
1493
  scrollToEndButtonMiddleware: undefined,
@@ -1684,7 +1677,15 @@ export const dummyDefaultProps = {
1684
1677
  MIDDLEWARE_MESSAGE_RETRY: "Retry",
1685
1678
  PRECHAT_REQUIRED_FIELD_MISSING_MESSAGE: "{0} field is required",
1686
1679
  MARKDOWN_EXTERNAL_LINK_ALT: "Opens in a new window; external."
1680
+ },
1681
+ botMagicCode: {
1682
+ disabled: false,
1683
+ fwdUrl: ""
1687
1684
  }
1688
1685
  },
1686
+ authProps: {
1687
+ authClientFunction: undefined,
1688
+ setAuthTokenProviderToChatSdk: undefined
1689
+ },
1689
1690
  telemetryConfig: undefined
1690
1691
  };
@@ -1,61 +1,150 @@
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
- import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
6
- import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
7
5
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
8
6
  import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
9
- 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 { addDelayInMs, getWidgetEndChatEventName } from "../../../common/utils"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
11
 
11
- export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter) => {
12
- try {
13
- var _props$webChatContain;
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, _conversationDetails;
14
14
 
15
- TelemetryHelper.logSDKEvent(LogLevel.INFO, {
16
- Event: TelemetryEvent.EndChatSDKCall
17
- });
18
- await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
19
- adapter === null || adapter === void 0 ? void 0 : adapter.end();
20
- setAdapter(undefined);
21
- setWebChatStyles({ ...defaultWebChatContainerStatefulProps.webChatStyles,
22
- ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
23
- });
24
- WebChatStoreLoader.store = null;
25
- dispatch({
26
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
27
- payload: ConversationState.Closed
28
- });
29
- dispatch({
30
- type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
31
- payload: false
32
- });
33
- dispatch({
34
- type: LiveChatWidgetActionType.SET_RECONNECT_ID,
35
- payload: undefined
36
- });
37
- dispatch({
38
- type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
39
- payload: null
40
- });
41
- dispatch({
42
- type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
43
- payload: undefined
44
- });
45
- dispatch({
46
- type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
47
- payload: undefined
48
- });
49
- BroadcastService.postMessage({
50
- eventName: "EndChat"
51
- });
52
- } catch (ex) {
53
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
54
- Event: TelemetryEvent.EndChatSDKCallFailed,
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; // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+
18
+ let conversationDetails = undefined;
19
+
20
+ try {
21
+ conversationDetails = await chatSDK.getConversationDetails();
22
+ } catch (erorr) {
23
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
24
+ Event: TelemetryEvent.GetConversationDetailsException,
55
25
  ExceptionDetails: {
56
- exception: ex
26
+ exception: `Failed to get conversation details: ${erorr}`
57
27
  }
58
28
  });
59
- NotificationHandler.notifyError(NotificationScenarios.Connection, "End Chat Call Failed: " + ex);
60
29
  }
61
- };
30
+
31
+ if (isPostChatEnabled === "true" && ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.canRenderPostChat) === Constants.truePascal) {
32
+ const skipEndChatSDK = false;
33
+ const skipCloseChat = true;
34
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, true);
35
+
36
+ if (postChatSurveyMode === PostChatSurveyMode.Embed) {
37
+ dispatch({
38
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
39
+ payload: ConversationState.PostchatLoading
40
+ });
41
+ await addDelayInMs(Constants.PostChatLoadingDurationInMs);
42
+ const loadPostChatEvent = {
43
+ eventName: BroadcastEvent.LoadPostChatSurvey
44
+ };
45
+ BroadcastService.postMessage(loadPostChatEvent);
46
+ } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
47
+ dispatch({
48
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
49
+ payload: ConversationState.InActive
50
+ });
51
+ }
52
+
53
+ return;
54
+ }
55
+
56
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
57
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
+
59
+
60
+ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
61
+ if (!skipEndChatSDK) {
62
+ try {
63
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
64
+ Event: TelemetryEvent.EndChatSDKCall
65
+ });
66
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
67
+ } catch (ex) {
68
+ TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
69
+ Event: TelemetryEvent.EndChatSDKCallFailed,
70
+ ExceptionDetails: {
71
+ exception: ex
72
+ }
73
+ });
74
+ postMessageToOtherTab = false;
75
+ }
76
+ } // Need to clear these states immediately when chat ended from OC.
77
+
78
+
79
+ dispatch({
80
+ type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
81
+ payload: undefined
82
+ });
83
+ dispatch({
84
+ type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
85
+ payload: undefined
86
+ });
87
+ dispatch({
88
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
89
+ payload: undefined
90
+ });
91
+
92
+ if (!skipCloseChat) {
93
+ try {
94
+ var _props$webChatContain;
95
+
96
+ adapter === null || adapter === void 0 ? void 0 : adapter.end();
97
+ setAdapter(undefined);
98
+ setWebChatStyles({ ...defaultWebChatContainerStatefulProps.webChatStyles,
99
+ ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
100
+ });
101
+ WebChatStoreLoader.store = null;
102
+ dispatch({
103
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
104
+ payload: ConversationState.Closed
105
+ });
106
+ dispatch({
107
+ type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
108
+ payload: false
109
+ });
110
+ dispatch({
111
+ type: LiveChatWidgetActionType.SET_RECONNECT_ID,
112
+ payload: undefined
113
+ });
114
+ dispatch({
115
+ type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
116
+ payload: null
117
+ });
118
+ dispatch({
119
+ type: LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
120
+ payload: 0
121
+ });
122
+ dispatch({
123
+ type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
124
+ payload: {
125
+ proactiveChatBodyTitle: "",
126
+ proactiveChatEnablePrechat: false,
127
+ proactiveChatInNewWindow: false
128
+ }
129
+ });
130
+
131
+ if (postMessageToOtherTab) {
132
+ var _chatSDK$omnichannelC, _chatSDK$omnichannelC2;
133
+
134
+ 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);
135
+ BroadcastService.postMessage({
136
+ eventName: endChatEventName
137
+ });
138
+ }
139
+ } catch (error) {
140
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
141
+ Event: TelemetryEvent.CloseChatMethodException,
142
+ ExceptionDetails: {
143
+ exception: `Failed to endChat: ${error}`
144
+ }
145
+ });
146
+ }
147
+ }
148
+ };
149
+
150
+ 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;