@microsoft/omnichannel-chat-widget 0.1.0-main.c461296 → 0.1.0-main.cda7a31

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 (179) hide show
  1. package/README.md +35 -11
  2. package/lib/cjs/common/Constants.js +50 -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 +51 -3
  7. package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
  8. package/lib/cjs/common/telemetry/TelemetryManager.js +16 -5
  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 +54 -21
  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 +8 -44
  17. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -4
  18. package/lib/cjs/components/footerstateful/FooterStateful.js +6 -15
  19. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  20. package/lib/cjs/components/headerstateful/HeaderStateful.js +15 -14
  21. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
  22. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
  23. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  24. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
  25. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
  26. package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
  27. package/lib/cjs/components/livechatwidget/common/authHelper.js +65 -0
  28. package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
  29. package/lib/cjs/components/livechatwidget/common/createFooter.js +7 -16
  30. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +12 -0
  31. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +31 -30
  32. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +36 -20
  33. package/lib/cjs/components/livechatwidget/common/endChat.js +93 -10
  34. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
  35. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +27 -3
  36. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +144 -39
  37. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +6 -17
  38. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
  39. package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
  40. package/lib/cjs/components/livechatwidget/common/startChat.js +166 -50
  41. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +310 -73
  42. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  43. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
  44. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  45. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -10
  46. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
  47. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +98 -2
  48. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
  49. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  50. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
  51. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  52. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  53. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  54. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
  55. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  56. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  57. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  58. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  59. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  60. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  61. package/lib/cjs/contexts/common/ConversationState.js +3 -2
  62. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +11 -8
  63. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +15 -6
  64. package/lib/cjs/contexts/createReducer.js +26 -12
  65. package/lib/cjs/controller/componentController.js +3 -3
  66. package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
  67. package/lib/esm/common/Constants.js +46 -5
  68. package/lib/esm/common/storage/default/defaultCacheManager.js +19 -0
  69. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +102 -0
  70. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +71 -0
  71. package/lib/esm/common/telemetry/TelemetryConstants.js +51 -3
  72. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  73. package/lib/esm/common/telemetry/TelemetryManager.js +14 -5
  74. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  75. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  76. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +55 -17
  77. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
  78. package/lib/esm/common/utils.js +64 -1
  79. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  80. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
  81. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +11 -42
  82. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -4
  83. package/lib/esm/components/footerstateful/FooterStateful.js +6 -15
  84. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  85. package/lib/esm/components/headerstateful/HeaderStateful.js +15 -14
  86. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
  87. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
  88. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  89. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
  90. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
  91. package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
  92. package/lib/esm/components/livechatwidget/common/authHelper.js +50 -0
  93. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
  94. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -15
  95. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
  96. package/lib/esm/components/livechatwidget/common/createMarkdown.js +31 -30
  97. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +36 -21
  98. package/lib/esm/components/livechatwidget/common/endChat.js +89 -11
  99. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
  100. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +25 -5
  101. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +134 -41
  102. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +5 -14
  103. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
  104. package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
  105. package/lib/esm/components/livechatwidget/common/startChat.js +161 -53
  106. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +298 -78
  107. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  108. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -4
  109. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  110. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -11
  111. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
  112. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +87 -2
  113. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  114. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  115. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
  116. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  117. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  118. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  119. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
  120. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  121. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  122. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  123. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  124. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  125. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  126. package/lib/esm/contexts/common/ConversationState.js +3 -2
  127. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +11 -8
  128. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +13 -6
  129. package/lib/esm/contexts/createReducer.js +26 -11
  130. package/lib/esm/controller/componentController.js +3 -3
  131. package/lib/esm/plugins/newMessageEventHandler.js +10 -12
  132. package/lib/types/common/Constants.d.ts +25 -2
  133. package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
  134. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  135. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  136. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  137. package/lib/types/common/telemetry/TelemetryConstants.d.ts +36 -5
  138. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  139. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  140. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  141. package/lib/types/common/utils.d.ts +8 -1
  142. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -4
  143. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  144. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
  145. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  146. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  147. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  148. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  149. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  150. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  151. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  152. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  153. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  154. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  155. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  156. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  157. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  158. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +4 -3
  159. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  160. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  161. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  162. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  163. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  164. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  165. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  166. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +2 -1
  167. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  168. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  169. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  170. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  171. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  172. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  173. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  174. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  175. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  176. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +4 -2
  177. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +12 -9
  178. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  179. package/package.json +9 -9
