@microsoft/omnichannel-chat-widget 1.8.3 → 1.8.4-main.1bfa518

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 (149) hide show
  1. package/README.md +27 -0
  2. package/lib/cjs/common/Constants.js +7 -0
  3. package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
  4. package/lib/cjs/common/telemetry/AppInsightsEvents.js +14 -9
  5. package/lib/cjs/common/telemetry/TelemetryConstants.js +46 -2
  6. package/lib/cjs/common/telemetry/TelemetryManager.js +10 -7
  7. package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +29 -13
  8. package/lib/cjs/common/utils/SecureEventBus.js +307 -0
  9. package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
  10. package/lib/cjs/common/utils.js +14 -1
  11. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
  12. package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +20 -1
  13. package/lib/cjs/components/headerstateful/HeaderStateful.js +8 -2
  14. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +127 -0
  15. package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +15 -0
  16. package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +290 -0
  17. package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
  18. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +17 -0
  19. package/lib/cjs/components/livechatwidget/common/endChat.js +33 -10
  20. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +16 -7
  21. package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
  22. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
  23. package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
  24. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
  25. package/lib/cjs/components/livechatwidget/common/startChat.js +5 -1
  26. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +24 -4
  27. package/lib/cjs/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
  28. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +123 -28
  29. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +37 -8
  30. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -3
  31. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +46 -22
  32. package/lib/cjs/components/webchatcontainerstateful/common/activities/botActivity.js +14 -0
  33. package/lib/cjs/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +17 -0
  34. package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +103 -0
  35. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
  36. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +1 -1
  37. package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +57 -0
  38. package/lib/cjs/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
  39. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +121 -0
  40. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +10 -0
  41. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +47 -0
  42. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1058 -0
  43. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +34 -0
  44. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +50 -1
  45. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +16 -2
  46. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +20 -0
  47. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -2
  48. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +59 -0
  49. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -3
  50. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -2
  51. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
  52. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
  53. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
  54. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
  55. package/lib/cjs/contexts/createReducer.js +15 -0
  56. package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
  57. package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
  58. package/lib/cjs/plugins/newMessageEventHandler.js +4 -1
  59. package/lib/esm/common/Constants.js +7 -0
  60. package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
  61. package/lib/esm/common/telemetry/AppInsightsEvents.js +14 -9
  62. package/lib/esm/common/telemetry/TelemetryConstants.js +44 -1
  63. package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
  64. package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +30 -14
  65. package/lib/esm/common/utils/SecureEventBus.js +328 -0
  66. package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
  67. package/lib/esm/common/utils.js +11 -0
  68. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -5
  69. package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +20 -1
  70. package/lib/esm/components/headerstateful/HeaderStateful.js +9 -3
  71. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +120 -0
  72. package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +8 -0
  73. package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +283 -0
  74. package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
  75. package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +10 -0
  76. package/lib/esm/components/livechatwidget/common/endChat.js +33 -10
  77. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +16 -7
  78. package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
  79. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
  80. package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
  81. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
  82. package/lib/esm/components/livechatwidget/common/startChat.js +7 -3
  83. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +23 -4
  84. package/lib/esm/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
  85. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +124 -29
  86. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +39 -10
  87. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -4
  88. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +46 -22
  89. package/lib/esm/components/webchatcontainerstateful/common/activities/botActivity.js +7 -0
  90. package/lib/esm/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +9 -0
  91. package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +96 -0
  92. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
  93. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  94. package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +49 -0
  95. package/lib/esm/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
  96. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +114 -0
  97. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +3 -0
  98. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +39 -0
  99. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1080 -0
  100. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +25 -0
  101. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +48 -1
  102. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +13 -0
  103. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +13 -0
  104. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +1 -1
  105. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +52 -0
  106. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +3 -2
  107. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +1 -1
  108. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
  109. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
  110. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
  111. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
  112. package/lib/esm/contexts/createReducer.js +15 -0
  113. package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
  114. package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
  115. package/lib/esm/plugins/newMessageEventHandler.js +4 -1
  116. package/lib/types/common/Constants.d.ts +6 -0
  117. package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
  118. package/lib/types/common/telemetry/TelemetryConstants.d.ts +41 -2
  119. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
  120. package/lib/types/common/utils/SecureEventBus.d.ts +159 -0
  121. package/lib/types/common/utils/dispatchCustomEvent.d.ts +2 -0
  122. package/lib/types/common/utils.d.ts +9 -1
  123. package/lib/types/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.d.ts +45 -0
  124. package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +7 -0
  125. package/lib/types/components/livechatwidget/common/PersistentConversationHandler.d.ts +28 -0
  126. package/lib/types/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.d.ts +2 -0
  127. package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
  128. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
  129. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
  130. package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +11 -0
  131. package/lib/types/components/webchatcontainerstateful/common/activities/botActivity.d.ts +7 -0
  132. package/lib/types/components/webchatcontainerstateful/common/activities/conversationDividerActivity.d.ts +10 -0
  133. package/lib/types/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.d.ts +2 -0
  134. package/lib/types/components/webchatcontainerstateful/hooks/usePersistentChatHistory.d.ts +4 -0
  135. package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +15 -0
  136. package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +6 -0
  137. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.d.ts +3 -0
  138. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.d.ts +4 -0
  139. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +326 -0
  140. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.d.ts +8 -0
  141. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
  142. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -0
  143. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.d.ts +2 -0
  144. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.d.ts +2 -0
  145. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
  146. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  147. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +6 -0
  148. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
  149. package/package.json +3 -3
