@microsoft/omnichannel-chat-widget 1.8.3-main.ec1328d → 1.8.4-main.7bdb634

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 (160) hide show
  1. package/lib/cjs/common/Constants.js +6 -0
  2. package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +34 -0
  4. package/lib/cjs/common/utils/SecureEventBus.js +307 -0
  5. package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
  6. package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
  7. package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +199 -0
  8. package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
  9. package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  10. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
  11. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +127 -0
  12. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  13. package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +15 -0
  14. package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +284 -0
  15. package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
  16. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +18 -0
  17. package/lib/cjs/components/livechatwidget/common/endChat.js +28 -3
  18. package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  19. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -6
  20. package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  21. package/lib/cjs/components/livechatwidget/common/startChat.js +5 -4
  22. package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
  23. package/lib/cjs/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
  24. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +29 -5
  25. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +122 -11
  26. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
  27. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  28. package/lib/cjs/components/webchatcontainerstateful/common/activities/botActivity.js +14 -0
  29. package/lib/cjs/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +17 -0
  30. package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +97 -0
  31. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  32. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +1 -1
  33. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  34. package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +36 -2
  35. package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
  36. package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +59 -0
  37. package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +122 -0
  39. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +10 -0
  40. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +18 -0
  41. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1038 -0
  42. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +34 -0
  43. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +44 -0
  44. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +16 -2
  45. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  46. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +20 -0
  47. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  48. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -2
  49. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +59 -0
  50. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +4 -3
  51. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -2
  52. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +97 -30
  53. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
  54. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +46 -45
  55. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
  56. package/lib/cjs/contexts/createReducer.js +15 -0
  57. package/lib/cjs/index.js +9 -1
  58. package/lib/esm/common/Constants.js +6 -0
  59. package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
  60. package/lib/esm/common/telemetry/TelemetryConstants.js +34 -0
  61. package/lib/esm/common/utils/SecureEventBus.js +328 -0
  62. package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
  63. package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
  64. package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +188 -0
  65. package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
  66. package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  67. package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
  68. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +120 -0
  69. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  70. package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +8 -0
  71. package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +277 -0
  72. package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
  73. package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +11 -0
  74. package/lib/esm/components/livechatwidget/common/endChat.js +29 -4
  75. package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  76. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -6
  77. package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  78. package/lib/esm/components/livechatwidget/common/startChat.js +5 -4
  79. package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
  80. package/lib/esm/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
  81. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +29 -5
  82. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +125 -12
  83. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
  84. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  85. package/lib/esm/components/webchatcontainerstateful/common/activities/botActivity.js +7 -0
  86. package/lib/esm/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +9 -0
  87. package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +90 -0
  88. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  89. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  90. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  91. package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +32 -0
  92. package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
  93. package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +51 -0
  94. package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  95. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +115 -0
  96. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +3 -0
  97. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +10 -0
  98. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1060 -0
  99. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +25 -0
  100. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +42 -0
  101. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +13 -0
  102. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  103. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +13 -0
  104. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  105. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +1 -1
  106. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +52 -0
  107. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -2
  108. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +1 -1
  109. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +98 -30
  110. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
  111. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +46 -45
  112. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
  113. package/lib/esm/contexts/createReducer.js +15 -0
  114. package/lib/esm/index.js +1 -0
  115. package/lib/types/common/Constants.d.ts +5 -0
  116. package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
  117. package/lib/types/common/telemetry/TelemetryConstants.d.ts +33 -2
  118. package/lib/types/common/utils/SecureEventBus.d.ts +159 -0
  119. package/lib/types/common/utils/dispatchCustomEvent.d.ts +2 -0
  120. package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
  121. package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
  122. package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
  123. package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
  124. package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
  125. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
  126. package/lib/types/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.d.ts +45 -0
  127. package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +7 -0
  128. package/lib/types/components/livechatwidget/common/PersistentConversationHandler.d.ts +28 -0
  129. package/lib/types/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.d.ts +2 -0
  130. package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
  131. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -1
  132. package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
  133. package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +7 -0
  134. package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
  135. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
  136. package/lib/types/components/webchatcontainerstateful/common/activities/botActivity.d.ts +7 -0
  137. package/lib/types/components/webchatcontainerstateful/common/activities/conversationDividerActivity.d.ts +10 -0
  138. package/lib/types/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.d.ts +2 -0
  139. package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +6 -1
  140. package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
  141. package/lib/types/components/webchatcontainerstateful/hooks/usePersistentChatHistory.d.ts +4 -0
  142. package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
  143. package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +7 -0
  144. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.d.ts +3 -0
  145. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.d.ts +4 -0
  146. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +326 -0
  147. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.d.ts +8 -0
  148. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -0
  149. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.d.ts +2 -0
  150. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.d.ts +2 -0
  151. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +3 -4
  152. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
  153. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  154. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +1 -0
  155. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +46 -45
  156. package/lib/types/index.d.ts +1 -0
  157. package/package.json +3 -3
  158. /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  159. /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  160. /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
