@microsoft/omnichannel-chat-widget 0.1.0-main.89c6531 → 0.1.0-main.ae3aa42

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 (147) hide show
  1. package/README.md +227 -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 +38 -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 +37 -4
  8. package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
  9. package/lib/cjs/common/telemetry/TelemetryManager.js +11 -6
  10. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  11. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  12. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +31 -10
  13. package/lib/cjs/common/utils.js +15 -2
  14. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -54
  15. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  16. package/lib/cjs/components/footerstateful/FooterStateful.js +4 -5
  17. package/lib/cjs/components/headerstateful/HeaderStateful.js +11 -8
  18. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
  19. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +16 -9
  20. package/lib/cjs/components/livechatwidget/common/endChat.js +102 -50
  21. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
  22. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +29 -9
  23. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +105 -20
  24. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +11 -5
  25. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +26 -24
  26. package/lib/cjs/components/livechatwidget/common/startChat.js +113 -54
  27. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
  28. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +98 -37
  29. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  30. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
  31. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  32. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +28 -11
  33. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +10 -4
  34. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  35. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  36. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +9 -46
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  39. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  40. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +44 -0
  41. package/lib/cjs/contexts/common/ConversationState.js +3 -2
  42. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +15 -13
  43. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +9 -3
  44. package/lib/cjs/contexts/createReducer.js +20 -10
  45. package/lib/cjs/controller/componentController.js +2 -2
  46. package/lib/cjs/plugins/newMessageEventHandler.js +102 -0
  47. package/lib/esm/assets/Audios.js +1 -0
  48. package/lib/esm/assets/Icons.js +11 -0
  49. package/lib/esm/common/Constants.js +34 -3
  50. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  51. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  52. package/lib/esm/common/telemetry/TelemetryConstants.js +33 -3
  53. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  54. package/lib/esm/common/telemetry/TelemetryManager.js +10 -6
  55. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  56. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  57. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
  58. package/lib/esm/common/utils.js +11 -1
  59. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -50
  60. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  61. package/lib/esm/components/footerstateful/FooterStateful.js +4 -5
  62. package/lib/esm/components/headerstateful/HeaderStateful.js +12 -9
  63. package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
  64. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -10
  65. package/lib/esm/components/livechatwidget/common/endChat.js +100 -47
  66. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
  67. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +25 -9
  68. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +94 -20
  69. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +10 -4
  70. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +23 -22
  71. package/lib/esm/components/livechatwidget/common/startChat.js +108 -51
  72. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  73. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +92 -36
  74. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  75. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
  76. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  77. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +26 -10
  78. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -5
  79. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  80. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  81. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  82. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -44
  83. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  84. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  85. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +31 -0
  86. package/lib/esm/contexts/common/ConversationState.js +3 -2
  87. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +15 -13
  88. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +9 -3
  89. package/lib/esm/contexts/createReducer.js +20 -9
  90. package/lib/esm/controller/componentController.js +2 -2
  91. package/lib/esm/plugins/newMessageEventHandler.js +84 -0
  92. package/lib/types/assets/Audios.d.ts +1 -0
  93. package/lib/types/assets/Icons.d.ts +11 -0
  94. package/lib/types/common/Constants.d.ts +19 -1
  95. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  96. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  97. package/lib/types/common/telemetry/TelemetryConstants.d.ts +23 -1
  98. package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
  99. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  100. package/lib/types/common/utils.d.ts +1 -0
  101. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
  102. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  103. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -1
  104. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  105. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -2
  106. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  107. package/lib/types/components/livechatwidget/common/startChat.d.ts +1 -1
  108. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  109. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  110. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
  111. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  112. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  113. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -0
  114. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  115. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  116. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  117. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  118. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  119. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
  120. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +15 -13
  121. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  122. package/package.json +11 -11
  123. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  124. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  125. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  126. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  127. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  128. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  129. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  130. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  131. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  132. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  133. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  134. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  135. package/lib/esm/assets/assets.d.js +0 -0
  136. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  137. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  138. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  139. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  140. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  141. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  142. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  143. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  144. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  145. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  146. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  147. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -1,40 +1,30 @@
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
-
28
- const chatSDK = useChatSDKStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
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,
36
26
  onConfirm: async () => {
37
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
27
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
38
28
  Event: TelemetryEvent.ConfirmationConfirmButtonClicked,
39
29
  Description: "Confirmation pane Confirm button clicked"
40
30
  });
