@microsoft/omnichannel-chat-widget 1.7.8-main.7a07fc5 → 1.7.8-main.8428c08
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/lib/cjs/common/Constants.js +66 -20
- package/lib/cjs/common/KeyCodes.js +6 -1
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +6 -1
- package/lib/cjs/common/facades/FacadeChatSDK.js +392 -295
- package/lib/cjs/common/storage/default/defaultCacheManager.js +6 -3
- package/lib/cjs/common/telemetry/ScenarioMarker.js +66 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +179 -148
- package/lib/cjs/common/telemetry/TelemetryHelper.js +281 -250
- package/lib/cjs/common/telemetry/TelemetryManager.js +31 -11
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAppInsightsConfig.js +11 -0
- package/lib/cjs/common/telemetry/interfaces/IAppInsightsConfig.js +1 -0
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +119 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +17 -14
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -4
- package/lib/cjs/components/footerstateful/FooterStateful.js +13 -8
- package/lib/cjs/components/headerstateful/HeaderStateful.js +24 -14
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +32 -19
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +71 -56
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +17 -8
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +65 -52
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +31 -18
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +14 -6
- package/lib/cjs/components/livechatwidget/common/Deferred.js +14 -6
- package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +3 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +4 -18
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +0 -5
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -1
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +7 -4
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +7 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +5 -26
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +7 -6
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -20
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +12 -8
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +31 -10
- package/lib/cjs/components/postchatsurveypanestateful/common/isValidSurveyUrl.js +28 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +9 -6
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -7
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +4 -3
- package/lib/cjs/components/webchatcontainerstateful/common/DemoChatAdapter.js +88 -65
- package/lib/cjs/components/webchatcontainerstateful/common/DemoChatSDK.js +26 -7
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +49 -26
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +57 -35
- package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +62 -52
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +95 -61
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +53 -39
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +4 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +88 -60
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +18 -6
- package/lib/cjs/firstresponselatency/Constants.js +13 -0
- package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +118 -0
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +201 -0
- package/lib/cjs/firstresponselatency/util.js +98 -0
- package/lib/cjs/plugins/createChatTranscript.js +92 -62
- package/lib/cjs/plugins/newMessageEventHandler.js +102 -88
- package/lib/esm/common/Constants.js +64 -19
- package/lib/esm/common/KeyCodes.js +6 -1
- package/lib/esm/common/contextDataStore/DataStoreManager.js +6 -1
- package/lib/esm/common/facades/FacadeChatSDK.js +392 -295
- package/lib/esm/common/storage/default/defaultCacheManager.js +6 -1
- package/lib/esm/common/telemetry/ScenarioMarker.js +59 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +179 -148
- package/lib/esm/common/telemetry/TelemetryHelper.js +281 -250
- package/lib/esm/common/telemetry/TelemetryManager.js +31 -11
- package/lib/esm/common/telemetry/defaultConfigs/defaultAppInsightsConfig.js +4 -0
- package/lib/esm/common/telemetry/interfaces/IAppInsightsConfig.js +1 -0
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +111 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -14
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -4
- package/lib/esm/components/footerstateful/FooterStateful.js +13 -8
- package/lib/esm/components/headerstateful/HeaderStateful.js +24 -14
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +32 -19
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +71 -56
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +17 -8
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +65 -52
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +31 -18
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +14 -6
- package/lib/esm/components/livechatwidget/common/Deferred.js +14 -6
- package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +4 -18
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +1 -6
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -1
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +7 -4
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +7 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +6 -27
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +7 -6
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -20
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +12 -8
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +31 -10
- package/lib/esm/components/postchatsurveypanestateful/common/isValidSurveyUrl.js +21 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +9 -6
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -7
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +4 -3
- package/lib/esm/components/webchatcontainerstateful/common/DemoChatAdapter.js +88 -65
- package/lib/esm/components/webchatcontainerstateful/common/DemoChatSDK.js +26 -7
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +49 -26
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +57 -35
- package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +63 -52
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +95 -61
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +53 -39
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +88 -60
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -6
- package/lib/esm/firstresponselatency/Constants.js +6 -0
- package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +112 -0
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +194 -0
- package/lib/esm/firstresponselatency/util.js +87 -0
- package/lib/esm/plugins/createChatTranscript.js +92 -62
- package/lib/esm/plugins/newMessageEventHandler.js +100 -86
- package/lib/types/common/Constants.d.ts +5 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +1 -0
- package/lib/types/common/telemetry/ScenarioMarker.d.ts +19 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +50 -33
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +5 -0
- package/lib/types/common/telemetry/defaultConfigs/defaultAppInsightsConfig.d.ts +2 -0
- package/lib/types/common/telemetry/interfaces/IAppInsightsConfig.d.ts +4 -0
- package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
- package/lib/types/common/telemetry/loggers/appInsightsLogger.d.ts +5 -0
- package/lib/types/components/callingcontainerstateful/CallingContainerStateful.d.ts +2 -1
- package/lib/types/components/chatbuttonstateful/ChatButtonStateful.d.ts +2 -1
- package/lib/types/components/confirmationpanestateful/ConfirmationPaneStateful.d.ts +2 -1
- package/lib/types/components/dimlayer/DimLayer.d.ts +2 -1
- package/lib/types/components/draggable/DraggableChatWidget.d.ts +2 -2
- package/lib/types/components/draggable/DraggableEventEmitter.d.ts +2 -2
- package/lib/types/components/draggable/DraggableEventReceiver.d.ts +2 -2
- package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.d.ts +2 -1
- package/lib/types/components/footerstateful/FooterStateful.d.ts +2 -1
- package/lib/types/components/footerstateful/audionotificationstateful/AudioNotificationStateful.d.ts +2 -1
- package/lib/types/components/headerstateful/HeaderStateful.d.ts +2 -1
- package/lib/types/components/livechatwidget/LiveChatWidget.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/createFooter.d.ts +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/loadingpanestateful/LoadingPaneStateful.d.ts +2 -1
- package/lib/types/components/notificationpanestateful/NotificationPaneStateful.d.ts +2 -1
- package/lib/types/components/ooohpanestateful/OOOHPaneStateful.d.ts +2 -1
- package/lib/types/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.d.ts +2 -1
- package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -1
- package/lib/types/components/postchatsurveypanestateful/common/isValidSurveyUrl.d.ts +2 -0
- package/lib/types/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.d.ts +2 -1
- package/lib/types/components/proactivechatpanestateful/ProactiveChatPaneStateful.d.ts +2 -1
- package/lib/types/components/reconnectchatpanestateful/ReconnectChatPaneStateful.d.ts +2 -1
- package/lib/types/components/startchaterrorpanestateful/StartChatErrorPaneStateful.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/WebChatContainerStateful.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +2 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentContent.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentIcon.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/DownloadBlockedAttachment.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/MaliciousAttachment.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/ScanInProgressAttachment.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Spinner.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.d.ts +2 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -1
- package/lib/types/firstresponselatency/Constants.d.ts +30 -0
- package/lib/types/firstresponselatency/FirstMessageTrackerFromBot.d.ts +1 -0
- package/lib/types/firstresponselatency/FirstResponseLatencyTracker.d.ts +22 -0
- package/lib/types/firstresponselatency/util.d.ts +7 -0
- package/package.json +27 -13
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
-
import { Constants, LiveWorkItemState,
|
|
2
|
+
import { Constants, LiveWorkItemState, WidgetLoadTelemetryMessage } from "../../../common/Constants";
|
|
3
3
|
import { checkContactIdError, createTimer, getConversationDetailsCall, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isNullOrUndefined, isUndefinedOrEmpty } from "../../../common/utils";
|
|
4
|
-
import { getAuthClientFunction, handleAuthentication } from "./authHelper";
|
|
5
4
|
import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "./reconnectChatHelper";
|
|
6
5
|
import { handleStartChatError, logWidgetLoadComplete } from "./startChatErrorHandler";
|
|
7
6
|
import { ActivityStreamHandler } from "./ActivityStreamHandler";
|
|
@@ -13,6 +12,7 @@ import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
|
13
12
|
import { chatSDKStateCleanUp } from "./endChat";
|
|
14
13
|
import { createAdapter } from "./createAdapter";
|
|
15
14
|
import { createOnNewAdapterActivityHandler } from "../../../plugins/newMessageEventHandler";
|
|
15
|
+
import { createTrackingForFirstMessage } from "../../../firstresponselatency/FirstMessageTrackerFromBot";
|
|
16
16
|
import { isPersistentChatEnabled } from "./liveChatConfigUtils";
|
|
17
17
|
import { setPostChatContextAndLoadSurvey } from "./setPostChatContextAndLoadSurvey";
|
|
18
18
|
import { shouldSetPreChatIfPersistentChat } from "./persistentChatHelper";
|
|
@@ -25,20 +25,6 @@ let widgetInstanceId;
|
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
26
|
let popoutWidgetInstanceId;
|
|
27
27
|
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
const setAuthenticationIfApplicable = async (props, facadeChatSDK) => {
|
|
30
|
-
const chatConfig = props === null || props === void 0 ? void 0 : props.chatConfig;
|
|
31
|
-
const getAuthToken = props === null || props === void 0 ? void 0 : props.getAuthToken;
|
|
32
|
-
const authClientFunction = getAuthClientFunction(chatConfig);
|
|
33
|
-
if (getAuthToken && authClientFunction) {
|
|
34
|
-
// set auth token to chat sdk before start chat
|
|
35
|
-
const authSuccess = await handleAuthentication(facadeChatSDK.getChatSDK(), chatConfig, getAuthToken);
|
|
36
|
-
if (!authSuccess.result) {
|
|
37
|
-
throw new Error(WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
29
|
const prepareStartChat = async (props, facadeChatSDK, state, dispatch, setAdapter) => {
|
|
44
30
|
optionalParams = {}; //Resetting to ensure no stale values
|
|
@@ -66,11 +52,6 @@ const prepareStartChat = async (props, facadeChatSDK, state, dispatch, setAdapte
|
|
|
66
52
|
const isProactiveChat = state.appStates.conversationState === ConversationState.ProactiveChat;
|
|
67
53
|
const isPreChatEnabledInProactiveChat = state.appStates.proactiveChatStates.proactiveChatEnablePrechat;
|
|
68
54
|
|
|
69
|
-
// Setting auth settings to OC API to retrieve existing persistent chat session before start chat if any
|
|
70
|
-
if (isPersistentEnabled(props.chatConfig)) {
|
|
71
|
-
await setAuthenticationIfApplicable(props, facadeChatSDK);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
55
|
//Setting PreChat and intiate chat
|
|
75
56
|
await setPreChatAndInitiateChat(facadeChatSDK, dispatch, setAdapter, isProactiveChat, isPreChatEnabledInProactiveChat, state, props);
|
|
76
57
|
};
|
|
@@ -145,6 +126,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
145
126
|
const optionalParams = {
|
|
146
127
|
isProactiveChat
|
|
147
128
|
};
|
|
129
|
+
createTrackingForFirstMessage();
|
|
148
130
|
await initStartChat(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams);
|
|
149
131
|
};
|
|
150
132
|
|
|
@@ -167,14 +149,11 @@ const initStartChat = async (facadeChatSDK, dispatch, setAdapter, state, props,
|
|
|
167
149
|
|
|
168
150
|
//Start widget load timer
|
|
169
151
|
TelemetryTimers.WidgetLoadTimer = createTimer();
|
|
170
|
-
TelemetryHelper.
|
|
171
|
-
Event: TelemetryEvent.
|
|
172
|
-
Description: "Widget
|
|
152
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
153
|
+
Event: TelemetryEvent.WidgetStartChatStarted,
|
|
154
|
+
Description: "Widget start chat started."
|
|
173
155
|
});
|
|
174
156
|
|
|
175
|
-
// Auth token retrieval needs to happen during start chat to support pop-out chat
|
|
176
|
-
await setAuthenticationIfApplicable(props, facadeChatSDK);
|
|
177
|
-
|
|
178
157
|
//Check if chat retrieved from cache
|
|
179
158
|
if (persistedState || params !== null && params !== void 0 && params.liveChatContext) {
|
|
180
159
|
var _persistedState$domai, _persistedState$domai2, _persistedState$domai3, _persistedState$domai4, _persistedState$domai5;
|
|
@@ -106,8 +106,9 @@ const logWidgetLoadFailed = ex => {
|
|
|
106
106
|
if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
|
|
107
107
|
exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
|
|
108
108
|
}
|
|
109
|
-
TelemetryHelper.
|
|
110
|
-
Event: TelemetryEvent.
|
|
109
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.ERROR, {
|
|
110
|
+
Event: TelemetryEvent.WidgetStartChatFailed,
|
|
111
|
+
Description: "Widget load complete with error",
|
|
111
112
|
ExceptionDetails: exDetails,
|
|
112
113
|
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg === void 0 ? void 0 : _TelemetryTimers$Widg.milliSecondsElapsed
|
|
113
114
|
});
|
|
@@ -118,8 +119,8 @@ export const logWidgetLoadComplete = additionalMessage => {
|
|
|
118
119
|
if (additionalMessage) {
|
|
119
120
|
descriptionString += `. ${additionalMessage}`;
|
|
120
121
|
}
|
|
121
|
-
TelemetryHelper.
|
|
122
|
-
Event: TelemetryEvent.
|
|
122
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
123
|
+
Event: TelemetryEvent.WidgetStartChatCompleted,
|
|
123
124
|
Description: descriptionString,
|
|
124
125
|
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg2 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg2 === void 0 ? void 0 : _TelemetryTimers$Widg2.milliSecondsElapsed
|
|
125
126
|
});
|
|
@@ -133,8 +134,8 @@ const logWidgetLoadCompleteWithError = ex => {
|
|
|
133
134
|
if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
|
|
134
135
|
exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
|
|
135
136
|
}
|
|
136
|
-
TelemetryHelper.
|
|
137
|
-
Event: TelemetryEvent.
|
|
137
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.ERROR, {
|
|
138
|
+
Event: TelemetryEvent.WidgetStartChatFailed,
|
|
138
139
|
Description: "Widget load complete with error",
|
|
139
140
|
ExceptionDetails: exDetails,
|
|
140
141
|
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
|
|
@@ -56,11 +56,12 @@ import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
|
56
56
|
import useFacadeSDKStore from "../../../hooks/useFacadeChatSDKStore";
|
|
57
57
|
let uiTimer;
|
|
58
58
|
export const LiveChatWidgetStateful = props => {
|
|
59
|
-
var _props$webChatContain, _props$styleProps, _props$webChatContain2, _props$webChatContain3, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain7, _state$appStates14, _props$webChatContain9, _props$webChatContain10, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _props$webChatContain11, _props$webChatContain12, _props$webChatContain13, _props$webChatContain14, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
59
|
+
var _props$webChatContain, _props$styleProps, _props$webChatContain2, _props$webChatContain3, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain7, _state$appStates14, _props$webChatContain9, _props$webChatContain10, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _props$webChatContain11, _props$webChatContain12, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _props$webChatContain17, _props$webChatContain18, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
60
60
|
useEffect(() => {
|
|
61
61
|
uiTimer = createTimer();
|
|
62
|
-
TelemetryHelper.
|
|
63
|
-
Event: TelemetryEvent.
|
|
62
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
63
|
+
Event: TelemetryEvent.UXLiveChatWidgetStart,
|
|
64
|
+
Description: "Live chat widget loading started."
|
|
64
65
|
});
|
|
65
66
|
}, []);
|
|
66
67
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -311,7 +312,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
311
312
|
});
|
|
312
313
|
});
|
|
313
314
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartProactiveChat).subscribe(msg => {
|
|
314
|
-
TelemetryHelper.
|
|
315
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
315
316
|
Event: TelemetryEvent.StartProactiveChatEventReceived,
|
|
316
317
|
Description: "Start proactive chat event received."
|
|
317
318
|
});
|
|
@@ -409,7 +410,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
409
410
|
|
|
410
411
|
// Start chat from SDK Event
|
|
411
412
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(msg => {
|
|
412
|
-
var _props$chatConfig5, _props$chatConfig5$Li, _props$chatConfig6, _props$chatConfig6$Li, _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta2, _inMemoryState$appSta3
|
|
413
|
+
var _props$chatConfig5, _props$chatConfig5$Li, _props$chatConfig6, _props$chatConfig6$Li, _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta2, _inMemoryState$appSta3;
|
|
413
414
|
// If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
|
|
414
415
|
if (typeof (props === null || props === void 0 ? void 0 : (_props$chatConfig5 = props.chatConfig) === null || _props$chatConfig5 === void 0 ? void 0 : (_props$chatConfig5$Li = _props$chatConfig5.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig5$Li === void 0 ? void 0 : _props$chatConfig5$Li.OutOfOperatingHours) === "string" && (props === null || props === void 0 ? void 0 : (_props$chatConfig6 = props.chatConfig) === null || _props$chatConfig6 === void 0 ? void 0 : (_props$chatConfig6$Li = _props$chatConfig6.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig6$Li === void 0 ? void 0 : _props$chatConfig6$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
415
416
|
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
@@ -428,7 +429,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
428
429
|
}
|
|
429
430
|
if (msg !== null && msg !== void 0 && (_msg$payload7 = msg.payload) !== null && _msg$payload7 !== void 0 && _msg$payload7.customContext) {
|
|
430
431
|
var _msg$payload8;
|
|
431
|
-
TelemetryHelper.
|
|
432
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
432
433
|
Event: TelemetryEvent.CustomContextReceived,
|
|
433
434
|
Description: "CustomContext received through startChat event."
|
|
434
435
|
});
|
|
@@ -437,8 +438,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
437
438
|
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
438
439
|
});
|
|
439
440
|
}
|
|
440
|
-
TelemetryHelper.
|
|
441
|
-
Event: TelemetryEvent.
|
|
441
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
442
|
+
Event: TelemetryEvent.StartChatEventReceived,
|
|
442
443
|
Description: "Start chat event received."
|
|
443
444
|
});
|
|
444
445
|
const inMemoryState = executeReducer(state, {
|
|
@@ -447,8 +448,14 @@ export const LiveChatWidgetStateful = props => {
|
|
|
447
448
|
});
|
|
448
449
|
inMemoryState.domainStates.customContext = msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.customContext;
|
|
449
450
|
|
|
450
|
-
|
|
451
|
-
|
|
451
|
+
/*
|
|
452
|
+
* If the conversation is in closed state then we start a new chat,
|
|
453
|
+
* else if the conversation is in active state then we maximize the chat
|
|
454
|
+
* If the conversation is in inactive or postchat state then we maximize the chat.
|
|
455
|
+
*
|
|
456
|
+
* To start a new chat, it needs to be called via the close button or close chat via SDK.
|
|
457
|
+
**/
|
|
458
|
+
if (((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === ConversationState.Closed) {
|
|
452
459
|
BroadcastService.postMessage({
|
|
453
460
|
eventName: BroadcastEvent.ChatInitiated
|
|
454
461
|
});
|
|
@@ -457,7 +464,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
457
464
|
}
|
|
458
465
|
|
|
459
466
|
// If minimized, maximize the chat
|
|
460
|
-
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
467
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.isMinimized) === true) {
|
|
461
468
|
var _inMemoryState$domain, _inMemoryState$domain2, _inMemoryState$domain3, _inMemoryState$domain4;
|
|
462
469
|
dispatch({
|
|
463
470
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -476,7 +483,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
476
483
|
|
|
477
484
|
// End chat
|
|
478
485
|
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async () => {
|
|
479
|
-
TelemetryHelper.
|
|
486
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
480
487
|
Event: TelemetryEvent.EndChatEventReceived,
|
|
481
488
|
Description: "Received InitiateEndChat BroadcastEvent."
|
|
482
489
|
});
|
|
@@ -585,12 +592,12 @@ export const LiveChatWidgetStateful = props => {
|
|
|
585
592
|
disablePolling: true
|
|
586
593
|
});
|
|
587
594
|
facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.onAgentEndSession(event => {
|
|
588
|
-
var _inMemoryState$
|
|
595
|
+
var _inMemoryState$appSta4;
|
|
589
596
|
const inMemoryState = executeReducer(state, {
|
|
590
597
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
591
598
|
payload: null
|
|
592
599
|
});
|
|
593
|
-
if ("participantsRemoved" in event && (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
600
|
+
if ("participantsRemoved" in event && (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta4 = inMemoryState.appStates) === null || _inMemoryState$appSta4 === void 0 ? void 0 : _inMemoryState$appSta4.conversationState) === ConversationState.Active) {
|
|
594
601
|
setWebChatStyles(styles => {
|
|
595
602
|
return {
|
|
596
603
|
...styles,
|
|
@@ -733,13 +740,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
733
740
|
|
|
734
741
|
// Handle Chat disconnect cases
|
|
735
742
|
useEffect(() => {
|
|
736
|
-
var _inMemoryState$
|
|
743
|
+
var _inMemoryState$appSta5;
|
|
737
744
|
const inMemoryState = executeReducer(state, {
|
|
738
745
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
739
746
|
payload: null
|
|
740
747
|
});
|
|
741
748
|
handleChatDisconnect(props, inMemoryState, setWebChatStyles);
|
|
742
|
-
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
749
|
+
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta5 = inMemoryState.appStates) === null || _inMemoryState$appSta5 === void 0 ? void 0 : _inMemoryState$appSta5.chatDisconnectEventReceived;
|
|
743
750
|
if (chatDisconnectState && adapter) {
|
|
744
751
|
try {
|
|
745
752
|
adapter.end();
|
|
@@ -762,8 +769,9 @@ export const LiveChatWidgetStateful = props => {
|
|
|
762
769
|
});
|
|
763
770
|
}, [(_props$webChatContain9 = props.webChatContainerProps) === null || _props$webChatContain9 === void 0 ? void 0 : _props$webChatContain9.renderingMiddlewareProps]);
|
|
764
771
|
useEffect(() => {
|
|
765
|
-
TelemetryHelper.
|
|
766
|
-
Event: TelemetryEvent.
|
|
772
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
773
|
+
Event: TelemetryEvent.UXLiveChatWidgetCompleted,
|
|
774
|
+
Description: "Live chat widget loading completed.",
|
|
767
775
|
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
768
776
|
});
|
|
769
777
|
}, []);
|
|
@@ -868,8 +876,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
868
876
|
userID: userID,
|
|
869
877
|
styleOptions: {
|
|
870
878
|
...webChatStyles,
|
|
871
|
-
bubbleBackground: ((_props$webChatContain11 = props.webChatContainerProps) === null || _props$webChatContain11 === void 0 ? void 0 : (_props$webChatContain12 = _props$webChatContain11.
|
|
872
|
-
bubbleTextColor: ((_props$
|
|
879
|
+
bubbleBackground: ((_props$webChatContain11 = props.webChatContainerProps) === null || _props$webChatContain11 === void 0 ? void 0 : (_props$webChatContain12 = _props$webChatContain11.webChatStyles) === null || _props$webChatContain12 === void 0 ? void 0 : _props$webChatContain12.bubbleBackground) ?? ((_props$webChatContain13 = props.webChatContainerProps) === null || _props$webChatContain13 === void 0 ? void 0 : (_props$webChatContain14 = _props$webChatContain13.adaptiveCardStyles) === null || _props$webChatContain14 === void 0 ? void 0 : _props$webChatContain14.background) ?? defaultAdaptiveCardStyles.background,
|
|
880
|
+
bubbleTextColor: ((_props$webChatContain15 = props.webChatContainerProps) === null || _props$webChatContain15 === void 0 ? void 0 : (_props$webChatContain16 = _props$webChatContain15.webChatStyles) === null || _props$webChatContain16 === void 0 ? void 0 : _props$webChatContain16.bubbleTextColor) ?? ((_props$webChatContain17 = props.webChatContainerProps) === null || _props$webChatContain17 === void 0 ? void 0 : (_props$webChatContain18 = _props$webChatContain17.adaptiveCardStyles) === null || _props$webChatContain18 === void 0 ? void 0 : _props$webChatContain18.color) ?? defaultAdaptiveCardStyles.color
|
|
873
881
|
},
|
|
874
882
|
directLine: directLine
|
|
875
883
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
3
|
import { createTimer, findAllFocusableElement } from "../../common/utils";
|
|
4
|
+
import DOMPurify from "dompurify";
|
|
4
5
|
import { OutOfOfficeHoursPane } from "@microsoft/omnichannel-chat-components";
|
|
5
6
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
6
7
|
import { defaultGeneralStyleProps } from "./common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps";
|
|
7
8
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
8
|
-
import DOMPurify from "dompurify";
|
|
9
9
|
let uiTimer;
|
|
10
10
|
export const OutOfOfficeHoursPaneStateful = props => {
|
|
11
11
|
var _props$styleProps;
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
uiTimer = createTimer();
|
|
14
|
-
TelemetryHelper.
|
|
15
|
-
Event: TelemetryEvent.
|
|
14
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
15
|
+
Event: TelemetryEvent.UXOutOfOfficeHoursPaneStart,
|
|
16
|
+
Description: "Out of office hours pane loading started."
|
|
16
17
|
});
|
|
17
18
|
}, []);
|
|
18
19
|
const [state] = useChatContextStore();
|
|
@@ -29,15 +30,18 @@ export const OutOfOfficeHoursPaneStateful = props => {
|
|
|
29
30
|
|
|
30
31
|
// Move focus to the first button
|
|
31
32
|
useEffect(() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
firstElement[0]
|
|
33
|
+
if (state.domainStates.widgetElementId !== null && state.domainStates.widgetElementId !== undefined && state.domainStates.widgetElementId.trim() !== "") {
|
|
34
|
+
const firstElement = findAllFocusableElement(`#${state.domainStates.widgetElementId}`);
|
|
35
|
+
if (firstElement && firstElement[0]) {
|
|
36
|
+
firstElement[0].focus();
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
37
40
|
Event: TelemetryEvent.OutOfOfficePaneLoaded
|
|
38
41
|
});
|
|
39
|
-
TelemetryHelper.
|
|
40
|
-
Event: TelemetryEvent.
|
|
42
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
43
|
+
Event: TelemetryEvent.UXOutOfOfficeHoursPaneCompleted,
|
|
44
|
+
Description: "Out of office hours pane loading completed.",
|
|
41
45
|
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
42
46
|
});
|
|
43
47
|
}, []);
|
|
@@ -8,14 +8,16 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
|
8
8
|
import { defaultGeneralPostChatSurveyPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps";
|
|
9
9
|
import { findAllFocusableElement } from "../../common/utils";
|
|
10
10
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
11
|
+
import isValidSurveyUrl from "./common/isValidSurveyUrl";
|
|
11
12
|
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
|
|
12
13
|
let showMultiLingual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const surveyLinkParams = new URLSearchParams({
|
|
15
|
+
embed: isEmbed.toString(),
|
|
16
|
+
compact: (compact ?? true).toString(),
|
|
17
|
+
lang: locale ?? "en-us",
|
|
18
|
+
showmultilingual: (showMultiLingual ?? false).toString()
|
|
19
|
+
});
|
|
20
|
+
return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
|
|
19
21
|
};
|
|
20
22
|
export const PostChatSurveyPaneStateful = props => {
|
|
21
23
|
var _props$styleProps, _state$appStates, _props$controlProps;
|
|
@@ -45,6 +47,20 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
45
47
|
surveyURL: ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.surveyURL) ?? surveyInviteLink,
|
|
46
48
|
...props.controlProps
|
|
47
49
|
};
|
|
50
|
+
if (controlProps.surveyURL) {
|
|
51
|
+
if (!isValidSurveyUrl(controlProps.surveyURL)) {
|
|
52
|
+
TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
|
|
53
|
+
Event: TelemetryEvent.PostChatSurveyUrlValidationFailed,
|
|
54
|
+
Description: `${controlProps.surveyURL} is not a valid Survey URL`
|
|
55
|
+
});
|
|
56
|
+
controlProps.surveyURL = "";
|
|
57
|
+
} else {
|
|
58
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
59
|
+
Event: TelemetryEvent.PostChatSurveyUrlValidationCompleted,
|
|
60
|
+
Description: `${controlProps.surveyURL} is a valid Survey URL`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
48
64
|
|
|
49
65
|
// Move focus to the first button
|
|
50
66
|
useEffect(() => {
|
|
@@ -68,12 +84,17 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
68
84
|
Event: TelemetryEvent.CustomerVoiceResponsePageLoaded
|
|
69
85
|
});
|
|
70
86
|
} else if (data === CustomerVoiceEvents.FormResponseSubmitted) {
|
|
71
|
-
TelemetryHelper.
|
|
72
|
-
Event: TelemetryEvent.CustomerVoiceFormResponseSubmitted
|
|
87
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
88
|
+
Event: TelemetryEvent.CustomerVoiceFormResponseSubmitted,
|
|
89
|
+
Description: "Customer Voice form response submitted."
|
|
73
90
|
});
|
|
74
91
|
} else if (data === CustomerVoiceEvents.FormResponseError) {
|
|
75
|
-
TelemetryHelper.
|
|
76
|
-
Event: TelemetryEvent.CustomerVoiceFormResponseError
|
|
92
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.ERROR, {
|
|
93
|
+
Event: TelemetryEvent.CustomerVoiceFormResponseError,
|
|
94
|
+
Description: "Customer Voice form response error.",
|
|
95
|
+
ExceptionDetails: {
|
|
96
|
+
message: "Customer Voice form response error."
|
|
97
|
+
}
|
|
77
98
|
});
|
|
78
99
|
}
|
|
79
100
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isNullOrEmptyString } from "../../../common/utils";
|
|
2
|
+
const validRootDomains = ["microsoft.com", "microsoft.us", "appsplatform.us", "powervirtualagents.cn"];
|
|
3
|
+
const isValidSurveyUrl = url => {
|
|
4
|
+
if (isNullOrEmptyString(url)) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
try {
|
|
8
|
+
const objectUrl = new URL(url);
|
|
9
|
+
if (!objectUrl.origin || objectUrl.origin === "null") {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const validDomain = validRootDomains.find(domain => objectUrl.origin.endsWith(domain));
|
|
13
|
+
if (validDomain) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
} catch (error) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
};
|
|
21
|
+
export default isValidSurveyUrl;
|
|
@@ -17,8 +17,9 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
17
17
|
var _surveyProps$stylePro, _props$surveyProps, _props$surveyProps$co;
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
uiTimer = createTimer();
|
|
20
|
-
TelemetryHelper.
|
|
21
|
-
Event: TelemetryEvent.UXPrechatPaneStart
|
|
20
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
21
|
+
Event: TelemetryEvent.UXPrechatPaneStart,
|
|
22
|
+
Description: "Prechat survey pane loading started."
|
|
22
23
|
});
|
|
23
24
|
}, []);
|
|
24
25
|
|
|
@@ -67,8 +68,9 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
67
68
|
payload: getAdaptiveCardPayload(state.domainStates.preChatSurveyResponse, requiredFieldMissingMessage),
|
|
68
69
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
70
|
onSubmit: async values => {
|
|
70
|
-
TelemetryHelper.
|
|
71
|
-
Event: TelemetryEvent.
|
|
71
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
72
|
+
Event: TelemetryEvent.PrechatSubmitCompleted,
|
|
73
|
+
Description: "Prechat survey submitted."
|
|
72
74
|
});
|
|
73
75
|
dispatch({
|
|
74
76
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
@@ -139,9 +141,10 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
139
141
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
140
142
|
Event: TelemetryEvent.PrechatSurveyLoaded
|
|
141
143
|
});
|
|
142
|
-
TelemetryHelper.
|
|
144
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
143
145
|
Event: TelemetryEvent.UXPrechatPaneCompleted,
|
|
144
|
-
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
146
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
147
|
+
Description: "Prechat survey pane loading completed."
|
|
145
148
|
});
|
|
146
149
|
}, []);
|
|
147
150
|
|
|
@@ -16,8 +16,9 @@ export const ProactiveChatPaneStateful = props => {
|
|
|
16
16
|
var _proactiveChatProps$c;
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
uiTimer = createTimer();
|
|
19
|
-
TelemetryHelper.
|
|
20
|
-
Event: TelemetryEvent.UXProactiveChatPaneStart
|
|
19
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
20
|
+
Event: TelemetryEvent.UXProactiveChatPaneStart,
|
|
21
|
+
Description: "Proactive chat pane loading started."
|
|
21
22
|
});
|
|
22
23
|
}, []);
|
|
23
24
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -42,8 +43,8 @@ export const ProactiveChatPaneStateful = props => {
|
|
|
42
43
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
43
44
|
payload: ConversationState.Closed
|
|
44
45
|
});
|
|
45
|
-
TelemetryHelper.
|
|
46
|
-
Event: TelemetryEvent.
|
|
46
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
47
|
+
Event: TelemetryEvent.ProactiveChatTimeOutCompleted,
|
|
47
48
|
ElapsedTimeInMilliseconds: TelemetryTimers.LcwLoadToChatButtonTimer.milliSecondsElapsed,
|
|
48
49
|
Description: "Proactive chat invitation timed out."
|
|
49
50
|
});
|
|
@@ -121,9 +122,10 @@ export const ProactiveChatPaneStateful = props => {
|
|
|
121
122
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
122
123
|
Event: TelemetryEvent.ProactiveChatPaneLoaded
|
|
123
124
|
});
|
|
124
|
-
TelemetryHelper.
|
|
125
|
-
Event: TelemetryEvent.
|
|
126
|
-
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
125
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
126
|
+
Event: TelemetryEvent.UXProactiveChatPaneCompleted,
|
|
127
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
128
|
+
Description: "Proactive chat pane loading completed."
|
|
127
129
|
});
|
|
128
130
|
return () => {
|
|
129
131
|
clearTimeout(timeoutEvent);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
|
|
3
|
+
import { Constants, HtmlAttributeNames, HtmlClassNames } from "../../common/Constants";
|
|
3
4
|
import { Stack } from "@fluentui/react";
|
|
4
5
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
5
6
|
import React, { useEffect } from "react";
|
|
6
7
|
import { createTimer, getDeviceType, setFocusOnSendBox } from "../../common/utils";
|
|
7
8
|
import { BotMagicCodeStore } from "./webchatcontroller/BotMagicCodeStore";
|
|
8
9
|
import { Components } from "botframework-webchat";
|
|
9
|
-
import { Constants, HtmlAttributeNames, HtmlClassNames } from "../../common/Constants";
|
|
10
10
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
11
11
|
import { NotificationHandler } from "./webchatcontroller/notification/NotificationHandler";
|
|
12
12
|
import { NotificationScenarios } from "./webchatcontroller/enums/NotificationScenarios";
|
|
@@ -48,7 +48,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
export const WebChatContainerStateful = props => {
|
|
51
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _props$webChatContain9, _props$webChatContain10;
|
|
51
|
+
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _props$webChatContain9, _props$webChatContain10;
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
uiTimer = createTimer();
|
|
54
54
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
@@ -233,8 +233,9 @@ export const WebChatContainerStateful = props => {
|
|
|
233
233
|
color: ${(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.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
// 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
|
|
236
237
|
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
237
|
-
border-radius: 0 !important; /* Override border-radius */
|
|
238
|
+
border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp16 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp16 === void 0 ? void 0 : _webChatContainerProp16.bubbleBorderRadius) ?? 0} !important; /* Override border-radius */
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
.webchat__stacked-layout_container>div {
|