@@ -0,0 +1,277 @@
1
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
8
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
9
+ import ChatWidgetEvents from "./ChatWidgetEvents";
10
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
11
+ import conversationDividerActivity from "../../webchatcontainerstateful/common/activities/conversationDividerActivity";
12
+ import convertPersistentChatHistoryMessageToActivity from "../../webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity";
13
+ import { createTimer } from "../../../common/utils";
14
+ import { defaultPersistentChatHistoryProps } from "./defaultProps/defaultPersistentChatHistoryProps";
15
+ import dispatchCustomEvent from "../../../common/utils/dispatchCustomEvent";
16
+
17
+ /**
18
+ * Class responsible for handling persistent conversation history
19
+ */
20
+ let PersistentConversationHandler = /*#__PURE__*/function () {
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+
23
+ function PersistentConversationHandler(facadeChatSDK, props) {
24
+ _classCallCheck(this, PersistentConversationHandler);
25
+ _defineProperty(this, "appliedProps", {
26
+ ...defaultPersistentChatHistoryProps
27
+ });
28
+ _defineProperty(this, "isLastPull", false);
29
+ _defineProperty(this, "pageToken", null);
30
+ _defineProperty(this, "facadeChatSDK", void 0);
31
+ _defineProperty(this, "lastMessage", null);
32
+ _defineProperty(this, "count", 0);
33
+ _defineProperty(this, "pageSize", 4);
34
+ _defineProperty(this, "isCurrentlyPulling", false);
35
+ _defineProperty(this, "pageTokenInTransitSet", new Set());
36
+ _defineProperty(this, "resetEventListener", BroadcastService.getMessageByEventName(BroadcastEvent.PersistentConversationReset).subscribe(() => {
37
+ this.reset();
38
+ }));
39
+ this.facadeChatSDK = facadeChatSDK;
40
+ this.appliedPropsHandler(props);
41
+ TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
42
+ Event: TelemetryEvent.LCWPersistentConversationHandlerInitialized,
43
+ Description: "PersistentConversationHandler initialized",
44
+ CustomProperties: {
45
+ pageSize: this.pageSize
46
+ }
47
+ });
48
+ }
49
+ _createClass(PersistentConversationHandler, [{
50
+ key: "appliedPropsHandler",
51
+ value: function appliedPropsHandler(props) {
52
+ this.appliedProps = {
53
+ ...defaultPersistentChatHistoryProps,
54
+ ...props
55
+ };
56
+ this.pageSize = this.appliedProps.pageSize || 4;
57
+ }
58
+ }, {
59
+ key: "reset",
60
+ value: function reset() {
61
+ this.isLastPull = false;
62
+ this.pageToken = null;
63
+ this.lastMessage = null;
64
+ this.count = 0;
65
+ this.isCurrentlyPulling = false;
66
+ this.pageTokenInTransitSet.clear();
67
+ }
68
+ }, {
69
+ key: "destroy",
70
+ value: function destroy() {
71
+ // Only unsubscribe when the handler is being destroyed completely
72
+ this.resetEventListener.unsubscribe();
73
+ }
74
+ }, {
75
+ key: "pullHistory",
76
+ value: async function pullHistory() {
77
+ const pullTimer = createTimer();
78
+
79
+ // Prevent concurrent pulls regardless of pageToken
80
+ if (this.isCurrentlyPulling) {
81
+ TelemetryHelper.logActionEvent(LogLevel.WARN, {
82
+ Event: TelemetryEvent.LCWPersistentHistoryPullBlocked,
83
+ Description: "History pull blocked - already in progress"
84
+ });
85
+ return;
86
+ }
87
+
88
+ // Additional check for specific pageToken duplicates
89
+ if (this.pageToken && this.pageTokenInTransitSet.has(this.pageToken)) {
90
+ return;
91
+ }
92
+
93
+ // Mark as currently pulling
94
+ this.isCurrentlyPulling = true;
95
+ if (this.pageToken) {
96
+ this.pageTokenInTransitSet.add(this.pageToken);
97
+ }
98
+ try {
99
+ var _ref;
100
+ const messages = await this.fetchHistoryMessages();
101
+ if (messages === null || (messages === null || messages === void 0 ? void 0 : messages.length) === 0) {
102
+ this.isLastPull = true;
103
+ // Dispatch event to notify UI that no more history is available
104
+ dispatchCustomEvent(ChatWidgetEvents.NO_MORE_HISTORY_AVAILABLE);
105
+ // Also hide the loading banner
106
+ dispatchCustomEvent(ChatWidgetEvents.HIDE_LOADING_BANNER);
107
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
108
+ Event: TelemetryEvent.LCWPersistentHistoryPullCompleted,
109
+ Description: "History pull completed - no more messages",
110
+ ElapsedTimeInMilliseconds: pullTimer.milliSecondsElapsed
111
+ });
112
+ return;
113
+ }
114
+ const messagesDescOrder = (_ref = [...messages]) === null || _ref === void 0 ? void 0 : _ref.reverse();
115
+ this.processHistoryMessages(messagesDescOrder);
116
+
117
+ // Dispatch event to hide the loading banner after messages are processed
118
+ dispatchCustomEvent(ChatWidgetEvents.HIDE_LOADING_BANNER);
119
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
120
+ Event: TelemetryEvent.LCWPersistentHistoryPullCompleted,
121
+ Description: "History pull completed successfully",
122
+ ElapsedTimeInMilliseconds: pullTimer.milliSecondsElapsed,
123
+ CustomProperties: {
124
+ messageCount: messages.length,
125
+ totalProcessed: this.count
126
+ }
127
+ });
128
+ } finally {
129
+ // Always clear the pulling flag when done
130
+ this.isCurrentlyPulling = false;
131
+
132
+ // Remove pageToken from transit set if it was added
133
+ if (this.pageToken) {
134
+ this.pageTokenInTransitSet.delete(this.pageToken);
135
+ }
136
+ }
137
+ }
138
+
139
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
140
+ }, {
141
+ key: "processHistoryMessages",
142
+ value: function processHistoryMessages(messagesDescOrder) {
143
+ for (const message of messagesDescOrder) {
144
+ try {
145
+ const activity = this.processMessageToActivity(message);
146
+ if (activity) {
147
+ dispatchCustomEvent(ChatWidgetEvents.ADD_ACTIVITY, {
148
+ activity
149
+ });
150
+ const dividerActivity = this.createDividerActivity(activity);
151
+ if (dividerActivity) {
152
+ dispatchCustomEvent(ChatWidgetEvents.ADD_ACTIVITY, {
153
+ activity: dividerActivity
154
+ });
155
+ }
156
+ this.lastMessage = activity;
157
+ }
158
+ } catch (error) {
159
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
160
+ Event: TelemetryEvent.ConvertPersistentChatHistoryMessageToActivityFailed,
161
+ ExceptionDetails: error
162
+ });
163
+ }
164
+ }
165
+ }
166
+
167
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
168
+ }, {
169
+ key: "fetchHistoryMessages",
170
+ value: async function fetchHistoryMessages() {
171
+ if (!this.shouldPull()) {
172
+ // Dispatch event to ensure banner is hidden when no more pulls are needed
173
+ dispatchCustomEvent(ChatWidgetEvents.NO_MORE_HISTORY_AVAILABLE);
174
+ dispatchCustomEvent(ChatWidgetEvents.HIDE_LOADING_BANNER);
175
+ return [];
176
+ }
177
+ const options = {
178
+ pageSize: this.pageSize,
179
+ pageToken: this.pageToken || undefined
180
+ };
181
+ try {
182
+ var _this$facadeChatSDK;
183
+ const response = await ((_this$facadeChatSDK = this.facadeChatSDK) === null || _this$facadeChatSDK === void 0 ? void 0 : _this$facadeChatSDK.fetchPersistentConversationHistory(options));
184
+ const {
185
+ chatMessages: messages,
186
+ nextPageToken: pageToken
187
+ } = response;
188
+ this.pageToken = pageToken || null;
189
+ if (pageToken === null) {
190
+ this.isLastPull = true;
191
+ // Dispatch event when we reach the end of available history
192
+ dispatchCustomEvent(ChatWidgetEvents.NO_MORE_HISTORY_AVAILABLE);
193
+ }
194
+
195
+ // if chatMessages is null, return empty array
196
+ if (!messages) {
197
+ this.isLastPull = true;
198
+ // Dispatch event when we reach the end of available history
199
+ dispatchCustomEvent(ChatWidgetEvents.NO_MORE_HISTORY_AVAILABLE);
200
+ // Also hide the loading banner
201
+ dispatchCustomEvent(ChatWidgetEvents.HIDE_LOADING_BANNER);
202
+ return [];
203
+ }
204
+ dispatchCustomEvent(ChatWidgetEvents.HIDE_LOADING_BANNER);
205
+ return messages;
206
+ } catch (error) {
207
+ TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
208
+ Event: TelemetryEvent.FetchPersistentChatHistoryFailed,
209
+ ExceptionDetails: error
210
+ });
211
+ this.isLastPull = true;
212
+ this.pageToken = null;
213
+ // Dispatch event when there's an error to stop loading banner
214
+ dispatchCustomEvent(ChatWidgetEvents.NO_MORE_HISTORY_AVAILABLE);
215
+ // Also hide the loading banner
216
+ dispatchCustomEvent(ChatWidgetEvents.HIDE_LOADING_BANNER);
217
+ return [];
218
+ }
219
+ }
220
+ }, {
221
+ key: "shouldPull",
222
+ value: function shouldPull() {
223
+ return !this.isLastPull;
224
+ }
225
+
226
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
227
+ }, {
228
+ key: "processMessageToActivity",
229
+ value: function processMessageToActivity(message) {
230
+ try {
231
+ const activity = convertPersistentChatHistoryMessageToActivity(message);
232
+ activity.id = activity.id || `activity-${this.count}`;
233
+ activity.channelData = {
234
+ ...activity.channelData,
235
+ metadata: {
236
+ count: this.count
237
+ }
238
+ };
239
+
240
+ // Increment the count after assigning it to the activity
241
+ this.count += 1;
242
+ return activity;
243
+ } catch (error) {
244
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
245
+ Event: TelemetryEvent.ConvertPersistentChatHistoryMessageToActivityFailed,
246
+ ExceptionDetails: error
247
+ });
248
+ throw error;
249
+ }
250
+ }
251
+
252
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
253
+ }, {
254
+ key: "createDividerActivity",
255
+ value: function createDividerActivity(activity) {
256
+ var _this$lastMessage, _this$lastMessage$cha;
257
+ if (((_this$lastMessage = this.lastMessage) === null || _this$lastMessage === void 0 ? void 0 : (_this$lastMessage$cha = _this$lastMessage.channelData) === null || _this$lastMessage$cha === void 0 ? void 0 : _this$lastMessage$cha.conversationId) !== activity.channelData.conversationId) {
258
+ const rawSequenceId = activity.channelData["webchat:sequence-id"];
259
+ const sequenceId = typeof rawSequenceId === "number" && !isNaN(rawSequenceId) ? rawSequenceId + 1 : 1;
260
+ const timestamp = new Date(activity.timestamp).getTime() + 1;
261
+ return {
262
+ ...conversationDividerActivity,
263
+ channelData: {
264
+ ...conversationDividerActivity.channelData,
265
+ conversationId: activity.channelData.conversationId,
266
+ "webchat:sequence-id": sequenceId
267
+ },
268
+ timestamp: new Date(timestamp).toISOString(),
269
+ identifier: `divider-${activity.channelData.conversationId}`
270
+ };
271
+ }
272
+ return null;
273
+ }
274
+ }]);
275
+ return PersistentConversationHandler;
276
+ }();
277
+ export default PersistentConversationHandler;
@@ -1,3 +1,4 @@
1
+ import { AddActivitySubscriber } from "./ActivitySubscriber/AddActivitySubscriber";
1
2
  import { BotAuthActivitySubscriber } from "./ActivitySubscriber/BotAuthActivitySubscriber";
