@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.
- package/README.md +27 -0
- package/lib/cjs/common/Constants.js +7 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
- package/lib/cjs/common/telemetry/AppInsightsEvents.js +14 -9
- package/lib/cjs/common/telemetry/TelemetryConstants.js +46 -2
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -7
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +29 -13
- package/lib/cjs/common/utils/SecureEventBus.js +307 -0
- package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
- package/lib/cjs/common/utils.js +14 -1
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +8 -2
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +127 -0
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +15 -0
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +290 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +17 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +33 -10
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +5 -1
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +24 -4
- package/lib/cjs/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +123 -28
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +37 -8
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -3
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +46 -22
- package/lib/cjs/components/webchatcontainerstateful/common/activities/botActivity.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +17 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +103 -0
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +57 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +121 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +47 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1058 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +34 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +50 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +20 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +59 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/cjs/plugins/newMessageEventHandler.js +4 -1
- package/lib/esm/common/Constants.js +7 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +14 -9
- package/lib/esm/common/telemetry/TelemetryConstants.js +44 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +30 -14
- package/lib/esm/common/utils/SecureEventBus.js +328 -0
- package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
- package/lib/esm/common/utils.js +11 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -5
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +9 -3
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +120 -0
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +8 -0
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +283 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +10 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +33 -10
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +7 -3
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +23 -4
- package/lib/esm/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +124 -29
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +39 -10
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -4
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +46 -22
- package/lib/esm/components/webchatcontainerstateful/common/activities/botActivity.js +7 -0
- package/lib/esm/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +9 -0
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +96 -0
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +49 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +114 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +39 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1080 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +25 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +48 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +52 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +3 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/esm/plugins/newMessageEventHandler.js +4 -1
- package/lib/types/common/Constants.d.ts +6 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +41 -2
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
- package/lib/types/common/utils/SecureEventBus.d.ts +159 -0
- package/lib/types/common/utils/dispatchCustomEvent.d.ts +2 -0
- package/lib/types/common/utils.d.ts +9 -1
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.d.ts +45 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/PersistentConversationHandler.d.ts +28 -0
- package/lib/types/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +11 -0
- package/lib/types/components/webchatcontainerstateful/common/activities/botActivity.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/common/activities/conversationDividerActivity.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/hooks/usePersistentChatHistory.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +15 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +6 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +326 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.d.ts +8 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +6 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HtmlAttributeNames, Regex } from "../../common/Constants";
|
|
2
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { ConversationStage, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
4
|
import { createTimer, extractPreChatSurveyResponseValues, findAllFocusableElement, getStateFromCache, getWidgetCacheId, isUndefinedOrEmpty, parseAdaptiveCardPayload } from "../../common/utils";
|
|
5
5
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
@@ -19,7 +19,10 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
19
19
|
uiTimer = createTimer();
|
|
20
20
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
21
21
|
Event: TelemetryEvent.UXPrechatPaneStart,
|
|
22
|
-
Description: "Prechat survey pane loading started."
|
|
22
|
+
Description: "Prechat survey pane loading started.",
|
|
23
|
+
CustomProperties: {
|
|
24
|
+
ConversationStage: ConversationStage.Initialization
|
|
25
|
+
}
|
|
23
26
|
});
|
|
24
27
|
}, []);
|
|
25
28
|
|
|
@@ -70,7 +73,10 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
70
73
|
onSubmit: async values => {
|
|
71
74
|
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
72
75
|
Event: TelemetryEvent.PrechatSubmitted,
|
|
73
|
-
Description: "Prechat survey submitted."
|
|
76
|
+
Description: "Prechat survey submitted.",
|
|
77
|
+
CustomProperties: {
|
|
78
|
+
ConversationStage: ConversationStage.Initialization
|
|
79
|
+
}
|
|
74
80
|
});
|
|
75
81
|
dispatch({
|
|
76
82
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
@@ -144,7 +150,10 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
144
150
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
145
151
|
Event: TelemetryEvent.UXPrechatPaneCompleted,
|
|
146
152
|
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
147
|
-
Description: "Prechat survey pane loading completed."
|
|
153
|
+
Description: "Prechat survey pane loading completed.",
|
|
154
|
+
CustomProperties: {
|
|
155
|
+
ConversationStage: ConversationStage.Initialization
|
|
156
|
+
}
|
|
148
157
|
});
|
|
149
158
|
}, []);
|
|
150
159
|
|
|
@@ -11,6 +11,7 @@ import { NotificationHandler } from "./webchatcontroller/notification/Notificati
|
|
|
11
11
|
import { NotificationScenarios } from "./webchatcontroller/enums/NotificationScenarios";
|
|
12
12
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
13
13
|
import { WebChatActionType } from "./webchatcontroller/enums/WebChatActionType";
|
|
14
|
+
import WebChatEventSubscribers from "./webchatcontroller/WebChatEventSubscribers";
|
|
14
15
|
import { WebChatStoreLoader } from "./webchatcontroller/WebChatStoreLoader";
|
|
15
16
|
import { createIOSOptimizedEmojiFont } from "./common/utils/fontUtils";
|
|
16
17
|
import { defaultAdaptiveCardStyles } from "./common/defaultStyles/defaultAdaptiveCardStyles";
|
|
@@ -20,7 +21,10 @@ import { defaultSentMessageAnchorStyles } from "./webchatcontroller/middlewares/
|
|
|
20
21
|
import { defaultSystemMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles";
|
|
21
22
|
import { defaultUserMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles";
|
|
22
23
|
import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
24
|
+
import { shouldLoadPersistentChatHistory } from "../livechatwidget/common/liveChatConfigUtils";
|
|
23
25
|
import { useChatContextStore } from "../..";
|
|
26
|
+
import useFacadeSDKStore from "../../hooks/useFacadeChatSDKStore";
|
|
27
|
+
import usePersistentChatHistory from "./hooks/usePersistentChatHistory";
|
|
24
28
|
let uiTimer;
|
|
25
29
|
const broadcastChannelMessageEvent = "message";
|
|
26
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -49,7 +53,9 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
49
53
|
};
|
|
50
54
|
};
|
|
51
55
|
export const WebChatContainerStateful = props => {
|
|
52
|
-
var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3,
|
|
56
|
+
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;
|
|
57
|
+
const [facadeChatSDK] = useFacadeSDKStore();
|
|
58
|
+
|
|
53
59
|
// Create a font family that includes emoji support, based on the primary font or default
|
|
54
60
|
const webChatStyles = ((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles) ?? defaultWebChatContainerStatefulProps.webChatStyles;
|
|
55
61
|
const primaryFont = (webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.primaryFont) ?? ((_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.primaryFont);
|
|
@@ -70,9 +76,6 @@ export const WebChatContainerStateful = props => {
|
|
|
70
76
|
// Guard to prevent handling multiple rapid clicks which could cause
|
|
71
77
|
// the dim layer and pane to re-render out of sync and create a flicker.
|
|
72
78
|
const citationOpeningRef = useRef(false);
|
|
73
|
-
|
|
74
|
-
// ...existing code...
|
|
75
|
-
|
|
76
79
|
const {
|
|
77
80
|
BasicWebChat
|
|
78
81
|
} = Components;
|
|
@@ -82,6 +85,17 @@ export const WebChatContainerStateful = props => {
|
|
|
82
85
|
contextDataStore
|
|
83
86
|
} = props;
|
|
84
87
|
|
|
88
|
+
// Type the chatConfig properly to avoid 'any' usage
|
|
89
|
+
const extendedChatConfig = props.chatConfig;
|
|
90
|
+
|
|
91
|
+
// Determine if persistent chat history should be loaded based on all conditions
|
|
92
|
+
const shouldLoadPersistentHistoryMessages = shouldLoadPersistentChatHistory(extendedChatConfig);
|
|
93
|
+
if (shouldLoadPersistentHistoryMessages) {
|
|
94
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
95
|
+
Event: TelemetryEvent.PersistentChatHistoryEnabled
|
|
96
|
+
});
|
|
97
|
+
usePersistentChatHistory(facadeChatSDK, (props === null || props === void 0 ? void 0 : props.persistentChatHistoryProps) ?? {});
|
|
98
|
+
}
|
|
85
99
|
// Delegated click handler for citation anchors. Placed after state is
|
|
86
100
|
// available so we can prefer reading citations from app state and fall
|
|
87
101
|
// back to the legacy window map for backward-compatibility in tests.
|
|
@@ -244,24 +258,28 @@ export const WebChatContainerStateful = props => {
|
|
|
244
258
|
background: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp === void 0 ? void 0 : _webChatContainerProp.background) ?? defaultAdaptiveCardStyles.background};
|
|
245
259
|
}
|
|
246
260
|
|
|
247
|
-
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock {
|
|
248
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? defaultAdaptiveCardStyles.color};
|
|
261
|
+
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock[role=heading] {
|
|
262
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? defaultAdaptiveCardStyles.color} !important;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card label .ac-textRun:first-child {
|
|
266
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp3 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp3 === void 0 ? void 0 : _webChatContainerProp3.color) ?? defaultAdaptiveCardStyles.color} !important;
|
|
249
267
|
}
|
|
250
268
|
|
|
251
269
|
.webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__bubble--from-user {
|
|
252
|
-
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
270
|
+
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 === null || defaultUserMessageBoxStyles === void 0 ? void 0 : defaultUserMessageBoxStyles.maxWidth)}
|
|
253
271
|
}
|
|
254
272
|
|
|
255
273
|
.webchat__stacked-layout--show-avatar div.webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__stacked-layout__message {
|
|
256
|
-
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
274
|
+
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 === null || defaultSystemMessageBoxStyles === void 0 ? void 0 : defaultSystemMessageBoxStyles.maxWidth)}
|
|
257
275
|
}
|
|
258
276
|
|
|
259
277
|
div[class="ac-textBlock"] *,
|
|
260
|
-
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
278
|
+
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.textWhiteSpace}}
|
|
261
279
|
|
|
262
280
|
div[class="ac-input-container"] input.ac-multichoiceInput,
|
|
263
281
|
div[class="ac-input-container"] select.ac-multichoiceInput {
|
|
264
|
-
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (
|
|
282
|
+
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp9 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp9 !== void 0 && _webChatContainerProp9.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
|
|
265
283
|
}
|
|
266
284
|
|
|
267
285
|
.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 {
|
|
@@ -273,15 +291,15 @@ export const WebChatContainerStateful = props => {
|
|
|
273
291
|
div[class="ac-textBlock"] a:visited,
|
|
274
292
|
div[class="ac-textBlock"] a:hover,
|
|
275
293
|
div[class="ac-textBlock"] a:active {
|
|
276
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
294
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp10 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
|
|
277
295
|
}
|
|
278
296
|
|
|
279
|
-
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
297
|
+
.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.buttonWhiteSpace} !important;}
|
|
280
298
|
|
|
281
299
|
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
282
300
|
/* Fallback for browsers that don't support mask */
|
|
283
301
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjRkZGRkZGIiAvPjwvc3ZnPg==);
|
|
284
|
-
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
302
|
+
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 === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.filter)};
|
|
285
303
|
height: .75em;
|
|
286
304
|
width: .75em;
|
|
287
305
|
margin-left: .25em;
|
|
@@ -291,7 +309,7 @@ export const WebChatContainerStateful = props => {
|
|
|
291
309
|
.ms_lcw_webchat_sent_message img.webchat__render-markdown__external-link-icon {
|
|
292
310
|
/* Fallback for browsers that don't support mask */
|
|
293
311
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjRkZGRkZGIiAvPjwvc3ZnPg==);
|
|
294
|
-
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
312
|
+
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 === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.filter)};
|
|
295
313
|
height: .75em;
|
|
296
314
|
width: .75em;
|
|
297
315
|
margin-left: .25em;
|
|
@@ -301,7 +319,7 @@ export const WebChatContainerStateful = props => {
|
|
|
301
319
|
/* Modern browsers with mask support */
|
|
302
320
|
@supports (mask: url()) or (-webkit-mask: url()) {
|
|
303
321
|
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
304
|
-
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
322
|
+
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 === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)} !important;
|
|
305
323
|
background-image: none !important;
|
|
306
324
|
filter: none !important;
|
|
307
325
|
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;
|
|
@@ -311,7 +329,7 @@ export const WebChatContainerStateful = props => {
|
|
|
311
329
|
}
|
|
312
330
|
|
|
313
331
|
.ms_lcw_webchat_sent_message img.webchat__render-markdown__external-link-icon {
|
|
314
|
-
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
332
|
+
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 === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)} !important;
|
|
315
333
|
background-image: none !important;
|
|
316
334
|
filter: none !important;
|
|
317
335
|
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;
|
|
@@ -329,18 +347,18 @@ export const WebChatContainerStateful = props => {
|
|
|
329
347
|
.ms_lcw_webchat_received_message a:visited,
|
|
330
348
|
.ms_lcw_webchat_received_message a:hover,
|
|
331
349
|
.ms_lcw_webchat_received_message a:active {
|
|
332
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
350
|
+
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 === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
|
|
333
351
|
}
|
|
334
352
|
.ms_lcw_webchat_sent_message a:link,
|
|
335
353
|
.ms_lcw_webchat_sent_message a:visited,
|
|
336
354
|
.ms_lcw_webchat_sent_message a:hover,
|
|
337
355
|
.ms_lcw_webchat_sent_message a:active {
|
|
338
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
356
|
+
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 === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
|
|
339
357
|
}
|
|
340
358
|
|
|
341
359
|
// 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
|
|
342
360
|
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
343
|
-
border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
361
|
+
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 */
|
|
344
362
|
}
|
|
345
363
|
|
|
346
364
|
.webchat__stacked-layout_container>div {
|
|
@@ -377,13 +395,19 @@ export const WebChatContainerStateful = props => {
|
|
|
377
395
|
|
|
378
396
|
/* Suggested actions carousel previous/next navigation focus */
|
|
379
397
|
.webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
|
|
380
|
-
outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
381
|
-
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
398
|
+
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;
|
|
399
|
+
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp28 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp28 === void 0 ? void 0 : _webChatContainerProp28.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
|
|
382
400
|
|
|
383
401
|
`), /*#__PURE__*/React.createElement(Stack, {
|
|
384
402
|
styles: containerStyles,
|
|
385
403
|
className: "webchat__stacked-layout_container"
|
|
386
|
-
}, /*#__PURE__*/React.createElement(
|
|
404
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
405
|
+
id: "ms_lcw_webchat_root",
|
|
406
|
+
style: {
|
|
407
|
+
height: "100%",
|
|
408
|
+
width: "100%"
|
|
409
|
+
}
|
|
410
|
+
}, shouldLoadPersistentHistoryMessages && /*#__PURE__*/React.createElement(WebChatEventSubscribers, null), /*#__PURE__*/React.createElement(BasicWebChat, null))), citationPaneOpen && /*#__PURE__*/React.createElement(CitationPaneStateful, {
|
|
387
411
|
id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || HtmlAttributeNames.ocwCitationPaneClassName,
|
|
388
412
|
title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || HtmlAttributeNames.ocwCitationPaneTitle,
|
|
389
413
|
contentHtml: citationPaneText,
|
package/lib/esm/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Constants } from "../../../../common/Constants";
|
|
2
|
+
import botActivity from "./botActivity";
|
|
3
|
+
const conversationDividerActivity = {
|
|
4
|
+
...botActivity,
|
|
5
|
+
channelData: {
|
|
6
|
+
tags: [Constants.conversationDividerTag]
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export default conversationDividerActivity;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Constants } from "../../../../common/Constants";
|
|
2
|
+
import botActivity from "../activities/botActivity";
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
const convertStringValueToInt = value => {
|
|
6
|
+
if (typeof value !== "string" || value === "") {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
let result;
|
|
10
|
+
try {
|
|
11
|
+
result = parseInt(value);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return isNaN(result) ? undefined : result;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
const convertPersistentChatHistoryMessageToActivity = message => {
|
|
20
|
+
var _from$user, _from$application;
|
|
21
|
+
const {
|
|
22
|
+
additionalData,
|
|
23
|
+
attachments,
|
|
24
|
+
content,
|
|
25
|
+
created,
|
|
26
|
+
from,
|
|
27
|
+
transcriptOriginalMessageId
|
|
28
|
+
} = message;
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
const activity = {
|
|
31
|
+
...botActivity,
|
|
32
|
+
channelData: {
|
|
33
|
+
tags: [Constants.persistentChatHistoryMessageTag]
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
let webchatSequenceId;
|
|
37
|
+
let timestamp;
|
|
38
|
+
if (transcriptOriginalMessageId) {
|
|
39
|
+
const id = convertStringValueToInt(transcriptOriginalMessageId); // Id used to determine the sequence of messages which is the same as the 'live' messages
|
|
40
|
+
if (id) {
|
|
41
|
+
webchatSequenceId = id;
|
|
42
|
+
timestamp = new Date(id) || created;
|
|
43
|
+
activity.channelData = {
|
|
44
|
+
...activity.channelData,
|
|
45
|
+
"webchat:sequence-id": webchatSequenceId
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (additionalData !== null && additionalData !== void 0 && additionalData.tags) {
|
|
50
|
+
const {
|
|
51
|
+
tags,
|
|
52
|
+
ConversationId
|
|
53
|
+
} = additionalData;
|
|
54
|
+
if (ConversationId) {
|
|
55
|
+
activity.channelData.conversationId = ConversationId;
|
|
56
|
+
}
|
|
57
|
+
if (tags) {
|
|
58
|
+
const formattedTags = additionalData.tags.split(",");
|
|
59
|
+
activity.channelData = {
|
|
60
|
+
...activity.channelData,
|
|
61
|
+
tags: [...activity.channelData.tags, ...formattedTags]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (from !== null && from !== void 0 && (_from$user = from.user) !== null && _from$user !== void 0 && _from$user.displayName) {
|
|
66
|
+
activity.from = {
|
|
67
|
+
...activity.from,
|
|
68
|
+
name: from.user.displayName
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if ((from === null || from === void 0 ? void 0 : (_from$application = from.application) === null || _from$application === void 0 ? void 0 : _from$application.displayName) === "Customer") {
|
|
72
|
+
activity.from = {
|
|
73
|
+
role: "user",
|
|
74
|
+
name: from.application.displayName
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (content) {
|
|
78
|
+
return {
|
|
79
|
+
...activity,
|
|
80
|
+
text: content,
|
|
81
|
+
timestamp
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (attachments && attachments.length > 0) {
|
|
85
|
+
const fileName = attachments[0].name || "Unknown";
|
|
86
|
+
const text = `The following attachment was uploaded during the conversation: ${fileName}`;
|
|
87
|
+
return {
|
|
88
|
+
...activity,
|
|
89
|
+
text,
|
|
90
|
+
timestamp
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// If neither content nor attachments are present, return null to indicate no activity could be created.
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
export default convertPersistentChatHistoryMessageToActivity;
|
|
@@ -28,5 +28,7 @@ export const defaultMiddlewareLocalizedTexts = {
|
|
|
28
28
|
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Allow sites to save/read cookies in browser settings. Reloading page starts a new chat.",
|
|
29
29
|
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
30
30
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
31
|
-
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
|
|
31
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later.",
|
|
32
|
+
PREVIOUS_MESSAGES_LOADING: "Loading previous messages...",
|
|
33
|
+
CONVERSATION_DIVIDER_ARIA_LABEL: "Conversation history divider"
|
|
32
34
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createActivityStatusMiddleware } from "../../webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware";
|
|
2
2
|
import { groupActivitiesMiddleware } from "../../webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware";
|
|
3
3
|
import { typingIndicatorMiddleware } from "../../webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware";
|
|
4
4
|
export const defaultWebChatStatefulProps = {
|
|
5
5
|
// activityMiddleware: activityMiddleware, - this is implemented elsewhere and can be customized
|
|
6
|
-
activityStatusMiddleware:
|
|
6
|
+
activityStatusMiddleware: createActivityStatusMiddleware(),
|
|
7
7
|
// avatarMiddleware: avatarMiddleware, - this is implemented elsewhere and can be customized
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
9
|
groupActivitiesMiddleware: groupActivitiesMiddleware,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import ChatWidgetEvents from "../../livechatwidget/common/ChatWidgetEvents";
|
|
4
|
+
import PersistentConversationHandler from "../../livechatwidget/common/PersistentConversationHandler";
|
|
5
|
+
import SecureEventBus from "../../../common/utils/SecureEventBus";
|
|
6
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
7
|
+
const usePersistentChatHistory = (facadeChatSDK, props) => {
|
|
8
|
+
const handlerRef = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!facadeChatSDK) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
14
|
+
Event: TelemetryEvent.UXLCWPersistentChatHistoryInitialized,
|
|
15
|
+
Description: "Persistent chat history hook initialized"
|
|
16
|
+
});
|
|
17
|
+
handlerRef.current = new PersistentConversationHandler(facadeChatSDK, props);
|
|
18
|
+
const handler = async () => {
|
|
19
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
20
|
+
Event: TelemetryEvent.LCWPersistentChatHistoryFetchStarted,
|
|
21
|
+
Description: "Persistent chat history fetch started"
|
|
22
|
+
});
|
|
23
|
+
try {
|
|
24
|
+
var _handlerRef$current;
|
|
25
|
+
await ((_handlerRef$current = handlerRef.current) === null || _handlerRef$current === void 0 ? void 0 : _handlerRef$current.pullHistory());
|
|
26
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
27
|
+
Event: TelemetryEvent.LCWPersistentChatHistoryFetchCompleted,
|
|
28
|
+
Description: "Persistent chat history fetch completed successfully"
|
|
29
|
+
});
|
|
30
|
+
} catch (error) {
|
|
31
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.ERROR, {
|
|
32
|
+
Event: TelemetryEvent.LCWPersistentChatHistoryFetchFailed,
|
|
33
|
+
Description: "Persistent chat history fetch failed",
|
|
34
|
+
ExceptionDetails: error
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Subscribe to the secure event bus instead of global window events
|
|
40
|
+
const eventBus = SecureEventBus.getInstance();
|
|
41
|
+
const unsubscribe = eventBus.subscribe(ChatWidgetEvents.FETCH_PERSISTENT_CHAT_HISTORY, handler);
|
|
42
|
+
return () => {
|
|
43
|
+
var _handlerRef$current2;
|
|
44
|
+
unsubscribe();
|
|
45
|
+
(_handlerRef$current2 = handlerRef.current) === null || _handlerRef$current2 === void 0 ? void 0 : _handlerRef$current2.destroy(); // Call destroy instead of reset to properly clean up
|
|
46
|
+
};
|
|
47
|
+
}, [facadeChatSDK]);
|
|
48
|
+
};
|
|
49
|
+
export default usePersistentChatHistory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import ChatWidgetEvents from "../../livechatwidget/common/ChatWidgetEvents";
|
|
4
|
+
import { Constants } from "../../../common/Constants";
|
|
5
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
6
|
+
import { WebChatStoreLoader } from "./WebChatStoreLoader";
|
|
7
|
+
import { createTimer } from "../../../common/utils";
|
|
8
|
+
import dispatchCustomEvent from "../../../common/utils/dispatchCustomEvent";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Component to handle persistent chat history events.
|
|
12
|
+
* Uses WebChatStoreLoader instead of hooks to avoid context issues.
|
|
13
|
+
*/
|
|
14
|
+
const WebChatEventSubscribers = () => {
|
|
15
|
+
const [isConnected, setIsConnected] = useState(false);
|
|
16
|
+
const [storeReady, setStoreReady] = useState(false);
|
|
17
|
+
const storeWaitTimer = createTimer();
|
|
18
|
+
// Type the chatConfig properly to avoid 'any' usage
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
22
|
+
Event: TelemetryEvent.LCWWebChatStorePollingStarted,
|
|
23
|
+
Description: "WebChat store polling started"
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Wait for WebChat store to be available
|
|
27
|
+
const waitForStore = () => {
|
|
28
|
+
if (WebChatStoreLoader.store) {
|
|
29
|
+
setStoreReady(true);
|
|
30
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
31
|
+
Event: TelemetryEvent.LCWWebChatStoreReady,
|
|
32
|
+
Description: "WebChat store ready",
|
|
33
|
+
ElapsedTimeInMilliseconds: storeWaitTimer.milliSecondsElapsed
|
|
34
|
+
});
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Check if store is already available
|
|
41
|
+
if (!waitForStore()) {
|
|
42
|
+
// Poll for store availability
|
|
43
|
+
const storeCheckInterval = setInterval(() => {
|
|
44
|
+
if (waitForStore()) {
|
|
45
|
+
clearInterval(storeCheckInterval);
|
|
46
|
+
}
|
|
47
|
+
}, 100);
|
|
48
|
+
return () => {
|
|
49
|
+
clearInterval(storeCheckInterval);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}, []);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!storeReady) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const checkConnectionStatus = () => {
|
|
58
|
+
try {
|
|
59
|
+
if (WebChatStoreLoader.store) {
|
|
60
|
+
const state = WebChatStoreLoader.store.getState();
|
|
61
|
+
const connectivityStatus = state === null || state === void 0 ? void 0 : state.connectivityStatus;
|
|
62
|
+
const newIsConnected = connectivityStatus === "connected";
|
|
63
|
+
if (newIsConnected && !isConnected) {
|
|
64
|
+
setIsConnected(true);
|
|
65
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
66
|
+
Event: TelemetryEvent.LCWWebChatConnected,
|
|
67
|
+
Description: "WebChat connection established, dispatching events"
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Dispatch events when connection is established
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
dispatchCustomEvent(ChatWidgetEvents.FETCH_PERSISTENT_CHAT_HISTORY);
|
|
73
|
+
dispatchCustomEvent(ChatWidgetEvents.ADD_ACTIVITY, {
|
|
74
|
+
activity: {
|
|
75
|
+
from: {
|
|
76
|
+
role: "bot"
|
|
77
|
+
},
|
|
78
|
+
timestamp: 0,
|
|
79
|
+
type: "message",
|
|
80
|
+
channelData: {
|
|
81
|
+
tags: [Constants.persistentChatHistoryMessagePullTriggerTag]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}, 2000);
|
|
86
|
+
} else if (!newIsConnected && isConnected) {
|
|
87
|
+
setIsConnected(false);
|
|
88
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.WARN, {
|
|
89
|
+
Event: TelemetryEvent.LCWWebChatDisconnected,
|
|
90
|
+
Description: "WebChat connection lost"
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
} catch (error) {
|
|
95
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.ERROR, {
|
|
96
|
+
Event: TelemetryEvent.LCWWebChatConnectionCheckFailed,
|
|
97
|
+
Description: "WebChat connection status check failed",
|
|
98
|
+
ExceptionDetails: error
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Check immediately
|
|
104
|
+
checkConnectionStatus();
|
|
105
|
+
|
|
106
|
+
// Set up interval to check connection status
|
|
107
|
+
const interval = setInterval(checkConnectionStatus, 1000);
|
|
108
|
+
return () => {
|
|
109
|
+
clearInterval(interval);
|
|
110
|
+
};
|
|
111
|
+
}, [isConnected, storeReady]);
|
|
112
|
+
return null;
|
|
113
|
+
};
|
|
114
|
+
export default WebChatEventSubscribers;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
3
|
+
import { defaultPersistentChatHistoryProps } from "../../../../../livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps";
|
|
4
|
+
import { mergeStyles } from "@fluentui/react";
|
|
5
|
+
const ConversationDividerActivity = props => {
|
|
6
|
+
const styleApplied = mergeStyles(defaultPersistentChatHistoryProps.dividerActivityStyle, props.dividerActivityStyle);
|
|
7
|
+
const ariaLabel = props.dividerActivityAriaLabel || defaultMiddlewareLocalizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL;
|
|
8
|
+
|
|
9
|
+
// Create a simple separator that screen readers can detect without being interactive
|
|
10
|
+
// Preserve the visual divider styling while making it accessible
|
|
11
|
+
// Use a ref to programmatically remove only the "EL said:" prefix from the label
|
|
12
|
+
const dividerRef = React.useRef(null);
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
if (dividerRef.current) {
|
|
15
|
+
// Find and hardcode the text in the label div to just show the divider label
|
|
16
|
+
const article = dividerRef.current.closest(".webchat__basic-transcript__activity");
|
|
17
|
+
if (article) {
|
|
18
|
+
const labelDiv = article.querySelector("div[id*=\"webchat__basic-transcript__active-descendant-label--\"]");
|
|
19
|
+
if (labelDiv) {
|
|
20
|
+
// Hardcode the text to just the aria label
|
|
21
|
+
labelDiv.textContent = ariaLabel || "";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}, [ariaLabel]);
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
ref: dividerRef,
|
|
28
|
+
role: "separator",
|
|
29
|
+
"aria-label": ariaLabel,
|
|
30
|
+
"aria-hidden": false,
|
|
31
|
+
className: styleApplied,
|
|
32
|
+
"data-accessibility-divider": "true",
|
|
33
|
+
style: {
|
|
34
|
+
// Add accessibility enhancements
|
|
35
|
+
position: "relative"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export default ConversationDividerActivity;
|