@microsoft/omnichannel-chat-widget 0.1.0-main.eb80fb1 → 0.1.0-main.f514612

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 (177) hide show
  1. package/README.md +35 -11
  2. package/lib/cjs/common/Constants.js +54 -6
  3. package/lib/cjs/common/storage/default/defaultCacheManager.js +34 -0
  4. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +114 -0
  5. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +86 -0
  6. package/lib/cjs/common/telemetry/TelemetryConstants.js +64 -6
  7. package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
  8. package/lib/cjs/common/telemetry/TelemetryManager.js +17 -6
  9. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  10. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  11. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
  12. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
  13. package/lib/cjs/common/utils.js +89 -2
  14. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  15. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
  16. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -40
  17. package/lib/cjs/components/footerstateful/FooterStateful.js +2 -10
  18. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  19. package/lib/cjs/components/headerstateful/HeaderStateful.js +14 -10
  20. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
  21. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
  22. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  23. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
  24. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
  25. package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
  26. package/lib/cjs/components/livechatwidget/common/authHelper.js +65 -0
  27. package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
  28. package/lib/cjs/components/livechatwidget/common/createFooter.js +7 -16
  29. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +12 -0
  30. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +32 -32
  31. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +34 -19
  32. package/lib/cjs/components/livechatwidget/common/endChat.js +141 -50
  33. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
  34. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +51 -9
  35. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +144 -39
  36. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +6 -17
  37. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -9
  38. package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
  39. package/lib/cjs/components/livechatwidget/common/startChat.js +171 -51
  40. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +308 -81
  41. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  42. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -10
  43. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +19 -3
  44. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +96 -2
  45. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
  46. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  47. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
  48. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  49. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  50. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  51. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
  52. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  53. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  54. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  55. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  56. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  57. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  58. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  59. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  60. package/lib/cjs/contexts/common/ConversationState.js +4 -2
  61. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +10 -7
  62. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +17 -4
  63. package/lib/cjs/contexts/createReducer.js +24 -10
  64. package/lib/cjs/controller/componentController.js +5 -5
  65. package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
  66. package/lib/esm/common/Constants.js +50 -5
  67. package/lib/esm/common/storage/default/defaultCacheManager.js +19 -0
  68. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +102 -0
  69. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +71 -0
  70. package/lib/esm/common/telemetry/TelemetryConstants.js +60 -5
  71. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  72. package/lib/esm/common/telemetry/TelemetryManager.js +15 -6
  73. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  74. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  75. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
  76. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
  77. package/lib/esm/common/utils.js +64 -1
  78. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  79. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
  80. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -36
  81. package/lib/esm/components/footerstateful/FooterStateful.js +2 -10
  82. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  83. package/lib/esm/components/headerstateful/HeaderStateful.js +15 -11
  84. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
  85. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
  86. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  87. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
  88. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
  89. package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
  90. package/lib/esm/components/livechatwidget/common/authHelper.js +50 -0
  91. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
  92. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -15
  93. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
  94. package/lib/esm/components/livechatwidget/common/createMarkdown.js +32 -31
  95. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +34 -20
  96. package/lib/esm/components/livechatwidget/common/endChat.js +139 -50
  97. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
  98. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +46 -11
  99. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +134 -41
  100. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +5 -14
  101. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +6 -9
  102. package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
  103. package/lib/esm/components/livechatwidget/common/startChat.js +165 -54
  104. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +293 -84
  105. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  106. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -11
  107. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +20 -4
  108. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +86 -2
  109. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  110. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  111. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
  112. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  113. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  114. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  115. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
  116. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  117. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  118. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  119. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  120. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  121. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  122. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  123. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  124. package/lib/esm/contexts/common/ConversationState.js +4 -2
  125. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +10 -7
  126. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +15 -4
  127. package/lib/esm/contexts/createReducer.js +24 -9
  128. package/lib/esm/controller/componentController.js +5 -5
  129. package/lib/esm/plugins/newMessageEventHandler.js +82 -0
  130. package/lib/types/common/Constants.d.ts +27 -2
  131. package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
  132. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  133. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  134. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  135. package/lib/types/common/telemetry/TelemetryConstants.d.ts +46 -4
  136. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  137. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  138. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  139. package/lib/types/common/utils.d.ts +8 -1
  140. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
  141. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  142. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +5 -1
  143. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  144. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  145. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  146. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  147. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  148. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  149. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  150. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  151. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  152. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  153. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  154. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  155. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  156. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -1
  157. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  158. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  159. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -0
  160. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  161. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  162. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +2 -1
  163. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  164. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  165. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  166. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  167. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  168. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  169. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  170. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  171. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  172. package/lib/types/contexts/common/ConversationState.d.ts +4 -2
  173. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -1
  174. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +11 -8
  175. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  176. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  177. package/package.json +11 -12