@@ -17,6 +17,7 @@ var _NotificationHandler = require("./webchatcontroller/notification/Notificatio
17
17
  var _NotificationScenarios = require("./webchatcontroller/enums/NotificationScenarios");
18
18
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
19
19
  var _WebChatActionType = require("./webchatcontroller/enums/WebChatActionType");
20
+ var _WebChatEventSubscribers = _interopRequireDefault(require("./webchatcontroller/WebChatEventSubscribers"));
20
21
  var _WebChatStoreLoader = require("./webchatcontroller/WebChatStoreLoader");
21
22
  var _fontUtils = require("./common/utils/fontUtils");
22
23
  var _defaultAdaptiveCardStyles = require("./common/defaultStyles/defaultAdaptiveCardStyles");
@@ -26,7 +27,10 @@ var _defaultSentMessageAnchorStyles = require("./webchatcontroller/middlewares/r
26
27
  var _defaultSystemMessageBoxStyles = require("./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles");
27
28
  var _defaultUserMessageBoxStyles = require("./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles");
28
29
  var _defaultWebChatContainerStatefulProps = require("./common/defaultProps/defaultWebChatContainerStatefulProps");
30
+ var _liveChatConfigUtils = require("../livechatwidget/common/liveChatConfigUtils");
29
31
  var _ = require("../..");
32
+ var _useFacadeChatSDKStore = _interopRequireDefault(require("../../hooks/useFacadeChatSDKStore"));
33
+ var _usePersistentChatHistory = _interopRequireDefault(require("./hooks/usePersistentChatHistory"));
30
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
35
  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); }
32
36
  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; }
@@ -58,7 +62,9 @@ const createMagicCodeSuccessResponse = signin => {
58
62
  };
59
63
  };
60
64
  const WebChatContainerStateful = props => {
61
- var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$webChatContain10, _props$webChatContain11, _webChatContainerProp24, _webChatContainerProp25, _webChatContainerProp26, _webChatContainerProp27, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
65
+ var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _webChatContainerProp24, _props$webChatContain10, _props$webChatContain11, _webChatContainerProp25, _webChatContainerProp26, _webChatContainerProp27, _webChatContainerProp28, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
66
+ const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
67
+
62
68
  // Create a font family that includes emoji support, based on the primary font or default
63
69
  const webChatStyles = ((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles) ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles;
64
70
  const primaryFont = (webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.primaryFont) ?? ((_defaultWebChatContai = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.primaryFont);
@@ -79,9 +85,6 @@ const WebChatContainerStateful = props => {
79
85
  // Guard to prevent handling multiple rapid clicks which could cause
80
86
  // the dim layer and pane to re-render out of sync and create a flicker.
81
87
  const citationOpeningRef = (0, _react2.useRef)(false);
82
-
83
- // ...existing code...
84
-
85
88
  const {
86
89
  BasicWebChat
87
90
  } = _botframeworkWebchat.Components;
@@ -91,6 +94,17 @@ const WebChatContainerStateful = props => {
91
94
  contextDataStore
92
95
  } = props;
93
96
 
97
+ // Type the chatConfig properly to avoid 'any' usage
98
+ const extendedChatConfig = props.chatConfig;
99
+
100
+ // Determine if persistent chat history should be loaded based on all conditions
101
+ const shouldLoadPersistentHistoryMessages = (0, _liveChatConfigUtils.shouldLoadPersistentChatHistory)(extendedChatConfig);
102
+ if (shouldLoadPersistentHistoryMessages) {
103
+ _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
104
+ Event: _TelemetryConstants.TelemetryEvent.PersistentChatHistoryEnabled
105
+ });
106
+ (0, _usePersistentChatHistory.default)(facadeChatSDK, (props === null || props === void 0 ? void 0 : props.persistentChatHistoryProps) ?? {});
107
+ }
94
108
  // Delegated click handler for citation anchors. Placed after state is
95
109
  // available so we can prefer reading citations from app state and fall
96
110
  // back to the legacy window map for backward-compatibility in tests.
@@ -253,24 +267,28 @@ const WebChatContainerStateful = props => {
253
267
  background: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp === void 0 ? void 0 : _webChatContainerProp.background) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.background};
254
268
  }
255
269
 
256
- .webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock {
257
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color};
270
+ .webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock[role=heading] {
271
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color} !important;
272
+ }
273
+
274
+ .webchat__bubble__content>div#ms_lcw_webchat_adaptive_card label .ac-textRun:first-child {
275
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp3 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp3 === void 0 ? void 0 : _webChatContainerProp3.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color} !important;
258
276
  }
259
277
 
