@microsoft/omnichannel-chat-widget 0.1.0-main.86df755 → 0.1.0-main.886e5cf

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 (186) hide show
  1. package/README.md +259 -0
  2. package/lib/cjs/assets/Audios.js +8 -0
  3. package/lib/cjs/assets/Icons.js +28 -0
  4. package/lib/cjs/common/Constants.js +52 -4
  5. package/lib/cjs/common/contextDataStore/DataStoreManager.js +14 -0
  6. package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
  7. package/lib/cjs/common/telemetry/TelemetryConstants.js +59 -4
  8. package/lib/cjs/common/telemetry/TelemetryHelper.js +22 -4
  9. package/lib/cjs/common/telemetry/TelemetryManager.js +28 -9
  10. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  11. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  12. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +48 -15
  13. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +9 -5
  14. package/lib/cjs/common/utils.js +76 -2
  15. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  16. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +28 -5
  17. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -54
  18. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  19. package/lib/cjs/components/footerstateful/FooterStateful.js +4 -5
  20. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  21. package/lib/cjs/components/headerstateful/HeaderStateful.js +13 -10
  22. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
  23. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +53 -48
  24. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
  25. package/lib/cjs/components/livechatwidget/common/endChat.js +142 -43
  26. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
  27. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +48 -11
  28. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +107 -22
  29. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +11 -7
  30. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +22 -24
  31. package/lib/cjs/components/livechatwidget/common/startChat.js +179 -41
  32. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
  33. package/lib/cjs/components/livechatwidget/interfaces/IAuthProps.js +1 -0
  34. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +249 -67
  35. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  36. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
  37. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  38. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
  39. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +27 -5
  40. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  41. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
  42. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  43. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  44. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  45. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  46. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
  47. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  48. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  49. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  50. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  51. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  52. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  53. package/lib/cjs/contexts/common/ConversationState.js +4 -2
  54. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +13 -7
  55. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +13 -5
  56. package/lib/cjs/contexts/createReducer.js +43 -10
  57. package/lib/cjs/controller/componentController.js +5 -5
  58. package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
  59. package/lib/esm/assets/Audios.js +1 -0
  60. package/lib/esm/assets/Icons.js +11 -0
  61. package/lib/esm/common/Constants.js +48 -3
  62. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  63. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  64. package/lib/esm/common/telemetry/TelemetryConstants.js +55 -3
  65. package/lib/esm/common/telemetry/TelemetryHelper.js +22 -5
  66. package/lib/esm/common/telemetry/TelemetryManager.js +22 -9
  67. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  68. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  69. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +50 -15
  70. package/lib/esm/common/telemetry/loggers/consoleLogger.js +9 -5
  71. package/lib/esm/common/utils.js +55 -1
  72. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  73. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +31 -8
  74. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -50
  75. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  76. package/lib/esm/components/footerstateful/FooterStateful.js +4 -5
  77. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  78. package/lib/esm/components/headerstateful/HeaderStateful.js +14 -11
  79. package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
  80. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +51 -49
  81. package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
  82. package/lib/esm/components/livechatwidget/common/endChat.js +139 -42
  83. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
  84. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +42 -12
  85. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +98 -23
  86. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +10 -3
  87. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +19 -22
  88. package/lib/esm/components/livechatwidget/common/startChat.js +172 -39
  89. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  90. package/lib/esm/components/livechatwidget/interfaces/IAuthProps.js +1 -0
  91. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +235 -71
  92. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  93. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
  94. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  95. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
  96. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +26 -6
  97. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  98. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
  99. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  100. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  101. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  102. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  103. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
  104. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  105. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  106. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  107. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  108. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  109. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  110. package/lib/esm/contexts/common/ConversationState.js +4 -2
  111. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +13 -7
  112. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +13 -5
  113. package/lib/esm/contexts/createReducer.js +43 -9
  114. package/lib/esm/controller/componentController.js +5 -5
  115. package/lib/esm/plugins/newMessageEventHandler.js +82 -0
  116. package/lib/types/assets/Audios.d.ts +1 -0
  117. package/lib/types/assets/Icons.d.ts +11 -0
  118. package/lib/types/common/Constants.d.ts +26 -1
  119. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  120. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  121. package/lib/types/common/telemetry/TelemetryConstants.d.ts +43 -2
  122. package/lib/types/common/telemetry/TelemetryHelper.d.ts +3 -1
  123. package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
  124. package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
  125. package/lib/types/common/telemetry/definitions/Payload.d.ts +15 -9
  126. package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
  127. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
  128. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +12 -0
  129. package/lib/types/common/utils.d.ts +6 -0
  130. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
  131. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  132. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
  133. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -1
  134. package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
  135. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  136. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  137. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  138. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  139. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  140. package/lib/types/components/livechatwidget/interfaces/IAuthProps.d.ts +4 -0
  141. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  142. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -1
  143. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  144. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  145. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  146. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  147. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  148. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  149. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  150. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  151. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -2
  152. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
  153. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  154. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  155. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  156. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  157. package/lib/types/contexts/common/ConversationState.d.ts +4 -2
  158. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -1
  159. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +14 -8
  160. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  161. package/package.json +11 -11
  162. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  163. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  164. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  165. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  166. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  167. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  168. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  169. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  170. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  171. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  172. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  173. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  174. package/lib/esm/assets/assets.d.js +0 -0
  175. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  176. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  177. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  178. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  179. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  180. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  181. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  182. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  183. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  184. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  185. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  186. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -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(() => {
@@ -73,8 +85,19 @@ export const ChatButtonStateful = props => {
73
85
  Event: TelemetryEvent.LCWChatButtonShow,
74
86
  ElapsedTimeInMilliseconds: TelemetryTimers.LcwLoadToChatButtonTimer.milliSecondsElapsed
75
87
  });
76
- setFocusOnElement(document.getElementById((controlProps === null || controlProps === void 0 ? void 0 : controlProps.id) ?? "oc-lcw-chat-button"));
88
+
89
+ if (state.uiStates.focusChatButton) {
90
+ setFocusOnElement(document.getElementById((controlProps === null || controlProps === void 0 ? void 0 : controlProps.id) ?? "oc-lcw-chat-button"));
91
+ } else {
92
+ dispatch({
93
+ type: LiveChatWidgetActionType.SET_FOCUS_CHAT_BUTTON,
94
+ payload: true
95
+ });
96
+ }
77
97
  }, []);
