@microsoft/omnichannel-chat-widget 1.8.4-main.7bdb634 → 1.8.4-main.9ae37a9
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 +3 -0
- package/lib/cjs/common/telemetry/AppInsightsEvents.js +14 -9
- package/lib/cjs/common/telemetry/TelemetryConstants.js +15 -2
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -7
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +26 -10
- 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/ChatWidgetEvents.js +1 -1
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +26 -20
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
- package/lib/cjs/components/livechatwidget/common/endChat.js +21 -9
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +9 -2
- 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/livechatwidgetstateful/LiveChatWidgetStateful.js +123 -28
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +31 -4
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -3
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +30 -29
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +6 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +30 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +21 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +1 -0
- 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 +3 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +14 -9
- package/lib/esm/common/telemetry/TelemetryConstants.js +13 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +27 -11
- 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/ChatWidgetEvents.js +1 -1
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +26 -20
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
- package/lib/esm/components/livechatwidget/common/endChat.js +21 -9
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +9 -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/livechatwidgetstateful/LiveChatWidgetStateful.js +124 -29
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +33 -6
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -4
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +30 -32
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +6 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +30 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +21 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +1 -0
- 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 +3 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +12 -1
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +5 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +15 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +1 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
- 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 +5 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +2 -2
|
@@ -149,7 +149,7 @@ const getPostChatContext = async (facadeChatSDK, state, dispatch) => {
|
|
|
149
149
|
if ((state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.postChatContext) === undefined) {
|
|
150
150
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
151
151
|
const context = await facadeChatSDK.getPostChatSurveyContext();
|
|
152
|
-
TelemetryHelper.
|
|
152
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
153
153
|
Event: TelemetryEvent.PostChatContextCallSucceed,
|
|
154
154
|
Description: PostChatSurveyTelemetryMessage.PostChatContextCallSucceed
|
|
155
155
|
});
|
|
@@ -167,7 +167,7 @@ const getPostChatContext = async (facadeChatSDK, state, dispatch) => {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
} catch (error) {
|
|
170
|
-
TelemetryHelper.
|
|
170
|
+
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
171
171
|
Event: TelemetryEvent.PostChatContextCallFailed,
|
|
172
172
|
Description: PostChatSurveyTelemetryMessage.PostChatContextCallFailed,
|
|
173
173
|
ExceptionDetails: {
|
|
@@ -19,13 +19,13 @@ export const setPostChatContextAndLoadSurvey = async (facadeChatSDK, dispatch, p
|
|
|
19
19
|
const postChatEnabled = postChatConfig.postChatEnabled;
|
|
20
20
|
if (postChatEnabled) {
|
|
21
21
|
if (!persistedChat) {
|
|
22
|
-
TelemetryHelper.
|
|
22
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
23
23
|
Event: TelemetryEvent.PostChatContextCallStarted,
|
|
24
24
|
Description: PostChatSurveyTelemetryMessage.PostChatContextCallStarted
|
|
25
25
|
});
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
27
|
const context = await facadeChatSDK.getPostChatSurveyContext();
|
|
28
|
-
TelemetryHelper.
|
|
28
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
29
29
|
Event: TelemetryEvent.PostChatContextCallSucceed,
|
|
30
30
|
Description: PostChatSurveyTelemetryMessage.PostChatContextCallSucceed
|
|
31
31
|
});
|
|
@@ -42,7 +42,7 @@ export const setPostChatContextAndLoadSurvey = async (facadeChatSDK, dispatch, p
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
} catch (ex) {
|
|
45
|
-
TelemetryHelper.
|
|
45
|
+
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
46
46
|
Event: TelemetryEvent.PostChatContextCallFailed,
|
|
47
47
|
Description: PostChatSurveyTelemetryMessage.PostChatContextCallFailed,
|
|
48
48
|
ExceptionDetails: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
1
|
+
import { BroadcastEvent, ConversationStage, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import { Constants, LiveWorkItemState, WidgetLoadTelemetryMessage } from "../../../common/Constants";
|
|
3
3
|
import { TelemetryManager, TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
4
4
|
import { checkContactIdError, createTimer, getConversationDetailsCall, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isNullOrUndefined, isUndefinedOrEmpty } from "../../../common/utils";
|
|
5
5
|
import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "./reconnectChatHelper";
|
|
6
|
-
import { handleStartChatError, logWidgetLoadComplete } from "./startChatErrorHandler";
|
|
6
|
+
import { handleStartChatError, logStartChatComplete, logWidgetLoadComplete } from "./startChatErrorHandler";
|
|
7
7
|
import { ActivityStreamHandler } from "./ActivityStreamHandler";
|
|
8
8
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
9
9
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
@@ -174,7 +174,10 @@ const initStartChat = async (facadeChatSDK, dispatch, setAdapter, state, props,
|
|
|
174
174
|
TelemetryTimers.WidgetLoadTimer = createTimer();
|
|
175
175
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
176
176
|
Event: TelemetryEvent.WidgetLoadStarted,
|
|
177
|
-
Description: "Widget start chat started."
|
|
177
|
+
Description: "Widget start chat started.",
|
|
178
|
+
CustomProperties: {
|
|
179
|
+
ConversationStage: ConversationStage.Initialization
|
|
180
|
+
}
|
|
178
181
|
});
|
|
179
182
|
|
|
180
183
|
//Check if chat retrieved from cache
|
|
@@ -202,6 +205,7 @@ const initStartChat = async (facadeChatSDK, dispatch, setAdapter, state, props,
|
|
|
202
205
|
const startTime = new Date().getTime();
|
|
203
206
|
createTrackingForFirstMessage();
|
|
204
207
|
await facadeChatSDK.startChat(startChatOptionalParams);
|
|
208
|
+
logStartChatComplete();
|
|
205
209
|
isStartChatSuccessful = true;
|
|
206
210
|
await createAdapterAndSubscribe(facadeChatSDK, dispatch, setAdapter, startTime, props);
|
|
207
211
|
} catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChatSDKError, ChatSDKErrorName } from "@microsoft/omnichannel-chat-sdk";
|
|
2
|
-
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { ConversationStage, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import { PrepareEndChatDescriptionConstants, WidgetLoadCustomErrorString, WidgetLoadTelemetryMessage } from "../../../common/Constants";
|
|
4
4
|
import { callingStateCleanUp, chatSDKStateCleanUp, closeChatStateCleanUp, endChatStateCleanUp } from "./endChat";
|
|
5
5
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
@@ -118,7 +118,10 @@ const logWidgetLoadFailed = ex => {
|
|
|
118
118
|
Event: TelemetryEvent.WidgetLoadFailed,
|
|
119
119
|
Description: "Widget load complete with error",
|
|
120
120
|
ExceptionDetails: exDetails,
|
|
121
|
-
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg === void 0 ? void 0 : _TelemetryTimers$Widg.milliSecondsElapsed
|
|
121
|
+
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg === void 0 ? void 0 : _TelemetryTimers$Widg.milliSecondsElapsed,
|
|
122
|
+
CustomProperties: {
|
|
123
|
+
ConversationStage: ConversationStage.Initialization
|
|
124
|
+
}
|
|
122
125
|
});
|
|
123
126
|
};
|
|
124
127
|
export const logWidgetLoadComplete = additionalMessage => {
|
|
@@ -133,6 +136,16 @@ export const logWidgetLoadComplete = additionalMessage => {
|
|
|
133
136
|
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg2 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg2 === void 0 ? void 0 : _TelemetryTimers$Widg2.milliSecondsElapsed
|
|
134
137
|
});
|
|
135
138
|
};
|
|
139
|
+
export const logStartChatComplete = additionalMessage => {
|
|
140
|
+
let descriptionString = "Start chat complete";
|
|
141
|
+
if (additionalMessage) {
|
|
142
|
+
descriptionString += `. ${additionalMessage}`;
|
|
143
|
+
}
|
|
144
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
145
|
+
Event: TelemetryEvent.StartChatComplete,
|
|
146
|
+
Description: descriptionString
|
|
147
|
+
});
|
|
148
|
+
};
|
|
136
149
|
const logWidgetLoadCompleteWithError = ex => {
|
|
137
150
|
var _TelemetryTimers$Widg3;
|
|
138
151
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -149,7 +162,10 @@ const logWidgetLoadCompleteWithError = ex => {
|
|
|
149
162
|
Event: TelemetryEvent.WidgetLoadFailed,
|
|
150
163
|
Description: "Widget load complete with error",
|
|
151
164
|
ExceptionDetails: exDetails,
|
|
152
|
-
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
|
|
165
|
+
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed,
|
|
166
|
+
CustomProperties: {
|
|
167
|
+
ConversationStage: ConversationStage.Initialization
|
|
168
|
+
}
|
|
153
169
|
});
|
|
154
170
|
};
|
|
155
171
|
export const logWidgetLoadWithUnexpectedError = ex => {
|
|
@@ -177,7 +193,10 @@ export const logWidgetLoadWithUnexpectedError = ex => {
|
|
|
177
193
|
Event: TelemetryEvent.WidgetLoadFailed,
|
|
178
194
|
Description: "Widget load with unexpected error",
|
|
179
195
|
ExceptionDetails: exDetails,
|
|
180
|
-
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed
|
|
196
|
+
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed,
|
|
197
|
+
CustomProperties: {
|
|
198
|
+
ConversationStage: ConversationStage.Initialization
|
|
199
|
+
}
|
|
181
200
|
});
|
|
182
201
|
};
|
|
183
202
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { BroadcastEvent, ConversationStage, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Components } from "botframework-webchat";
|
|
5
5
|
import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, PrepareEndChatDescriptionConstants, StorageType, WidgetLoadCustomErrorString } from "../../../common/Constants";
|
|
@@ -54,14 +54,18 @@ import { startProactiveChat } from "../common/startProactiveChat";
|
|
|
54
54
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
55
55
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
56
56
|
import useFacadeSDKStore from "../../../hooks/useFacadeChatSDKStore";
|
|
57
|
+
import { getPostChatContext, initiatePostChat } from "../common/renderSurveyHelpers";
|
|
57
58
|
let uiTimer;
|
|
58
59
|
export const LiveChatWidgetStateful = props => {
|
|
59
|
-
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$styleProps, _props$webChatContain10, _props$webChatContain11, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain15, _state$
|
|
60
|
+
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$styleProps, _props$webChatContain10, _props$webChatContain11, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain15, _state$appStates8, _props$webChatContain17, _props$webChatContain18, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _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
61
|
useEffect(() => {
|
|
61
62
|
uiTimer = createTimer();
|
|
62
63
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
63
64
|
Event: TelemetryEvent.UXLiveChatWidgetStart,
|
|
64
|
-
Description: "Live chat widget loading started."
|
|
65
|
+
Description: "Live chat widget loading started.",
|
|
66
|
+
CustomProperties: {
|
|
67
|
+
ConversationStage: ConversationStage.Initialization
|
|
68
|
+
}
|
|
65
69
|
});
|
|
66
70
|
}, []);
|
|
67
71
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -314,7 +318,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
314
318
|
});
|
|
315
319
|
});
|
|
316
320
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartProactiveChat).subscribe(msg => {
|
|
317
|
-
TelemetryHelper.
|
|
321
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
318
322
|
Event: TelemetryEvent.StartProactiveChatEventReceived,
|
|
319
323
|
Description: "Start proactive chat event received."
|
|
320
324
|
});
|
|
@@ -440,7 +444,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
440
444
|
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
441
445
|
});
|
|
442
446
|
}
|
|
443
|
-
TelemetryHelper.
|
|
447
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
444
448
|
Event: TelemetryEvent.StartChatEventReceived,
|
|
445
449
|
Description: "Start chat event received."
|
|
446
450
|
});
|
|
@@ -487,18 +491,91 @@ export const LiveChatWidgetStateful = props => {
|
|
|
487
491
|
return;
|
|
488
492
|
}
|
|
489
493
|
});
|
|
494
|
+
const handleInitiateEndChatForPersistentChat = async (msg, conversationDetails) => {
|
|
495
|
+
var _msg$payload10, _msg$payload11, _msg$payload12;
|
|
496
|
+
//If the payload does NOT include the skipSessionCloseForPersistentChat flag, default is false. Upon receiving the customer event, always ending session from C2.
|
|
497
|
+
const skipSessionCloseForPersistentChat = typeof (msg === null || msg === void 0 ? void 0 : (_msg$payload10 = msg.payload) === null || _msg$payload10 === void 0 ? void 0 : _msg$payload10[Constants.SkipSessionCloseForPersistentChatFlag]) === Constants.String && (msg === null || msg === void 0 ? void 0 : (_msg$payload11 = msg.payload) === null || _msg$payload11 === void 0 ? void 0 : _msg$payload11[Constants.SkipSessionCloseForPersistentChatFlag]).toLowerCase() === Constants.true || (msg === null || msg === void 0 ? void 0 : (_msg$payload12 = msg.payload) === null || _msg$payload12 === void 0 ? void 0 : _msg$payload12[Constants.SkipSessionCloseForPersistentChatFlag]) === true;
|
|
498
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
499
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
500
|
+
Description: "Processing initiateEndChat for persistent chat",
|
|
501
|
+
CustomProperties: {
|
|
502
|
+
conversationDetails
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
const conversationState = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state;
|
|
506
|
+
if (conversationState !== LiveWorkItemState.Closed && conversationState !== LiveWorkItemState.WrapUp) {
|
|
507
|
+
if (skipSessionCloseForPersistentChat) {
|
|
508
|
+
var _conversationDetails$;
|
|
509
|
+
if (((_conversationDetails$ = conversationDetails.canRenderPostChat) === null || _conversationDetails$ === void 0 ? void 0 : _conversationDetails$.toLowerCase()) === "true") {
|
|
510
|
+
var _state$domainStates3;
|
|
511
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
512
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
513
|
+
Description: "Processing initiateEndChat, fetching postChatContext"
|
|
514
|
+
});
|
|
515
|
+
const postchatContext = (await getPostChatContext(facadeChatSDK, state, dispatch)) ?? (state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.postChatContext);
|
|
516
|
+
if (postchatContext) {
|
|
517
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
518
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
519
|
+
Description: "Processing initiateEndChat, initiatePostChat",
|
|
520
|
+
CustomProperties: {
|
|
521
|
+
postchatContext
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
await initiatePostChat(props, conversationDetails, state, dispatch, postchatContext);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
const skipEndChatSDK = false;
|
|
529
|
+
const skipCloseChat = false;
|
|
530
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
531
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
532
|
+
Description: "Processing initiateEndChat, trigger endChat"
|
|
533
|
+
});
|
|
534
|
+
await endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
//if conversation already closed, it is safe to unmount it upon receiving the closeChat event
|
|
538
|
+
else {
|
|
539
|
+
BroadcastService.postMessage({
|
|
540
|
+
eventName: BroadcastEvent.CloseChat
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
};
|
|
490
544
|
|
|
491
545
|
// End chat
|
|
492
|
-
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async
|
|
546
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async msg => {
|
|
493
547
|
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
494
548
|
Event: TelemetryEvent.EndChatEventReceived,
|
|
495
|
-
Description: "Received InitiateEndChat BroadcastEvent."
|
|
549
|
+
Description: "Received InitiateEndChat BroadcastEvent.",
|
|
550
|
+
CustomProperties: {
|
|
551
|
+
ConversationStage: ConversationStage.ConversationEnd,
|
|
552
|
+
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
553
|
+
}
|
|
496
554
|
});
|
|
497
|
-
|
|
498
|
-
|
|
555
|
+
const conversationDetails = await getConversationDetailsCall(facadeChatSDK);
|
|
556
|
+
const {
|
|
557
|
+
chatConfig
|
|
558
|
+
} = props;
|
|
559
|
+
const isPersistent = isPersistentEnabled(chatConfig);
|
|
560
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
561
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
562
|
+
Description: "Processing initiateEndChat, fetched conversation details",
|
|
563
|
+
CustomProperties: {
|
|
564
|
+
conversationDetails,
|
|
565
|
+
isPersistent
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
if (isPersistent && conversationDetails) {
|
|
569
|
+
await handleInitiateEndChatForPersistentChat(msg, conversationDetails);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
499
572
|
const persistedState = getStateFromCache(getWidgetCacheIdfromProps(props));
|
|
500
573
|
if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
|
|
501
|
-
|
|
574
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
575
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
576
|
+
Description: PrepareEndChatDescriptionConstants.InitiateEndChatReceivedActiveChat
|
|
577
|
+
});
|
|
578
|
+
//We need to simulate states for closing chat, in order to messup with close confirmation pane.
|
|
502
579
|
dispatch({
|
|
503
580
|
type: LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
|
|
504
581
|
payload: ConfirmationState.Ok
|
|
@@ -518,11 +595,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
518
595
|
Event: TelemetryEvent.PrepareEndChat,
|
|
519
596
|
Description: PrepareEndChatDescriptionConstants.InitiateEndChatReceived
|
|
520
597
|
});
|
|
521
|
-
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
598
|
+
await endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
522
599
|
}
|
|
523
|
-
BroadcastService.postMessage({
|
|
524
|
-
eventName: BroadcastEvent.CloseChat
|
|
525
|
-
});
|
|
526
600
|
});
|
|
527
601
|
|
|
528
602
|
// End chat on browser unload
|
|
@@ -533,8 +607,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
533
607
|
// Listen to end chat event from other tabs
|
|
534
608
|
const endChatEventName = getWidgetEndChatEventName((_facadeChatSDK$getCha3 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha3 === void 0 ? void 0 : (_facadeChatSDK$getCha4 = _facadeChatSDK$getCha3.omnichannelConfig) === null || _facadeChatSDK$getCha4 === void 0 ? void 0 : _facadeChatSDK$getCha4.orgId, (_facadeChatSDK$getCha5 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha5 === void 0 ? void 0 : (_facadeChatSDK$getCha6 = _facadeChatSDK$getCha5.omnichannelConfig) === null || _facadeChatSDK$getCha6 === void 0 ? void 0 : _facadeChatSDK$getCha6.widgetId, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
535
609
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
536
|
-
var _msg$
|
|
537
|
-
if ((msg === null || msg === void 0 ? void 0 : (_msg$
|
|
610
|
+
var _msg$payload13;
|
|
611
|
+
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload13 = msg.payload) === null || _msg$payload13 === void 0 ? void 0 : _msg$payload13.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
538
612
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
539
613
|
Event: TelemetryEvent.PrepareEndChat,
|
|
540
614
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
@@ -576,8 +650,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
576
650
|
|
|
577
651
|
// Retrieve convId
|
|
578
652
|
BroadcastService.getMessageByEventName(BroadcastEvent.UpdateConversationDataForTelemetry).subscribe(msg => {
|
|
579
|
-
var _msg$
|
|
580
|
-
if ((_msg$
|
|
653
|
+
var _msg$payload14, _msg$payload14$liveWo;
|
|
654
|
+
if ((_msg$payload14 = msg.payload) !== null && _msg$payload14 !== void 0 && (_msg$payload14$liveWo = _msg$payload14.liveWorkItem) !== null && _msg$payload14$liveWo !== void 0 && _msg$payload14$liveWo.conversationId) {
|
|
581
655
|
setConversationId(msg.payload.liveWorkItem.conversationId);
|
|
582
656
|
}
|
|
583
657
|
});
|
|
@@ -695,14 +769,22 @@ export const LiveChatWidgetStateful = props => {
|
|
|
695
769
|
}
|
|
696
770
|
}, [state.domainStates.confirmationState]);
|
|
697
771
|
useEffect(() => {
|
|
698
|
-
var
|
|
772
|
+
var _inMemoryState$appSta7, _inMemoryState$appSta8, _inMemoryState$appSta9, _inMemoryState$appSta10, _inMemoryState$appSta11, _inMemoryState$appSta12, _inMemoryState$appSta13;
|
|
773
|
+
const inMemoryState = executeReducer(state, {
|
|
774
|
+
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
775
|
+
payload: null
|
|
776
|
+
});
|
|
699
777
|
// Do not process anything during initialization
|
|
700
|
-
if ((
|
|
778
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta7 = inMemoryState.appStates) === null || _inMemoryState$appSta7 === void 0 ? void 0 : _inMemoryState$appSta7.conversationEndedBy) === ConversationEndEntity.NotSet) {
|
|
779
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
780
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
781
|
+
Description: "conversationEndedBy is not set"
|
|
782
|
+
});
|
|
701
783
|
return;
|
|
702
784
|
}
|
|
703
785
|
|
|
704
786
|
// If start chat failed, and C2 is trying to close chat widget
|
|
705
|
-
if (
|
|
787
|
+
if (inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta8 = inMemoryState.appStates) !== null && _inMemoryState$appSta8 !== void 0 && _inMemoryState$appSta8.startChatFailed || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta9 = inMemoryState.appStates) === null || _inMemoryState$appSta9 === void 0 ? void 0 : _inMemoryState$appSta9.conversationState) === ConversationState.Postchat) {
|
|
706
788
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
707
789
|
Event: TelemetryEvent.PrepareEndChat,
|
|
708
790
|
Description: PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
|
|
@@ -712,7 +794,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
712
794
|
}
|
|
713
795
|
|
|
714
796
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
715
|
-
if ((
|
|
797
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta10 = inMemoryState.appStates) === null || _inMemoryState$appSta10 === void 0 ? void 0 : _inMemoryState$appSta10.conversationState) === ConversationState.InActive) {
|
|
716
798
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
717
799
|
Event: TelemetryEvent.PrepareEndChat,
|
|
718
800
|
Description: PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
|
|
@@ -720,11 +802,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
720
802
|
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
721
803
|
return;
|
|
722
804
|
}
|
|
723
|
-
const isConversationalSurveyEnabled =
|
|
805
|
+
const isConversationalSurveyEnabled = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta11 = inMemoryState.appStates) === null || _inMemoryState$appSta11 === void 0 ? void 0 : _inMemoryState$appSta11.isConversationalSurveyEnabled;
|
|
724
806
|
|
|
725
807
|
// In conversational survey, we need to check post chat survey logics before we set ConversationState to InActive
|
|
726
808
|
// Hence setting ConversationState to InActive will be done later in the post chat flows
|
|
727
|
-
if (!isConversationalSurveyEnabled && (
|
|
809
|
+
if (!isConversationalSurveyEnabled && (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta12 = inMemoryState.appStates) === null || _inMemoryState$appSta12 === void 0 ? void 0 : _inMemoryState$appSta12.conversationEndedBy) === ConversationEndEntity.Agent || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta13 = inMemoryState.appStates) === null || _inMemoryState$appSta13 === void 0 ? void 0 : _inMemoryState$appSta13.conversationEndedBy) === ConversationEndEntity.Bot) {
|
|
728
810
|
dispatch({
|
|
729
811
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
730
812
|
payload: ConversationState.InActive
|
|
@@ -732,8 +814,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
732
814
|
}
|
|
733
815
|
|
|
734
816
|
// All other cases
|
|
735
|
-
prepareEndChat(props, facadeChatSDK,
|
|
736
|
-
}, [state === null || state === void 0 ? void 0 : (_state$
|
|
817
|
+
prepareEndChat(props, facadeChatSDK, inMemoryState, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
818
|
+
}, [state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy]);
|
|
737
819
|
|
|
738
820
|
// Publish chat widget state
|
|
739
821
|
useEffect(() => {
|
|
@@ -765,13 +847,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
765
847
|
|
|
766
848
|
// Handle Chat disconnect cases
|
|
767
849
|
useEffect(() => {
|
|
768
|
-
var _inMemoryState$
|
|
850
|
+
var _inMemoryState$appSta14;
|
|
769
851
|
const inMemoryState = executeReducer(state, {
|
|
770
852
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
771
853
|
payload: null
|
|
772
854
|
});
|
|
773
855
|
handleChatDisconnect(props, inMemoryState, setWebChatStyles);
|
|
774
|
-
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
856
|
+
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta14 = inMemoryState.appStates) === null || _inMemoryState$appSta14 === void 0 ? void 0 : _inMemoryState$appSta14.chatDisconnectEventReceived;
|
|
775
857
|
if (chatDisconnectState && adapter) {
|
|
776
858
|
try {
|
|
777
859
|
adapter.end();
|
|
@@ -797,7 +879,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
797
879
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
798
880
|
Event: TelemetryEvent.UXLiveChatWidgetCompleted,
|
|
799
881
|
Description: "Live chat widget loading completed.",
|
|
800
|
-
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
882
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
883
|
+
CustomProperties: {
|
|
884
|
+
ConversationStage: ConversationStage.Initialization
|
|
885
|
+
}
|
|
801
886
|
});
|
|
802
887
|
}, []);
|
|
803
888
|
const initiateEndChatOnBrowserUnload = () => {
|
|
@@ -867,6 +952,16 @@ export const LiveChatWidgetStateful = props => {
|
|
|
867
952
|
bubbleTextColor
|
|
868
953
|
}), [webChatStyles, bubbleBackground, bubbleTextColor]);
|
|
869
954
|
|
|
955
|
+
// React to dynamic bot avatar initials updates from context
|
|
956
|
+
useEffect(() => {
|
|
957
|
+
if (state.domainStates.botAvatarInitials && state.domainStates.botAvatarInitials !== webChatStyles.botAvatarInitials) {
|
|
958
|
+
setWebChatStyles(styles => ({
|
|
959
|
+
...styles,
|
|
960
|
+
botAvatarInitials: state.domainStates.botAvatarInitials
|
|
961
|
+
}));
|
|
962
|
+
}
|
|
963
|
+
}, [state.domainStates.botAvatarInitials]);
|
|
964
|
+
|
|
870
965
|
// WebChat's Composer can only be rendered if a directLine object is defined
|
|
871
966
|
return directLine && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
872
967
|
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
1
|
+
import { ConversationStage, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
3
|
import { ParticipantType } from "../../common/Constants";
|
|
4
4
|
import { CustomerVoiceEvents } from "./enums/CustomerVoiceEvents";
|
|
@@ -6,9 +6,10 @@ import { PostChatSurveyMode } from "./enums/PostChatSurveyMode";
|
|
|
6
6
|
import { PostChatSurveyPane } from "@microsoft/omnichannel-chat-components";
|
|
7
7
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
8
8
|
import { defaultGeneralPostChatSurveyPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps";
|
|
9
|
-
import { findAllFocusableElement } from "../../common/utils";
|
|
9
|
+
import { createTimer, findAllFocusableElement } from "../../common/utils";
|
|
10
10
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
11
11
|
import isValidSurveyUrl from "./common/isValidSurveyUrl";
|
|
12
|
+
let uiTimer;
|
|
12
13
|
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact, customerVoiceSurveyCorrelationId) {
|
|
13
14
|
let showMultiLingual = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
14
15
|
const surveyLinkParams = new URLSearchParams({
|
|
@@ -22,6 +23,16 @@ const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, co
|
|
|
22
23
|
};
|
|
23
24
|
export const PostChatSurveyPaneStateful = props => {
|
|
24
25
|
var _props$styleProps, _state$appStates, _props$controlProps;
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
uiTimer = createTimer();
|
|
28
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
29
|
+
Event: TelemetryEvent.UXPostChatPaneStarted,
|
|
30
|
+
Description: "Postchat survey pane loading started.",
|
|
31
|
+
CustomProperties: {
|
|
32
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
25
36
|
const [state] = useChatContextStore();
|
|
26
37
|
const generalStyleProps = Object.assign({}, defaultGeneralPostChatSurveyPaneStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
27
38
|
display: state.appStates.isMinimized ? "none" : "contents"
|
|
@@ -72,7 +83,14 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
72
83
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
73
84
|
Event: TelemetryEvent.PostChatSurveyLoaded
|
|
74
85
|
});
|
|
75
|
-
|
|
86
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
87
|
+
Event: TelemetryEvent.UXPostChatPaneCompleted,
|
|
88
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
89
|
+
Description: "Postchat survey pane loading completed.",
|
|
90
|
+
CustomProperties: {
|
|
91
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
92
|
+
}
|
|
93
|
+
});
|
|
76
94
|
//Customer Voice Telemetry Events
|
|
77
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
96
|
window.addEventListener("message", message => {
|
|
@@ -85,16 +103,22 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
85
103
|
Event: TelemetryEvent.CustomerVoiceResponsePageLoaded
|
|
86
104
|
});
|
|
87
105
|
} else if (data === CustomerVoiceEvents.FormResponseSubmitted) {
|
|
88
|
-
TelemetryHelper.
|
|
106
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
89
107
|
Event: TelemetryEvent.CustomerVoiceFormResponseSubmitted,
|
|
90
|
-
Description: "Customer Voice form response submitted."
|
|
108
|
+
Description: "Customer Voice form response submitted.",
|
|
109
|
+
CustomProperties: {
|
|
110
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
111
|
+
}
|
|
91
112
|
});
|
|
92
113
|
} else if (data === CustomerVoiceEvents.FormResponseError) {
|
|
93
|
-
TelemetryHelper.
|
|
114
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
94
115
|
Event: TelemetryEvent.CustomerVoiceFormResponseError,
|
|
95
116
|
Description: "Customer Voice form response error.",
|
|
96
117
|
ExceptionDetails: {
|
|
97
118
|
message: "Customer Voice form response error."
|
|
119
|
+
},
|
|
120
|
+
CustomProperties: {
|
|
121
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
98
122
|
}
|
|
99
123
|
});
|
|
100
124
|
} else if (typeof data === "string" && data.startsWith(CustomerVoiceEvents.FormsError)) {
|
|
@@ -103,6 +127,9 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
103
127
|
Description: "Customer Voice failed to load with forms error.",
|
|
104
128
|
ExceptionDetails: {
|
|
105
129
|
message: `Customer Voice forms error details: ${data}`
|
|
130
|
+
},
|
|
131
|
+
CustomProperties: {
|
|
132
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
106
133
|
}
|
|
107
134
|
});
|
|
108
135
|
}
|
|
@@ -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
|
|