260
278
  .webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__bubble--from-user {
261
- max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp3 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp3 === void 0 ? void 0 : (_webChatContainerProp4 = _webChatContainerProp3.userMessageBoxStyles) === null || _webChatContainerProp4 === void 0 ? void 0 : _webChatContainerProp4.maxWidth) ?? (_defaultUserMessageBoxStyles.defaultUserMessageBoxStyles === null || _defaultUserMessageBoxStyles.defaultUserMessageBoxStyles === void 0 ? void 0 : _defaultUserMessageBoxStyles.defaultUserMessageBoxStyles.maxWidth)}
279
+ max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp4 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp4 === void 0 ? void 0 : (_webChatContainerProp5 = _webChatContainerProp4.userMessageBoxStyles) === null || _webChatContainerProp5 === void 0 ? void 0 : _webChatContainerProp5.maxWidth) ?? (_defaultUserMessageBoxStyles.defaultUserMessageBoxStyles === null || _defaultUserMessageBoxStyles.defaultUserMessageBoxStyles === void 0 ? void 0 : _defaultUserMessageBoxStyles.defaultUserMessageBoxStyles.maxWidth)}
262
280
  }
263
281
 
264
282
  .webchat__stacked-layout--show-avatar div.webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__stacked-layout__message {
265
- max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp5 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp5 === void 0 ? void 0 : (_webChatContainerProp6 = _webChatContainerProp5.systemMessageBoxStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.maxWidth) ?? (_defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles === null || _defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles === void 0 ? void 0 : _defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles.maxWidth)}
283
+ max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp6 === void 0 ? void 0 : (_webChatContainerProp7 = _webChatContainerProp6.systemMessageBoxStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.maxWidth) ?? (_defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles === null || _defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles === void 0 ? void 0 : _defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles.maxWidth)}
266
284
  }
267
285
 
268
286
  div[class="ac-textBlock"] *,
269
- div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.textWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.textWhiteSpace}}
287
+ div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.textWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.textWhiteSpace}}
270
288
 
271
289
  div[class="ac-input-container"] input.ac-multichoiceInput,
272
290
  div[class="ac-input-container"] select.ac-multichoiceInput {
273
- ${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp8 !== void 0 && _webChatContainerProp8.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
291
+ ${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp9 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp9 !== void 0 && _webChatContainerProp9.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
274
292
  }
275
293
 
276
294
  .ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
@@ -282,15 +300,15 @@ const WebChatContainerStateful = props => {
282
300
  div[class="ac-textBlock"] a:visited,
283
301
  div[class="ac-textBlock"] a:hover,
284
302
  div[class="ac-textBlock"] a:active {
285
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp9 === void 0 ? void 0 : _webChatContainerProp9.anchorColor) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.anchorColor};
303
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp10 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.anchorColor) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.anchorColor};
286
304
  }
287
305
 
288
- .webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp10 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.buttonWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
306
+ .webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp11 === void 0 ? void 0 : _webChatContainerProp11.buttonWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
289
307
 
290
308
  .ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
291
309
  /* Fallback for browsers that don't support mask */
292
310
  background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjRkZGRkZGIiAvPjwvc3ZnPg==);
293
- filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp11 === void 0 ? void 0 : (_webChatContainerProp12 = _webChatContainerProp11.receivedMessageAnchorStyles) === null || _webChatContainerProp12 === void 0 ? void 0 : _webChatContainerProp12.filter) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.filter)};
311
+ filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp12 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp12 === void 0 ? void 0 : (_webChatContainerProp13 = _webChatContainerProp12.receivedMessageAnchorStyles) === null || _webChatContainerProp13 === void 0 ? void 0 : _webChatContainerProp13.filter) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.filter)};
294
312
  height: .75em;
295
313
  width: .75em;
296
314
  margin-left: .25em;
@@ -300,7 +318,7 @@ const WebChatContainerStateful = props => {
300
318
  .ms_lcw_webchat_sent_message img.webchat__render-markdown__external-link-icon {
301
319
  /* Fallback for browsers that don't support mask */
302
320
  background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjRkZGRkZGIiAvPjwvc3ZnPg==);
303
- filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp13 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp13 === void 0 ? void 0 : (_webChatContainerProp14 = _webChatContainerProp13.sentMessageAnchorStyles) === null || _webChatContainerProp14 === void 0 ? void 0 : _webChatContainerProp14.filter) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.filter)};
321
+ filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp14 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp14 === void 0 ? void 0 : (_webChatContainerProp15 = _webChatContainerProp14.sentMessageAnchorStyles) === null || _webChatContainerProp15 === void 0 ? void 0 : _webChatContainerProp15.filter) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.filter)};
304
322
  height: .75em;
305
323
  width: .75em;
306
324
  margin-left: .25em;
@@ -310,7 +328,7 @@ const WebChatContainerStateful = props => {
310
328
  /* Modern browsers with mask support */
311
329
  @supports (mask: url()) or (-webkit-mask: url()) {
312
330
  .ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
313
- background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp15 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp15 === void 0 ? void 0 : (_webChatContainerProp16 = _webChatContainerProp15.receivedMessageAnchorStyles) === null || _webChatContainerProp16 === void 0 ? void 0 : _webChatContainerProp16.color) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.color)} !important;
331
+ background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp16 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp16 === void 0 ? void 0 : (_webChatContainerProp17 = _webChatContainerProp16.receivedMessageAnchorStyles) === null || _webChatContainerProp17 === void 0 ? void 0 : _webChatContainerProp17.color) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.color)} !important;
314
332
  background-image: none !important;