@@ -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,27 +11,42 @@ export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineM
12
11
  html: true,
13
12
  linkify: true,
14
13
  breaks: !disableNewLineMarkdownSupport
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
+ } else {
17
+ markdown = new MarkdownIt(Constants.Zero, {
18
+ html: true,
19
+ linkify: true,
20
+ breaks: !disableNewLineMarkdownSupport
15
21
  });
16
- markdown.use(MarkdownSlack); // Markdown override for open link in new tab
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, quotes
22
+ markdown.enable(["entity", // Rule to process html entity - {, ¯, "
23
+ "linkify", // Rule to replace link-like texts with link nodes
24
+ "html_block", // Rule to process html blocks and paragraphs
25
+ "html_inline", // Rule to process html tags
26
+ "newline" // Rule to proceess '\n'
27
+ ]);
28
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
29
 
19
- markdown.use(MarkdownItForInline, "url_new_win", "link_open", function (tokens, idx, env) {
20
- const targetAttrIndex = tokens[idx].attrIndex(Constants.Target); // Put a transparent pixel instead of the "open in new window" icon, so developers can easily modify the icon in CSS.
21
30
 
22
- const TRANSPARENT_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
31
+ markdown.use(MarkdownItForInline, "url_new_win", "link_open", function (tokens, idx, env) {
32
+ const targetAttrIndex = tokens[idx].attrIndex(Constants.Target); // Put a transparent pixel instead of the "open in new window" icon, so developers can easily modify the icon in CSS.
23
33
 
24
- if (~targetAttrIndex) {
25
- tokens[idx].attrs[targetAttrIndex][1] = Constants.Blank;
26
- } else {
27
- tokens[idx].attrPush([Constants.Target, Constants.Blank]);
28
- }
34
+ const TRANSPARENT_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
35
+
36
+ if (~targetAttrIndex) {
37
+ tokens[idx].attrs[targetAttrIndex][1] = Constants.Blank;
38
+ } else {
39
+ tokens[idx].attrPush([Constants.Target, Constants.Blank]);
40
+ }
41
+
42
+ const relAttrIndex = tokens[idx].attrIndex(Constants.TargetRelationship);
29
43
 
30
- const relAttrIndex = tokens[idx].attrIndex(Constants.TargetRelationship);
44
+ if (~relAttrIndex) {
45
+ tokens[idx].attrs[relAttrIndex][1] = Constants.TargetRelationshipAttributes;
46
+ } else {
47
+ tokens[idx].attrPush([Constants.TargetRelationship, Constants.TargetRelationshipAttributes]);
31
48
 
32
- if (~relAttrIndex) {
33
- tokens[idx].attrs[relAttrIndex][1] = Constants.TargetRelationshipAttributes;
34
- } else {
35
- tokens[idx].attrPush([Constants.TargetRelationship, Constants.TargetRelationshipAttributes]);
49
+ if (!disableMarkdownMessageFormatting) {
36
50
  tokens[idx].attrPush([Constants.Title, defaultMarkdownLocalizedTexts.MARKDOWN_EXTERNAL_LINK_ALT]); // eslint-disable-next-line quotes
37
51
 
38
52
  const iconTokens = markdown.parseInline(`![${defaultMarkdownLocalizedTexts.MARKDOWN_EXTERNAL_LINK_ALT}](${TRANSPARENT_GIF})`, env)[0].children;
@@ -42,20 +56,7 @@ export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineM
42
56
  tokens.splice(idx + 2, 0, ...iconTokens);
43
57
  }
44
58
  }
45
- });
46
- } else {
47
- markdown = new MarkdownIt(Constants.Zero, {
48
- html: true,
49
- linkify: true,
50
- breaks: !disableNewLineMarkdownSupport
51
- });
52
- markdown.enable(["entity", // Rule to process html entity - {, ¯, "
53
- "linkify", // Rule to replace link-like texts with link nodes
54
- "html_block", // Rule to process html blocks and paragraphs
55
- "html_inline", // Rule to process html tags
56
- "newline" // Rule to proceess '\n'
57
- ]);
58
- }
59
-
59
+ }
60
+ });
60
61
  return markdown;