@@ -11,6 +11,9 @@ const defaultTelemetryConfiguration = {
11
11
  telemetryDisabled: false,
12
12
  disableConsoleLog: false,
13
13
  telemetryLoggers: [],
14
- ariaConfigurations: _defaultAriaConfig.defaultAriaConfig
14
+ ariaConfigurations: _defaultAriaConfig.defaultAriaConfig,
15
+ chatWidgetVersion: "0.0.0-0",
16
+ chatComponentVersion: "0.0.0-0",
17
+ OCChatSDKVersion: "0.0.0-0"
15
18
  };
16
19
  exports.defaultTelemetryConfiguration = defaultTelemetryConfiguration;
@@ -7,17 +7,13 @@ exports.ariaTelemetryLogger = void 0;
7
7
 
8
8
  var _utils = require("../../utils");
9
9
 
10
- var _AWTEventProperties = _interopRequireDefault(require("@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTEventProperties"));
11
-
12
- var _AWTLogManager = _interopRequireDefault(require("@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTLogManager"));
10
+ var _AriaSDK = require("@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AriaSDK");
13
11
 
14
12
  var _Enums = require("@microsoft/omnichannel-chat-sdk/lib/external/aria/common/Enums");
15
13
 
16
14
  var _Constants = require("../../Constants");
17
15
 
18
- var _TelemetryHelper = require("../TelemetryHelper");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ var _TelemetryManager = require("../TelemetryManager");
21
17
 
22
18
  const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
23
19
  let _logger;
@@ -30,13 +26,28 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
30
26
 
