@microsoft/omnichannel-chat-widget 0.1.0-main.3d1c026 → 0.1.0-main.47ede4d

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 (125) 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 +6 -0
  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 +25 -4
  8. package/lib/cjs/common/telemetry/TelemetryManager.js +7 -5
  9. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  10. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +24 -35
  11. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  12. package/lib/cjs/components/footerstateful/FooterStateful.js +3 -3
  13. package/lib/cjs/components/headerstateful/HeaderStateful.js +12 -3
  14. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
  15. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +11 -7
  16. package/lib/cjs/components/livechatwidget/common/endChat.js +65 -53
  17. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
  18. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +24 -12
  19. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +23 -5
  20. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +26 -24
  21. package/lib/cjs/components/livechatwidget/common/startChat.js +77 -27
  22. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
  23. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +37 -20
  24. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  25. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
  26. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +28 -11
  27. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +10 -4
  28. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  29. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  30. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  31. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +9 -46
  32. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  33. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  34. package/lib/cjs/contexts/common/ConversationState.js +3 -2
  35. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +2 -0
  36. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +7 -2
  37. package/lib/cjs/contexts/createReducer.js +13 -3
  38. package/lib/cjs/controller/componentController.js +2 -2
  39. package/lib/cjs/plugins/newMessageEventHandler.js +102 -0
  40. package/lib/esm/assets/Audios.js +1 -0
  41. package/lib/esm/assets/Icons.js +11 -0
  42. package/lib/esm/common/Constants.js +6 -0
  43. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  44. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  45. package/lib/esm/common/telemetry/TelemetryConstants.js +21 -3
  46. package/lib/esm/common/telemetry/TelemetryManager.js +6 -5
  47. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  48. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +22 -34
  49. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  50. package/lib/esm/components/footerstateful/FooterStateful.js +3 -3
  51. package/lib/esm/components/headerstateful/HeaderStateful.js +13 -4
  52. package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
  53. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +11 -9
  54. package/lib/esm/components/livechatwidget/common/endChat.js +64 -49
  55. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
  56. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +21 -12
  57. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +20 -4
  58. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +23 -22
  59. package/lib/esm/components/livechatwidget/common/startChat.js +71 -23
  60. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  61. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +33 -17
  62. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  63. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
  64. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +26 -10
  65. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -5
  66. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  67. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
  68. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  69. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -44
  70. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  71. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  72. package/lib/esm/contexts/common/ConversationState.js +3 -2
  73. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +2 -0
  74. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +7 -2
  75. package/lib/esm/contexts/createReducer.js +13 -2
  76. package/lib/esm/controller/componentController.js +2 -2
  77. package/lib/esm/plugins/newMessageEventHandler.js +84 -0
  78. package/lib/types/assets/Audios.d.ts +1 -0
  79. package/lib/types/assets/Icons.d.ts +11 -0
  80. package/lib/types/common/Constants.d.ts +3 -0
  81. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  82. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  83. package/lib/types/common/telemetry/TelemetryConstants.d.ts +16 -1
  84. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -1
  85. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -1
  86. package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
  87. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  88. package/lib/types/components/livechatwidget/common/startChat.d.ts +1 -1
  89. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  90. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
  91. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  92. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  93. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  94. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  95. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  96. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  97. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  98. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +3 -1
  99. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  100. package/package.json +5 -6
  101. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  102. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  103. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  104. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  105. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  106. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  107. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  108. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  109. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  110. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  111. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  112. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  113. package/lib/esm/assets/assets.d.js +0 -0
  114. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  115. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  116. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  117. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  118. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  119. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  120. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  121. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  122. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  123. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  124. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  125. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -1,7 +1,7 @@