315
333
  filter: none !important;
316
334
  mask: url("data:image/svg+xml,%3Csvg viewBox='3 3 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.2501 4.50017H10.7495C11.1637 4.50017 11.4995 4.83596 11.4995 5.25017C11.4995 5.62986 11.2173 5.94366 10.8513 5.99332L10.7495 6.00017H7.24974C6.07079 5.99961 5.10349 6.90656 5.00786 8.06112L5.00028 8.22003L5.00312 16.7507C5.00343 17.9415 5.92885 18.9161 7.09966 18.9949L7.25371 19.0001L15.7518 18.9884C16.9415 18.9868 17.9145 18.062 17.9935 16.8923L17.9987 16.7384V13.2321C17.9987 12.8179 18.3345 12.4821 18.7487 12.4821C19.1284 12.4821 19.4422 12.7643 19.4918 13.1303L19.4987 13.2321V16.7384C19.4987 18.7407 17.9293 20.3769 15.9528 20.4829L15.7538 20.4884L7.25827 20.5001L7.05495 20.4949C5.14239 20.3954 3.60895 18.8627 3.50837 16.9502L3.50312 16.7511L3.50089 8.2527L3.50529 8.0502C3.60539 6.13749 5.13867 4.60449 7.05096 4.50527L7.2501 4.50017H10.7495H7.2501ZM13.7481 3.00146L20.3018 3.00197L20.4014 3.01575L20.5022 3.04393L20.559 3.06803C20.6122 3.09122 20.6634 3.12163 20.7111 3.15885L20.7804 3.22156L20.8641 3.32014L20.9183 3.41025L20.957 3.50057L20.9762 3.56476L20.9898 3.62862L20.9992 3.72282L20.9997 10.2554C20.9997 10.6696 20.6639 11.0054 20.2497 11.0054C19.87 11.0054 19.5562 10.7232 19.5065 10.3571L19.4997 10.2554L19.4989 5.56147L12.2797 12.7847C12.0134 13.051 11.5968 13.0753 11.3031 12.8575L11.219 12.7849C10.9527 12.5187 10.9284 12.1021 11.1462 11.8084L11.2188 11.7243L18.4369 4.50146H13.7481C13.3684 4.50146 13.0546 4.21931 13.005 3.85324L12.9981 3.75146C12.9981 3.37177 13.2803 3.05797 13.6464 3.00831L13.7481 3.00146Z' fill='currentColor' /%3E%3C/svg%3E") no-repeat center;
@@ -320,7 +338,7 @@ const WebChatContainerStateful = props => {
320
338
  }
321
339
 
322
340
  .ms_lcw_webchat_sent_message img.webchat__render-markdown__external-link-icon {
323
- background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp17 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp17 === void 0 ? void 0 : (_webChatContainerProp18 = _webChatContainerProp17.sentMessageAnchorStyles) === null || _webChatContainerProp18 === void 0 ? void 0 : _webChatContainerProp18.color) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.color)} !important;
341
+ background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp18 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp18 === void 0 ? void 0 : (_webChatContainerProp19 = _webChatContainerProp18.sentMessageAnchorStyles) === null || _webChatContainerProp19 === void 0 ? void 0 : _webChatContainerProp19.color) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.color)} !important;
324
342
  background-image: none !important;
325
343
  filter: none !important;
326
344
  mask: url("data:image/svg+xml,%3Csvg viewBox='3 3 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.2501 4.50017H10.7495C11.1637 4.50017 11.4995 4.83596 11.4995 5.25017C11.4995 5.62986 11.2173 5.94366 10.8513 5.99332L10.7495 6.00017H7.24974C6.07079 5.99961 5.10349 6.90656 5.00786 8.06112L5.00028 8.22003L5.00312 16.7507C5.00343 17.9415 5.92885 18.9161 7.09966 18.9949L7.25371 19.0001L15.7518 18.9884C16.9415 18.9868 17.9145 18.062 17.9935 16.8923L17.9987 16.7384V13.2321C17.9987 12.8179 18.3345 12.4821 18.7487 12.4821C19.1284 12.4821 19.4422 12.7643 19.4918 13.1303L19.4987 13.2321V16.7384C19.4987 18.7407 17.9293 20.3769 15.9528 20.4829L15.7538 20.4884L7.25827 20.5001L7.05495 20.4949C5.14239 20.3954 3.60895 18.8627 3.50837 16.9502L3.50312 16.7511L3.50089 8.2527L3.50529 8.0502C3.60539 6.13749 5.13867 4.60449 7.05096 4.50527L7.2501 4.50017H10.7495H7.2501ZM13.7481 3.00146L20.3018 3.00197L20.4014 3.01575L20.5022 3.04393L20.559 3.06803C20.6122 3.09122 20.6634 3.12163 20.7111 3.15885L20.7804 3.22156L20.8641 3.32014L20.9183 3.41025L20.957 3.50057L20.9762 3.56476L20.9898 3.62862L20.9992 3.72282L20.9997 10.2554C20.9997 10.6696 20.6639 11.0054 20.2497 11.0054C19.87 11.0054 19.5562 10.7232 19.5065 10.3571L19.4997 10.2554L19.4989 5.56147L12.2797 12.7847C12.0134 13.051 11.5968 13.0753 11.3031 12.8575L11.219 12.7849C10.9527 12.5187 10.9284 12.1021 11.1462 11.8084L11.2188 11.7243L18.4369 4.50146H13.7481C13.3684 4.50146 13.0546 4.21931 13.005 3.85324L12.9981 3.75146C12.9981 3.37177 13.2803 3.05797 13.6464 3.00831L13.7481 3.00146Z' fill='currentColor' /%3E%3C/svg%3E") no-repeat center;
