@microsoft/omnichannel-chat-widget 0.1.0-main.e170704 → 0.1.0-main.fb426ed
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/telemetry/TelemetryManager.js +7 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +8 -9
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/cjs/common/utils.js +1 -0
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +0 -12
- package/lib/cjs/components/livechatwidget/common/endChat.js +10 -9
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +4 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +17 -2
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +6 -1
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -0
- package/lib/cjs/contexts/createReducer.js +1 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
- package/lib/esm/common/telemetry/TelemetryManager.js +6 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +8 -6
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/esm/common/utils.js +1 -0
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +0 -12
- package/lib/esm/components/livechatwidget/common/endChat.js +10 -9
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +4 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +17 -2
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +6 -1
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -0
- package/lib/esm/contexts/createReducer.js +1 -0
- package/lib/esm/plugins/newMessageEventHandler.js +10 -12
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -0
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
- package/package.json +2 -2
|
@@ -15,6 +15,8 @@ var _consoleLogger = require("./loggers/consoleLogger");
|
|
|
15
15
|
|
|
16
16
|
var _defaultAriaConfig = require("./defaultConfigs/defaultAriaConfig");
|
|
17
17
|
|
|
18
|
+
var _TelemetryHelper = require("./TelemetryHelper");
|
|
19
|
+
|
|
18
20
|
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; }
|
|
19
21
|
|
|
20
22
|
class TelemetryTimers {}
|
|
@@ -92,7 +94,11 @@ const RegisterLoggers = () => {
|
|
|
92
94
|
|
|
93
95
|
const logLevel = telemetryEvent.logLevel ?? _TelemetryConstants.LogLevel.INFO;
|
|
94
96
|
const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? _TelemetryConstants.ScenarioType.UNDEFINED;
|
|
95
|
-
|
|
97
|
+
const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
|
|
98
|
+
telemetryInput.telemetryInfo = {
|
|
99
|
+
telemetryInfo: _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
|
|
100
|
+
};
|
|
101
|
+
logger.log(logLevel, telemetryInput);
|
|
96
102
|
});
|
|
97
103
|
};
|
|
98
104
|
|
|
@@ -15,8 +15,6 @@ var _Enums = require("@microsoft/omnichannel-chat-sdk/lib/external/aria/common/E
|
|
|
15
15
|
|
|
16
16
|
var _Constants = require("../../Constants");
|
|
17
17
|
|
|
18
|
-
var _TelemetryHelper = require("../TelemetryHelper");
|
|
19
|
-
|
|
20
18
|
var _TelemetryManager = require("../TelemetryManager");
|
|
21
19
|
|
|
22
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -67,18 +65,19 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
|
|
|
67
65
|
log: (logLevel, telemetryInput) => {
|
|
68
66
|
try {
|
|
69
67
|
let property;
|
|
68
|
+
const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
|
|
70
69
|
const eventProperties = new _AWTEventProperties.default();
|
|
71
|
-
|
|
72
|
-
const event = _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput);
|
|
73
|
-
|
|
74
70
|
eventProperties.setName(telemetryInput.scenarioType);
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
if (telemetryInfo) {
|
|
73
|
+
for (const key of Object.keys(telemetryInfo)) {
|
|
74
|
+
property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
|
|
75
|
+
eventProperties.setProperty(key, property);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
|
|
82
81
|
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
83
82
|
} catch (error) {
|
|
84
83
|
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
@@ -13,27 +13,28 @@ const consoleLogger = () => {
|
|
|
13
13
|
const consoleLogger = {
|
|
14
14
|
log: (logLevel, telemetryInput) => {
|
|
15
15
|
const payload = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.payload && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload : "";
|
|
16
|
+
const telemetryInfo = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.telemetryInfo && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo : "";
|
|
16
17
|
|
|
17
18
|
try {
|
|
18
19
|
switch (logLevel) {
|
|
19
20
|
case _TelemetryConstants.LogLevel.INFO:
|
|
20
|
-
console.info(_Constants.Constants.LiveChatWidget, payload);
|
|
21
|
+
console.info(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
21
22
|
break;
|
|
22
23
|
|
|
23
24
|
case _TelemetryConstants.LogLevel.DEBUG:
|
|
24
|
-
console.debug(_Constants.Constants.LiveChatWidget, payload);
|
|
25
|
+
console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
25
26
|
break;
|
|
26
27
|
|
|
27
28
|
case _TelemetryConstants.LogLevel.WARN:
|
|
28
|
-
console.warn(_Constants.Constants.LiveChatWidget, payload);
|
|
29
|
+
console.warn(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
29
30
|
break;
|
|
30
31
|
|
|
31
32
|
case _TelemetryConstants.LogLevel.ERROR:
|
|
32
|
-
console.error(_Constants.Constants.LiveChatWidget, payload);
|
|
33
|
+
console.error(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
33
34
|
break;
|
|
34
35
|
|
|
35
36
|
default:
|
|
36
|
-
console.debug(_Constants.Constants.LiveChatWidget, payload);
|
|
37
|
+
console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
37
38
|
break;
|
|
38
39
|
}
|
|
39
40
|
} catch (ex) {
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -206,6 +206,20 @@ const CallingContainerStateful = props => {
|
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
+
window.addEventListener("beforeunload", () => {
|
|
210
|
+
if (state.uiStates.isIncomingCall) {
|
|
211
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
|
|
212
|
+
} else {
|
|
213
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
|
|
217
|
+
dispatch({
|
|
218
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
219
|
+
payload: false
|
|
220
|
+
});
|
|
221
|
+
resetCallingStates(true);
|
|
222
|
+
});
|
|
209
223
|
}, []);
|
|
210
224
|
const controlProps = {
|
|
211
225
|
id: "oc-lcw-callingcontainer",
|
package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -138,7 +138,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
138
138
|
|
|
139
139
|
if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
|
|
140
140
|
fileAttachmentName = value.attachments[0].name;
|
|
141
|
-
value.content = attachmentMessage
|
|
141
|
+
value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -274,18 +274,6 @@ const dummyDefaultProps = {
|
|
|
274
274
|
width: "50px",
|
|
275
275
|
fontSize: "18px"
|
|
276
276
|
},
|
|
277
|
-
currentCallTimerStyleProps: {
|
|
278
|
-
borderRadius: "2px",
|
|
279
|
-
margin: "1px",
|
|
280
|
-
color: "#FFFFFF",
|
|
281
|
-
paddingTop: "18px",
|
|
282
|
-
fontSize: 12,
|
|
283
|
-
fontFamily: "Segoe UI, Arial, sans-serif",
|
|
284
|
-
backgroundColor: "darkgrey",
|
|
285
|
-
height: "45px",
|
|
286
|
-
width: "50px",
|
|
287
|
-
textAlign: "center"
|
|
288
|
-
},
|
|
289
277
|
videoTileStyleProps: {
|
|
290
278
|
width: "100%",
|
|
291
279
|
marginLeft: "auto",
|
|
@@ -63,7 +63,16 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
63
63
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
66
|
+
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat()); // Need to clear these states immediately when chat ended from OC.
|
|
67
|
+
|
|
68
|
+
dispatch({
|
|
69
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
70
|
+
payload: undefined
|
|
71
|
+
});
|
|
72
|
+
dispatch({
|
|
73
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
74
|
+
payload: undefined
|
|
75
|
+
});
|
|
67
76
|
} catch (ex) {
|
|
68
77
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
69
78
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCallFailed,
|
|
@@ -100,14 +109,6 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
100
109
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
|
|
101
110
|
payload: null
|
|
102
111
|
});
|
|
103
|
-
dispatch({
|
|
104
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
105
|
-
payload: undefined
|
|
106
|
-
});
|
|
107
|
-
dispatch({
|
|
108
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
109
|
-
payload: undefined
|
|
110
|
-
});
|
|
111
112
|
|
|
112
113
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
113
114
|
eventName: _TelemetryConstants.BroadcastEvent.EndChat
|
|
@@ -123,6 +123,10 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
123
123
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
124
124
|
payload: undefined
|
|
125
125
|
});
|
|
126
|
+
dispatch({
|
|
127
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
128
|
+
payload: undefined
|
|
129
|
+
});
|
|
126
130
|
};
|
|
127
131
|
|
|
128
132
|
webChatStore = (0, _botframeworkWebchat.createStore)({}, //initial state
|
|
@@ -35,7 +35,8 @@ var _setPostChatContextAndLoadSurvey = require("./setPostChatContextAndLoadSurve
|
|
|
35
35
|
|
|
36
36
|
var _updateSessionDataForTelemetry = require("./updateSessionDataForTelemetry");
|
|
37
37
|
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
let optionalParams = {}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
|
|
39
40
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
40
41
|
var _props$reconnectChatP;
|
|
41
42
|
|
|
@@ -74,11 +75,13 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
|
|
|
74
75
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
75
76
|
payload: _ConversationState.ConversationState.Prechat
|
|
76
77
|
});
|
|
78
|
+
setCustomContextParams(props, state);
|
|
77
79
|
} else {
|
|
78
80
|
dispatch({
|
|
79
81
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
80
82
|
payload: _ConversationState.ConversationState.Loading
|
|
81
83
|
});
|
|
84
|
+
setCustomContextParams(props, state);
|
|
82
85
|
await initStartChat(chatSDK, dispatch, setAdapter);
|
|
83
86
|
}
|
|
84
87
|
}
|
|
@@ -98,7 +101,8 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedSta
|
|
|
98
101
|
Event: _TelemetryConstants.TelemetryEvent.StartChatSDKCall
|
|
99
102
|
});
|
|
100
103
|
|
|
101
|
-
|
|
104
|
+
optionalParams = Object.assign({}, params, optionalParams);
|
|
105
|
+
await chatSDK.startChat(optionalParams);
|
|
102
106
|
} catch (error) {
|
|
103
107
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
104
108
|
Event: _TelemetryConstants.TelemetryEvent.StartChatMethodException,
|
|
@@ -198,4 +202,15 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
198
202
|
} else {
|
|
199
203
|
return false;
|
|
200
204
|
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const setCustomContextParams = (props, state) => {
|
|
208
|
+
var _props$chatConfig, _state$domainStates;
|
|
209
|
+
|
|
210
|
+
// Add custom context if any only for unauthenticated chat
|
|
211
|
+
if (!((_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && _props$chatConfig.LiveChatConfigAuthSettings) && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.customContext) {
|
|
212
|
+
optionalParams = Object.assign({}, optionalParams, {
|
|
213
|
+
customContext: state.domainStates.customContext
|
|
214
|
+
});
|
|
215
|
+
}
|
|
201
216
|
};
|
|
@@ -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,
|
|
@@ -109,9 +109,7 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
109
109
|
} else {
|
|
110
110
|
const prechatResponseValues = (0, _utils.extractPreChatSurveyResponseValues)(state.domainStates.preChatSurveyResponse, values);
|
|
111
111
|
optionalParams = {
|
|
112
|
-
|
|
113
|
-
preChatResponse: prechatResponseValues
|
|
114
|
-
}
|
|
112
|
+
preChatResponse: prechatResponseValues
|
|
115
113
|
};
|
|
116
114
|
setPreChatResponseEmail(values);
|
|
117
115
|
await initStartChat(optionalParams);
|
|
@@ -10,6 +10,7 @@ var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstan
|
|
|
10
10
|
var _TelemetryHelper = require("../../../../common/telemetry/TelemetryHelper");
|
|
11
11
|
|
|
12
12
|
function createWebChatTelemetry() {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
14
|
const handleTelemetry = event => {
|
|
14
15
|
const {
|
|
15
16
|
level
|
|
@@ -72,6 +72,7 @@ const createReducer = () => {
|
|
|
72
72
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
|
|
73
73
|
return { ...state,
|
|
74
74
|
domainStates: { ...state.domainStates,
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
76
|
customContext: action.payload
|
|
76
77
|
}
|
|
77
78
|
};
|
|
@@ -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
|
}
|
|
@@ -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);
|
|
@@ -72,7 +73,11 @@ export const RegisterLoggers = () => {
|
|
|
72
73
|
|
|
73
74
|
const logLevel = telemetryEvent.logLevel ?? LogLevel.INFO;
|
|
74
75
|
const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? ScenarioType.UNDEFINED;
|
|
75
|
-
|
|
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);
|
|
76
81
|
});
|
|
77
82
|
};
|
|
78
83
|
|
|
@@ -3,7 +3,6 @@ import AWTEventProperties from "@microsoft/omnichannel-chat-sdk/lib/external/ari
|
|
|
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
5
|
import { Constants, AriaTelemetryConstants, EnvironmentVersion } from "../../Constants";
|
|
6
|
-
import { TelemetryHelper } from "../TelemetryHelper";
|
|
7
6
|
import { TelemetryManager } from "../TelemetryManager";
|
|
8
7
|
export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
|
|
9
8
|
let _logger;
|
|
@@ -51,16 +50,19 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
51
50
|
log: (logLevel, telemetryInput) => {
|
|
52
51
|
try {
|
|
53
52
|
let property;
|
|
53
|
+
const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
|
|
54
54
|
const eventProperties = new AWTEventProperties();
|
|
55
|
-
const event = TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput);
|
|
56
55
|
eventProperties.setName(telemetryInput.scenarioType);
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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);
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, Constants.LiveChatWidget, AWTPiiKind.GenericData);
|
|
64
66
|
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
65
67
|
} catch (error) {
|
|
66
68
|
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
@@ -4,27 +4,28 @@ export const consoleLogger = () => {
|
|
|
4
4
|
const consoleLogger = {
|
|
5
5
|
log: (logLevel, telemetryInput) => {
|
|
6
6
|
const payload = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.payload && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload : "";
|
|
7
|
+
const telemetryInfo = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.telemetryInfo && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo : "";
|
|
7
8
|
|
|
8
9
|
try {
|
|
9
10
|
switch (logLevel) {
|
|
10
11
|
case LogLevel.INFO:
|
|
11
|
-
console.info(Constants.LiveChatWidget, payload);
|
|
12
|
+
console.info(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
12
13
|
break;
|
|
13
14
|
|
|
14
15
|
case LogLevel.DEBUG:
|
|
15
|
-
console.debug(Constants.LiveChatWidget, payload);
|
|
16
|
+
console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
16
17
|
break;
|
|
17
18
|
|
|
18
19
|
case LogLevel.WARN:
|
|
19
|
-
console.warn(Constants.LiveChatWidget, payload);
|
|
20
|
+
console.warn(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
20
21
|
break;
|
|
21
22
|
|
|
22
23
|
case LogLevel.ERROR:
|
|
23
|
-
console.error(Constants.LiveChatWidget, payload);
|
|
24
|
+
console.error(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
24
25
|
break;
|
|
25
26
|
|
|
26
27
|
default:
|
|
27
|
-
console.debug(Constants.LiveChatWidget, payload);
|
|
28
|
+
console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
28
29
|
break;
|
|
29
30
|
}
|
|
30
31
|
} catch (ex) {
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -277,6 +277,7 @@ export const createTimer = () => {
|
|
|
277
277
|
|
|
278
278
|
};
|
|
279
279
|
}; // Returns the domain of the org
|
|
280
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
280
281
|
|
|
281
282
|
export const getDomain = hostValue => {
|
|
282
283
|
for (let i = 0; i < AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
|
|
@@ -177,6 +177,20 @@ export const CallingContainerStateful = props => {
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
+
window.addEventListener("beforeunload", () => {
|
|
181
|
+
if (state.uiStates.isIncomingCall) {
|
|
182
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
|
|
183
|
+
} else {
|
|
184
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
|
|
188
|
+
dispatch({
|
|
189
|
+
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
190
|
+
payload: false
|
|
191
|
+
});
|
|
192
|
+
resetCallingStates(true);
|
|
193
|
+
});
|
|
180
194
|
}, []);
|
|
181
195
|
const controlProps = {
|
|
182
196
|
id: "oc-lcw-callingcontainer",
|
package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -127,7 +127,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
127
127
|
|
|
128
128
|
if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
|
|
129
129
|
fileAttachmentName = value.attachments[0].name;
|
|
130
|
-
value.content = attachmentMessage
|
|
130
|
+
value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -253,18 +253,6 @@ export const dummyDefaultProps = {
|
|
|
253
253
|
width: "50px",
|
|
254
254
|
fontSize: "18px"
|
|
255
255
|
},
|
|
256
|
-
currentCallTimerStyleProps: {
|
|
257
|
-
borderRadius: "2px",
|
|
258
|
-
margin: "1px",
|
|
259
|
-
color: "#FFFFFF",
|
|
260
|
-
paddingTop: "18px",
|
|
261
|
-
fontSize: 12,
|
|
262
|
-
fontFamily: "Segoe UI, Arial, sans-serif",
|
|
263
|
-
backgroundColor: "darkgrey",
|
|
264
|
-
height: "45px",
|
|
265
|
-
width: "50px",
|
|
266
|
-
textAlign: "center"
|
|
267
|
-
},
|
|
268
256
|
videoTileStyleProps: {
|
|
269
257
|
width: "100%",
|
|
270
258
|
marginLeft: "auto",
|
|
@@ -44,7 +44,16 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
44
44
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
45
45
|
Event: TelemetryEvent.EndChatSDKCall
|
|
46
46
|
});
|
|
47
|
-
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
47
|
+
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat()); // Need to clear these states immediately when chat ended from OC.
|
|
48
|
+
|
|
49
|
+
dispatch({
|
|
50
|
+
type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
51
|
+
payload: undefined
|
|
52
|
+
});
|
|
53
|
+
dispatch({
|
|
54
|
+
type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
55
|
+
payload: undefined
|
|
56
|
+
});
|
|
48
57
|
} catch (ex) {
|
|
49
58
|
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
50
59
|
Event: TelemetryEvent.EndChatSDKCallFailed,
|
|
@@ -81,14 +90,6 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
81
90
|
type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
|
|
82
91
|
payload: null
|
|
83
92
|
});
|
|
84
|
-
dispatch({
|
|
85
|
-
type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
86
|
-
payload: undefined
|
|
87
|
-
});
|
|
88
|
-
dispatch({
|
|
89
|
-
type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
90
|
-
payload: undefined
|
|
91
|
-
});
|
|
92
93
|
BroadcastService.postMessage({
|
|
93
94
|
eventName: BroadcastEvent.EndChat
|
|
94
95
|
});
|
|
@@ -84,6 +84,10 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
|
|
|
84
84
|
type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
85
85
|
payload: undefined
|
|
86
86
|
});
|
|
87
|
+
dispatch({
|
|
88
|
+
type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
89
|
+
payload: undefined
|
|
90
|
+
});
|
|
87
91
|
};
|
|
88
92
|
|
|
89
93
|
webChatStore = createStore({}, //initial state
|
|
@@ -12,7 +12,8 @@ import { createOnNewAdapterActivityHandler } from "../../../plugins/newMessageEv
|
|
|
12
12
|
import { createTimer } from "../../../common/utils";
|
|
13
13
|
import { getReconnectIdForAuthenticatedChat, handleRedirectUnauthenticatedReconnectChat } from "./reconnectChatHelper";
|
|
14
14
|
import { setPostChatContextAndLoadSurvey } from "./setPostChatContextAndLoadSurvey";
|
|
15
|
-
import { updateSessionDataForTelemetry } from "./updateSessionDataForTelemetry";
|
|
15
|
+
import { updateSessionDataForTelemetry } from "./updateSessionDataForTelemetry";
|
|
16
|
+
let optionalParams = {}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
17
|
|
|
17
18
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
18
19
|
var _props$reconnectChatP;
|
|
@@ -52,11 +53,13 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
|
|
|
52
53
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
53
54
|
payload: ConversationState.Prechat
|
|
54
55
|
});
|
|
56
|
+
setCustomContextParams(props, state);
|
|
55
57
|
} else {
|
|
56
58
|
dispatch({
|
|
57
59
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
58
60
|
payload: ConversationState.Loading
|
|
59
61
|
});
|
|
62
|
+
setCustomContextParams(props, state);
|
|
60
63
|
await initStartChat(chatSDK, dispatch, setAdapter);
|
|
61
64
|
}
|
|
62
65
|
}
|
|
@@ -72,7 +75,8 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedSta
|
|
|
72
75
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
73
76
|
Event: TelemetryEvent.StartChatSDKCall
|
|
74
77
|
});
|
|
75
|
-
|
|
78
|
+
optionalParams = Object.assign({}, params, optionalParams);
|
|
79
|
+
await chatSDK.startChat(optionalParams);
|
|
76
80
|
} catch (error) {
|
|
77
81
|
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
78
82
|
Event: TelemetryEvent.StartChatMethodException,
|
|
@@ -170,4 +174,15 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
170
174
|
}
|
|
171
175
|
};
|
|
172
176
|
|
|
177
|
+
const setCustomContextParams = (props, state) => {
|
|
178
|
+
var _props$chatConfig, _state$domainStates;
|
|
179
|
+
|
|
180
|
+
// Add custom context if any only for unauthenticated chat
|
|
181
|
+
if (!((_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && _props$chatConfig.LiveChatConfigAuthSettings) && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.customContext) {
|
|
182
|
+
optionalParams = Object.assign({}, optionalParams, {
|
|
183
|
+
customContext: state.domainStates.customContext
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
173
188
|
export { prepareStartChat, initStartChat };
|
|
@@ -53,7 +53,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
53
53
|
...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
|
|
54
54
|
}); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
55
|
|
|
56
|
-
const chatSDK = useChatSDKStore();
|
|
56
|
+
const chatSDK = useChatSDKStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
|
|
57
58
|
const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = useState(undefined);
|
|
58
59
|
const {
|
|
59
60
|
Composer
|
|
@@ -81,6 +82,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
81
82
|
type: LiveChatWidgetActionType.SET_SKIP_CHAT_BUTTON_RENDERING,
|
|
82
83
|
payload: ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.skipChatButtonRendering) || false
|
|
83
84
|
});
|
|
85
|
+
dispatch({
|
|
86
|
+
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
87
|
+
payload: false
|
|
88
|
+
});
|
|
84
89
|
initCallingSdk(chatSDK, setVoiceVideoCallingSDK).then(sdkCreated => {
|
|
85
90
|
sdkCreated && dispatch({
|
|
86
91
|
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
@@ -83,9 +83,7 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
83
83
|
} else {
|
|
84
84
|
const prechatResponseValues = extractPreChatSurveyResponseValues(state.domainStates.preChatSurveyResponse, values);
|
|
85
85
|
optionalParams = {
|
|
86
|
-
|
|
87
|
-
preChatResponse: prechatResponseValues
|
|
88
|
-
}
|
|
86
|
+
preChatResponse: prechatResponseValues
|
|
89
87
|
};
|
|
90
88
|
setPreChatResponseEmail(values);
|
|
91
89
|
await initStartChat(optionalParams);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LogLevel } from "../../../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import { TelemetryHelper } from "../../../../common/telemetry/TelemetryHelper";
|
|
3
3
|
export function createWebChatTelemetry() {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
5
|
const handleTelemetry = event => {
|
|
5
6
|
const {
|
|
6
7
|
level
|
|
@@ -64,6 +64,7 @@ export const createReducer = () => {
|
|
|
64
64
|
case LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
|
|
65
65
|
return { ...state,
|
|
66
66
|
domainStates: { ...state.domainStates,
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
68
|
customContext: action.payload
|
|
68
69
|
}
|
|
69
70
|
};
|
|
@@ -2,7 +2,6 @@ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../common/telemetry/Te
|
|
|
2
2
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
3
3
|
import { Constants } from "../common/Constants";
|
|
4
4
|
import { TelemetryHelper } from "../common/telemetry/TelemetryHelper";
|
|
5
|
-
import { TelemetryManager } from "../common/telemetry/TelemetryManager";
|
|
6
5
|
export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
7
6
|
const onNewAdapterActivityHandler = activity => {
|
|
8
7
|
var _activity$channelData, _activity$channelData2, _activity$channelData3;
|
|
@@ -17,18 +16,16 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
17
16
|
|
|
18
17
|
const raiseMessageEvent = activity => {
|
|
19
18
|
if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message) {
|
|
20
|
-
var
|
|
19
|
+
var _text, _text2, _activity$channelData4, _activity$from;
|
|
21
20
|
|
|
22
21
|
const payload = {
|
|
22
|
+
// To identify hidden contents vs empty content
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
-
text: activity === null || activity === void 0 ? void 0 : activity.text,
|
|
25
|
-
id: activity === null || activity === void 0 ? void 0 : activity.id,
|
|
24
|
+
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)*` : "",
|
|
26
25
|
type: activity === null || activity === void 0 ? void 0 : activity.type,
|
|
27
26
|
timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
|
|
28
|
-
chatId: chatId,
|
|
29
27
|
userId: userId,
|
|
30
|
-
|
|
31
|
-
channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
|
|
28
|
+
tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
|
|
32
29
|
messageType: ""
|
|
33
30
|
};
|
|
34
31
|
|
|
@@ -45,18 +42,18 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
45
42
|
Description: "New message sent"
|
|
46
43
|
});
|
|
47
44
|
} else {
|
|
48
|
-
var _activity$
|
|
45
|
+
var _activity$channelData5, _activity$channelData6;
|
|
49
46
|
|
|
50
|
-
if (activity !== null && activity !== void 0 && (_activity$
|
|
47
|
+
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.systemMessageTag)) {
|
|
51
48
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
49
|
payload.messageType = Constants.systemMessageTag;
|
|
53
50
|
} else {
|
|
54
|
-
var _activity$
|
|
51
|
+
var _activity$channelData7, _activity$channelData8, _activity$channelData9;
|
|
55
52
|
|
|
56
53
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
54
|
const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
55
|
|
|
59
|
-
const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$
|
|
56
|
+
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
|
|
60
57
|
|
|
61
58
|
const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
|
|
62
59
|
|
|
@@ -74,7 +71,8 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
74
71
|
BroadcastService.postMessage(newMessageReceivedEvent);
|
|
75
72
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
76
73
|
Event: TelemetryEvent.MessageReceived,
|
|
77
|
-
Description: "New message received"
|
|
74
|
+
Description: "New message received",
|
|
75
|
+
Data: payload
|
|
78
76
|
});
|
|
79
77
|
}
|
|
80
78
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface BaseTelemetryData {
|
|
2
|
+
Data?: any;
|
|
3
|
+
}
|
|
4
|
+
export interface ConfigValidationTelemetryData extends BaseTelemetryData {
|
|
2
5
|
Event?: string;
|
|
3
6
|
RequestId?: string;
|
|
4
7
|
LCWVersion?: string;
|
|
@@ -8,7 +11,7 @@ export interface ConfigValidationTelemetryData {
|
|
|
8
11
|
ExceptionDetails?: object;
|
|
9
12
|
Domain?: string;
|
|
10
13
|
}
|
|
11
|
-
export interface LoadTelemetryData {
|
|
14
|
+
export interface LoadTelemetryData extends BaseTelemetryData {
|
|
12
15
|
Event?: string;
|
|
13
16
|
ResourcePath?: string;
|
|
14
17
|
ElapsedTimeInMilliseconds?: number;
|
|
@@ -20,18 +23,18 @@ export interface LoadTelemetryData {
|
|
|
20
23
|
OCChatWidgetVersion?: string;
|
|
21
24
|
OCChatComponentsVersion?: string;
|
|
22
25
|
}
|
|
23
|
-
export interface MessageProcessingErrorData {
|
|
26
|
+
export interface MessageProcessingErrorData extends BaseTelemetryData {
|
|
24
27
|
Event: string;
|
|
25
28
|
ExceptionDetails: object;
|
|
26
29
|
}
|
|
27
|
-
export interface OCChatSDKTelemetryData {
|
|
30
|
+
export interface OCChatSDKTelemetryData extends BaseTelemetryData {
|
|
28
31
|
RequestId: string;
|
|
29
32
|
Event?: string;
|
|
30
33
|
ElapsedTimeInMilliseconds?: number;
|
|
31
34
|
TransactionId: string;
|
|
32
35
|
ExceptionDetails?: object;
|
|
33
36
|
}
|
|
34
|
-
export interface IC3ClientTelemetryData {
|
|
37
|
+
export interface IC3ClientTelemetryData extends BaseTelemetryData {
|
|
35
38
|
SubscriptionId?: string;
|
|
36
39
|
EndpointUrl?: string;
|
|
37
40
|
EndpointId?: string;
|
|
@@ -42,7 +45,7 @@ export interface IC3ClientTelemetryData {
|
|
|
42
45
|
ShouldBubbleToHost?: boolean;
|
|
43
46
|
Description?: string;
|
|
44
47
|
}
|
|
45
|
-
export interface WebChatTelemetryData {
|
|
48
|
+
export interface WebChatTelemetryData extends BaseTelemetryData {
|
|
46
49
|
data?: any;
|
|
47
50
|
dimensions?: any;
|
|
48
51
|
duration?: number;
|
|
@@ -53,7 +56,7 @@ export interface WebChatTelemetryData {
|
|
|
53
56
|
name?: string;
|
|
54
57
|
type?: string;
|
|
55
58
|
}
|
|
56
|
-
export interface ACSAdapterTelemetryData {
|
|
59
|
+
export interface ACSAdapterTelemetryData extends BaseTelemetryData {
|
|
57
60
|
Description?: string;
|
|
58
61
|
ACSUserId?: string;
|
|
59
62
|
ChatThreadId?: string;
|
|
@@ -63,14 +66,14 @@ export interface ACSAdapterTelemetryData {
|
|
|
63
66
|
ErrorCode?: string;
|
|
64
67
|
ExceptionDetails?: any;
|
|
65
68
|
}
|
|
66
|
-
export interface ActionTelemetryData {
|
|
69
|
+
export interface ActionTelemetryData extends BaseTelemetryData {
|
|
67
70
|
Event?: string;
|
|
68
71
|
ElapsedTimeInMilliseconds?: number;
|
|
69
72
|
ActionType?: string;
|
|
70
73
|
ExceptionDetails?: object;
|
|
71
74
|
Description?: string;
|
|
72
75
|
}
|
|
73
|
-
export interface CallingTelemetryData {
|
|
76
|
+
export interface CallingTelemetryData extends BaseTelemetryData {
|
|
74
77
|
CallId?: string;
|
|
75
78
|
Event?: string;
|
|
76
79
|
ElapsedTimeInMilliseconds?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "0.1.0-main.
|
|
3
|
+
"version": "0.1.0-main.fb426ed",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@fluentui/react": "^8.49.1",
|
|
77
|
-
"@microsoft/omnichannel-chat-components": "^0.1.0-main.
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "^0.1.0-main.91dd060",
|
|
78
78
|
"@microsoft/omnichannel-chat-sdk": "1.0.1-main.077d17c",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|