31
27
  if (!(0, _utils.isNullOrEmptyString)(collectiorUriForTelemetry)) {
32
28
  configuration.collectorUri = collectiorUriForTelemetry;
29
+ } else {
30
+ if (_TelemetryManager.TelemetryManager.InternalTelemetryData.environmentVersion == _Constants.EnvironmentVersion.prod) {
31
+ var _TelemetryManager$Int;
32
+
33
+ const orgUrl = (_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.orgUrl;
34
+
35
+ if (!(0, _utils.isNullOrUndefined)(orgUrl)) {
36
+ // If the given org is a Production EU org, modify the Aria collector uri
37
+ const region = (0, _utils.getDomain)(orgUrl);
38
+
39
+ if (region === _Constants.AriaTelemetryConstants.EU) {
40
+ configuration.collectorUri = _Constants.AriaTelemetryConstants.EUROPE_ENDPOINT;
41
+ }
42
+ }
43
+ }
33
44
  }
34
45
 
35
46
  try {
36
- _logger = _AWTLogManager.default.initialize(ariaTelemetryKey, configuration);
47
+ _logger = _AriaSDK.AWTLogManager.initialize(ariaTelemetryKey, configuration);
37
48
 
38
49
  if (_logger === undefined) {
39
- _logger = _AWTLogManager.default.getLogger(ariaTelemetryKey);
50
+ _logger = _AriaSDK.AWTLogManager.getLogger(ariaTelemetryKey);
40
51
  }
41
52
  } catch (error) {
42
53
  console.log(error);
@@ -48,23 +59,45 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
48
59
 
49
60
  const ariaLogger = {
50
61
  log: (logLevel, telemetryInput) => {
51
- let property;
52
- const eventProperties = new _AWTEventProperties.default();
53
-
54
- const event = _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput);
55
-
56
- eventProperties.setName(telemetryInput.scenarioType);
62
+ try {
63
+ var _telemetryInput$telem;
64
+
65
+ const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : (_telemetryInput$telem = telemetryInput.telemetryInfo) === null || _telemetryInput$telem === void 0 ? void 0 : _telemetryInput$telem.telemetryInfo; // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
+
67
+ const eventProperties = {
68
+ name: telemetryInput.scenarioType,
69
+ properties: {}
70
+ };
71
+
72
+ if (telemetryInfo) {
73
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
74
+ Object.keys(telemetryInfo).forEach((key, index) => {
75
+ if (!(0, _utils.isNullOrUndefined)(telemetryInfo[key]) && !(0, _utils.isNullOrEmptyString)(telemetryInfo[key])) {
76
+ const property = {
77
+ value: typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key],
78
+ type: typeof telemetryInfo[key] === "number" ? _Enums.AWTPropertyType.Double : _Enums.AWTPropertyType.String,
79
+ pii: _Enums.AWTPiiKind.NotSet,
80
+ cc: _Enums.AWTCustomerContentKind.NotSet
81
+ };
82
+ eventProperties.properties[key] = property;
83
+ }
84
+ });
85
+ const nameProperty = {
86
+ value: _Constants.Constants.LiveChatWidget,
87
+ type: _Enums.AWTPropertyType.String,
88
+ pii: _Enums.AWTPiiKind.GenericData,
89
+ cc: _Enums.AWTCustomerContentKind.NotSet
90
+ };
91
+ eventProperties.properties[ariaTelemetryApplicationName] = nameProperty;
92
+ }
57
93
 
58
- for (const key of Object.keys(event)) {
59
- property = typeof event[key] === "object" ? JSON.stringify(event[key]) : event[key];
60
- eventProperties.setProperty(key, property);
94
+ logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
95
+ } catch (error) {
96
+ console.error("Error in logging telemetry to Aria logger:" + error);
61
97
  }
62
-
63
- eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
64
- logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
65
98
  },
66
99
  dispose: () => {
67
- _AWTLogManager.default.flush(function () {
100
+ _AriaSDK.AWTLogManager.flush(function () {
68
101
  console.log("Aria logger disposed");
69
102
  });
70
103
  }
@@ -13,27 +13,28 @@ const consoleLogger = () => {
13
13
  const consoleLogger = {
14
14
  log: (logLevel, telemetryInput) => {
15
15
  const payload = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.payload && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload : "";
16
+ const telemetryInfo = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.telemetryInfo && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo : "";
16
17
 
17
18
  try {
18
19
  switch (logLevel) {
19
20
  case _TelemetryConstants.LogLevel.INFO:
20
- console.info(_Constants.Constants.LiveChatWidget, payload);
21
+ console.info(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
21
22
  break;
22
23
 
23
24
  case _TelemetryConstants.LogLevel.DEBUG:
24
- console.debug(_Constants.Constants.LiveChatWidget, payload);
25
+ console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
25
26
  break;
26
27
 
27
28
  case _TelemetryConstants.LogLevel.WARN:
28
- console.warn(_Constants.Constants.LiveChatWidget, payload);
29
+ console.warn(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
29
30
  break;
30
31
 
31
32
  case _TelemetryConstants.LogLevel.ERROR:
32
- console.error(_Constants.Constants.LiveChatWidget, payload);
33
+ console.error(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
33
34
  break;
34
35
 
35
36
  default:
36
- console.debug(_Constants.Constants.LiveChatWidget, payload);
37
+ console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
37
38
  break;
38
39
  }
39
40
  } catch (ex) {
@@ -3,12 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getTimestampHourMinute = exports.getLocaleDirection = exports.getIconText = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = void 0;
6
+ exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getBroadcastChannelName = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
7
7
 
8
8
  var _Constants = require("./Constants");
9
9
 
10
+ var _DataStoreManager = require("./contextDataStore/DataStoreManager");
11
+
10
12
  var _KeyCodes = require("./KeyCodes");
11
13
 
14
+ var _TelemetryConstants = require("./telemetry/TelemetryConstants");
15
+
16
+ var _md5Typescript = require("md5-typescript");
17
+
12
18
  const getElementBySelector = selector => {
13
19
  let element;
14
20
 
@@ -332,6 +338,87 @@ const createTimer = () => {
332
338
  }
333
339
 
334
340
  };
341
+ }; // Returns the domain of the org
342
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
343
+
344
+
345
+ exports.createTimer = createTimer;
346
+
347
+ const getDomain = hostValue => {
348
+ for (let i = 0; i < _Constants.AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
349
+ if (hostValue.endsWith(_Constants.AriaTelemetryConstants.lcwEUDomainNames[i])) {
350
+ return _Constants.AriaTelemetryConstants.EU;
351
+ }
352
+ }
353
+
354
+ return _Constants.AriaTelemetryConstants.Public;
355
+ };
356
+
357
+ exports.getDomain = getDomain;
358
+
359
+ const getWidgetCacheId = (orgId, widgetId, widgetInstanceId) => {
360
+ const widgetCacheId = `${widgetInstanceId}_${orgId}_${widgetId}`;
361
+ return _md5Typescript.Md5.init(widgetCacheId);
362
+ };
363
+
364
+ exports.getWidgetCacheId = getWidgetCacheId;
365
+
366
+ const getWidgetEndChatEventName = (orgId, widgetId, widgetInstanceId) => {
367
+ if (!isNullOrEmptyString(widgetInstanceId)) {
368
+ return `${_TelemetryConstants.BroadcastEvent.ChatEnded}_${widgetInstanceId}_${orgId}_${widgetId}`;
369
+ }
370
+
371
+ return `${_TelemetryConstants.BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
372
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
373
+
374
+
375
+ exports.getWidgetEndChatEventName = getWidgetEndChatEventName;
376
+
377
+ const getStateFromCache = (orgId, widgetId, widgetInstanceId) => {
378
+ // Getting updated state from cache
379
+ try {
380
+ if (_DataStoreManager.DataStoreManager.clientDataStore) {
381
+ var _DataStoreManager$cli;
382
+
383
+ const widgetStateEventName = getWidgetCacheId(orgId, widgetId, widgetInstanceId);
384
+ const widgetStateFromCache = (_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateEventName, "localStorage");
385
+ const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
386
+ return persistedState;
387
+ } else {
388
+ return null;
389
+ }
390
+ } catch (error) {
391
+ console.log(error);
392
+ return null;
393
+ }
394
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
395
+
396
+
397
+ exports.getStateFromCache = getStateFromCache;
398
+
399
+ const isUndefinedOrEmpty = object => {
400
+ if (object) {
401
+ if (Object.keys(object).length === 0) {
402
+ return true;
403
+ }
404
+
405
+ return false;
406
+ } else {
407
+ return true;
408
+ }
409
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
410
+
411
+
412
+ exports.isUndefinedOrEmpty = isUndefinedOrEmpty;
413
+
414
+ const addDelayInMs = ms => {
415
+ return new Promise(resolve => setTimeout(resolve, ms));
416
+ };
417
+
418
+ exports.addDelayInMs = addDelayInMs;
419
+
420
+ const getBroadcastChannelName = (widgetId, widgetInstanceId) => {
421
+ return widgetInstanceId && !isNullOrEmptyString(widgetInstanceId) ? `${widgetInstanceId}_${widgetId}` : widgetId;
335
422
  };
336
423
 
337
- exports.createTimer = createTimer;
424
+ exports.getBroadcastChannelName = getBroadcastChannelName;
@@ -206,6 +206,20 @@ const CallingContainerStateful = props => {
206
206
  });
207
207
  }
208
208
  });
209
+ window.addEventListener("beforeunload", () => {
210
+ if (state.uiStates.isIncomingCall) {
211
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
212
+ } else {
213
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
214
+ }
215
+
216
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
217
+ dispatch({
218
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
219
+ payload: false
220
+ });
221
+ resetCallingStates(true);
222
+ });
209
223
  }, []);
210
224
  const controlProps = {
211
225
  id: "oc-lcw-callingcontainer",
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
34
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
35
 
36
36
  const ChatButtonStateful = props => {
37
- var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
37
+ var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
38
38
 
39
39
  const [state, dispatch] = (0, _useChatContextStore.default)();
40
40
  const {
@@ -44,20 +44,27 @@ const ChatButtonStateful = props => {
44
44
  } = props; //Setting OutOfOperatingHours Flag
45
45
 
46
46
  const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.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");
47
+ const proactiveChatInNewWindow = (0, _react.useRef)(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
47
48
  const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeChatButtonStyleProps.defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
48
49
  const controlProps = {
49
50
  id: "oc-lcw-chat-button",
50
51
  dir: state.domainStates.globalDir,
51
52
  titleText: "Let's Chat!",
52
53
  subtitleText: "We're online.",
53
- hideNotificationBubble: !(state.appStates.isMinimized === true && state.appStates.unreadMessageCount > 0) || (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true,
54
- unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? _Constants.Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
54
+ hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
55
+ unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
55
56
  onClick: async () => {
56
57
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
57
58
  Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
58
59
  });
59
60
 
60
- if (state.appStates.isMinimized) {
61
+ if (proactiveChatInNewWindow.current) {
62
+ const proactiveChatIsInPopoutModeEvent = {
63
+ eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatIsInPopoutMode
64
+ };
65
+
66
+ _omnichannelChatComponents.BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
67
+ } else if (state.appStates.isMinimized) {
61
68
  dispatch({
62
69
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
63
70
  payload: false
@@ -66,6 +73,7 @@ const ChatButtonStateful = props => {
66
73
  await startChat();
67
74
  }
68
75
  },
76
+ unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
69
77
  ...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
70
78
  };
71
79
  const outOfOfficeControlProps = {
@@ -74,6 +82,10 @@ const ChatButtonStateful = props => {
74
82
  titleText: "We're Offline",
75
83
  subtitleText: "No agents available",
76
84
  onClick: async () => {
85
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
86
+ Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
87
+ });
88
+
77
89
  if (state.appStates.isMinimized) {
78
90
  dispatch({
79
91
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
@@ -86,6 +98,7 @@ const ChatButtonStateful = props => {
86
98
  });
87
99
  }
88
100
  },
101
+ unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
89
102
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
90
103
  };
91
104
  (0, _react.useEffect)(() => {
@@ -107,6 +120,9 @@ const ChatButtonStateful = props => {
107
120
  });
108
121
  }
109
122
  }, []);
123
+ (0, _react.useEffect)(() => {
124
+ proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
125
+ }, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
110
126
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ChatButton, {
111
127
  componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
112
128
  controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
@@ -13,10 +13,6 @@ var _react = _interopRequireWildcard(require("react"));
13
13
 
14
14
  var _utils = require("../../common/utils");
15
15
 
16
- var _Constants = require("../../common/Constants");
17
-
18
- var _ConversationState = require("../../contexts/common/ConversationState");
19
-
20
16
  var _DimLayer = require("../dimlayer/DimLayer");
21
17
 
22
18
  var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
@@ -25,16 +21,12 @@ var _NotificationHandler = require("../webchatcontainerstateful/webchatcontrolle
25
21
 
26
22
  var _NotificationScenarios = require("../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
27
23
 
28
- var _PostChatSurveyMode = require("../postchatsurveypanestateful/enums/PostChatSurveyMode");
29
-
30
24
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
31
25
 
32
26
  var _useChatAdapterStore = _interopRequireDefault(require("../../hooks/useChatAdapterStore"));
33
27
 
34
28
  var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
35
29
 
36
- var _useChatSDKStore = _interopRequireDefault(require("../../hooks/useChatSDKStore"));
37
-
38
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
31
 
40
32
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -43,21 +35,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
43
35
 
44
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
37
  const ConfirmationPaneStateful = props => {
46
- var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
47
-
48
38
  const initialTabIndexMap = new Map();
49
- let elements = []; // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
-
51
- const chatSDK = (0, _useChatSDKStore.default)();
39
+ let elements = [];
52
40
  const [state, dispatch] = (0, _useChatContextStore.default)();
53
41
  const {
54
- endChat
42
+ prepareEndChat
55
43
  } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
44
 
58
45
  const [adapter] = (0, _useChatAdapterStore.default)();
59
- 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;
60
- 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;
61
46
  const controlProps = {
62
47
  id: "oc-lcw-confirmation-pane",
63
48
  dir: state.domainStates.globalDir,
@@ -73,29 +58,8 @@ const ConfirmationPaneStateful = props => {
73
58
  });
74
59
 
75
60
  try {
76
- // check agent has joined conversation
77
- const conversationDetails = await chatSDK.getConversationDetails();
78
-
79
- if (isPostChatEnabled === "true" && (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.canRenderPostChat) === _Constants.Constants.truePascal) {
80
- if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
81
- const loadPostChatEvent = {
82
- eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
83
- };
84
-
85
- _omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
86
- } else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
87
- const skipEndChatSDK = false;
88
- const skipCloseChat = true;
89
- await endChat(adapter, skipEndChatSDK, skipCloseChat);
90
- dispatch({
91
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
92
- payload: _ConversationState.ConversationState.InActive
93
- });
94
- }
95
- } else {
96
- (0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
97
- await endChat(adapter);
98
- }
61
+ (0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
62
+ await prepareEndChat(adapter, state);
99
63
  } catch (ex) {
100
64
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
101
65
  Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsCallFailed,
@@ -117,12 +81,12 @@ const ConfirmationPaneStateful = props => {
117
81
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
118
82
  payload: false
119
83
  });
120
- const previousFocused = state.appStates.previousElementOnFocusBeforeModalOpen;
84
+ const previousFocusedElementId = state.appStates.previousElementIdOnFocusBeforeModalOpen;
121
85
 
122
- if (previousFocused) {
123
- (0, _utils.setFocusOnElement)(previousFocused);
86
+ if (previousFocusedElementId) {
87
+ (0, _utils.setFocusOnElement)("#" + previousFocusedElementId);
124
88
  dispatch({
125
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
89
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
126
90
  payload: null
127
91
  });
128
92
  } else {
@@ -50,16 +50,16 @@ const EmailTranscriptPaneStateful = props => {
50
50
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_EMAIL_TRANSCRIPT_PANE,
51
51
  payload: false
52
52
  });
53
- const previousFocused = state.appStates.previousElementOnFocusBeforeModalOpen;
53
+ const previousFocusedElementId = state.appStates.previousElementIdOnFocusBeforeModalOpen;
54
54
 
55
- if (previousFocused) {
56
- (0, _utils.setFocusOnElement)(previousFocused);
55
+ if (previousFocusedElementId) {
56
+ (0, _utils.setFocusOnElement)("#" + previousFocusedElementId);
57
57
  } else {
58
58
  (0, _utils.setFocusOnSendBox)();
59
59
  }
60
60
 
61
61
  dispatch({
62
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
62
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
63
63
  payload: null
64
64
  });
65
65
  (0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
@@ -79,13 +79,12 @@ const FooterStateful = props => {
79
79
  Description: "Email Transcript button clicked."
80
80
  });
81
81
 
82
- const emailTranscriptButtonId = (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP = footerProps.controlProps) === null || _footerProps$controlP === void 0 ? void 0 : (_footerProps$controlP2 = _footerProps$controlP.emailTranscriptButtonProps) === null || _footerProps$controlP2 === void 0 ? void 0 : _footerProps$controlP2.id) ?? "oc-lcw-footer-emailtranscript-button";
83
- const emailTranscriptButton = document.getElementById(emailTranscriptButtonId);
82
+ const emailTranscriptButtonId = (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP = footerProps.controlProps) === null || _footerProps$controlP === void 0 ? void 0 : (_footerProps$controlP2 = _footerProps$controlP.emailTranscriptButtonProps) === null || _footerProps$controlP2 === void 0 ? void 0 : _footerProps$controlP2.id) ?? `${controlProps.id}-emailtranscript-button`;
84
83
 
85
- if (emailTranscriptButton) {
84
+ if (emailTranscriptButtonId) {
86
85
  dispatch({
87
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
88
- payload: emailTranscriptButton
86
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
87
+ payload: emailTranscriptButtonId
89
88
  });
90
89
  }
91
90
 
@@ -110,21 +109,13 @@ const FooterStateful = props => {
110
109
  isAudioMuted: state.appStates.isAudioMuted
111
110
  }
112
111
  };
113
- const footerId = (controlProps === null || controlProps === void 0 ? void 0 : controlProps.id) ?? "oc-lcw-footer";
114
- const footer = document.getElementById(footerId);
115
-
116
- if (footer) {
117
- footer.style.display = hideFooterDisplay ? "none" : "";
118
- }
119
-
120
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Footer, {
112
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !hideFooterDisplay && /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Footer, {
121
113
  componentOverrides: footerProps === null || footerProps === void 0 ? void 0 : footerProps.componentOverrides,
122
114
  controlProps: controlProps,
123
115
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
124
116
  }), /*#__PURE__*/_react.default.createElement(_AudioNotificationStateful.default, {
125
117
  audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? _Audios.NewMessageNotificationSoundBase64,
126
- hideAudioNotificationButton: (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false,
127
- isAudioMuted: state.appStates.isAudioMuted ?? false
118
+ isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
128
119
  }));
129
120
  };
130
121
 
@@ -116,8 +116,17 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
116
116
  let fileAttachmentName = _Constants.TranscriptConstants.DefaultFileAttachmentName;
117
117
  let dialogColor = _Constants.TranscriptConstants.CustomerDialogColor;
118
118
  let fontColor = _Constants.TranscriptConstants.CustomerFontColor;
119
+ const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.systemMessageTag) !== -1;
120
+ const isControlMessage = value.isControlMessage && value.isControlMessage === true;
119
121
 
120
- if (value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.systemMessageTag) !== -1 || value.isControlMessage && value.isControlMessage === true || value.contentType && value.contentType.toLowerCase() === _Constants.TranscriptConstants.AdaptiveCardType || value.deliveryMode && value.deliveryMode.toLowerCase() === _Constants.TranscriptConstants.InternalMode) {
122
+ const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === _Constants.TranscriptConstants.AdaptiveCardType;
123
+
124
+ const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === _Constants.TranscriptConstants.InternalMode;
125
+
126
+ const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.hiddenTag.toLowerCase()) !== -1;
127
+ const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
128
+
129
+ if (shouldIgnoreMessage) {
121
130
  return;
122
131
  } else if (value.from) {
123
132
  if (value.from.application) {
@@ -138,7 +147,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
138
147
 
139
148
  if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
140
149
  fileAttachmentName = value.attachments[0].name;
141
- value.content = attachmentMessage ?? "The following attachment was uploaded during the conversation:" + fileAttachmentName;
150
+ value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
142
151
  }
143
152
  }
144
153
 
@@ -59,6 +59,8 @@ const HeaderStateful = props => {
59
59
  });
60
60
  },
61
61
  onCloseClick: async () => {
62
+ var _props$headerProps, _props$headerProps$co, _props$headerProps$co2;
63
+
62
64
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
63
65
  Event: _TelemetryConstants.TelemetryEvent.HeaderCloseButtonClicked,
64
66
  Description: "Header Close button clicked."
@@ -69,26 +71,25 @@ const HeaderStateful = props => {
69
71
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
70
72
  payload: true
71
73
  });
72
- } else if (conversationState.current === _ConversationState.ConversationState.Postchat) {
73
- dispatch({
74
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
75
- payload: false
76
- });
77
- await endChat(adapter);
78
- } else if (conversationState.current === _ConversationState.ConversationState.InActive) {
74
+ } else {
79
75
  const skipEndChatSDK = true;
80
76
  const skipCloseChat = false;
81
- await endChat(adapter, skipEndChatSDK, skipCloseChat);
77
+ const postMessageToOtherTabs = true;
78
+ await endChat(adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTabs);
82
79
  }
83
80
 
84
- dispatch({
85
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
86
- payload: document.getElementById(`${controlProps.id}-closebutton`)
87
- });
81
+ const closeButtonId = ((_props$headerProps = props.headerProps) === null || _props$headerProps === void 0 ? void 0 : (_props$headerProps$co = _props$headerProps.controlProps) === null || _props$headerProps$co === void 0 ? void 0 : (_props$headerProps$co2 = _props$headerProps$co.closeButtonProps) === null || _props$headerProps$co2 === void 0 ? void 0 : _props$headerProps$co2.id) ?? `${controlProps.id}-close-button`;
82
+
83
+ if (closeButtonId) {
84
+ dispatch({
85
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
86
+ payload: closeButtonId
87
+ });
88
+ }
88
89
  },
89
90
  ...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
90
- hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
91
- hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
91
+ hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
92
+ hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
92
93
  hideCloseButton: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.Prechat || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
93
94
  };
94
95
  const outOfOfficeControlProps = {