@@ -338,18 +356,18 @@ const WebChatContainerStateful = props => {
338
356
  .ms_lcw_webchat_received_message a:visited,
339
357
  .ms_lcw_webchat_received_message a:hover,
340
358
  .ms_lcw_webchat_received_message a:active {
341
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp19 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp19 === void 0 ? void 0 : (_webChatContainerProp20 = _webChatContainerProp19.receivedMessageAnchorStyles) === null || _webChatContainerProp20 === void 0 ? void 0 : _webChatContainerProp20.color) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.color)};
359
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp20 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp20 === void 0 ? void 0 : (_webChatContainerProp21 = _webChatContainerProp20.receivedMessageAnchorStyles) === null || _webChatContainerProp21 === void 0 ? void 0 : _webChatContainerProp21.color) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.color)};
342
360
  }
343
361
  .ms_lcw_webchat_sent_message a:link,
344
362
  .ms_lcw_webchat_sent_message a:visited,
345
363
  .ms_lcw_webchat_sent_message a:hover,
346
364
  .ms_lcw_webchat_sent_message a:active {
347
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp21 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp21 === void 0 ? void 0 : (_webChatContainerProp22 = _webChatContainerProp21.sentMessageAnchorStyles) === null || _webChatContainerProp22 === void 0 ? void 0 : _webChatContainerProp22.color) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.color)};
365
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp22 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp22 === void 0 ? void 0 : (_webChatContainerProp23 = _webChatContainerProp22.sentMessageAnchorStyles) === null || _webChatContainerProp23 === void 0 ? void 0 : _webChatContainerProp23.color) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.color)};
348
366
  }
349
367
 
350
368
  // we had a nasty bug long time ago with crashing borders messing with the sendbox, so if customer adds this value, they need to deal with that
351
369
  .webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
352
- border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp23 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp23 === void 0 ? void 0 : _webChatContainerProp23.bubbleBorderRadius) ?? 0} !important; /* Override border-radius */
370
+ border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp24 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp24 === void 0 ? void 0 : _webChatContainerProp24.bubbleBorderRadius) ?? 0} !important; /* Override border-radius */
353
371
  }
354
372
 
355
373
  .webchat__stacked-layout_container>div {
@@ -386,13 +404,19 @@ const WebChatContainerStateful = props => {
386
404
 
387
405
  /* Suggested actions carousel previous/next navigation focus */
388
406
  .webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
389
- outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp24 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp24 === void 0 ? void 0 : _webChatContainerProp24.suggestedActionKeyboardFocusIndicatorBorderStyle) ?? "dashed"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp25 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp25 === void 0 ? void 0 : _webChatContainerProp25.suggestedActionKeyboardFocusIndicatorBorderWidth) ?? "1px"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp26 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp26 === void 0 ? void 0 : _webChatContainerProp26.suggestedActionKeyboardFocusIndicatorBorderColor) ?? "#605E5C"} !important;
390
- outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp27 === void 0 ? void 0 : _webChatContainerProp27.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
407
+ outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp25 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp25 === void 0 ? void 0 : _webChatContainerProp25.suggestedActionKeyboardFocusIndicatorBorderStyle) ?? "dashed"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp26 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp26 === void 0 ? void 0 : _webChatContainerProp26.suggestedActionKeyboardFocusIndicatorBorderWidth) ?? "1px"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp27 === void 0 ? void 0 : _webChatContainerProp27.suggestedActionKeyboardFocusIndicatorBorderColor) ?? "#605E5C"} !important;
408
+ outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp28 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp28 === void 0 ? void 0 : _webChatContainerProp28.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
391
409
 