1
- import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
+ import { BroadcastService, 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
5
  import { Constants } from "../../common/Constants";
6
6
  import { ConversationState } from "../../contexts/common/ConversationState";
7
7
  import { DimLayer } from "../dimlayer/DimLayer";
@@ -18,14 +18,14 @@ export const ConfirmationPaneStateful = props => {
18
18
  var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
19
19
 
20
20
  const initialTabIndexMap = new Map();
21
- let elements = [];
21
+ let elements = []; // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+
23
+ const chatSDK = useChatSDKStore();
22
24
  const [state, dispatch] = useChatContextStore();
23
25
  const {
24
- setPostChatContext,
25
26
  endChat
26
27
  } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
-
28
- const chatSDK = useChatSDKStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
29
 
30
30
  const [adapter] = useChatAdapterStore();
31
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;
@@ -34,7 +34,7 @@ export const ConfirmationPaneStateful = props => {
34
34
  id: "oc-lcw-confirmation-pane",
35
35
  dir: state.domainStates.globalDir,
36
36
  onConfirm: async () => {
37
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
37
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
38
38
  Event: TelemetryEvent.ConfirmationConfirmButtonClicked,
39
39
  Description: "Confirmation pane Confirm button clicked"
40
40
  });
@@ -44,39 +44,27 @@ export const ConfirmationPaneStateful = props => {
44
44
  });
45
45
 
46
46
  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();
47
+ // check agent has joined conversation
48
+ const conversationDetails = await chatSDK.getConversationDetails();
60
49
 
61
- if (state.domainStates.postChatContext) {
50
+ if (isPostChatEnabled === "true" && (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.canRenderPostChat) === Constants.truePascal) {
51
+ if (postChatSurveyMode === PostChatSurveyMode.Embed) {
52
+ const loadPostChatEvent = {
53
+ eventName: BroadcastEvent.LoadPostChatSurvey
54
+ };
55
+ BroadcastService.postMessage(loadPostChatEvent);
56
+ } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
57
+ const skipEndChatSDK = false;
58
+ const skipCloseChat = true;
59
+ await endChat(adapter, skipEndChatSDK, skipCloseChat);
62
60
  dispatch({
63
61
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
64
- payload: ConversationState.Postchat
62
+ payload: ConversationState.InActive
65
63
  });
66
64
  }
67
65
  } else {
68
66
  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
- }
67
+ await endChat(adapter);
80
68
  }
81
69
  } catch (ex) {
82
70
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
@@ -89,7 +77,7 @@ export const ConfirmationPaneStateful = props => {
89
77
  }
90
78
  },
91
79
  onCancel: () => {
92
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
80
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
93
81
  Event: TelemetryEvent.ConfirmationCancelButtonClicked,
94
82
  Description: "Confirmation pane Cancel button clicked."
95
83
  });
@@ -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,7 +96,7 @@ 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,
99
+ audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? NewMessageNotificationSoundBase64,
100
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
101
  isAudioMuted: state.appStates.isAudioMuted ?? false
102
102
  }));
@@ -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,21 @@ 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
+ } else if (conversationState.current === ConversationState.Postchat) {
49
50
  dispatch({
50
51
  type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
51
52
  payload: false
52
53
  });
53
54
  await endChat(adapter);
55
+ } else if (conversationState.current === ConversationState.InActive) {
56
+ const skipEndChatSDK = true;
57
+ const skipCloseChat = false;
58
+ await endChat(adapter, skipEndChatSDK, skipCloseChat);
54
59
  }
55
60
 