@@ -44,40 +34,8 @@ export const ConfirmationPaneStateful = props => {
44
34
  });
45
35
 
46
36
  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
- }
37
+ setTabIndices(elements, initialTabIndexMap, true);
38
+ await prepareEndChat(adapter, state);
81
39
  } catch (ex) {
82
40
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
83
41
  Event: TelemetryEvent.GetConversationDetailsCallFailed,
@@ -89,7 +47,7 @@ export const ConfirmationPaneStateful = props => {
89
47
  }
90
48
  },
91
49
  onCancel: () => {
92
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
50
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
93
51
  Event: TelemetryEvent.ConfirmationCancelButtonClicked,
94
52
  Description: "Confirmation pane Cancel button clicked."
95
53
  });
@@ -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;
@@ -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({
@@ -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: {
@@ -366,7 +369,7 @@ export const dummyDefaultProps = {
366
369
  margin: "-2px -2px -2px -3px",
367
370
  justifyContent: "center",
368
371
  backgroundSize: "65% 65%",
369
- backgroundImage: "assets/imgs/chat.svg",
372
+ backgroundImage: `url(${ModernChatIconBase64})`,
370
373
  display: "flex",
371
374
  backgroundRepeat: "no-repeat",
372
375
  backgroundPosition: "center"
@@ -887,7 +890,7 @@ export const dummyDefaultProps = {
887
890
  },
888
891
  headerIconProps: {
889
892
  id: "oc-lcw-header-icon",
890
- src: "assets/imgs/chatIcon.svg",
893
+ src: ModernChatIconBase64,
891
894
  alt: "Chat Icon",
892
895
  className: undefined
893
896
  },
@@ -1012,7 +1015,7 @@ export const dummyDefaultProps = {
1012
1015
  alignSelf: "auto"
1013
1016
  },
1014
1017
  iconImageProps: {
1015
- src: "assets/imgs/chat.svg",
1018
+ src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIwX2lpKSI+DQo8cGF0aCBkPSJNMTUuMTk3MSAxNi4yNzI1VjI1Ljg1MjRDMTUuMTk3MSAyNy4zODExIDE1Ljg0MDEgMjcuNTIwMSAxNi45ODMyIDI3LjUyMDFMMjYuNzA4NCAyNy41NjQ5TDMxLjAwMzkgMzIuMzEyM1YyNy41NjQ5SDMxLjg5N0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MDAxIiB5MT0iMjMuMTI4MiIgeDI9IjIwLjEwNTgiIHkyPSIzNy44NDc0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+DQo8c3RvcCBzdG9wLWNvbG9yPSIjRUZFRkVGIi8+DQo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+DQo8L2xpbmVhckdyYWRpZW50Pg0KPC9kZWZzPg0KPC9zdmc+DQo=",
1016
1019
  imageFit: 0,
1017
1020
  width: "86px",
1018
1021
  height: "86px",
@@ -1220,7 +1223,7 @@ export const dummyDefaultProps = {
1220
1223
  },
1221
1224
  headerContainerStyleProps: {
1222
1225
  backgroundColor: "rgb(49, 95, 162)",
1223
- backgroundImage: "assets/imgs/Proactive_banner.png",
1226
+ backgroundImage: `url(${ProactiveChatBannerBase64})`,
1224
1227
  backgroundPosition: "initial",
1225
1228
  backgroundRepeat: "no-repeat",
1226
1229
  borderTopLeftRadius: "inherit",
@@ -1248,7 +1251,7 @@ export const dummyDefaultProps = {
1248
1251
  fontWeight: "600"
1249
1252
  },
1250
1253
  closeButtonStyleProps: {
1251
- backgroundImage: "assets/imgs/closeChatButton.svg",
1254
+ backgroundImage: `url(${CloseChatButtonIconBase64})`,
1252
1255
  backgroundPosition: "center",
1253
1256
  backgroundRepeat: "no-repeat",
1254
1257
  color: "#605e5c",
@@ -1371,7 +1374,7 @@ export const dummyDefaultProps = {
1371
1374
  lineHeight: "19px"
1372
1375
  },
1373
1376
  iconStyleProps: {
1374
- backgroundImage: "assets/imgs//ChatReconnectPopupIcon.png",
1377
+ backgroundImage: `url(${ChatReconnectIconBase64})`,
1375
1378
  backgroundPosition: "center",
1376
1379
  backgroundRepeat: "no-repeat",
1377
1380
  backgroundSize: "200px",
@@ -1422,7 +1425,8 @@ export const dummyDefaultProps = {
1422
1425
  },
1423
1426
  authClientFunction: undefined,
1424
1427
  isReconnectEnabled: undefined,
1425
- reconnectId: undefined
1428
+ reconnectId: undefined,
1429
+ redirectInSameWindow: undefined
1426
1430
  },
1427
1431
  styleProps: {
1428
1432
  generalStyles: {
@@ -1494,7 +1498,7 @@ export const dummyDefaultProps = {
1494
1498
  internalErrorBoxClass: undefined,
1495
1499
  internalRenderErrorBox: undefined,
1496
1500
  locale: "en-US",
1497
- onTelemetry: undefined,
1501
+ onTelemetry: createWebChatTelemetry(),
1498
1502
  overrideLocalizedStrings: undefined,
1499
1503
  renderMarkdown: createMarkdown(false, false),
1500
1504
  scrollToEndButtonMiddleware: undefined,
@@ -1,53 +1,106 @@
1
- import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
2
3
  import { ConversationState } from "../../../contexts/common/ConversationState";
3
4
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
4
- import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
5
- import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
6
5
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
7
6
  import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
8
7
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
9
- import { BroadcastService } from "@microsoft/omnichannel-chat-components"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
-
11
- export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter) => {
12
- try {
13
- var _props$webChatContain;
14
-
15
- TelemetryHelper.logConfigDataEvent(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_RECONNECT_ID,
31
- payload: undefined
32
- });
33
- dispatch({
34
- type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
35
- payload: null
36
- });
37
- dispatch({
38
- type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
39
- payload: undefined
40
- });
41
- BroadcastService.postMessage({
42
- eventName: "EndChat"
43
- });
44
- } catch (ex) {
45
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
46
- Event: TelemetryEvent.EndChatSDKCallFailed,
47
- ExceptionDetails: {
48
- exception: ex
49
- }
50
- });
51
- NotificationHandler.notifyError(NotificationScenarios.Connection, "End Chat Call Failed: " + ex);
8
+ import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
9
+ import { Constants } from "../../../common/Constants";
10
+
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
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);
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);
52
37
  }
53
- };
38
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
+
40
+
41
+ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat) => {
42
+ if (!skipEndChatSDK) {
43
+ try {
44
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
45
+ Event: TelemetryEvent.EndChatSDKCall
46
+ });
47
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
48
+ } catch (ex) {
49
+ TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
50
+ Event: TelemetryEvent.EndChatSDKCallFailed,
51
+ ExceptionDetails: {
52
+ exception: ex
53
+ }
54
+ });
55
+ }
56
+ }
57
+
58
+ if (!skipCloseChat) {
59
+ try {
60
+ var _props$webChatContain;
61
+
62
+ adapter === null || adapter === void 0 ? void 0 : adapter.end();
63
+ setAdapter(undefined);
64
+ setWebChatStyles({ ...defaultWebChatContainerStatefulProps.webChatStyles,
65
+ ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
66
+ });
67
+ WebChatStoreLoader.store = null;
68
+ dispatch({
69
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
70
+ payload: ConversationState.Closed
71
+ });
72
+ dispatch({
73
+ type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
74
+ payload: false
75
+ });
76
+ dispatch({
77
+ type: LiveChatWidgetActionType.SET_RECONNECT_ID,
78
+ payload: undefined
79
+ });
80
+ dispatch({
81
+ type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
82
+ payload: null
83
+ });
84
+ dispatch({
85
+ type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
86
+ payload: undefined
87
+ });
88
+ dispatch({
89
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
90
+ payload: undefined
91
+ });
92
+ BroadcastService.postMessage({
93
+ eventName: BroadcastEvent.EndChat
94
+ });
95
+ } catch (error) {
96
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
97
+ Event: TelemetryEvent.CloseChatMethodException,
98
+ ExceptionDetails: {
99
+ exception: `Failed to endChat: ${error}`
100
+ }
101
+ });
102
+ }
103
+ }
104
+ };
105
+
106
+ export { prepareEndChat, endChat };
@@ -8,6 +8,9 @@ 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.INFO, {
12
+ Event: TelemetryEvent.CallingSDKLoadSuccess
13
+ });
11
14
  return true;