392
410
  `), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
393
411
  styles: containerStyles,
394
412
  className: "webchat__stacked-layout_container"
395
- }, /*#__PURE__*/_react2.default.createElement(BasicWebChat, null)), citationPaneOpen && /*#__PURE__*/_react2.default.createElement(_CitationPaneStateful.default, {
413
+ }, /*#__PURE__*/_react2.default.createElement("div", {
414
+ id: "ms_lcw_webchat_root",
415
+ style: {
416
+ height: "100%",
417
+ width: "100%"
418
+ }
419
+ }, shouldLoadPersistentHistoryMessages && /*#__PURE__*/_react2.default.createElement(_WebChatEventSubscribers.default, null), /*#__PURE__*/_react2.default.createElement(BasicWebChat, null))), citationPaneOpen && /*#__PURE__*/_react2.default.createElement(_CitationPaneStateful.default, {
396
420
  id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || _Constants.HtmlAttributeNames.ocwCitationPaneClassName,
397
421
  title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || _Constants.HtmlAttributeNames.ocwCitationPaneTitle,
398
422
  contentHtml: citationPaneText,
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const botActivity = {
8
+ from: {
9
+ role: "bot"
10
+ },
11
+ type: "message"
12
+ };
13
+ var _default = botActivity;
14
+ exports.default = _default;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _Constants = require("../../../../common/Constants");
8
+ var _botActivity = _interopRequireDefault(require("./botActivity"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const conversationDividerActivity = {
11
+ ..._botActivity.default,
12
+ channelData: {
13
+ tags: [_Constants.Constants.conversationDividerTag]
14
+ }
15
+ };
16
+ var _default = conversationDividerActivity;
17
+ exports.default = _default;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _Constants = require("../../../../common/Constants");
8
+ var _botActivity = _interopRequireDefault(require("../activities/botActivity"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ const convertStringValueToInt = value => {
12
+ if (typeof value !== "string" || value === "") {
13
+ return undefined;
14
+ }
15
+ let result;
16
+ try {
17
+ result = parseInt(value);
18
+ } catch (e) {
19
+ return undefined;
20
+ }
21
+ return isNaN(result) ? undefined : result;
22
+ };
23
+
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ const convertPersistentChatHistoryMessageToActivity = message => {
26
+ var _from$user, _from$application;
27
+ const {
28
+ additionalData,
29
+ attachments,
30
+ content,
31
+ created,
32
+ from,
33
+ transcriptOriginalMessageId
34
+ } = message;
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+ const activity = {
37
+ ..._botActivity.default,
38
+ channelData: {
39
+ tags: [_Constants.Constants.persistentChatHistoryMessageTag]
40
+ }
41
+ };
42
+ let webchatSequenceId;
43
+ let timestamp;
44
+ if (transcriptOriginalMessageId) {
45
+ const id = convertStringValueToInt(transcriptOriginalMessageId); // Id used to determine the sequence of messages which is the same as the 'live' messages
46
+ if (id) {
47
+ webchatSequenceId = id;
48
+ timestamp = new Date(id) || created;
49
+ activity.channelData = {
50
+ ...activity.channelData,
51
+ "webchat:sequence-id": webchatSequenceId
52
+ };
53
+ }
54
+ }
55
+ if (additionalData !== null && additionalData !== void 0 && additionalData.tags) {
56
+ const {
57
+ tags,
58
+ ConversationId
59
+ } = additionalData;
60
+ if (ConversationId) {
61
+ activity.channelData.conversationId = ConversationId;
62
+ }
63
+ if (tags) {
64
+ const formattedTags = additionalData.tags.split(",");
65
+ activity.channelData = {
66
+ ...activity.channelData,
67
+ tags: [...activity.channelData.tags, ...formattedTags]
68
+ };
69
+ }
70
+ }
71
+ if (from !== null && from !== void 0 && (_from$user = from.user) !== null && _from$user !== void 0 && _from$user.displayName) {
72
+ activity.from = {
73
+ ...activity.from,
74
+ name: from.user.displayName
75
+ };
76
+ }
77
+ if ((from === null || from === void 0 ? void 0 : (_from$application = from.application) === null || _from$application === void 0 ? void 0 : _from$application.displayName) === "Customer") {
78
+ activity.from = {
79
+ role: "user",
80
+ name: from.application.displayName
81
+ };
82
+ }
83
+ if (content) {
84
+ return {
85
+ ...activity,
86
+ text: content,
87
+ timestamp
88
+ };
89
+ }
90
+ if (attachments && attachments.length > 0) {
91
+ const fileName = attachments[0].name || "Unknown";
92
+ const text = `The following attachment was uploaded during the conversation: ${fileName}`;
93
+ return {
94
+ ...activity,
95
+ text,
96
+ timestamp
97
+ };
98
+ }
99
+ // If neither content nor attachments are present, return null to indicate no activity could be created.
100
+ return null;
101
+ };
102
+ var _default = convertPersistentChatHistoryMessageToActivity;
103
+ exports.default = _default;
@@ -34,6 +34,8 @@ const defaultMiddlewareLocalizedTexts = {
34
34
  THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Allow sites to save/read cookies in browser settings. Reloading page starts a new chat.",
35
35
  MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
36
36
  MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
37
- MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
37
+ MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later.",
38
+ PREVIOUS_MESSAGES_LOADING: "Loading previous messages...",
39
+ CONVERSATION_DIVIDER_ARIA_LABEL: "Conversation history divider"
38
40
  };
39
41
  exports.defaultMiddlewareLocalizedTexts = defaultMiddlewareLocalizedTexts;
@@ -9,7 +9,7 @@ var _groupActivitiesMiddleware = require("../../webchatcontroller/middlewares/re
9
9
  var _typingIndicatorMiddleware = require("../../webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware");
10
10
  const defaultWebChatStatefulProps = {
11
11
  // activityMiddleware: activityMiddleware, - this is implemented elsewhere and can be customized
12
- activityStatusMiddleware: _activityStatusMiddleware.activityStatusMiddleware,
12
+ activityStatusMiddleware: (0, _activityStatusMiddleware.createActivityStatusMiddleware)(),
13
13
  // avatarMiddleware: avatarMiddleware, - this is implemented elsewhere and can be customized
14
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
15
  groupActivitiesMiddleware: _groupActivitiesMiddleware.groupActivitiesMiddleware,
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
8
+ var _react = require("react");
9
+ var _ChatWidgetEvents = _interopRequireDefault(require("../../livechatwidget/common/ChatWidgetEvents"));
10
+ var _PersistentConversationHandler = _interopRequireDefault(require("../../livechatwidget/common/PersistentConversationHandler"));
11
+ var _SecureEventBus = _interopRequireDefault(require("../../../common/utils/SecureEventBus"));
12
+ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ const usePersistentChatHistory = (facadeChatSDK, props) => {
15
+ const handlerRef = (0, _react.useRef)(null);
16
+ (0, _react.useEffect)(() => {
17
+ if (!facadeChatSDK) {
18
+ return;
19
+ }
20
+ _TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
21
+ Event: _TelemetryConstants.TelemetryEvent.UXLCWPersistentChatHistoryInitialized,
22
+ Description: "Persistent chat history hook initialized"
23
+ });
24
+ handlerRef.current = new _PersistentConversationHandler.default(facadeChatSDK, props);
25
+ const handler = async () => {
26
+ _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
27
+ Event: _TelemetryConstants.TelemetryEvent.LCWPersistentChatHistoryFetchStarted,
28
+ Description: "Persistent chat history fetch started"
29
+ });
30
+ try {
31
+ var _handlerRef$current;
32
+ await ((_handlerRef$current = handlerRef.current) === null || _handlerRef$current === void 0 ? void 0 : _handlerRef$current.pullHistory());
33
+ _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
34
+ Event: _TelemetryConstants.TelemetryEvent.LCWPersistentChatHistoryFetchCompleted,
35
+ Description: "Persistent chat history fetch completed successfully"
36
+ });
37
+ } catch (error) {
38
+ _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
39
+ Event: _TelemetryConstants.TelemetryEvent.LCWPersistentChatHistoryFetchFailed,
40
+ Description: "Persistent chat history fetch failed",
41
+ ExceptionDetails: error
42
+ });
43
+ }
44
+ };
45
+
46
+ // Subscribe to the secure event bus instead of global window events
47
+ const eventBus = _SecureEventBus.default.getInstance();
48
+ const unsubscribe = eventBus.subscribe(_ChatWidgetEvents.default.FETCH_PERSISTENT_CHAT_HISTORY, handler);
49
+ return () => {
50
+ var _handlerRef$current2;
51
+ unsubscribe();
52
+ (_handlerRef$current2 = handlerRef.current) === null || _handlerRef$current2 === void 0 ? void 0 : _handlerRef$current2.destroy(); // Call destroy instead of reset to properly clean up
53
+ };
54
+ }, [facadeChatSDK]);
55
+ };
56
+ var _default = usePersistentChatHistory;
57
+ exports.default = _default;
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
8
+ var _react = require("react");
9
+ var _ChatWidgetEvents = _interopRequireDefault(require("../../livechatwidget/common/ChatWidgetEvents"));
10
+ var _Constants = require("../../../common/Constants");
11
+ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
12
+ var _WebChatStoreLoader = require("./WebChatStoreLoader");
13
+ var _utils = require("../../../common/utils");
14
+ var _dispatchCustomEvent = _interopRequireDefault(require("../../../common/utils/dispatchCustomEvent"));
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ /**
17
+ * Component to handle persistent chat history events.
18
+ * Uses WebChatStoreLoader instead of hooks to avoid context issues.
19
+ */
20
+ const WebChatEventSubscribers = () => {
21
+ const [isConnected, setIsConnected] = (0, _react.useState)(false);
22
+ const [storeReady, setStoreReady] = (0, _react.useState)(false);
23
+ const storeWaitTimer = (0, _utils.createTimer)();
24
+ // Type the chatConfig properly to avoid 'any' usage
25
+
26
+ (0, _react.useEffect)(() => {
27
+ _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
28
+ Event: _TelemetryConstants.TelemetryEvent.LCWWebChatStorePollingStarted,
29
+ Description: "WebChat store polling started"
30
+ });
31
+
32
+ // Wait for WebChat store to be available
33
+ const waitForStore = () => {
34
+ if (_WebChatStoreLoader.WebChatStoreLoader.store) {
35
+ setStoreReady(true);
36
+ _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
37
+ Event: _TelemetryConstants.TelemetryEvent.LCWWebChatStoreReady,
38
+ Description: "WebChat store ready",
39
+ ElapsedTimeInMilliseconds: storeWaitTimer.milliSecondsElapsed
40
+ });
41
+ return true;
42
+ }
43
+ return false;
44
+ };
45
+
46
+ // Check if store is already available
47
+ if (!waitForStore()) {
48
+ // Poll for store availability
49
+ const storeCheckInterval = setInterval(() => {
50
+ if (waitForStore()) {
51
+ clearInterval(storeCheckInterval);
52
+ }
53
+ }, 100);
54
+ return () => {
55
+ clearInterval(storeCheckInterval);
56
+ };
57
+ }
58
+ }, []);
59
+ (0, _react.useEffect)(() => {
60
+ if (!storeReady) {
61
+ return;
62
+ }
63
+ const checkConnectionStatus = () => {
64
+ try {
65
+ if (_WebChatStoreLoader.WebChatStoreLoader.store) {
66
+ const state = _WebChatStoreLoader.WebChatStoreLoader.store.getState();
67
+ const connectivityStatus = state === null || state === void 0 ? void 0 : state.connectivityStatus;
68
+ const newIsConnected = connectivityStatus === "connected";
69
+ if (newIsConnected && !isConnected) {
70
+ setIsConnected(true);
71
+ _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
72
+ Event: _TelemetryConstants.TelemetryEvent.LCWWebChatConnected,
73
+ Description: "WebChat connection established, dispatching events"
74
+ });
75
+
76
+ // Dispatch events when connection is established
77
+ setTimeout(() => {
78
+ (0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.FETCH_PERSISTENT_CHAT_HISTORY);
79
+ (0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.ADD_ACTIVITY, {
80
+ activity: {
81
+ from: {
82
+ role: "bot"
83
+ },
84
+ timestamp: 0,
85
+ type: "message",
86
+ channelData: {
87
+ tags: [_Constants.Constants.persistentChatHistoryMessagePullTriggerTag]
88
+ }
89
+ }
90
+ });
91
+ }, 2000);
92
+ } else if (!newIsConnected && isConnected) {
93
+ setIsConnected(false);
94
+ _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.WARN, {
95
+ Event: _TelemetryConstants.TelemetryEvent.LCWWebChatDisconnected,
96
+ Description: "WebChat connection lost"
97
+ });
98
+ }
99
+ }
100
+ } catch (error) {
101
+ _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
102
+ Event: _TelemetryConstants.TelemetryEvent.LCWWebChatConnectionCheckFailed,
103
+ Description: "WebChat connection status check failed",
104
+ ExceptionDetails: error
105
+ });
106
+ }
107
+ };
108
+
109
+ // Check immediately
110
+ checkConnectionStatus();
111
+
112
+ // Set up interval to check connection status
113
+ const interval = setInterval(checkConnectionStatus, 1000);
114
+ return () => {
115
+ clearInterval(interval);
116
+ };
117
+ }, [isConnected, storeReady]);
118
+ return null;
119
+ };
120
+ var _default = WebChatEventSubscribers;
121
+ exports.default = _default;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LazyLoadActivityConstants = void 0;
7
+ const LazyLoadActivityConstants = {
8
+ SCROLL_ID: ".webchat__basic-transcript__scrollable"
9
+ };
10
+ exports.LazyLoadActivityConstants = LazyLoadActivityConstants;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
9
+ var _defaultPersistentChatHistoryProps = require("../../../../../livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps");
10
+ var _react2 = require("@fluentui/react");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ const ConversationDividerActivity = props => {
13
+ const styleApplied = (0, _react2.mergeStyles)(_defaultPersistentChatHistoryProps.defaultPersistentChatHistoryProps.dividerActivityStyle, props.dividerActivityStyle);
14
+ const ariaLabel = props.dividerActivityAriaLabel || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL;
15
+
16
+ // Create a simple separator that screen readers can detect without being interactive
17
+ // Preserve the visual divider styling while making it accessible
18
+ // Use a ref to programmatically remove only the "EL said:" prefix from the label
19
+ const dividerRef = _react.default.useRef(null);
20
+ _react.default.useEffect(() => {
21
+ if (dividerRef.current) {
22
+ // Find and hardcode the text in the label div to just show the divider label
23
+ const article = dividerRef.current.closest(".webchat__basic-transcript__activity");
24
+ if (article) {
25
+ const labelDiv = article.querySelector("div[id*=\"webchat__basic-transcript__active-descendant-label--\"]");
26
+ if (labelDiv) {
27
+ // Hardcode the text to just the aria label
28
+ labelDiv.textContent = ariaLabel || "";
29
+ }
30
+ }
31
+ }
32
+ }, [ariaLabel]);
33
+ return /*#__PURE__*/_react.default.createElement("div", {
34
+ ref: dividerRef,
35
+ role: "separator",
36
+ "aria-label": ariaLabel,
37
+ "aria-hidden": false,
38
+ className: styleApplied,
39
+ "data-accessibility-divider": "true",
40
+ style: {
41
+ // Add accessibility enhancements
42
+ position: "relative"
43
+ }
44
+ });
45
+ };
46
+ var _default = ConversationDividerActivity;
47
+ exports.default = _default;