@microsoft/omnichannel-chat-widget 0.1.0-main.63cfb47 → 0.1.0-main.745305b
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 -2
- package/lib/cjs/common/telemetry/TelemetryConstants.js +5 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +7 -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/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/registerTelemetryLoggers.js +3 -15
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +21 -5
- 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 +7 -0
- package/lib/esm/common/Constants.js +28 -1
- package/lib/esm/common/telemetry/TelemetryConstants.js +5 -0
- package/lib/esm/common/telemetry/TelemetryManager.js +6 -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/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/registerTelemetryLoggers.js +3 -13
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +19 -5
- 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 +7 -0
- package/lib/types/common/Constants.d.ts +16 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +5 -2
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
- package/lib/types/common/utils.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.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 +4 -7
|
@@ -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 () {
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import { Constants, LocaleConstants } from "./Constants";
|
|
1
|
+
import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
|
|
2
2
|
import { KeyCodes } from "./KeyCodes";
|
|
3
3
|
|
|
4
4
|
const getElementBySelector = selector => {
|
|
@@ -276,4 +276,15 @@ export const createTimer = () => {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
};
|
|
279
|
+
}; // Returns the domain of the org
|
|
280
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
281
|
+
|
|
282
|
+
export const getDomain = hostValue => {
|
|
283
|
+
for (let i = 0; i < AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
|
|
284
|
+
if (hostValue.endsWith(AriaTelemetryConstants.lcwEUDomainNames[i])) {
|
|
285
|
+
return AriaTelemetryConstants.EU;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return AriaTelemetryConstants.Public;
|
|
279
290
|
};
|
|
@@ -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",
|
|
@@ -26,7 +26,7 @@ export const ChatButtonStateful = props => {
|
|
|
26
26
|
dir: state.domainStates.globalDir,
|
|
27
27
|
titleText: "Let's Chat!",
|
|
28
28
|
subtitleText: "We're online.",
|
|
29
|
-
hideNotificationBubble:
|
|
29
|
+
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,
|
|
30
30
|
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ? Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
|
|
31
31
|
onClick: async () => {
|
|
32
32
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
@@ -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
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { RegisterLoggers, TelemetryManager } from "../../../common/telemetry/TelemetryManager";
|
|
2
2
|
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
3
3
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
4
|
-
import { version as chatComponentVersion } from "@microsoft/omnichannel-chat-components/package.json";
|
|
5
|
-
import { version as chatSdkVersion } from "@microsoft/omnichannel-chat-sdk/package.json";
|
|
6
4
|
import { defaultAriaConfig } from "../../../common/telemetry/defaultConfigs/defaultAriaConfig";
|
|
7
5
|
import { defaultInternalTelemetryData } from "../../../common/telemetry/defaultConfigs/defaultTelemetryInternalData";
|
|
8
6
|
import { defaultTelemetryConfiguration } from "../../../common/telemetry/defaultConfigs/defaultTelemetryConfiguration";
|
|
9
7
|
export const registerTelemetryLoggers = (props, dispatch) => {
|
|
10
8
|
var _props$liveChatContex, _props$liveChatContex2;
|
|
11
9
|
|
|
12
|
-
let widgetPackageInfo;
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
widgetPackageInfo = require("@microsoft/omnichannel-chat-widget/package.json");
|
|
16
|
-
} catch (error) {
|
|
17
|
-
widgetPackageInfo = "0.0.0-0";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
10
|
const telemetryConfig = { ...defaultTelemetryConfiguration,
|
|
21
11
|
...props.telemetryConfig
|
|
22
12
|
};
|
|
@@ -38,9 +28,9 @@ export const registerTelemetryLoggers = (props, dispatch) => {
|
|
|
38
28
|
}
|
|
39
29
|
|
|
40
30
|
telemetryData = TelemetryHelper.addWidgetDataToTelemetry(telemetryConfig, telemetryData);
|
|
41
|
-
telemetryData.OCChatSDKVersion =
|
|
42
|
-
telemetryData.chatComponentVersion = chatComponentVersion;
|
|
43
|
-
telemetryData.chatWidgetVersion =
|
|
31
|
+
telemetryData.OCChatSDKVersion = telemetryConfig.OCChatSDKVersion ?? "0.0.0-0";
|
|
32
|
+
telemetryData.chatComponentVersion = telemetryConfig.chatComponentVersion ?? "0.0.0-0";
|
|
33
|
+
telemetryData.chatWidgetVersion = telemetryConfig.chatWidgetVersion ?? "0.0.0-0";
|
|
44
34
|
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;
|
|
45
35
|
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;
|
|
46
36
|
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;
|
|
@@ -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,
|
|
@@ -101,13 +106,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
101
106
|
payload: globalDir
|
|
102
107
|
});
|
|
103
108
|
|
|
104
|
-
if ((_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.
|
|
109
|
+
if ((_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.liveChatContext) {
|
|
105
110
|
var _state$domainStates2;
|
|
106
111
|
|
|
107
112
|
const optionalParams = {
|
|
108
|
-
liveChatContext:
|
|
109
|
-
chatToken: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.chatToken
|
|
110
|
-
}
|
|
113
|
+
liveChatContext: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.liveChatContext
|
|
111
114
|
};
|
|
112
115
|
initStartChat(chatSDK, dispatch, setAdapter, optionalParams);
|
|
113
116
|
}
|
|
@@ -147,6 +150,17 @@ export const LiveChatWidgetStateful = props => {
|
|
|
147
150
|
}
|
|
148
151
|
}, [state.appStates.skipChatButtonRendering]);
|
|
149
152
|
useEffect(() => {
|
|
153
|
+
// Add the custom context on receiving the SetCustomContext event
|
|
154
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
155
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
156
|
+
Event: TelemetryEvent.CustomContextReceived,
|
|
157
|
+
Description: "CustomContext received."
|
|
158
|
+
});
|
|
159
|
+
dispatch({
|
|
160
|
+
type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
161
|
+
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
162
|
+
});
|
|
163
|
+
});
|
|
150
164
|
BroadcastService.getMessageByEventName("StartProactiveChat").subscribe(msg => {
|
|
151
165
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
152
166
|
Event: TelemetryEvent.StartProactiveChatEventReceived,
|
|
@@ -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
|
|
@@ -10,25 +10,26 @@ export let LiveChatWidgetActionType;
|
|
|
10
10
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT";
|
|
11
11
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 7] = "SET_OUTSIDE_OPERATING_HOURS";
|
|
12
12
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 8] = "SET_PRE_CHAT_SURVEY_RESPONSE";
|
|
13
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
14
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
15
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
16
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
17
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
18
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
19
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
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["
|
|
13
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 9] = "SET_CUSTOM_CONTEXT";
|
|
14
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 10] = "SET_SHOW_CONFIRMATION";
|
|
15
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 11] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
|
|
16
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 12] = "SET_PRECHAT_RESPONSE_EMAIL";
|
|
17
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 13] = "SET_AUDIO_NOTIFICATION";
|
|
18
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 14] = "SET_E2VV_ENABLED";
|
|
19
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 15] = "SET_POST_CHAT_CONTEXT";
|
|
20
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 16] = "SHOW_CALLING_CONTAINER";
|
|
21
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 17] = "SET_INCOMING_CALL";
|
|
22
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 18] = "DISABLE_VIDEO_CALL";
|
|
23
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 19] = "DISABLE_LOCAL_VIDEO";
|
|
24
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 20] = "DISABLE_REMOTE_VIDEO";
|
|
25
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 21] = "SET_CHAT_TOKEN";
|
|
26
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SKIP_CHAT_BUTTON_RENDERING"] = 22] = "SET_SKIP_CHAT_BUTTON_RENDERING";
|
|
27
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 23] = "SET_PROACTIVE_CHAT_PARAMS";
|
|
28
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 24] = "SET_TELEMETRY_DATA";
|
|
29
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
|
|
30
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 26] = "SET_UNREAD_MESSAGE_COUNT";
|
|
31
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 27] = "SET_FOCUS_CHAT_BUTTON";
|
|
32
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
|
|
33
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
|
|
34
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
|
|
34
35
|
})(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));
|
|
@@ -18,7 +18,8 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
18
18
|
postChatContext: undefined,
|
|
19
19
|
telemetryInternalData: {},
|
|
20
20
|
globalDir: "ltr",
|
|
21
|
-
liveChatContext: undefined
|
|
21
|
+
liveChatContext: undefined,
|
|
22
|
+
customContext: undefined
|
|
22
23
|
},
|
|
23
24
|
appStates: {
|
|
24
25
|
conversationState: ConversationState.Closed,
|
|
@@ -61,6 +61,13 @@ export const createReducer = () => {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
case LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
|
|
65
|
+
return { ...state,
|
|
66
|
+
domainStates: { ...state.domainStates,
|
|
67
|
+
customContext: action.payload
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
64
71
|
case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
|
|
65
72
|
return { ...state,
|
|
66
73
|
appStates: { ...state.appStates,
|
|
@@ -136,6 +136,12 @@ export declare enum ElementType {
|
|
|
136
136
|
export declare enum ChatSDKError {
|
|
137
137
|
WidgetUseOutsideOperatingHour = "WidgetUseOutsideOperatingHour"
|
|
138
138
|
}
|
|
139
|
+
export declare enum EnvironmentVersion {
|
|
140
|
+
prod = "prod",
|
|
141
|
+
dogfood = "df",
|
|
142
|
+
int = "int",
|
|
143
|
+
test = "test"
|
|
144
|
+
}
|
|
139
145
|
export declare class TranscriptConstants {
|
|
140
146
|
static readonly ChatTranscriptsBodyColor = "#F5F5F5";
|
|
141
147
|
static readonly TranscriptMessageEmojiMessageType = "http://schema.skype.com/emoji";
|
|
@@ -148,3 +154,13 @@ export declare class TranscriptConstants {
|
|
|
148
154
|
static readonly AgentDialogColor = "#2266E3";
|
|
149
155
|
static readonly AgentFontColor = "white";
|
|
150
156
|
}
|
|
157
|
+
export declare class AriaTelemetryConstants {
|
|
158
|
+
static readonly GERMANY_ENDPOINT: string;
|
|
159
|
+
static readonly GCCH_ENDPOINT: string;
|
|
160
|
+
static readonly DOD_ENDPOINT: string;
|
|
161
|
+
static readonly EUROPE_ENDPOINT: string;
|
|
162
|
+
static readonly MOONCAKE_ENDPOINT: string;
|
|
163
|
+
static readonly Public: string;
|
|
164
|
+
static readonly EU: string;
|
|
165
|
+
static readonly lcwEUDomainNames: Array<string>;
|
|
166
|
+
}
|
|
@@ -30,7 +30,8 @@ export declare enum BroadcastEvent {
|
|
|
30
30
|
NewMessageReceived = "NewMessageReceived",
|
|
31
31
|
RedirectPageRequest = "RedirectPageRequest",
|
|
32
32
|
StartChatSkippingChatButtonRendering = "StartChatSkippingChatButtonRendering",
|
|
33
|
-
StartUnauthenticatedReconnectChat = "StartUnauthenticatedReconnectChat"
|
|
33
|
+
StartUnauthenticatedReconnectChat = "StartUnauthenticatedReconnectChat",
|
|
34
|
+
SetCustomContext = "SetCustomContext"
|
|
34
35
|
}
|
|
35
36
|
export declare enum TelemetryEvent {
|
|
36
37
|
CallAdded = "CallAdded",
|
|
@@ -129,11 +130,13 @@ export declare enum TelemetryEvent {
|
|
|
129
130
|
ReconnectChatStartNewConversation = "ReconnectChatStartNewConversation",
|
|
130
131
|
ReconnectChatMinimize = "ReconnectChatMinimize",
|
|
131
132
|
MessageSent = "MessageSent",
|
|
132
|
-
MessageReceived = "MessageReceived"
|
|
133
|
+
MessageReceived = "MessageReceived",
|
|
134
|
+
CustomContextReceived = "CustomContextReceived"
|
|
133
135
|
}
|
|
134
136
|
export interface TelemetryInput {
|
|
135
137
|
scenarioType: ScenarioType;
|
|
136
138
|
payload: TelemetryData;
|
|
139
|
+
telemetryInfo?: any;
|
|
137
140
|
}
|
|
138
141
|
export declare class TelemetryConstants {
|
|
139
142
|
private static map;
|
|
@@ -32,13 +32,13 @@ export interface ITelemetryConfig {
|
|
|
32
32
|
/**
|
|
33
33
|
* Omnichannel chat widget version
|
|
34
34
|
*/
|
|
35
|
-
chatWidgetVersion
|
|
35
|
+
chatWidgetVersion: string;
|
|
36
36
|
/**
|
|
37
37
|
* Omnichannel chat components version
|
|
38
38
|
*/
|
|
39
|
-
chatComponentVersion
|
|
39
|
+
chatComponentVersion: string;
|
|
40
40
|
/**
|
|
41
41
|
* Omnichannel Chat SDK Version
|
|
42
42
|
*/
|
|
43
|
-
OCChatSDKVersion
|
|
43
|
+
OCChatSDKVersion: string;
|
|
44
44
|
}
|
|
@@ -21,3 +21,4 @@ export declare const isNullOrUndefined: (obj: any) => boolean;
|
|
|
21
21
|
export declare const isNullOrEmptyString: (s: string) => boolean;
|
|
22
22
|
export declare const newGuid: () => string;
|
|
23
23
|
export declare const createTimer: () => ITimer;
|
|
24
|
+
export declare const getDomain: (hostValue: any) => string;
|
|
@@ -45,7 +45,7 @@ export interface ILiveChatWidgetProps {
|
|
|
45
45
|
proactiveChatPaneProps?: IProactiveChatPaneStatefulProps;
|
|
46
46
|
reconnectChatPaneProps?: IReconnectChatPaneStatefulProps;
|
|
47
47
|
styleProps?: ILiveChatWidgetStyleProps;
|
|
48
|
-
telemetryConfig
|
|
48
|
+
telemetryConfig: ITelemetryConfig;
|
|
49
49
|
webChatContainerProps?: IWebChatContainerStatefulProps;
|
|
50
50
|
liveChatContextFromCache?: ILiveChatWidgetContext;
|
|
51
51
|
contextDataStore?: IContextDataStore;
|
|
@@ -8,25 +8,26 @@ export declare enum LiveChatWidgetActionType {
|
|
|
8
8
|
SET_PREVIOUS_FOCUSED_ELEMENT = 6,
|
|
9
9
|
SET_OUTSIDE_OPERATING_HOURS = 7,
|
|
10
10
|
SET_PRE_CHAT_SURVEY_RESPONSE = 8,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
SET_CUSTOM_CONTEXT = 9,
|
|
12
|
+
SET_SHOW_CONFIRMATION = 10,
|
|
13
|
+
SET_SHOW_EMAIL_TRANSCRIPT_PANE = 11,
|
|
14
|
+
SET_PRECHAT_RESPONSE_EMAIL = 12,
|
|
15
|
+
SET_AUDIO_NOTIFICATION = 13,
|
|
16
|
+
SET_E2VV_ENABLED = 14,
|
|
17
|
+
SET_POST_CHAT_CONTEXT = 15,
|
|
18
|
+
SHOW_CALLING_CONTAINER = 16,
|
|
19
|
+
SET_INCOMING_CALL = 17,
|
|
20
|
+
DISABLE_VIDEO_CALL = 18,
|
|
21
|
+
DISABLE_LOCAL_VIDEO = 19,
|
|
22
|
+
DISABLE_REMOTE_VIDEO = 20,
|
|
23
|
+
SET_CHAT_TOKEN = 21,
|
|
24
|
+
SET_SKIP_CHAT_BUTTON_RENDERING = 22,
|
|
25
|
+
SET_PROACTIVE_CHAT_PARAMS = 23,
|
|
26
|
+
SET_TELEMETRY_DATA = 24,
|
|
27
|
+
SET_RECONNECT_ID = 25,
|
|
28
|
+
SET_UNREAD_MESSAGE_COUNT = 26,
|
|
29
|
+
SET_FOCUS_CHAT_BUTTON = 27,
|
|
30
|
+
SET_CONVERSATION_ENDED_BY_AGENT = 28,
|
|
31
|
+
SET_WIDGET_STATE = 29,
|
|
32
|
+
SET_LIVE_CHAT_CONTEXT = 30
|
|
32
33
|
}
|
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.745305b",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"import": "./lib/esm/index.js",
|
|
17
17
|
"require": "./lib/cjs/index.js",
|
|
18
18
|
"types": "./lib/types/index.d.ts"
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"@babel/core": "^7.15.8",
|
|
@@ -71,13 +72,9 @@
|
|
|
71
72
|
"webpack": "^4.44.2",
|
|
72
73
|
"webpack-cli": "^4.9.2"
|
|
73
74
|
},
|
|
74
|
-
"peerDependencies": {
|
|
75
|
-
"react": "^16.14.0",
|
|
76
|
-
"react-dom": "^16.14.0"
|
|
77
|
-
},
|
|
78
75
|
"dependencies": {
|
|
79
76
|
"@fluentui/react": "^8.49.1",
|
|
80
|
-
"@microsoft/omnichannel-chat-components": "0.1.0-main.
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "^0.1.0-main.1756db4",
|
|
81
78
|
"@microsoft/omnichannel-chat-sdk": "1.0.1-main.077d17c",
|
|
82
79
|
"abort-controller-es5": "^2.0.1",
|
|
83
80
|
"dompurify": "^2.3.4",
|