98
+ useEffect(() => {
99
+ proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
100
+ }, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
78
101
  return /*#__PURE__*/React.createElement(ChatButton, {
79
102
  componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
80
103
  controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
@@ -1,40 +1,29 @@
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 { ConfirmationPane } from "@microsoft/omnichannel-chat-components";
5
- import { Constants } from "../../common/Constants";
6
- import { ConversationState } from "../../contexts/common/ConversationState";
7
5
  import { DimLayer } from "../dimlayer/DimLayer";
8
6
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
9
7
  import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
10
8
  import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
11
- import { PostChatSurveyMode } from "../postchatsurveypanestateful/enums/PostChatSurveyMode";
12
9
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
13
10
  import useChatAdapterStore from "../../hooks/useChatAdapterStore";
14
- import useChatContextStore from "../../hooks/useChatContextStore";
15
- import useChatSDKStore from "../../hooks/useChatSDKStore"; // 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
15
  let elements = [];
22
16
  const [state, dispatch] = useChatContextStore();
23
17
  const {
24
- setPostChatContext,
25
- endChat
18
+ prepareEndChat
26
19
  } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
20
 
28
- const chatSDK = useChatSDKStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
-
30
21
  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
22
  const controlProps = {
34
23
  id: "oc-lcw-confirmation-pane",
35
24
  dir: state.domainStates.globalDir,
36
25
  onConfirm: async () => {
37
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
26
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
38
27
  Event: TelemetryEvent.ConfirmationConfirmButtonClicked,
39
28
  Description: "Confirmation pane Confirm button clicked"
40
29
  });
@@ -44,40 +33,8 @@ export const ConfirmationPaneStateful = props => {
44
33
  });
45
34
 
46
35
  try {
47
- //ToDo: End Chat before PostChat Context and conversation Details is set once the getPostChatContext request ID fetch issue is fixed
48
- const conversationDetails = await chatSDK.getConversationDetails(); // ToDo: Replace with CanRenderPostChat once available in conversationDetails API response
49
-
50
- if (isPostChatEnabled === "true" && postChatSurveyMode === PostChatSurveyMode.Embed && conversationDetails.canRenderPostChat === Constants.truePascal) {
51
- dispatch({
52
- type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
53
- payload: true
54
- });
55
- dispatch({
56
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
57
- payload: ConversationState.Loading
58
- });
59
- await setPostChatContext();
60
-
61
- if (state.domainStates.postChatContext) {
62
- dispatch({
63
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
64
- payload: ConversationState.Postchat
65
- });
66
- }
67
- } else {
68
- setTabIndices(elements, initialTabIndexMap, true);
69
-
70
- try {
71
- await endChat(adapter);
72
- } catch (error) {
73
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
74
- Event: TelemetryEvent.CloseChatMethodException,
75
- ExceptionDetails: {
76
- exception: `Failed to endChat: ${error}`
77
- }
78
- });
79
- }
80
- }
36
+ setTabIndices(elements, initialTabIndexMap, true);
37
+ await prepareEndChat(adapter, state);
81
38
  } catch (ex) {
82
39
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
83
40
  Event: TelemetryEvent.GetConversationDetailsCallFailed,
@@ -89,7 +46,7 @@ export const ConfirmationPaneStateful = props => {
89
46
  }
90
47
  },
91
48
  onCancel: () => {
92
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
49
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
93
50
  Event: TelemetryEvent.ConfirmationCancelButtonClicked,
94
51
  Description: "Confirmation pane Cancel button clicked."
95
52
  });
@@ -68,8 +68,8 @@ export const EmailTranscriptPaneStateful = props => {
68
68
  },
69
69
  onCancel: () => {
70
70
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
71
- Event: TelemetryEvent.EmailTranscriptButtonClicked,
72
- Description: "Email Transcript button clicked."
71
+ Event: TelemetryEvent.EmailTranscriptCancelButtonClicked,
72
+ Description: "Email Transcript cancel button clicked."
73
73
  });
74
74
  closeEmailTranscriptPane();
75
75
  },
@@ -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) {