@microsoft/omnichannel-chat-widget 0.1.0-main.ae3aa42 → 0.1.0-main.b59a07c
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 +2 -2
- package/lib/cjs/common/telemetry/TelemetryConstants.js +13 -2
- 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 +17 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +12 -4
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +3 -13
- package/lib/cjs/components/livechatwidget/common/endChat.js +28 -13
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +4 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +49 -10
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +52 -5
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +4 -5
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -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 +2 -2
- package/lib/esm/common/telemetry/TelemetryConstants.js +13 -2
- 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 +8 -0
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +13 -5
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +3 -13
- package/lib/esm/components/livechatwidget/common/endChat.js +25 -14
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +4 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +51 -14
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +47 -6
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -7
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -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 +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +13 -4
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
- package/lib/types/common/utils.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +22 -21
- package/package.json +2 -2
|
@@ -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,
|
|
@@ -201,7 +206,22 @@ const LiveChatWidgetStateful = props => {
|
|
|
201
206
|
}
|
|
202
207
|
}, [state.appStates.skipChatButtonRendering]);
|
|
203
208
|
(0, _react2.useEffect)(() => {
|
|
204
|
-
|
|
209
|
+
var _chatSDK$omnichannelC, _chatSDK$omnichannelC2;
|
|
210
|
+
|
|
211
|
+
// Add the custom context on receiving the SetCustomContext event
|
|
212
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
213
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
214
|
+
Event: _TelemetryConstants.TelemetryEvent.CustomContextReceived,
|
|
215
|
+
Description: "CustomContext received."
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
dispatch({
|
|
219
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
220
|
+
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartProactiveChat).subscribe(msg => {
|
|
205
225
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
206
226
|
Event: _TelemetryConstants.TelemetryEvent.StartProactiveChatEventReceived,
|
|
207
227
|
Description: "Start proactive chat event received."
|
|
@@ -220,7 +240,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
220
240
|
}); // start chat from SDK Event
|
|
221
241
|
|
|
222
242
|
|
|
223
|
-
_omnichannelChatComponents.BroadcastService.getMessageByEventName(
|
|
243
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(() => {
|
|
224
244
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
225
245
|
Event: _TelemetryConstants.TelemetryEvent.StartChatEventRecevied,
|
|
226
246
|
Description: "Start chat event received."
|
|
@@ -237,7 +257,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
237
257
|
}); // end chat from SDK Event
|
|
238
258
|
|
|
239
259
|
|
|
240
|
-
_omnichannelChatComponents.BroadcastService.getMessageByEventName(
|
|
260
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.EndChat).subscribe(async () => {
|
|
241
261
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
242
262
|
Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
|
|
243
263
|
Description: "End chat event received."
|
|
@@ -250,6 +270,30 @@ const LiveChatWidgetStateful = props => {
|
|
|
250
270
|
const skipCloseChat = false;
|
|
251
271
|
(0, _endChat.endChat)(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat);
|
|
252
272
|
}
|
|
273
|
+
}); // Listen to end chat event from other tabs
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
const endChatEventName = (0, _utils.getWidgetEndChatEventName)(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId);
|
|
277
|
+
|
|
278
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(endChatEventName).subscribe(async () => {
|
|
279
|
+
(0, _endChat.endChat)(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, false);
|
|
280
|
+
}); // Close popout window
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.ClosePopoutWindow).subscribe(() => {
|
|
284
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
285
|
+
Event: _TelemetryConstants.TelemetryEvent.ClosePopoutWindowEventRecevied,
|
|
286
|
+
Description: "Close popout window event received."
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
dispatch({
|
|
290
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
|
|
291
|
+
payload: {
|
|
292
|
+
proactiveChatBodyTitle: "",
|
|
293
|
+
proactiveChatEnablePrechat: false,
|
|
294
|
+
proactiveChatInNewWindow: false
|
|
295
|
+
}
|
|
296
|
+
});
|
|
253
297
|
});
|
|
254
298
|
|
|
255
299
|
window.addEventListener("beforeunload", () => {
|
|
@@ -335,8 +379,11 @@ const LiveChatWidgetStateful = props => {
|
|
|
335
379
|
const confirmationPaneProps = (0, _initConfirmationPropsComposer.initConfirmationPropsComposer)(props); // publish chat widget state
|
|
336
380
|
|
|
337
381
|
(0, _react2.useEffect)(() => {
|
|
382
|
+
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic;
|
|
383
|
+
|
|
384
|
+
const widgetStateEventName = (0, _utils.getWidgetCacheId)(props === null || props === void 0 ? void 0 : (_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, props === null || props === void 0 ? void 0 : (_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);
|
|
338
385
|
const chatWidgetStateChangeEvent = {
|
|
339
|
-
eventName:
|
|
386
|
+
eventName: widgetStateEventName,
|
|
340
387
|
payload: { ...state
|
|
341
388
|
}
|
|
342
389
|
};
|
|
@@ -93,9 +93,10 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
try {
|
|
96
|
-
var _DataStoreManager$cli, _persistedState$domai;
|
|
96
|
+
var _state$domainStates, _state$domainStates$t, _state$domainStates$t2, _DataStoreManager$cli, _persistedState$domai;
|
|
97
97
|
|
|
98
|
-
const
|
|
98
|
+
const widgetStateCacheId = (0, _utils.getWidgetCacheId)(((_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$t = _state$domainStates.telemetryInternalData) === null || _state$domainStates$t === void 0 ? void 0 : _state$domainStates$t.orgId) ?? "", ((_state$domainStates$t2 = state.domainStates.telemetryInternalData) === null || _state$domainStates$t2 === void 0 ? void 0 : _state$domainStates$t2.widgetId) ?? "");
|
|
99
|
+
const widgetStateFromCache = (_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateCacheId, "localStorage");
|
|
99
100
|
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
100
101
|
let optionalParams = {};
|
|
101
102
|
|
|
@@ -109,9 +110,7 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
109
110
|
} else {
|
|
110
111
|
const prechatResponseValues = (0, _utils.extractPreChatSurveyResponseValues)(state.domainStates.preChatSurveyResponse, values);
|
|
111
112
|
optionalParams = {
|
|
112
|
-
|
|
113
|
-
preChatResponse: prechatResponseValues
|
|
114
|
-
}
|
|
113
|
+
preChatResponse: prechatResponseValues
|
|
115
114
|
};
|
|
116
115
|
setPreChatResponseEmail(values);
|
|
117
116
|
await initStartChat(optionalParams);
|
|
@@ -46,6 +46,14 @@ const ProactiveChatPaneStateful = props => {
|
|
|
46
46
|
const handleProactiveChatInviteTimeout = () => {
|
|
47
47
|
if (!timeoutRemoved) {
|
|
48
48
|
setTimeoutRemoved(true);
|
|
49
|
+
dispatch({
|
|
50
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
|
|
51
|
+
payload: {
|
|
52
|
+
proactiveChatBodyTitle: "",
|
|
53
|
+
proactiveChatEnablePrechat: false,
|
|
54
|
+
proactiveChatInNewWindow: false
|
|
55
|
+
}
|
|
56
|
+
});
|
|
49
57
|
dispatch({
|
|
50
58
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
51
59
|
payload: _ConversationState.ConversationState.Closed
|
|
@@ -111,6 +119,14 @@ const ProactiveChatPaneStateful = props => {
|
|
|
111
119
|
Description: "Proactive chat closed."
|
|
112
120
|
});
|
|
113
121
|
|
|
122
|
+
dispatch({
|
|
123
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
|
|
124
|
+
payload: {
|
|
125
|
+
proactiveChatBodyTitle: "",
|
|
126
|
+
proactiveChatEnablePrechat: false,
|
|
127
|
+
proactiveChatInNewWindow: false
|
|
128
|
+
}
|
|
129
|
+
});
|
|
114
130
|
dispatch({
|
|
115
131
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
116
132
|
payload: _ConversationState.ConversationState.Closed
|
|
@@ -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
|
|
@@ -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
|
}
|
|
@@ -36,8 +36,6 @@ _defineProperty(Constants, "false", "false");
|
|
|
36
36
|
|
|
37
37
|
_defineProperty(Constants, "maximumUnreadMessageCount", 99);
|
|
38
38
|
|
|
39
|
-
_defineProperty(Constants, "widgetStateDataKey", "LcwChatWidgetState");
|
|
40
|
-
|
|
41
39
|
_defineProperty(Constants, "channelIdKey", "ChannelId-");
|
|
42
40
|
|
|
43
41
|
_defineProperty(Constants, "ChannelId", "lcw");
|
|
@@ -146,6 +144,8 @@ _defineProperty(Constants, "internetConnectionTestUrl", "https://ocsdk-prod.azur
|
|
|
146
144
|
|
|
147
145
|
_defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
|
|
148
146
|
|
|
147
|
+
_defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
|
|
148
|
+
|
|
149
149
|
export const Regex = (_class = class Regex {}, _defineProperty(_class, "EmailRegex", "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"), _class);
|
|
150
150
|
export class HtmlIdNames {}
|
|
151
151
|
|
|
@@ -26,18 +26,24 @@ export let BroadcastEvent; // Events being logged
|
|
|
26
26
|
|
|
27
27
|
(function (BroadcastEvent) {
|
|
28
28
|
BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
|
|
29
|
-
BroadcastEvent["
|
|
29
|
+
BroadcastEvent["ChatEnded"] = "ChatEnded";
|
|
30
30
|
BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
|
|
31
31
|
BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
|
|
32
|
-
BroadcastEvent["
|
|
32
|
+
BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
|
|
33
33
|
BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
|
|
34
34
|
BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
|
|
35
|
+
BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
|
|
36
|
+
BroadcastEvent["ClosePopoutWindow"] = "ClosePopoutWindow";
|
|
35
37
|
BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
|
|
36
38
|
BroadcastEvent["NewMessageSent"] = "NewMessageSent";
|
|
37
39
|
BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
|
|
38
40
|
BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
|
|
41
|
+
BroadcastEvent["StartChat"] = "StartChat";
|
|
39
42
|
BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
|
|
40
43
|
BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
|
|
44
|
+
BroadcastEvent["EndChat"] = "EndChat";
|
|
45
|
+
BroadcastEvent["SetCustomContext"] = "SetCustomContext";
|
|
46
|
+
BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
|
|
41
47
|
})(BroadcastEvent || (BroadcastEvent = {}));
|
|
42
48
|
|
|
43
49
|
export let TelemetryEvent;
|
|
@@ -91,6 +97,7 @@ export let TelemetryEvent;
|
|
|
91
97
|
TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
|
|
92
98
|
TelemetryEvent["EndChatSDKCall"] = "EndChatCall";
|
|
93
99
|
TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
|
|
100
|
+
TelemetryEvent["ClosePopoutWindowEventRecevied"] = "ClosePopoutWindowEventRecevied";
|
|
94
101
|
TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
|
|
95
102
|
TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
|
|
96
103
|
TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
|
|
@@ -140,6 +147,7 @@ export let TelemetryEvent;
|
|
|
140
147
|
TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
|
|
141
148
|
TelemetryEvent["MessageSent"] = "MessageSent";
|
|
142
149
|
TelemetryEvent["MessageReceived"] = "MessageReceived";
|
|
150
|
+
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
143
151
|
})(TelemetryEvent || (TelemetryEvent = {}));
|
|
144
152
|
|
|
145
153
|
export class TelemetryConstants {
|
|
@@ -182,6 +190,9 @@ export class TelemetryConstants {
|
|
|
182
190
|
case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
|
|
183
191
|
case TelemetryEvent.HeaderCloseButtonClicked:
|
|
184
192
|
case TelemetryEvent.HeaderMinimizeButtonClicked:
|
|
193
|
+
case TelemetryEvent.MessageSent:
|
|
194
|
+
case TelemetryEvent.MessageReceived:
|
|
195
|
+
case TelemetryEvent.CustomContextReceived:
|
|
185
196
|
return ScenarioType.ACTIONS;
|
|
186
197
|
|
|
187
198
|
case TelemetryEvent.StartChatSDKCall:
|
|
@@ -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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
|
|
2
2
|
import { KeyCodes } from "./KeyCodes";
|
|
3
|
+
import { BroadcastEvent } from "./telemetry/TelemetryConstants";
|
|
3
4
|
|
|
4
5
|
const getElementBySelector = selector => {
|
|
5
6
|
let element;
|
|
@@ -277,6 +278,7 @@ export const createTimer = () => {
|
|
|
277
278
|
|
|
278
279
|
};
|
|
279
280
|
}; // Returns the domain of the org
|
|
281
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
280
282
|
|
|
281
283
|
export const getDomain = hostValue => {
|
|
282
284
|
for (let i = 0; i < AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
|
|
@@ -286,4 +288,10 @@ export const getDomain = hostValue => {
|
|
|
286
288
|
}
|
|
287
289
|
|
|
288
290
|
return AriaTelemetryConstants.Public;
|
|
291
|
+
};
|
|
292
|
+
export const getWidgetCacheId = (orgId, widgetId) => {
|
|
293
|
+
return `${Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
|
|
294
|
+
};
|
|
295
|
+
export const getWidgetEndChatEventName = (orgId, widgetId) => {
|
|
296
|
+
return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
|
|
289
297
|
};
|
|
@@ -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",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
1
|
+
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect, useState } from "react";
|
|
3
3
|
import { ChatButton } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Constants } from "../../common/Constants";
|
|
@@ -9,8 +9,9 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
|
9
9
|
import { TelemetryTimers } from "../../common/telemetry/TelemetryManager";
|
|
10
10
|
import { defaultOutOfOfficeChatButtonStyleProps } from "./common/styleProps/defaultOutOfOfficeChatButtonStyleProps";
|
|
11
11
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
12
|
+
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
12
13
|
export const ChatButtonStateful = props => {
|
|
13
|
-
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
|
|
14
|
+
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
|
|
14
15
|
|
|
15
16
|
const [state, dispatch] = useChatContextStore();
|
|
16
17
|
const {
|
|
@@ -26,14 +27,19 @@ export const ChatButtonStateful = props => {
|
|
|
26
27
|
dir: state.domainStates.globalDir,
|
|
27
28
|
titleText: "Let's Chat!",
|
|
28
29
|
subtitleText: "We're online.",
|
|
29
|
-
hideNotificationBubble:
|
|
30
|
-
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ?
|
|
30
|
+
hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
|
|
31
|
+
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
|
|
31
32
|
onClick: async () => {
|
|
32
33
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
33
34
|
Event: TelemetryEvent.LCWChatButtonClicked
|
|
34
35
|
});
|
|
35
36
|
|
|
36
|
-
if (state.appStates.
|
|
37
|
+
if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
|
|
38
|
+
const proactiveChatIsInPopoutModeEvent = {
|
|
39
|
+
eventName: BroadcastEvent.ProactiveChatIsInPopoutMode
|
|
40
|
+
};
|
|
41
|
+
BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
|
|
42
|
+
} else if (state.appStates.isMinimized) {
|
|
37
43
|
dispatch({
|
|
38
44
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
39
45
|
payload: false
|
|
@@ -42,6 +48,7 @@ export const ChatButtonStateful = props => {
|
|
|
42
48
|
await startChat();
|
|
43
49
|
}
|
|
44
50
|
},
|
|
51
|
+
unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
|
|
45
52
|
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
|
|
46
53
|
};
|
|
47
54
|
const outOfOfficeControlProps = {
|
|
@@ -62,6 +69,7 @@ export const ChatButtonStateful = props => {
|
|
|
62
69
|
});
|
|
63
70
|
}
|
|
64
71
|
},
|
|
72
|
+
unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
|
|
65
73
|
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
66
74
|
};
|
|
67
75
|
useEffect(() => {
|
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",
|
|
@@ -328,7 +316,9 @@ export const dummyDefaultProps = {
|
|
|
328
316
|
hideChatTextContainer: false,
|
|
329
317
|
hideChatSubtitle: false,
|
|
330
318
|
hideChatTitle: false,
|
|
331
|
-
hideNotificationBubble: true
|
|
319
|
+
hideNotificationBubble: true,
|
|
320
|
+
unreadMessageString: "new messages",
|
|
321
|
+
largeUnreadMessageString: "99+"
|
|
332
322
|
},
|
|
333
323
|
styleProps: {
|
|
334
324
|
generalStyleProps: {
|