2
3
  import { ChatAdapterShim } from "./ChatAdapterShim";
3
4
  import { HiddenAdaptiveCardActivitySubscriber } from "./ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber";
@@ -44,6 +45,7 @@ export const createAdapter = async (facadeChatSDK, props) => {
44
45
  fetchBotAuthConfigRetryInterval: (props === null || props === void 0 ? void 0 : (_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : (_props$webChatContain4 = _props$webChatContain3.botAuthConfig) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.fetchBotAuthConfigRetryInterval) || defaultBotAuthConfig.fetchBotAuthConfigRetryInterval
45
46
  };
46
47
  adapter = new ChatAdapterShim(adapter);
48
+ adapter.addSubscriber(new AddActivitySubscriber());
47
49
  adapter.addSubscriber(new PauseActivitySubscriber());
48
50
  adapter.addSubscriber(new BotAuthActivitySubscriber(botAuthActivitySubscriberOptionalParams));
49
51
  // Remove this code after ICM ID:544623085 is fixed
@@ -0,0 +1,11 @@
1
+ export const defaultPersistentChatHistoryProps = {
2
+ persistentChatHistoryEnabled: true,
3
+ pageSize: 4,
4
+ dividerActivityStyle: {
5
+ border: "1px solid rgb(96, 94, 92, 0.5)",
6
+ margin: "10px 20%"
7
+ },
8
+ bannerStyle: {
9
+ margin: "10px auto"
10
+ }
11
+ };
@@ -1,9 +1,10 @@
1
1
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
- import { ConfirmationState, Constants, ConversationEndEntity, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
2
+ import { ConfirmationState, Constants, ConversationEndEntity, LiveWorkItemState, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
3
3
  import { getConversationDetailsCall, getWidgetEndChatEventName } from "../../../common/utils";
4
4
  import { getPostChatContext, initiatePostChat } from "./renderSurveyHelpers";
5
5
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
6
6
  import { ConversationState } from "../../../contexts/common/ConversationState";
7
+ import { LazyLoadHandler } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity";
7
8
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
8
9
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
9
10
  import { TelemetryManager } from "../../../common/telemetry/TelemetryManager";
@@ -39,7 +40,7 @@ const prepareEndChat = async (props, facadeChatSDK, state, dispatch, setAdapter,
39
40
  }
40
41
 
41
42
  // Use Case: If ended by Agent, stay chat in InActive state
42
- let isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
43
+ const isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
43
44
  if (isConversationalSurveyEnabled && ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates3 = state.appStates) === null || _state$appStates3 === void 0 ? void 0 : _state$appStates3.conversationEndedBy) === ConversationEndEntity.Bot)) {
44
45
  dispatch({
45
46
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
@@ -147,8 +148,23 @@ const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWeb
147
148
  type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
148
149
  payload: null
149
150
  });
151
+ let isSessionEnded = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.chatDisconnectEventReceived;
152
+ if (!isSessionEnded) {
153
+ // double check by fetching the latest conversation details
154
+ const conversationDetails = await getConversationDetailsCall(facadeChatSDK);
155
+ if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.Closed) {
156
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
157
+ Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
158
+ Description: "Checking conversation details upon endChat. Chat disconnected.",
159
+ CustomProperties: {
160
+ conversationDetails
161
+ }
162
+ });
163
+ isSessionEnded = true;
164
+ }
165
+ }
150
166
  const endChatOptionalParameters = {
151
- isSessionEnded: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.chatDisconnectEventReceived
167
+ isSessionEnded
152
168
  };