56
61
  dispatch({
@@ -82,7 +87,11 @@ export const HeaderStateful = props => {
82
87
  if (state.appStates.outsideOperatingHours) {
83
88
  setOutOfOperatingHours(true);
84
89
  }
85
- }, []);
90
+
91
+ if (state.appStates.conversationState) {
92
+ conversationState.current = state.appStates.conversationState;
93
+ }
94
+ }, [state.appStates]);
86
95
  return /*#__PURE__*/React.createElement(Header, {
87
96
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
88
97
  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";
@@ -7,11 +9,11 @@ import createAttachmentMiddleware from "../../../webchatcontainerstateful/webcha
7
9
  import { createAvatarMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware";
8
10
  import { createMarkdown } from "../createMarkdown";
9
11
  import { groupActivitiesMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware";
10
- import { typingIndicatorMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware";
11
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
+ import { typingIndicatorMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware"; // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+
12
14
  export const dummyDefaultProps = {
13
15
  audioNotificationProps: {
14
- audioSrc: "assets/audios/newMessageNotification.mp3"
16
+ audioSrc: NewMessageNotificationSoundBase64
15
17
  },
16
18
  callingContainerProps: {
17
19
  controlProps: {
@@ -366,7 +368,7 @@ export const dummyDefaultProps = {
366
368
  margin: "-2px -2px -2px -3px",
367
369
  justifyContent: "center",
368
370
  backgroundSize: "65% 65%",
369
- backgroundImage: "assets/imgs/chat.svg",
371
+ backgroundImage: `url(${ModernChatIconBase64})`,
370
372
  display: "flex",
371
373
  backgroundRepeat: "no-repeat",
372
374
  backgroundPosition: "center"
@@ -887,7 +889,7 @@ export const dummyDefaultProps = {
887
889
  },
888
890
  headerIconProps: {
889
891
  id: "oc-lcw-header-icon",
890
- src: "assets/imgs/chatIcon.svg",
892
+ src: ModernChatIconBase64,
891
893
  alt: "Chat Icon",
892
894
  className: undefined
893
895
  },
@@ -1012,7 +1014,7 @@ export const dummyDefaultProps = {
1012
1014
  alignSelf: "auto"
1013
1015
  },
1014
1016
  iconImageProps: {
1015
- src: "assets/imgs/chat.svg",
1017
+ src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIwX2lpKSI+DQo8cGF0aCBkPSJNMTUuMTk3MSAxNi4yNzI1VjI1Ljg1MjRDMTUuMTk3MSAyNy4zODExIDE1Ljg0MDEgMjcuNTIwMSAxNi45ODMyIDI3LjUyMDFMMjYuNzA4NCAyNy41NjQ5TDMxLjAwMzkgMzIuMzEyM1YyNy41NjQ5SDMxLjg5N0MzMi4xNzQzIDI3LjU2MzcgMzIuNDQ4NyAyNy41MDc3IDMyLjcwNDUgMjcuNDAwMUMzMi45NjAzIDI3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1c2VyU3BhY2VPblVzZSI+DQo8c3RvcCBzdG9wLWNvbG9yPSIjRUZFRkVGIi8+DQo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+DQo8L2xpbmVhckdyYWRpZW50Pg0KPC9kZWZzPg0KPC9zdmc+DQo=",
1016
1018
  imageFit: 0,
1017
1019
  width: "86px",
1018
1020
  height: "86px",
@@ -1220,7 +1222,7 @@ export const dummyDefaultProps = {
1220
1222
  },
1221
1223
  headerContainerStyleProps: {
1222
1224
  backgroundColor: "rgb(49, 95, 162)",
1223
- backgroundImage: "assets/imgs/Proactive_banner.png",
1225
+ backgroundImage: `url(${ProactiveChatBannerBase64})`,
1224
1226
  backgroundPosition: "initial",
1225
1227
  backgroundRepeat: "no-repeat",
1226
1228
  borderTopLeftRadius: "inherit",
@@ -1248,7 +1250,7 @@ export const dummyDefaultProps = {
1248
1250
  fontWeight: "600"
1249
1251
  },
1250
1252
  closeButtonStyleProps: {
1251
- backgroundImage: "assets/imgs/closeChatButton.svg",
1253
+ backgroundImage: `url(${CloseChatButtonIconBase64})`,
1252
1254
  backgroundPosition: "center",
1253
1255
  backgroundRepeat: "no-repeat",
1254
1256
  color: "#605e5c",
@@ -1371,7 +1373,7 @@ export const dummyDefaultProps = {
1371
1373
  lineHeight: "19px"
1372
1374
  },
1373
1375
  iconStyleProps: {
1374
- backgroundImage: "assets/imgs//ChatReconnectPopupIcon.png",
1376
+ backgroundImage: `url(${ChatReconnectIconBase64})`,
1375
1377
  backgroundPosition: "center",
1376
1378
  backgroundRepeat: "no-repeat",
1377
1379
  backgroundSize: "200px",
@@ -1,57 +1,72 @@
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
- import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
9
- import { BroadcastService } from "@microsoft/omnichannel-chat-components"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
8
 
11
- export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter) => {
12
- try {
13
- var _props$webChatContain;
9
+ export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat) => {
10
+ if (!skipEndChatSDK) {
11
+ try {
12
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
13
+ Event: TelemetryEvent.EndChatSDKCall
14
+ });
15
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
16
+ } catch (ex) {
17
+ TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
18
+ Event: TelemetryEvent.EndChatSDKCallFailed,
19
+ ExceptionDetails: {
20
+ exception: ex
21
+ }
22
+ });
23
+ }
24
+ }
25
+
26
+ if (!skipCloseChat) {
27
+ try {
28
+ var _props$webChatContain;
14
29
 
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_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
- BroadcastService.postMessage({
46
- eventName: "EndChat"
47
- });
48
- } catch (ex) {
49
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
50
- Event: TelemetryEvent.EndChatSDKCallFailed,
51
- ExceptionDetails: {
52
- exception: ex
53
- }
54
- });
55
- NotificationHandler.notifyError(NotificationScenarios.Connection, "End Chat Call Failed: " + ex);
30
+ adapter === null || adapter === void 0 ? void 0 : adapter.end();
31
+ setAdapter(undefined);
32
+ setWebChatStyles({ ...defaultWebChatContainerStatefulProps.webChatStyles,
33
+ ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
34
+ });
35
+ WebChatStoreLoader.store = null;
36
+ dispatch({
37
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
38
+ payload: ConversationState.Closed
39
+ });
40
+ dispatch({
41
+ type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
42
+ payload: false
43
+ });
44
+ dispatch({
45
+ type: LiveChatWidgetActionType.SET_RECONNECT_ID,
46
+ payload: undefined
47
+ });
48
+ dispatch({
49
+ type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
50
+ payload: null
51
+ });
52
+ dispatch({
53
+ type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
54
+ payload: undefined
55
+ });
56
+ dispatch({
57
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
58
+ payload: undefined
59
+ });
60
+ BroadcastService.postMessage({
61
+ eventName: BroadcastEvent.EndChat
62
+ });
63
+ } catch (error) {
64
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
65
+ Event: TelemetryEvent.CloseChatMethodException,
66
+ ExceptionDetails: {
67
+ exception: `Failed to endChat: ${error}`
68
+ }
69
+ });
70
+ }
56
71
  }
57
72
  };
@@ -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";
@@ -22,8 +25,7 @@ import gifUploadMiddleware from "../../webchatcontainerstateful/webchatcontrolle
22
25
  import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware";
23
26
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
24
27
  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
28
+ import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
29
 
28
30
  export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
29
31
  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 +47,11 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
45
47
  const conversationEndCallback = async () => {
46
48
  var _props$webChatContain4, _props$webChatContain5;
47
49
 
50
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
51
+ Event: TelemetryEvent.ConversationEndedThreadEventReceived,
52
+ Description: "Conversation is ended by agent side or by timeout."
53
+ });
54
+
48
55
  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
56
  setWebChatStyles(styles => {
50
57
  return { ...styles,
@@ -53,16 +60,18 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
53
60
  });
54
61
  }
55
62
 
56
- if (isPostChatEnabled === "true" && postChatSurveyMode === PostChatSurveyMode.Embed) {
57
- dispatch({
58
- type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
59
- payload: true
60
- });
61
- dispatch({
62
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
63
- payload: ConversationState.Loading
64
- });
65
- await setPostChatContextAndLoadSurvey(chatSDK, dispatch, true);
63
+ if (isPostChatEnabled === "true") {
64
+ if (postChatSurveyMode === PostChatSurveyMode.Embed) {
65
+ const loadPostChatEvent = {
66
+ eventName: BroadcastEvent.LoadPostChatSurvey
67
+ };
68
+ BroadcastService.postMessage(loadPostChatEvent);
69
+ } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
70
+ dispatch({
71
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
72
+ payload: ConversationState.InActive
73
+ });
74
+ }
66
75
  } else {
67
76
  dispatch({
68
77
  type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
@@ -1,12 +1,22 @@
1
- import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
2
1
  import { RegisterLoggers, TelemetryManager } from "../../../common/telemetry/TelemetryManager";
2
+ import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
3
3
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
4
+ import { version as chatComponentVersion } from "@microsoft/omnichannel-chat-components/package.json";
5
+ import { version as chatSdkVersion } from "@microsoft/omnichannel-chat-sdk/package.json";
4
6
  import { defaultAriaConfig } from "../../../common/telemetry/defaultConfigs/defaultAriaConfig";
5
7
  import { defaultInternalTelemetryData } from "../../../common/telemetry/defaultConfigs/defaultTelemetryInternalData";
6
8
  import { defaultTelemetryConfiguration } from "../../../common/telemetry/defaultConfigs/defaultTelemetryConfiguration";
7
9
  export const registerTelemetryLoggers = (props, dispatch) => {
8
10
  var _props$liveChatContex, _props$liveChatContex2;
9
11
 
12
+ let widgetPackageInfo;
13
+
14
+ try {
15
+ widgetPackageInfo = require("@microsoft/omnichannel-chat-widget/package.json");
16
+ } catch (error) {
17
+ widgetPackageInfo = "0.0.0-0";
18
+ }
19
+
10
20
  const telemetryConfig = { ...defaultTelemetryConfiguration,
11
21
  ...props.telemetryConfig
12
22
  };
@@ -16,6 +26,8 @@ export const registerTelemetryLoggers = (props, dispatch) => {
16
26
 
17
27
  TelemetryManager.InternalTelemetryData = (_props$liveChatContex3 = props.liveChatContextFromCache) === null || _props$liveChatContex3 === void 0 ? void 0 : (_props$liveChatContex4 = _props$liveChatContex3.domainStates) === null || _props$liveChatContex4 === void 0 ? void 0 : _props$liveChatContex4.telemetryInternalData;
18
28
  } else {
29
+ var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$chatSDK3, _props$chatSDK3$omnic;
30
+
19
31
  let telemetryData = { ...defaultInternalTelemetryData,
20
32
  telemetryConfig: Object.assign({}, defaultTelemetryConfiguration, telemetryConfig),
21
33
  ariaConfig: Object.assign({}, defaultAriaConfig, telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.ariaConfigurations)
@@ -26,9 +38,13 @@ export const registerTelemetryLoggers = (props, dispatch) => {
26
38
  }
27
39
 
28
40
  telemetryData = TelemetryHelper.addWidgetDataToTelemetry(telemetryConfig, telemetryData);
29
- telemetryData.OCChatSDKVersion = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.OCChatSDKVersion;
30
- telemetryData.chatComponentVersion = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.chatComponentVersion;
31
- telemetryData.chatWidgetVersion = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.chatWidgetVersion;
41
+ telemetryData.OCChatSDKVersion = chatSdkVersion;
42
+ telemetryData.chatComponentVersion = chatComponentVersion;
43
+ telemetryData.chatWidgetVersion = widgetPackageInfo;
44
+ telemetryData.orgId = (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId;
45
+ telemetryData.widgetId = (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId;
46
+ telemetryData.orgUrl = (_props$chatSDK3 = props.chatSDK) === null || _props$chatSDK3 === void 0 ? void 0 : (_props$chatSDK3$omnic = _props$chatSDK3.omnichannelConfig) === null || _props$chatSDK3$omnic === void 0 ? void 0 : _props$chatSDK3$omnic.orgUrl;
47
+ TelemetryManager.InternalTelemetryData = telemetryData;
32
48
  dispatch({
33
49
  type: LiveChatWidgetActionType.SET_TELEMETRY_DATA,
34
50
  payload: telemetryData
@@ -1,20 +1,23 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
3
+ import { ConversationState } from "../../../contexts/common/ConversationState";
2
4
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
3
- import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
4
- import { ConversationState } from "../../../contexts/common/ConversationState"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
6
 
6
- export const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, loadSurvey) => {
7
+ export const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, persistedChat) => {
7
8
  try {
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- const context = await chatSDK.getPostChatSurveyContext();
10
- TelemetryHelper.logSDKEvent(LogLevel.INFO, {
11
- Event: TelemetryEvent.PostChatContextCallSucceed,
12
- Description: "Postchat context call succeed."
13
- });
14
- dispatch({
15
- type: LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT,
16
- payload: context
17
- });
9
+ if (!persistedChat) {
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ const context = await chatSDK.getPostChatSurveyContext();
12
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
13
+ Event: TelemetryEvent.PostChatContextCallSucceed,
14
+ Description: "Postchat context call succeed."
15
+ });
16
+ dispatch({
17
+ type: LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT,
18
+ payload: context
19
+ });
20
+ }
18
21
  } catch (ex) {
19
22
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
20
23
  Event: TelemetryEvent.PostChatContextCallFailed,
@@ -22,19 +25,17 @@ export const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, loadSur
22
25
  exception: ex
23
26
  }
24
27
  });
25
- }
26
- /* -true: setPostChatContextAndLoadSurvey is called after passing all checks from ConfirmationPane and endChatMiddleware in usual scenario.
27
- -false: Below if condition is needed for multi-tab scenarios. So when agent ends a chat and customer has opened chat in multiple tabs,
28
- all tabs should show post chat survey as per existing functionality. But when an agent end a conversation, Omnichannel SDK
29
- getPostChatSurveyContext returns as invalid conversation. To avoid that, caching the survey url is needed after chat starts and
30
- in this case loadSurvey is false
31
- */
28
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
29
 
33
30
 
34
- if (loadSurvey) {
31
+ BroadcastService.getMessageByEventName("LoadPostChatSurvey").subscribe(msg => {
32
+ dispatch({
33
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
34
+ payload: ConversationState.Loading
35
+ });
35
36
  dispatch({
36
37
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
37
38
  payload: ConversationState.Postchat
38
39
  });
39
- }
40
+ });
40
41
  };