@microsoft/omnichannel-chat-widget 0.1.0-main.20562ae → 0.1.0-main.4188c11
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 +32 -4
- package/lib/cjs/common/telemetry/TelemetryConstants.js +9 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -1
- package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/cjs/common/utils.js +16 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +1 -1
- package/lib/cjs/components/footerstateful/FooterStateful.js +1 -2
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +5 -14
- package/lib/cjs/components/livechatwidget/common/endChat.js +10 -9
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +7 -0
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +105 -20
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -15
- package/lib/cjs/components/livechatwidget/common/startChat.js +38 -29
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +30 -8
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +22 -21
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
- package/lib/cjs/contexts/createReducer.js +8 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
- package/lib/esm/common/Constants.js +28 -3
- package/lib/esm/common/telemetry/TelemetryConstants.js +9 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +9 -1
- package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/esm/common/utils.js +12 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +1 -1
- package/lib/esm/components/footerstateful/FooterStateful.js +1 -2
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +5 -15
- package/lib/esm/components/livechatwidget/common/endChat.js +10 -9
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +6 -0
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +94 -20
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -13
- package/lib/esm/components/livechatwidget/common/startChat.js +39 -30
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +27 -9
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +22 -21
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
- package/lib/esm/contexts/createReducer.js +8 -0
- package/lib/esm/plugins/newMessageEventHandler.js +10 -12
- package/lib/types/common/Constants.d.ts +16 -1
- package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +9 -2
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
- package/lib/types/common/utils.d.ts +1 -0
- package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -2
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +22 -21
- package/package.json +6 -7
|
@@ -11,10 +11,6 @@ var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidget
|
|
|
11
11
|
|
|
12
12
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
13
13
|
|
|
14
|
-
var _package = require("@microsoft/omnichannel-chat-components/package.json");
|
|
15
|
-
|
|
16
|
-
var _package2 = require("@microsoft/omnichannel-chat-sdk/package.json");
|
|
17
|
-
|
|
18
14
|
var _defaultAriaConfig = require("../../../common/telemetry/defaultConfigs/defaultAriaConfig");
|
|
19
15
|
|
|
20
16
|
var _defaultTelemetryInternalData = require("../../../common/telemetry/defaultConfigs/defaultTelemetryInternalData");
|
|
@@ -24,14 +20,6 @@ var _defaultTelemetryConfiguration = require("../../../common/telemetry/defaultC
|
|
|
24
20
|
const registerTelemetryLoggers = (props, dispatch) => {
|
|
25
21
|
var _props$liveChatContex, _props$liveChatContex2;
|
|
26
22
|
|
|
27
|
-
let widgetPackageInfo;
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
widgetPackageInfo = require("@microsoft/omnichannel-chat-widget/package.json");
|
|
31
|
-
} catch (error) {
|
|
32
|
-
widgetPackageInfo = "0.0.0-0";
|
|
33
|
-
}
|
|
34
|
-
|
|
35
23
|
const telemetryConfig = { ..._defaultTelemetryConfiguration.defaultTelemetryConfiguration,
|
|
36
24
|
...props.telemetryConfig
|
|
37
25
|
};
|
|
@@ -53,9 +41,9 @@ const registerTelemetryLoggers = (props, dispatch) => {
|
|
|
53
41
|
}
|
|
54
42
|
|
|
55
43
|
telemetryData = _TelemetryHelper.TelemetryHelper.addWidgetDataToTelemetry(telemetryConfig, telemetryData);
|
|
56
|
-
telemetryData.OCChatSDKVersion =
|
|
57
|
-
telemetryData.chatComponentVersion =
|
|
58
|
-
telemetryData.chatWidgetVersion =
|
|
44
|
+
telemetryData.OCChatSDKVersion = telemetryConfig.OCChatSDKVersion ?? "0.0.0-0";
|
|
45
|
+
telemetryData.chatComponentVersion = telemetryConfig.chatComponentVersion ?? "0.0.0-0";
|
|
46
|
+
telemetryData.chatWidgetVersion = telemetryConfig.chatWidgetVersion ?? "0.0.0-0";
|
|
59
47
|
telemetryData.orgId = (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId;
|
|
60
48
|
telemetryData.widgetId = (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId;
|
|
61
49
|
telemetryData.orgUrl = (_props$chatSDK3 = props.chatSDK) === null || _props$chatSDK3 === void 0 ? void 0 : (_props$chatSDK3$omnic = _props$chatSDK3.omnichannelConfig) === null || _props$chatSDK3$omnic === void 0 ? void 0 : _props$chatSDK3$omnic.orgUrl;
|
|
@@ -37,41 +37,50 @@ var _updateSessionDataForTelemetry = require("./updateSessionDataForTelemetry");
|
|
|
37
37
|
|
|
38
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
39
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
40
|
+
var _props$reconnectChatP;
|
|
41
|
+
|
|
40
42
|
if (await canConnectToExistingChat(props, chatSDK, state, dispatch, setAdapter)) {
|
|
41
43
|
return;
|
|
42
|
-
} //
|
|
43
|
-
|
|
44
|
+
} // Redirecting if unauthenticated reconnect chat expired
|
|
44
45
|
|
|
45
|
-
const parseToJson = false;
|
|
46
|
-
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
47
|
-
const showPrechat = state.appStates.conversationState === _ConversationState.ConversationState.ProactiveChat ? preChatSurveyResponse && state.appStates.proactiveChatStates.proactiveChatEnablePrechat : preChatSurveyResponse; // Getting reconnectId for authenticated chat
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
if ((_props$reconnectChatP = props.reconnectChatPaneProps) !== null && _props$reconnectChatP !== void 0 && _props$reconnectChatP.reconnectId) {
|
|
48
|
+
var _props$reconnectChatP2, _props$reconnectChatP3;
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
dispatch({
|
|
53
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
54
|
-
payload: reconnectId
|
|
55
|
-
});
|
|
56
|
-
dispatch({
|
|
57
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
58
|
-
payload: _ConversationState.ConversationState.ReconnectChat
|
|
59
|
-
});
|
|
60
|
-
} else if (showPrechat) {
|
|
61
|
-
dispatch({
|
|
62
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
63
|
-
payload: preChatSurveyResponse
|
|
64
|
-
});
|
|
65
|
-
dispatch({
|
|
66
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
67
|
-
payload: _ConversationState.ConversationState.Prechat
|
|
68
|
-
});
|
|
50
|
+
await (0, _reconnectChatHelper.handleRedirectUnauthenticatedReconnectChat)(chatSDK, dispatch, setAdapter, initStartChat, (_props$reconnectChatP2 = props.reconnectChatPaneProps) === null || _props$reconnectChatP2 === void 0 ? void 0 : _props$reconnectChatP2.reconnectId, (_props$reconnectChatP3 = props.reconnectChatPaneProps) === null || _props$reconnectChatP3 === void 0 ? void 0 : _props$reconnectChatP3.redirectInSameWindow);
|
|
69
51
|
} else {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
52
|
+
// Getting PreChat Survey Context
|
|
53
|
+
const parseToJson = false;
|
|
54
|
+
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
55
|
+
const showPrechat = state.appStates.conversationState === _ConversationState.ConversationState.ProactiveChat ? preChatSurveyResponse && state.appStates.proactiveChatStates.proactiveChatEnablePrechat : preChatSurveyResponse; // Getting reconnectId for authenticated chat
|
|
56
|
+
|
|
57
|
+
const reconnectId = await (0, _reconnectChatHelper.getReconnectIdForAuthenticatedChat)(props, chatSDK);
|
|
58
|
+
|
|
59
|
+
if (reconnectId) {
|
|
60
|
+
dispatch({
|
|
61
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
62
|
+
payload: reconnectId
|
|
63
|
+
});
|
|
64
|
+
dispatch({
|
|
65
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
66
|
+
payload: _ConversationState.ConversationState.ReconnectChat
|
|
67
|
+
});
|
|
68
|
+
} else if (showPrechat) {
|
|
69
|
+
dispatch({
|
|
70
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
71
|
+
payload: preChatSurveyResponse
|
|
72
|
+
});
|
|
73
|
+
dispatch({
|
|
74
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
75
|
+
payload: _ConversationState.ConversationState.Prechat
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
dispatch({
|
|
79
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
80
|
+
payload: _ConversationState.ConversationState.Loading
|
|
81
|
+
});
|
|
82
|
+
await initStartChat(chatSDK, dispatch, setAdapter);
|
|
83
|
+
}
|
|
75
84
|
}
|
|
76
85
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
86
|
|
|
@@ -107,7 +107,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
107
107
|
...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
|
|
108
108
|
}); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
109
109
|
|
|
110
|
-
const chatSDK = (0, _useChatSDKStore.default)();
|
|
110
|
+
const chatSDK = (0, _useChatSDKStore.default)(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
|
+
|
|
111
112
|
const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = (0, _react2.useState)(undefined);
|
|
112
113
|
const {
|
|
113
114
|
Composer
|
|
@@ -135,6 +136,10 @@ const LiveChatWidgetStateful = props => {
|
|
|
135
136
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SKIP_CHAT_BUTTON_RENDERING,
|
|
136
137
|
payload: ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.skipChatButtonRendering) || false
|
|
137
138
|
});
|
|
139
|
+
dispatch({
|
|
140
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
141
|
+
payload: false
|
|
142
|
+
});
|
|
138
143
|
(0, _initCallingSdk.initCallingSdk)(chatSDK, setVoiceVideoCallingSDK).then(sdkCreated => {
|
|
139
144
|
sdkCreated && dispatch({
|
|
140
145
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
@@ -145,7 +150,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
145
150
|
if (!((_props$controlProps3 = props.controlProps) !== null && _props$controlProps3 !== void 0 && _props$controlProps3.skipChatButtonRendering) && (_props$reconnectChatP = props.reconnectChatPaneProps) !== null && _props$reconnectChatP !== void 0 && _props$reconnectChatP.reconnectId) {
|
|
146
151
|
var _props$reconnectChatP2;
|
|
147
152
|
|
|
148
|
-
(0, _reconnectChatHelper.
|
|
153
|
+
(0, _reconnectChatHelper.startUnauthenticatedReconnectChat)(chatSDK, dispatch, setAdapter, (_props$reconnectChatP2 = props.reconnectChatPaneProps) === null || _props$reconnectChatP2 === void 0 ? void 0 : _props$reconnectChatP2.reconnectId, _startChat.initStartChat);
|
|
149
154
|
} // Initialize global dir
|
|
150
155
|
|
|
151
156
|
|
|
@@ -155,13 +160,11 @@ const LiveChatWidgetStateful = props => {
|
|
|
155
160
|
payload: globalDir
|
|
156
161
|
});
|
|
157
162
|
|
|
158
|
-
if ((_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.
|
|
163
|
+
if ((_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.liveChatContext) {
|
|
159
164
|
var _state$domainStates2;
|
|
160
165
|
|
|
161
166
|
const optionalParams = {
|
|
162
|
-
liveChatContext:
|
|
163
|
-
chatToken: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.chatToken
|
|
164
|
-
}
|
|
167
|
+
liveChatContext: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.liveChatContext
|
|
165
168
|
};
|
|
166
169
|
(0, _startChat.initStartChat)(chatSDK, dispatch, setAdapter, optionalParams);
|
|
167
170
|
}
|
|
@@ -171,9 +174,9 @@ const LiveChatWidgetStateful = props => {
|
|
|
171
174
|
var _props$reconnectChatP3;
|
|
172
175
|
|
|
173
176
|
if ((_props$reconnectChatP3 = props.reconnectChatPaneProps) !== null && _props$reconnectChatP3 !== void 0 && _props$reconnectChatP3.reconnectId && !state.appStates.reconnectId) {
|
|
174
|
-
var _props$reconnectChatP4;
|
|
177
|
+
var _props$reconnectChatP4, _props$reconnectChatP5;
|
|
175
178
|
|
|
176
|
-
(0, _reconnectChatHelper.handleUnauthenticatedReconnectChat)(dispatch, (_props$reconnectChatP4 = props.reconnectChatPaneProps) === null || _props$reconnectChatP4 === void 0 ? void 0 : _props$reconnectChatP4.reconnectId, _startChat.initStartChat);
|
|
179
|
+
(0, _reconnectChatHelper.handleUnauthenticatedReconnectChat)(chatSDK, dispatch, setAdapter, (_props$reconnectChatP4 = props.reconnectChatPaneProps) === null || _props$reconnectChatP4 === void 0 ? void 0 : _props$reconnectChatP4.reconnectId, _startChat.initStartChat, (_props$reconnectChatP5 = props.reconnectChatPaneProps) === null || _props$reconnectChatP5 === void 0 ? void 0 : _props$reconnectChatP5.redirectInSameWindow);
|
|
177
180
|
} else {
|
|
178
181
|
(0, _reconnectChatHelper.getReconnectIdForAuthenticatedChat)(props, chatSDK).then(authReconnectId => {
|
|
179
182
|
if (authReconnectId && !state.appStates.reconnectId) {
|
|
@@ -186,6 +189,12 @@ const LiveChatWidgetStateful = props => {
|
|
|
186
189
|
payload: _ConversationState.ConversationState.ReconnectChat
|
|
187
190
|
});
|
|
188
191
|
} else {
|
|
192
|
+
const chatStartedSkippingChatButtonRendering = {
|
|
193
|
+
eventName: _TelemetryConstants.BroadcastEvent.StartChatSkippingChatButtonRendering
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
_omnichannelChatComponents.BroadcastService.postMessage(chatStartedSkippingChatButtonRendering);
|
|
197
|
+
|
|
189
198
|
dispatch({
|
|
190
199
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
191
200
|
payload: _ConversationState.ConversationState.Loading
|
|
@@ -197,6 +206,19 @@ const LiveChatWidgetStateful = props => {
|
|
|
197
206
|
}
|
|
198
207
|
}, [state.appStates.skipChatButtonRendering]);
|
|
199
208
|
(0, _react2.useEffect)(() => {
|
|
209
|
+
// Add the custom context on receiving the SetCustomContext event
|
|
210
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
211
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
212
|
+
Event: _TelemetryConstants.TelemetryEvent.CustomContextReceived,
|
|
213
|
+
Description: "CustomContext received."
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
dispatch({
|
|
217
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
218
|
+
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
|
|
200
222
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName("StartProactiveChat").subscribe(msg => {
|
|
201
223
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
202
224
|
Event: _TelemetryConstants.TelemetryEvent.StartProactiveChatEventReceived,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createWebChatTelemetry = createWebChatTelemetry;
|
|
7
|
+
|
|
8
|
+
var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstants");
|
|
9
|
+
|
|
10
|
+
var _TelemetryHelper = require("../../../../common/telemetry/TelemetryHelper");
|
|
11
|
+
|
|
12
|
+
function createWebChatTelemetry() {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
const handleTelemetry = event => {
|
|
15
|
+
const {
|
|
16
|
+
level
|
|
17
|
+
} = event;
|
|
18
|
+
const loglevel = level ? level.toUpperCase() : "";
|
|
19
|
+
|
|
20
|
+
switch (loglevel) {
|
|
21
|
+
case _TelemetryConstants.LogLevel.DEBUG:
|
|
22
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.DEBUG, event);
|
|
23
|
+
|
|
24
|
+
break;
|
|
25
|
+
|
|
26
|
+
case _TelemetryConstants.LogLevel.WARN:
|
|
27
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.WARN, event);
|
|
28
|
+
|
|
29
|
+
break;
|
|
30
|
+
|
|
31
|
+
case _TelemetryConstants.LogLevel.ERROR:
|
|
32
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.ERROR, event);
|
|
33
|
+
|
|
34
|
+
break;
|
|
35
|
+
|
|
36
|
+
case _TelemetryConstants.LogLevel.INFO:
|
|
37
|
+
default:
|
|
38
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.INFO, event);
|
|
39
|
+
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return handleTelemetry;
|
|
45
|
+
}
|
|
@@ -17,25 +17,26 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
17
17
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT";
|
|
18
18
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 7] = "SET_OUTSIDE_OPERATING_HOURS";
|
|
19
19
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 8] = "SET_PRE_CHAT_SURVEY_RESPONSE";
|
|
20
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
21
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
22
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
23
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
24
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
25
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
26
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
27
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
28
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
29
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
30
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
31
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
32
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
33
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
34
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
35
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
36
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
37
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
38
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
39
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
40
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
20
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 9] = "SET_CUSTOM_CONTEXT";
|
|
21
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 10] = "SET_SHOW_CONFIRMATION";
|
|
22
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 11] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
|
|
23
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 12] = "SET_PRECHAT_RESPONSE_EMAIL";
|
|
24
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 13] = "SET_AUDIO_NOTIFICATION";
|
|
25
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 14] = "SET_E2VV_ENABLED";
|
|
26
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 15] = "SET_POST_CHAT_CONTEXT";
|
|
27
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 16] = "SHOW_CALLING_CONTAINER";
|
|
28
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 17] = "SET_INCOMING_CALL";
|
|
29
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 18] = "DISABLE_VIDEO_CALL";
|
|
30
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 19] = "DISABLE_LOCAL_VIDEO";
|
|
31
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 20] = "DISABLE_REMOTE_VIDEO";
|
|
32
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 21] = "SET_CHAT_TOKEN";
|
|
33
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SKIP_CHAT_BUTTON_RENDERING"] = 22] = "SET_SKIP_CHAT_BUTTON_RENDERING";
|
|
34
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 23] = "SET_PROACTIVE_CHAT_PARAMS";
|
|
35
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 24] = "SET_TELEMETRY_DATA";
|
|
36
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
|
|
37
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 26] = "SET_UNREAD_MESSAGE_COUNT";
|
|
38
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 27] = "SET_FOCUS_CHAT_BUTTON";
|
|
39
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
|
|
40
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
|
|
41
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
|
|
41
42
|
})(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
|
|
@@ -27,7 +27,8 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
27
27
|
postChatContext: undefined,
|
|
28
28
|
telemetryInternalData: {},
|
|
29
29
|
globalDir: "ltr",
|
|
30
|
-
liveChatContext: undefined
|
|
30
|
+
liveChatContext: undefined,
|
|
31
|
+
customContext: undefined
|
|
31
32
|
},
|
|
32
33
|
appStates: {
|
|
33
34
|
conversationState: _ConversationState.ConversationState.Closed,
|
|
@@ -69,6 +69,14 @@ const createReducer = () => {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
|
|
73
|
+
return { ...state,
|
|
74
|
+
domainStates: { ...state.domainStates,
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
customContext: action.payload
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
72
80
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
|
|
73
81
|
return { ...state,
|
|
74
82
|
appStates: { ...state.appStates,
|
|
@@ -13,8 +13,6 @@ var _Constants = require("../common/Constants");
|
|
|
13
13
|
|
|
14
14
|
var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
|
|
15
15
|
|
|
16
|
-
var _TelemetryManager = require("../common/telemetry/TelemetryManager");
|
|
17
|
-
|
|
18
16
|
const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
19
17
|
const onNewAdapterActivityHandler = activity => {
|
|
20
18
|
var _activity$channelData, _activity$channelData2, _activity$channelData3;
|
|
@@ -29,18 +27,16 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
29
27
|
|
|
30
28
|
const raiseMessageEvent = activity => {
|
|
31
29
|
if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message) {
|
|
32
|
-
var
|
|
30
|
+
var _text, _text2, _activity$channelData4, _activity$from;
|
|
33
31
|
|
|
34
32
|
const payload = {
|
|
33
|
+
// To identify hidden contents vs empty content
|
|
35
34
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
-
text: activity === null || activity === void 0 ? void 0 : activity.text,
|
|
37
|
-
id: activity === null || activity === void 0 ? void 0 : activity.id,
|
|
35
|
+
text: (activity === null || activity === void 0 ? void 0 : (_text = activity.text) === null || _text === void 0 ? void 0 : _text.length) >= 1 ? `*contents hidden (${activity === null || activity === void 0 ? void 0 : (_text2 = activity.text) === null || _text2 === void 0 ? void 0 : _text2.length} chars)*` : "",
|
|
38
36
|
type: activity === null || activity === void 0 ? void 0 : activity.type,
|
|
39
37
|
timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
|
|
40
|
-
chatId: chatId,
|
|
41
38
|
userId: userId,
|
|
42
|
-
|
|
43
|
-
channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
|
|
39
|
+
tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
|
|
44
40
|
messageType: ""
|
|
45
41
|
};
|
|
46
42
|
|
|
@@ -59,18 +55,18 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
59
55
|
Description: "New message sent"
|
|
60
56
|
});
|
|
61
57
|
} else {
|
|
62
|
-
var _activity$
|
|
58
|
+
var _activity$channelData5, _activity$channelData6;
|
|
63
59
|
|
|
64
|
-
if (activity !== null && activity !== void 0 && (_activity$
|
|
60
|
+
if (activity !== null && activity !== void 0 && (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.systemMessageTag)) {
|
|
65
61
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
62
|
payload.messageType = _Constants.Constants.systemMessageTag;
|
|
67
63
|
} else {
|
|
68
|
-
var _activity$
|
|
64
|
+
var _activity$channelData7, _activity$channelData8, _activity$channelData9;
|
|
69
65
|
|
|
70
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
67
|
const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
68
|
|
|
73
|
-
const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$
|
|
69
|
+
const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData7 = activity.channelData) !== null && _activity$channelData7 !== void 0 && _activity$channelData7.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData8 = activity.channelData) === null || _activity$channelData8 === void 0 ? void 0 : (_activity$channelData9 = _activity$channelData8.tags) === null || _activity$channelData9 === void 0 ? void 0 : _activity$channelData9.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
70
|
|
|
75
71
|
const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
|
|
76
72
|
|
|
@@ -90,7 +86,8 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
90
86
|
|
|
91
87
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
92
88
|
Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
|
|
93
|
-
Description: "New message received"
|
|
89
|
+
Description: "New message received",
|
|
90
|
+
Data: payload
|
|
94
91
|
});
|
|
95
92
|
}
|
|
96
93
|
}
|
|
@@ -122,8 +122,6 @@ _defineProperty(Constants, "InputSubmit", "InputSubmit");
|
|
|
122
122
|
|
|
123
123
|
_defineProperty(Constants, "ReconnectIdAttributeName", "oc.reconnectid");
|
|
124
124
|
|
|
125
|
-
_defineProperty(Constants, "redirectPageRequest", "redirectPageRequest");
|
|
126
|
-
|
|
127
125
|
_defineProperty(Constants, "LiveChatWidget", "LiveChatWidgetNew");
|
|
128
126
|
|
|
129
127
|
_defineProperty(Constants, "GuidPattern", "xx-x-4m-ym-xxx");
|
|
@@ -257,6 +255,15 @@ export let ChatSDKError;
|
|
|
257
255
|
ChatSDKError["WidgetUseOutsideOperatingHour"] = "WidgetUseOutsideOperatingHour";
|
|
258
256
|
})(ChatSDKError || (ChatSDKError = {}));
|
|
259
257
|
|
|
258
|
+
export let EnvironmentVersion;
|
|
259
|
+
|
|
260
|
+
(function (EnvironmentVersion) {
|
|
261
|
+
EnvironmentVersion["prod"] = "prod";
|
|
262
|
+
EnvironmentVersion["dogfood"] = "df";
|
|
263
|
+
EnvironmentVersion["int"] = "int";
|
|
264
|
+
EnvironmentVersion["test"] = "test";
|
|
265
|
+
})(EnvironmentVersion || (EnvironmentVersion = {}));
|
|
266
|
+
|
|
260
267
|
export class TranscriptConstants {}
|
|
261
268
|
|
|
262
269
|
_defineProperty(TranscriptConstants, "ChatTranscriptsBodyColor", "#F5F5F5");
|
|
@@ -277,4 +284,22 @@ _defineProperty(TranscriptConstants, "InternalMode", "internal");
|
|
|
277
284
|
|
|
278
285
|
_defineProperty(TranscriptConstants, "AgentDialogColor", "#2266E3");
|
|
279
286
|
|
|
280
|
-
_defineProperty(TranscriptConstants, "AgentFontColor", "white");
|
|
287
|
+
_defineProperty(TranscriptConstants, "AgentFontColor", "white");
|
|
288
|
+
|
|
289
|
+
export class AriaTelemetryConstants {}
|
|
290
|
+
|
|
291
|
+
_defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
|
|
292
|
+
|
|
293
|
+
_defineProperty(AriaTelemetryConstants, "GCCH_ENDPOINT", "https://tb.pipe.aria.microsoft.com/Collector/3.0/");
|
|
294
|
+
|
|
295
|
+
_defineProperty(AriaTelemetryConstants, "DOD_ENDPOINT", "https://pf.pipe.aria.microsoft.com/Collector/3.0");
|
|
296
|
+
|
|
297
|
+
_defineProperty(AriaTelemetryConstants, "EUROPE_ENDPOINT", "https://eu-mobile.events.data.microsoft.com/Collector/3.0/");
|
|
298
|
+
|
|
299
|
+
_defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
|
|
300
|
+
|
|
301
|
+
_defineProperty(AriaTelemetryConstants, "Public", "Public");
|
|
302
|
+
|
|
303
|
+
_defineProperty(AriaTelemetryConstants, "EU", "Europe");
|
|
304
|
+
|
|
305
|
+
_defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
|
|
@@ -35,6 +35,10 @@ export let BroadcastEvent; // Events being logged
|
|
|
35
35
|
BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
|
|
36
36
|
BroadcastEvent["NewMessageSent"] = "NewMessageSent";
|
|
37
37
|
BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
|
|
38
|
+
BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
|
|
39
|
+
BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
|
|
40
|
+
BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
|
|
41
|
+
BroadcastEvent["SetCustomContext"] = "SetCustomContext";
|
|
38
42
|
})(BroadcastEvent || (BroadcastEvent = {}));
|
|
39
43
|
|
|
40
44
|
export let TelemetryEvent;
|
|
@@ -123,6 +127,7 @@ export let TelemetryEvent;
|
|
|
123
127
|
TelemetryEvent["InvalidConfiguration"] = "InvalidConfiguration";
|
|
124
128
|
TelemetryEvent["SendTypingIndicatorSucceeded"] = "SendTypingIndicatorSucceeded";
|
|
125
129
|
TelemetryEvent["SendTypingIndicatorFailed"] = "SendTypingIndicatorFailed";
|
|
130
|
+
TelemetryEvent["WebChatEvent"] = "WebChatEvent";
|
|
126
131
|
TelemetryEvent["PreChatSurveyStartChatMethodFailed"] = "PreChatSurveyStartChatMethodFailed";
|
|
127
132
|
TelemetryEvent["ChatAlreadyTriggered"] = "ChatAlreadyTriggered";
|
|
128
133
|
TelemetryEvent["StartProactiveChatEventReceived"] = "StartProactiveChatEventReceived";
|
|
@@ -136,6 +141,7 @@ export let TelemetryEvent;
|
|
|
136
141
|
TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
|
|
137
142
|
TelemetryEvent["MessageSent"] = "MessageSent";
|
|
138
143
|
TelemetryEvent["MessageReceived"] = "MessageReceived";
|
|
144
|
+
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
139
145
|
})(TelemetryEvent || (TelemetryEvent = {}));
|
|
140
146
|
|
|
141
147
|
export class TelemetryConstants {
|
|
@@ -178,6 +184,9 @@ export class TelemetryConstants {
|
|
|
178
184
|
case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
|
|
179
185
|
case TelemetryEvent.HeaderCloseButtonClicked:
|
|
180
186
|
case TelemetryEvent.HeaderMinimizeButtonClicked:
|
|
187
|
+
case TelemetryEvent.MessageSent:
|
|
188
|
+
case TelemetryEvent.MessageReceived:
|
|
189
|
+
case TelemetryEvent.CustomContextReceived:
|
|
181
190
|
return ScenarioType.ACTIONS;
|
|
182
191
|
|
|
183
192
|
case TelemetryEvent.StartChatSDKCall:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
-
import { ScenarioType } from "./TelemetryConstants";
|
|
3
|
+
import { ScenarioType, TelemetryEvent } from "./TelemetryConstants";
|
|
4
4
|
import { newGuid } from "../utils";
|
|
5
5
|
import { TelemetryManager } from "./TelemetryManager";
|
|
6
6
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
@@ -259,4 +259,16 @@ _defineProperty(TelemetryHelper, "logConfigDataEvent", (logLevel, payload) => {
|
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
BroadcastService.postMessage(telemetryEvent);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
_defineProperty(TelemetryHelper, "logWebChatEvent", (logLevel, payload) => {
|
|
265
|
+
const telemetryEvent = {
|
|
266
|
+
eventName: TelemetryEvent.WebChatEvent,
|
|
267
|
+
logLevel: logLevel,
|
|
268
|
+
payload: { ...payload,
|
|
269
|
+
type: TelemetryEvent.WebChatEvent,
|
|
270
|
+
scenarioType: ScenarioType.WEBCHAT
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
BroadcastService.postMessage(telemetryEvent);
|
|
262
274
|
});
|
|
@@ -5,6 +5,7 @@ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
|
5
5
|
import { ariaTelemetryLogger } from "./loggers/ariaTelemetryLogger";
|
|
6
6
|
import { consoleLogger } from "./loggers/consoleLogger";
|
|
7
7
|
import { defaultAriaConfig } from "./defaultConfigs/defaultAriaConfig";
|
|
8
|
+
import { TelemetryHelper } from "./TelemetryHelper";
|
|
8
9
|
export class TelemetryTimers {}
|
|
9
10
|
|
|
10
11
|
_defineProperty(TelemetryTimers, "LcwLoadToChatButtonTimer", void 0);
|
|
@@ -68,8 +69,15 @@ export const RegisterLoggers = () => {
|
|
|
68
69
|
|
|
69
70
|
const logTelemetry = telemetryEvent => {
|
|
70
71
|
loggers.map(logger => {
|
|
72
|
+
var _payload;
|
|
73
|
+
|
|
71
74
|
const logLevel = telemetryEvent.logLevel ?? LogLevel.INFO;
|
|
72
|
-
|
|
75
|
+
const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? ScenarioType.UNDEFINED;
|
|
76
|
+
const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
|
|
77
|
+
telemetryInput.telemetryInfo = {
|
|
78
|
+
telemetryInfo: TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
|
|
79
|
+
};
|
|
80
|
+
logger.log(logLevel, telemetryInput);
|
|
73
81
|
});
|
|
74
82
|
};
|
|
75
83
|
|
|
@@ -3,5 +3,8 @@ export const defaultTelemetryConfiguration = {
|
|
|
3
3
|
telemetryDisabled: false,
|
|
4
4
|
disableConsoleLog: false,
|
|
5
5
|
telemetryLoggers: [],
|
|
6
|
-
ariaConfigurations: defaultAriaConfig
|
|
6
|
+
ariaConfigurations: defaultAriaConfig,
|
|
7
|
+
chatWidgetVersion: "0.0.0-0",
|
|
8
|
+
chatComponentVersion: "0.0.0-0",
|
|
9
|
+
OCChatSDKVersion: "0.0.0-0"
|
|
7
10
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isNullOrEmptyString, isNullOrUndefined } from "../../utils";
|
|
1
|
+
import { getDomain, isNullOrEmptyString, isNullOrUndefined } from "../../utils";
|
|
2
2
|
import AWTEventProperties from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTEventProperties";
|
|
3
3
|
import AWTLogManager from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTLogManager";
|
|
4
4
|
import { AWTPiiKind } from "@microsoft/omnichannel-chat-sdk/lib/external/aria/common/Enums";
|
|
5
|
-
import { Constants } from "../../Constants";
|
|
6
|
-
import {
|
|
5
|
+
import { Constants, AriaTelemetryConstants, EnvironmentVersion } from "../../Constants";
|
|
6
|
+
import { TelemetryManager } from "../TelemetryManager";
|
|
7
7
|
export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
|
|
8
8
|
let _logger;
|
|
9
9
|
|
|
@@ -15,6 +15,21 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
15
15
|
|
|
16
16
|
if (!isNullOrEmptyString(collectiorUriForTelemetry)) {
|
|
17
17
|
configuration.collectorUri = collectiorUriForTelemetry;
|
|
18
|
+
} else {
|
|
19
|
+
if (TelemetryManager.InternalTelemetryData.environmentVersion == EnvironmentVersion.prod) {
|
|
20
|
+
var _TelemetryManager$Int;
|
|
21
|
+
|
|
22
|
+
const orgUrl = (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.orgUrl;
|
|
23
|
+
|
|
24
|
+
if (!isNullOrUndefined(orgUrl)) {
|
|
25
|
+
// If the given org is a Production EU org, modify the Aria collector uri
|
|
26
|
+
const region = getDomain(orgUrl);
|
|
27
|
+
|
|
28
|
+
if (region === AriaTelemetryConstants.EU) {
|
|
29
|
+
configuration.collectorUri = AriaTelemetryConstants.EUROPE_ENDPOINT;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
try {
|
|
@@ -33,18 +48,25 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
33
48
|
|
|
34
49
|
const ariaLogger = {
|
|
35
50
|
log: (logLevel, telemetryInput) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
for (const key of Object.keys(event)) {
|
|
42
|
-
property = typeof event[key] === "object" ? JSON.stringify(event[key]) : event[key];
|
|
43
|
-
eventProperties.setProperty(key, property);
|
|
44
|
-
}
|
|
51
|
+
try {
|
|
52
|
+
let property;
|
|
53
|
+
const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
|
|
54
|
+
const eventProperties = new AWTEventProperties();
|
|
55
|
+
eventProperties.setName(telemetryInput.scenarioType);
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
if (telemetryInfo) {
|
|
58
|
+
for (const key of Object.keys(telemetryInfo)) {
|
|
59
|
+
property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
|
|
60
|
+
eventProperties.setProperty(key, property);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, Constants.LiveChatWidget, AWTPiiKind.GenericData);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
69
|
+
}
|
|
48
70
|
},
|
|
49
71
|
dispose: () => {
|
|
50
72
|
AWTLogManager.flush(function () {
|