12
15
  }
13
16
 
@@ -1,7 +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";
2
4
  import { ConversationState } from "../../../contexts/common/ConversationState";
3
5
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
4
6
  import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
7
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
5
8
  import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
6
9
  import attachmentProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware";
7
10
  import { changeLanguageCodeFormatForWebChat } from "../../../common/utils";
@@ -14,6 +17,7 @@ import createConversationEndMiddleware from "../../webchatcontainerstateful/webc
14
17
  import createDataMaskingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware";
15
18
  import { createMarkdown } from "./createMarkdown";
16
19
  import createMaxMessageSizeValidator from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator";
20
+ import { createWebChatTelemetry } from "../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
17
21
  import { defaultAttachmentProps } from "../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps";
18
22
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
19
23
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
@@ -22,8 +26,7 @@ import gifUploadMiddleware from "../../webchatcontainerstateful/webchatcontrolle
22
26
  import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware";
23
27
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
24
28
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
25
- import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
26
- import { setPostChatContextAndLoadSurvey } from "./setPostChatContextAndLoadSurvey"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
30
 
28
31
  export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
29
32
  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;
@@ -45,6 +48,11 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
45
48
  const conversationEndCallback = async () => {
46
49
  var _props$webChatContain4, _props$webChatContain5;
47
50
 
51
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
52
+ Event: TelemetryEvent.ConversationEndedThreadEventReceived,
53
+ Description: "Conversation is ended by agent side or by timeout."
54
+ });
55
+
48
56
  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