61
62
  };
@@ -9,7 +9,8 @@ import createAttachmentMiddleware from "../../../webchatcontainerstateful/webcha
9
9
  import { createAvatarMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware";
10
10
  import { createMarkdown } from "../createMarkdown";
11
11
  import { groupActivitiesMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware";
12
- import { typingIndicatorMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware"; // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
+ import { typingIndicatorMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware";
13
+ import { createWebChatTelemetry } from "../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger"; // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
14
 
14
15
  export const dummyDefaultProps = {
15
16
  audioNotificationProps: {
@@ -252,18 +253,6 @@ export const dummyDefaultProps = {
252
253
  width: "50px",
253
254
  fontSize: "18px"
254
255
  },
255
- currentCallTimerStyleProps: {
256
- borderRadius: "2px",
257
- margin: "1px",
258
- color: "#FFFFFF",
259
- paddingTop: "18px",
260
- fontSize: 12,
261
- fontFamily: "Segoe UI, Arial, sans-serif",
262
- backgroundColor: "darkgrey",
263
- height: "45px",
264
- width: "50px",
265
- textAlign: "center"
266
- },
267
256
  videoTileStyleProps: {
268
257
  width: "100%",
269
258
  marginLeft: "auto",
@@ -327,7 +316,10 @@ export const dummyDefaultProps = {
327
316
  hideChatTextContainer: false,
328
317
  hideChatSubtitle: false,
329
318
  hideChatTitle: false,
330
- hideNotificationBubble: true
319
+ hideNotificationBubble: true,
320
+ unreadMessageString: "new messages",
321
+ largeUnreadMessageString: "99+",
322
+ ariaLabelUnreadMessageString: "you have new messages"
331
323
  },
332
324
  styleProps: {
333
325
  generalStyleProps: {
@@ -878,7 +870,7 @@ export const dummyDefaultProps = {
878
870
  className: undefined
879
871
  },
880
872
  closeButtonProps: {
881
- id: "oc-lcw-header-minimize-button",
873
+ id: "oc-lcw-header-close-button",
882
874
  type: "icon",
883
875
  iconName: "ChromeClose",
884
876
  ariaLabel: "Close",
@@ -1194,7 +1186,17 @@ export const dummyDefaultProps = {
1194
1186
  hideSubtitle: false,
1195
1187
  subtitleText: "Live chat support!",
1196
1188
  hideCloseButton: false,
1197
- closeButtonAriaLabel: "Close Button",
1189
+ closeButtonProps: {
1190
+ id: "oc-lcw-proactivechat-closebutton",
1191
+ type: "icon",
1192
+ iconName: "ChromeClose",
1193
+ ariaLabel: "Close",
1194
+ imageIconProps: undefined,
1195
+ text: "Close",
1196
+ onClick: undefined,
1197
+ className: undefined,
1198
+ hideButtonTitle: true
1199
+ },
1198
1200
  isBodyContainerHorizantal: false,
1199
1201
  hideBodyTitle: false,
1200
1202
  bodyTitleText: "Hi! Have any questions? I am here to help.",
@@ -1422,9 +1424,9 @@ export const dummyDefaultProps = {
1422
1424
  startNewChatButtonClassName: undefined
1423
1425
  }
1424
1426
  },
1425
- authClientFunction: undefined,
1426
1427
  isReconnectEnabled: undefined,
1427
- reconnectId: undefined
1428
+ reconnectId: undefined,
1429
+ redirectInSameWindow: undefined
1428
1430
  },
1429
1431
  styleProps: {
1430
1432
  generalStyles: {
@@ -1496,7 +1498,7 @@ export const dummyDefaultProps = {
1496
1498
  internalErrorBoxClass: undefined,
1497
1499
  internalRenderErrorBox: undefined,
1498
1500
  locale: "en-US",
1499
- onTelemetry: undefined,
1501
+ onTelemetry: createWebChatTelemetry(),
1500
1502
  overrideLocalizedStrings: undefined,
1501
1503
  renderMarkdown: createMarkdown(false, false),
1502
1504
  scrollToEndButtonMiddleware: undefined,
@@ -1663,6 +1665,9 @@ export const dummyDefaultProps = {
1663
1665
  },
1664
1666
  attachmentSizeStyles: {
1665
1667
  display: "none"
1668
+ },
1669
+ receivedMessageAnchorStyles: {
1670
+ color: "white"
1666
1671
  }
1667
1672
  },
1668
1673
  localizedTexts: {
@@ -1686,7 +1691,16 @@ export const dummyDefaultProps = {
1686
1691
  MIDDLEWARE_MESSAGE_RETRY: "Retry",
1687
1692
  PRECHAT_REQUIRED_FIELD_MISSING_MESSAGE: "{0} field is required",
1688
1693
  MARKDOWN_EXTERNAL_LINK_ALT: "Opens in a new window; external."
1694
+ },
1695
+ botMagicCode: {
1696
+ disabled: false,
1697
+ fwdUrl: ""
1698
+ },
1699
+ adaptiveCardStyles: {
1700
+ background: "white",
1701
+ color: "black"
1689
1702
  }
1690
1703
  },
1691
- telemetryConfig: undefined
1704
+ telemetryConfig: undefined,
1705
+ getAuthToken: undefined
1692
1706
  };
@@ -1,61 +1,150 @@
1
- import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
2
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
3
3
  import { ConversationState } from "../../../contexts/common/ConversationState";
4
4
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
5
- import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
6
- import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
7
5
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
8
6
  import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
9
- import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
8
+ import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
9
+ import { Constants } from "../../../common/Constants";
10
+ import { addDelayInMs, getWidgetEndChatEventName } from "../../../common/utils"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
11
 
11
- export const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter) => {
12
- try {
13
- var _props$webChatContain;
12
+ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
13
+ var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _conversationDetails;
14
14
 
15
- TelemetryHelper.logSDKEvent(LogLevel.INFO, {
16
- Event: TelemetryEvent.EndChatSDKCall
17
- });
18
- await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
19
- adapter === null || adapter === void 0 ? void 0 : adapter.end();
20
- setAdapter(undefined);
21
- setWebChatStyles({ ...defaultWebChatContainerStatefulProps.webChatStyles,
22
- ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
23
- });
24
- WebChatStoreLoader.store = null;
25
- dispatch({
26
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
27
- payload: ConversationState.Closed
28
- });
29
- dispatch({
30
- type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
31
- payload: false
32
- });
33
- dispatch({
34
- type: LiveChatWidgetActionType.SET_RECONNECT_ID,
35
- payload: undefined
36
- });
37
- dispatch({
38
- type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
39
- payload: null
40
- });
41
- dispatch({
42
- type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
43
- payload: undefined
44
- });
45
- dispatch({
46
- type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
47
- payload: undefined
48
- });
49
- BroadcastService.postMessage({
50
- eventName: "EndChat"
51
- });
52
- } catch (ex) {
53
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
54
- Event: TelemetryEvent.EndChatSDKCallFailed,
15
+ const isPostChatEnabled = (_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable;
16
+ const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode; // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+
18
+ let conversationDetails = undefined;
19
+
20
+ try {
21
+ conversationDetails = await chatSDK.getConversationDetails();
22
+ } catch (erorr) {
23
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
24
+ Event: TelemetryEvent.GetConversationDetailsException,
55
25
  ExceptionDetails: {
56
- exception: ex
26
+ exception: `Failed to get conversation details: ${erorr}`
57
27
  }
58
28
  });
59
- NotificationHandler.notifyError(NotificationScenarios.Connection, "End Chat Call Failed: " + ex);
60
29
  }
61
- };
30
+
31
+ if (isPostChatEnabled === "true" && ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.canRenderPostChat) === Constants.truePascal) {
32
+ const skipEndChatSDK = false;
33
+ const skipCloseChat = true;
34
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, false);
35
+
36
+ if (postChatSurveyMode === PostChatSurveyMode.Embed) {
37
+ dispatch({
38
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
39
+ payload: ConversationState.PostchatLoading
40
+ });
41
+ await addDelayInMs(Constants.PostChatLoadingDurationInMs);
42
+ const loadPostChatEvent = {
43
+ eventName: BroadcastEvent.LoadPostChatSurvey
44
+ };
45
+ BroadcastService.postMessage(loadPostChatEvent);
46
+ } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
47
+ dispatch({
48
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
49
+ payload: ConversationState.InActive
50
+ });
51
+ }
52
+
53
+ return;
54
+ }
55
+
56
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
57
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
+
59
+
60
+ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
61
+ if (!skipEndChatSDK) {
62
+ try {
63
+ TelemetryHelper.logSDKEvent(LogLevel.INFO, {
64
+ Event: TelemetryEvent.EndChatSDKCall
65
+ });
66
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
67
+ } catch (ex) {
68
+ TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
69
+ Event: TelemetryEvent.EndChatSDKCallFailed,
70
+ ExceptionDetails: {
71
+ exception: ex
72
+ }
73
+ });
74
+ postMessageToOtherTab = false;
75
+ }
76
+ } // Need to clear these states immediately when chat ended from OC.
77
+
78
+
79
+ dispatch({
80
+ type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
81
+ payload: undefined
82
+ });
83
+ dispatch({
84
+ type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
85
+ payload: undefined
86
+ });
87
+ dispatch({
88
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
89
+ payload: undefined
90
+ });
91
+
92
+ if (!skipCloseChat) {
93
+ try {
94
+ var _props$webChatContain;
95
+
96
+ adapter === null || adapter === void 0 ? void 0 : adapter.end();
97
+ setAdapter(undefined);
98
+ setWebChatStyles({ ...defaultWebChatContainerStatefulProps.webChatStyles,
99
+ ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
100
+ });
101
+ WebChatStoreLoader.store = null;
102
+ dispatch({
103
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
104
+ payload: ConversationState.Closed
105
+ });
106
+ dispatch({
107
+ type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
108
+ payload: false
109
+ });
110
+ dispatch({
111
+ type: LiveChatWidgetActionType.SET_RECONNECT_ID,
112
+ payload: undefined
113
+ });
114
+ dispatch({
115
+ type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
116
+ payload: null
117
+ });
118
+ dispatch({
119
+ type: LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
120
+ payload: 0
121
+ });
122
+ dispatch({
123
+ type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
124
+ payload: {
125
+ proactiveChatBodyTitle: "",
126
+ proactiveChatEnablePrechat: false,
127
+ proactiveChatInNewWindow: false
128
+ }
129
+ });
130
+
131
+ if (postMessageToOtherTab) {
132
+ var _chatSDK$omnichannelC, _chatSDK$omnichannelC2, _props$controlProps;
133
+
134
+ const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
135
+ BroadcastService.postMessage({
136
+ eventName: endChatEventName
137
+ });
138
+ }
139
+ } catch (error) {
140
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
141
+ Event: TelemetryEvent.CloseChatMethodException,
142
+ ExceptionDetails: {
143
+ exception: `Failed to endChat: ${error}`
144
+ }
145
+ });
146
+ }
147
+ }
148
+ };
149
+
150
+ export { prepareEndChat, endChat };
@@ -8,7 +8,7 @@ export const initCallingSdk = async (chatSDK, setVoiceVideoCallingSDK) => {
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
9
  const callingSDK = await chatSDK.getVoiceVideoCalling();
10
10
  setVoiceVideoCallingSDK(callingSDK);
11
- TelemetryHelper.logCallingEvent(LogLevel.ERROR, {
11
+ TelemetryHelper.logCallingEvent(LogLevel.INFO, {
12
12
  Event: TelemetryEvent.CallingSDKLoadSuccess
13
13
  });
14
14
  return true;
@@ -1,9 +1,13 @@
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
1
2
  import { createStore } from "botframework-webchat";
3
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
4
+ import { ConversationState } from "../../../contexts/common/ConversationState";
2
5
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
3
6
  import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
7
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
4
8
  import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
5
9
  import attachmentProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware";
6
- import { changeLanguageCodeFormatForWebChat } from "../../../common/utils";
10
+ import { addDelayInMs, changeLanguageCodeFormatForWebChat } from "../../../common/utils";
7
11
  import channelDataMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware";
8
12
  import { createActivityMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware";
9
13
  import createAttachmentMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware";
@@ -13,6 +17,7 @@ import createConversationEndMiddleware from "../../webchatcontainerstateful/webc
13
17
  import createDataMaskingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware";
14
18
  import { createMarkdown } from "./createMarkdown";
15
19
  import createMaxMessageSizeValidator from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator";
20
+ import { createWebChatTelemetry } from "../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
16
21
  import { defaultAttachmentProps } from "../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps";
17
22
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
18
23
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
@@ -22,10 +27,12 @@ import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroll
22
27
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
23
28
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
24
29
  import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
25
- import { BroadcastService } from "@microsoft/omnichannel-chat-components";
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ import { createCardActionMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware";
31
+ import createMessageTimeStampMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware";
32
+ import { Constants } from "../../../common/Constants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+
27
34
  export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
28
- 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;
35
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
29
36
 
30
37
  const localizedTexts = { ...defaultMiddlewareLocalizedTexts,
31
38
  ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.localizedTexts)
@@ -44,6 +51,11 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
44
51
  const conversationEndCallback = async () => {
45
52
  var _props$webChatContain4, _props$webChatContain5;
46
53
 
54
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
55
+ Event: TelemetryEvent.ConversationEndedThreadEventReceived,
56
+ Description: "Conversation is ended by agent side or by timeout."
57
+ });
58
+
47
59
  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) {
48
60
  setWebChatStyles(styles => {
49
61
  return { ...styles,
@@ -52,12 +64,29 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
52
64
  });
53
65
  }
54
66
 
55
- if (isPostChatEnabled === "true" && postChatSurveyMode === PostChatSurveyMode.Embed) {
56
- const loadPostChatEvent = {
57
- eventName: "LoadPostChatSurvey"
58
- };
59
- BroadcastService.postMessage(loadPostChatEvent);
67
+ if (isPostChatEnabled === "true") {
68
+ if (postChatSurveyMode === PostChatSurveyMode.Embed) {
69
+ WebChatStoreLoader.store = null;
70
+ dispatch({
71
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
72
+ payload: ConversationState.PostchatLoading
73
+ });
74
+ await addDelayInMs(Constants.PostChatLoadingDurationInMs);
75
+ const loadPostChatEvent = {
76
+ eventName: BroadcastEvent.LoadPostChatSurvey
77
+ };
78
+ BroadcastService.postMessage(loadPostChatEvent);
79
+ } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
80
+ dispatch({
81
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
82
+ payload: ConversationState.InActive
83
+ });
84
+ }
60
85
  } else {
86
+ dispatch({
87
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
88
+ payload: ConversationState.InActive
89
+ });
61
90
  dispatch({
62
91
  type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
63
92
  payload: true
@@ -68,10 +97,14 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
68
97
  type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
69
98
  payload: undefined
70
99
  });
100
+ dispatch({
101
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
102
+ payload: undefined
103
+ });
71
104
  };
72
105
 
73
106
  webChatStore = createStore({}, //initial state
74
- preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), channelDataMiddleware, createConversationEndMiddleware(conversationEndCallback), createDataMaskingMiddleware((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware, createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, // eslint-disable-next-line @typescript-eslint/no-explicit-any
107
+ preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), channelDataMiddleware, createConversationEndMiddleware(conversationEndCallback), createDataMaskingMiddleware((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), createMessageTimeStampMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware, createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
108
  ...(((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.storeMiddlewares) ?? []));
76
109
  WebChatStoreLoader.store = webChatStore;
77
110
  } // Initialize the remaining Web Chat props
@@ -88,7 +121,9 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
88
121
  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),
89
122
  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,
90
123
  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,
91
- ...((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.webChatProps)
124
+ onTelemetry: createWebChatTelemetry(),
125
+ cardActionMiddleware: createCardActionMiddleware(((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.botMagicCode) || undefined),
126
+ ...((_props$webChatContain22 = props.webChatContainerProps) === null || _props$webChatContain22 === void 0 ? void 0 : _props$webChatContain22.webChatProps)
92
127
  };
93
128
  return webChatProps;
94
129
  };