153
169
  try {
154
170
  TelemetryHelper.logSDKEvent(LogLevel.INFO, {
@@ -210,7 +226,12 @@ const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWeb
210
226
  type: LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT,
211
227
  payload: undefined
212
228
  });
213
- // Always allow to close the chat for embedded mode irrespective of end chat errors
229
+
230
+ // Call direct reset to ensure LazyLoadHandler gets reset regardless of broadcast timing
231
+ LazyLoadHandler.directReset();
232
+ BroadcastService.postMessage({
233
+ eventName: BroadcastEvent.PersistentConversationReset
234
+ });
214
235
  closeChatWidget(dispatch, setWebChatStyles, props);
215
236
  facadeChatSDK.destroy();
216
237
  }
@@ -296,6 +317,10 @@ export const closeChatStateCleanUp = dispatch => {
296
317
  proactiveChatInNewWindow: false
297
318
  }
298
319
  });
320
+ dispatch({
321
+ type: LiveChatWidgetActionType.SET_CITATIONS,
322
+ payload: {}
323
+ });
299
324
 
300
325
  // Clear live chat context only if chat widget is fully closed to support transcript calls after sessionclose is called
301
326
  dispatch({
@@ -3,14 +3,15 @@ import { DesignerChatSDK } from "../../webchatcontainerstateful/common/DesignerC
3
3
  import { MockChatSDK } from "../../webchatcontainerstateful/common/mockchatsdk";
4
4
 
5
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- export const getMockChatSDKIfApplicable = (chatSDK, type) => {
7
- if (type) {
8
- switch (type.toLowerCase()) {
6
+ export const getMockChatSDKIfApplicable = (chatSDK, mockProps) => {
7
+ if (mockProps !== null && mockProps !== void 0 && mockProps.type) {
8
+ switch (mockProps.type.toLowerCase()) {
9
9
  case "demo":
10
10
  chatSDK = new DemoChatSDK();
11
11
  break;
12
12
  case "designer":
13
13
  chatSDK = new DesignerChatSDK();
14
+ chatSDK.mockMessages = mockProps === null || mockProps === void 0 ? void 0 : mockProps.mockMessages;
14
15
  break;
15
16
  default:
16
17
  chatSDK = new MockChatSDK();
@@ -1,6 +1,7 @@
1
1
  import { ConversationEndEntity, ParticipantType } from "../../../common/Constants";
2
2
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
3
  import { changeLanguageCodeFormatForWebChat, getConversationDetailsCall } from "../../../common/utils";
4
+ import { getOverriddenLocalizedStrings, localizedStringsBotInitialsMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware";
4
5
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
5
6
  import { Constants } from "../../../common/Constants";
6
7
  import { ConversationState } from "../../../contexts/common/ConversationState";
@@ -12,6 +13,7 @@ import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontro
12
13
  import attachmentProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware";
13
14
  import channelDataMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware";
14
15
  import { createActivityMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware";
16
+ import { createActivityStatusMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware";
15
17
  import { createAttachmentMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware";
16
18
  import createAttachmentUploadValidatorMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware";
17
19
  import { createAvatarMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware";
@@ -39,11 +41,10 @@ import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroll
39
41
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
40
42
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
41
43
  import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
42
- import { localizedStringsBotInitialsMiddleware, getOverriddenLocalizedStrings } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware";
43
44
 
44
45
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
46
  export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) => {
46
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _defaultWebChatContai, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai2, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai3, _props$webChatContain25, _props$webChatContain26, _props$webChatContain27, _props$webChatContain28;
47
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _state$domainStates$l6, _state$domainStates$l7, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai2, _props$webChatContain25, _props$webChatContain26, _props$webChatContain27, _props$webChatContain28;
47
48
  // Add a hook to make all links open a new window
48
49
  postDomPurifyActivities();
49
50
  const localizedTexts = {
@@ -61,6 +62,7 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
61
62
  let webChatStore = WebChatStoreLoader.store;
62
63
  if (!webChatStore) {
63
64
  var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _props$webChatContain7;
65
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
66
  const addConversationalSurveyTagsCallback = action => {
65
67
  var _inMemoryState$appSta;
66
68
  const inMemoryState = executeReducer(state, {
@@ -118,7 +120,7 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
118
120
  };
119
121
  webChatStore = createStore({},
120
122
  //initial state
121
- preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), createCustomEventMiddleware(BroadcastService), createQueueOverflowMiddleware(state, dispatch), channelDataMiddleware(addConversationalSurveyTagsCallback), createConversationEndMiddleware(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), createDataMaskingMiddleware((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), createMessageTimeStampMiddleware, createMessageSequenceIdOverrideMiddleware, createCitationsMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware(honorsTargetInHTMLLinks), createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, createCallActionMiddleware(), localizedStringsBotInitialsMiddleware(),
123
+ preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), createCustomEventMiddleware(BroadcastService), createQueueOverflowMiddleware(state, dispatch), channelDataMiddleware(addConversationalSurveyTagsCallback), createConversationEndMiddleware(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), createDataMaskingMiddleware((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), createMessageTimeStampMiddleware, createMessageSequenceIdOverrideMiddleware, createCitationsMiddleware(state, dispatch), gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware(honorsTargetInHTMLLinks), createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, createCallActionMiddleware(), localizedStringsBotInitialsMiddleware(),
122
124
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
125
  ...(((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.storeMiddlewares) ?? []));
124
126
  WebChatStoreLoader.store = webChatStore;
@@ -163,12 +165,12 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
163
165
  store: webChatStore,
164
166
  activityMiddleware: (_props$webChatContain11 = props.webChatContainerProps) !== null && _props$webChatContain11 !== void 0 && (_props$webChatContain12 = _props$webChatContain11.renderingMiddlewareProps) !== null && _props$webChatContain12 !== void 0 && _props$webChatContain12.disableActivityMiddleware ? undefined : createActivityMiddleware(renderMarkdown, (_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.systemMessageStyleProps, (_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.userMessageStyleProps),
165
167
  attachmentMiddleware: (_props$webChatContain13 = props.webChatContainerProps) !== null && _props$webChatContain13 !== void 0 && (_props$webChatContain14 = _props$webChatContain13.renderingMiddlewareProps) !== null && _props$webChatContain14 !== void 0 && _props$webChatContain14.disableAttachmentMiddleware ? undefined : createAttachmentMiddleware(((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : (_state$domainStates$r4 = _state$domainStates$r3.attachmentProps) === null || _state$domainStates$r4 === void 0 ? void 0 : _state$domainStates$r4.enableInlinePlaying) ?? defaultAttachmentProps.enableInlinePlaying),
166
- activityStatusMiddleware: (_props$webChatContain15 = props.webChatContainerProps) !== null && _props$webChatContain15 !== void 0 && (_props$webChatContain16 = _props$webChatContain15.renderingMiddlewareProps) !== null && _props$webChatContain16 !== void 0 && _props$webChatContain16.disableActivityStatusMiddleware ? undefined : (_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.activityStatusMiddleware,
168
+ activityStatusMiddleware: (_props$webChatContain15 = props.webChatContainerProps) !== null && _props$webChatContain15 !== void 0 && (_props$webChatContain16 = _props$webChatContain15.renderingMiddlewareProps) !== null && _props$webChatContain16 !== void 0 && _props$webChatContain16.disableActivityStatusMiddleware ? undefined : createActivityStatusMiddleware(getLocaleStringFromId((_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : (_state$domainStates$l7 = _state$domainStates$l6.ChatWidgetLanguage) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.msdyn_localeid)),
167
169
  toastMiddleware: (_props$webChatContain17 = props.webChatContainerProps) !== null && _props$webChatContain17 !== void 0 && (_props$webChatContain18 = _props$webChatContain17.renderingMiddlewareProps) !== null && _props$webChatContain18 !== void 0 && _props$webChatContain18.disableToastMiddleware ? undefined : createToastMiddleware(props.notificationPaneProps, endChat),
168
170
  renderMarkdown,
169
171
  avatarMiddleware: (_props$webChatContain19 = props.webChatContainerProps) !== null && _props$webChatContain19 !== void 0 && (_props$webChatContain20 = _props$webChatContain19.renderingMiddlewareProps) !== null && _props$webChatContain20 !== void 0 && _props$webChatContain20.disableAvatarMiddleware ? undefined : createAvatarMiddleware((_state$domainStates$r5 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r5 === void 0 ? void 0 : _state$domainStates$r5.avatarStyleProps, (_state$domainStates$r6 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r6 === void 0 ? void 0 : _state$domainStates$r6.avatarTextStyleProps),
170
- groupActivitiesMiddleware: (_props$webChatContain21 = props.webChatContainerProps) !== null && _props$webChatContain21 !== void 0 && (_props$webChatContain22 = _props$webChatContain21.renderingMiddlewareProps) !== null && _props$webChatContain22 !== void 0 && _props$webChatContain22.disableGroupActivitiesMiddleware ? undefined : (_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.groupActivitiesMiddleware,
171
- typingIndicatorMiddleware: (_props$webChatContain23 = props.webChatContainerProps) !== null && _props$webChatContain23 !== void 0 && (_props$webChatContain24 = _props$webChatContain23.renderingMiddlewareProps) !== null && _props$webChatContain24 !== void 0 && _props$webChatContain24.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai3 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.typingIndicatorMiddleware,
172
+ groupActivitiesMiddleware: (_props$webChatContain21 = props.webChatContainerProps) !== null && _props$webChatContain21 !== void 0 && (_props$webChatContain22 = _props$webChatContain21.renderingMiddlewareProps) !== null && _props$webChatContain22 !== void 0 && _props$webChatContain22.disableGroupActivitiesMiddleware ? undefined : (_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.groupActivitiesMiddleware,
173
+ typingIndicatorMiddleware: (_props$webChatContain23 = props.webChatContainerProps) !== null && _props$webChatContain23 !== void 0 && (_props$webChatContain24 = _props$webChatContain23.renderingMiddlewareProps) !== null && _props$webChatContain24 !== void 0 && _props$webChatContain24.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.typingIndicatorMiddleware,
172
174
  onTelemetry: createWebChatTelemetry(),
173
175
  cardActionMiddleware: createCardActionMiddleware(((_props$webChatContain25 = props.webChatContainerProps) === null || _props$webChatContain25 === void 0 ? void 0 : _props$webChatContain25.botMagicCode) || undefined),
174
176
  sendTypingIndicator: true,
@@ -1,6 +1,7 @@
1
1
  const overridePropsOnMockIfApplicable = props => {
2
2
  var _props$mock, _props$mock2;
3
3
  if (props !== null && props !== void 0 && (_props$mock = props.mock) !== null && _props$mock !== void 0 && _props$mock.type && (props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type.toLowerCase()) === "designer") {
4
+ var _props$mock3, _props$mock3$mockMess;
4
5
  if (!props.webChatContainerProps) {
5
6
  props.webChatContainerProps = {};
6
7
  }
@@ -16,7 +17,7 @@ const overridePropsOnMockIfApplicable = props => {
16
17
  props.webChatContainerProps = {
17
18
  ...props.webChatContainerProps,
18
19
  webChatProps: {
19
- disabled: true,
20
+ disabled: !(props !== null && props !== void 0 && (_props$mock3 = props.mock) !== null && _props$mock3 !== void 0 && (_props$mock3$mockMess = _props$mock3.mockMessages) !== null && _props$mock3$mockMess !== void 0 && _props$mock3$mockMess.length),
20
21
  ...props.webChatContainerProps.webChatProps,
21
22
  overrideLocalizedStrings: {
22
23
  TEXT_INPUT_PLACEHOLDER: "Send a message . . .",
@@ -99,7 +99,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
99
99
 
100
100
  // If minimized, maximize the chat, if the state is missing, consider it as minimized
101
101
  if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) === undefined || (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.isMinimized) === true) {
102
- var _state$domainStates3, _state$domainStates3$, _state$domainStates4, _state$domainStates4$;
102
+ var _state$domainStates3, _state$domainStates3$, _state$domainStates4, _state$domainStates4$, _TelemetryManager$Int;
103
103
  dispatch({
104
104
  type: LiveChatWidgetActionType.SET_MINIMIZED,
105
105
  payload: false
@@ -110,7 +110,8 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
110
110
  eventName: BroadcastEvent.MaximizeChat,
111
111
  payload: {
112
112
  height: state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.widgetSize) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.height,
113
- width: state === null || state === void 0 ? void 0 : (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.widgetSize) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.width
113
+ width: state === null || state === void 0 ? void 0 : (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.widgetSize) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.width,
114
+ runtimeId: TelemetryManager === null || TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.lcwRuntimeId
114
115
  }
115
116
  });
116
117
  }
@@ -131,7 +132,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
131
132
  * This is because a new change to control OOH as closed event when a widget is coming from chat.
132
133
  */
133
134
  if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) === undefined || (state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.isMinimized) === true) {
134
- var _state$domainStates5, _state$domainStates5$, _state$domainStates6, _state$domainStates6$, _TelemetryManager$Int;
135
+ var _state$domainStates5, _state$domainStates5$, _state$domainStates6, _state$domainStates6$, _TelemetryManager$Int2;
135
136
  dispatch({
136
137
  type: LiveChatWidgetActionType.SET_MINIMIZED,
137
138
  payload: false
@@ -142,7 +143,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
142
143
  payload: {
143
144
  height: state === null || state === void 0 ? void 0 : (_state$domainStates5 = state.domainStates) === null || _state$domainStates5 === void 0 ? void 0 : (_state$domainStates5$ = _state$domainStates5.widgetSize) === null || _state$domainStates5$ === void 0 ? void 0 : _state$domainStates5$.height,
144
145
  width: state === null || state === void 0 ? void 0 : (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.widgetSize) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.width,
145
- runtimeId: TelemetryManager === null || TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.lcwRuntimeId
146
+ runtimeId: TelemetryManager === null || TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int2 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.lcwRuntimeId
146
147
  }
147
148
  });
148
149
  }
@@ -1,6 +1,6 @@
1
- var LiveChatWidgetMockType;
1
+ export let LiveChatWidgetMockType;
2
2
  (function (LiveChatWidgetMockType) {
3
3
  LiveChatWidgetMockType["Test"] = "Test";
4
4
  LiveChatWidgetMockType["Demo"] = "Demo";
5
- })(LiveChatWidgetMockType || (LiveChatWidgetMockType = {}));
6
- export {};
5
+ LiveChatWidgetMockType["Designer"] = "Designer";
6
+ })(LiveChatWidgetMockType || (LiveChatWidgetMockType = {}));
@@ -480,7 +480,8 @@ export const LiveChatWidgetStateful = props => {
480
480
  eventName: BroadcastEvent.MaximizeChat,
481
481
  payload: {
482
482
  height: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : (_inMemoryState$domain2 = _inMemoryState$domain.widgetSize) === null || _inMemoryState$domain2 === void 0 ? void 0 : _inMemoryState$domain2.height,
483
- width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width
483
+ width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width,
484
+ lcwRuntimeId: TelemetryManager.InternalTelemetryData.lcwRuntimeId
484
485
  }
485
486
  });
486
487
  return;
@@ -868,23 +869,46 @@ export const LiveChatWidgetStateful = props => {
868
869
 
869
870
  // WebChat's Composer can only be rendered if a directLine object is defined
870
871
  return directLine && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
871
- ::-webkit-scrollbar {
872
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
872
873
  width: ${scrollbarProps.width};
873
874
  }
874
875
 
875
- ::-webkit-scrollbar-track {
876
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
876
877
  background: ${scrollbarProps.trackBackgroundColor};
877
878
  }
878
879
 
879
- ::-webkit-scrollbar-thumb {
880
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
880
881
  background: ${scrollbarProps.thumbBackgroundColor};
881
882
  border-radius: ${scrollbarProps.thumbBorderRadius};
882
883
  }
883
884
 
884
- ::-webkit-scrollbar-thumb:hover {
885
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
885
886
  background: ${scrollbarProps.thumbHoverColor};
886
887
  }
887
888
 
889
+ /* High Contrast mode support - optimized for all variants */
890
+ @media (prefers-contrast: high), (-ms-high-contrast: active), (forced-colors: active) {
891
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
892
+ background: Canvas !important;
893
+ border: 1px solid CanvasText !important;
894
+ }
895
+
896
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
897
+ background: CanvasText !important;
898
+ border: 1px solid Canvas !important;
899
+ min-height: 20px !important;
900
+ }
901
+
902
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
903
+ background: Highlight !important;
904
+ border: 1px solid CanvasText !important;
905
+ }
906
+
907
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-corner {
908
+ background: Canvas !important;
909
+ }
910
+ }
911
+
888
912
  .webchat__basic-transcript__activity-markdown-body > :last-child {
889
913
  margin-bottom: 0px;
890
914
  }