57
  setWebChatStyles(styles => {
50
58
  return { ...styles,
@@ -53,16 +61,23 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
53
61
  });
54
62
  }
55
63
 
56
- if (isPostChatEnabled === "true" && postChatSurveyMode === PostChatSurveyMode.Embed) {
64
+ if (isPostChatEnabled === "true") {
65
+ if (postChatSurveyMode === PostChatSurveyMode.Embed) {
66
+ const loadPostChatEvent = {
67
+ eventName: BroadcastEvent.LoadPostChatSurvey
68
+ };
69
+ BroadcastService.postMessage(loadPostChatEvent);
70
+ } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
71
+ dispatch({
72
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
73
+ payload: ConversationState.InActive
74
+ });
75
+ }
76
+ } else {
57
77
  dispatch({
58
- type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
78
+ type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
59
79
  payload: true
60
80
  });
61
- dispatch({
62
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
63
- payload: ConversationState.Loading
64
- });
65
- await setPostChatContextAndLoadSurvey(chatSDK, dispatch, true);
66
81
  }
67
82
 
68
83
  dispatch({
@@ -89,6 +104,7 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
89
104
  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),
90
105
  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,
91
106
  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,
107
+ onTelemetry: createWebChatTelemetry(),
92
108
  ...((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.webChatProps)
93
109
  };
94
110
  return webChatProps;