@microsoft/omnichannel-chat-widget 1.0.5-main.b47afe8 → 1.0.5-main.d908c85
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/defaultConfigs/defaultTelemetryInternalData.js +1 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +22 -2
- package/lib/cjs/components/livechatwidget/common/endChat.js +1 -1
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +3 -2
- package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryInternalData.js +1 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +22 -2
- package/lib/esm/components/livechatwidget/common/endChat.js +1 -1
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +3 -2
- package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +1 -1
- package/package.json +1 -1
|
@@ -9,10 +9,29 @@ var _AriaSDK = require("@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/
|
|
|
9
9
|
var _Enums = require("@microsoft/omnichannel-chat-sdk/lib/external/aria/common/Enums");
|
|
10
10
|
var _Constants = require("../../Constants");
|
|
11
11
|
var _TelemetryManager = require("../TelemetryManager");
|
|
12
|
+
const AWTDefaultConfiguration = {
|
|
13
|
+
collectorUri: "https://browser.pipe.aria.microsoft.com/Collector/3.0/",
|
|
14
|
+
cacheMemorySizeLimitInNumberOfEvents: 10000,
|
|
15
|
+
disableCookiesUsage: false,
|
|
16
|
+
canSendStatEvent: eventName => {
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
20
|
+
clockSkewRefreshDurationInMins: 0
|
|
21
|
+
};
|
|
12
22
|
const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
|
|
13
23
|
let _logger;
|
|
24
|
+
|
|
25
|
+
// AWTLogManager is a global variable. Reset after a logEvent() is required to prevent collisions with other components using AWTLogManager.
|
|
26
|
+
const resetAriaLogger = function () {
|
|
27
|
+
let configuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AWTDefaultConfiguration;
|
|
28
|
+
_AriaSDK.AWTLogManager.flushAndTeardown();
|
|
29
|
+
_AriaSDK.AWTLogManager._isInitialized = false; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
30
|
+
_AriaSDK.AWTLogManager._isDestroyed = false; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
31
|
+
_logger = _AriaSDK.AWTLogManager.initialize(ariaTelemetryKey, configuration);
|
|
32
|
+
};
|
|
14
33
|
const logger = () => {
|
|
15
|
-
if (
|
|
34
|
+
if (!(0, _utils.isNullOrEmptyString)(ariaTelemetryKey)) {
|
|
16
35
|
const configuration = {
|
|
17
36
|
disableCookiesUsage: disabledCookieUsage
|
|
18
37
|
};
|
|
@@ -32,7 +51,7 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
|
|
|
32
51
|
}
|
|
33
52
|
}
|
|
34
53
|
try {
|
|
35
|
-
|
|
54
|
+
resetAriaLogger(configuration);
|
|
36
55
|
if (_logger === undefined) {
|
|
37
56
|
_logger = _AriaSDK.AWTLogManager.getLogger(ariaTelemetryKey);
|
|
38
57
|
}
|
|
@@ -74,6 +93,7 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
|
|
|
74
93
|
eventProperties.properties[ariaTelemetryApplicationName] = nameProperty;
|
|
75
94
|
}
|
|
76
95
|
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
96
|
+
resetAriaLogger();
|
|
77
97
|
} catch (error) {
|
|
78
98
|
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
79
99
|
}
|
|
@@ -56,7 +56,7 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
56
56
|
|
|
57
57
|
// Initiate post chat render
|
|
58
58
|
if (state !== null && state !== void 0 && (_state$domainStates2 = state.domainStates) !== null && _state$domainStates2 !== void 0 && _state$domainStates2.postChatContext) {
|
|
59
|
-
await (0, _renderSurveyHelpers.initiatePostChat)(props, conversationDetails, state, dispatch);
|
|
59
|
+
await (0, _renderSurveyHelpers.initiatePostChat)(props, conversationDetails, state, dispatch, postchatContext);
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
} catch (error) {
|
|
@@ -87,10 +87,11 @@ const embedModePostChatWorkflow = async (state, dispatch) => {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
-
const initiatePostChat = async (props, conversationDetailsParam, state, dispatch) => {
|
|
90
|
+
const initiatePostChat = async (props, conversationDetailsParam, state, dispatch, postchatContext) => {
|
|
91
91
|
var _conversationDetails;
|
|
92
92
|
conversationDetails = conversationDetailsParam;
|
|
93
|
-
|
|
93
|
+
const participantType = ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.participantType) ?? postchatContext.participantType;
|
|
94
|
+
await setSurveyMode(props, participantType, state, dispatch);
|
|
94
95
|
await renderSurvey(state, dispatch);
|
|
95
96
|
};
|
|
96
97
|
|
|
@@ -3,10 +3,29 @@ import { AWTLogManager } from "@microsoft/omnichannel-chat-sdk/lib/external/aria
|
|
|
3
3
|
import { AWTCustomerContentKind, AWTPiiKind, AWTPropertyType } from "@microsoft/omnichannel-chat-sdk/lib/external/aria/common/Enums";
|
|
4
4
|
import { Constants, AriaTelemetryConstants, EnvironmentVersion } from "../../Constants";
|
|
5
5
|
import { TelemetryManager } from "../TelemetryManager";
|
|
6
|
+
const AWTDefaultConfiguration = {
|
|
7
|
+
collectorUri: "https://browser.pipe.aria.microsoft.com/Collector/3.0/",
|
|
8
|
+
cacheMemorySizeLimitInNumberOfEvents: 10000,
|
|
9
|
+
disableCookiesUsage: false,
|
|
10
|
+
canSendStatEvent: eventName => {
|
|
11
|
+
return true;
|
|
12
|
+
},
|
|
13
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
14
|
+
clockSkewRefreshDurationInMins: 0
|
|
15
|
+
};
|
|
6
16
|
export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
|
|
7
17
|
let _logger;
|
|
18
|
+
|
|
19
|
+
// AWTLogManager is a global variable. Reset after a logEvent() is required to prevent collisions with other components using AWTLogManager.
|
|
20
|
+
const resetAriaLogger = function () {
|
|
21
|
+
let configuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AWTDefaultConfiguration;
|
|
22
|
+
AWTLogManager.flushAndTeardown();
|
|
23
|
+
AWTLogManager._isInitialized = false; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
24
|
+
AWTLogManager._isDestroyed = false; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
25
|
+
_logger = AWTLogManager.initialize(ariaTelemetryKey, configuration);
|
|
26
|
+
};
|
|
8
27
|
const logger = () => {
|
|
9
|
-
if (
|
|
28
|
+
if (!isNullOrEmptyString(ariaTelemetryKey)) {
|
|
10
29
|
const configuration = {
|
|
11
30
|
disableCookiesUsage: disabledCookieUsage
|
|
12
31
|
};
|
|
@@ -26,7 +45,7 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
26
45
|
}
|
|
27
46
|
}
|
|
28
47
|
try {
|
|
29
|
-
|
|
48
|
+
resetAriaLogger(configuration);
|
|
30
49
|
if (_logger === undefined) {
|
|
31
50
|
_logger = AWTLogManager.getLogger(ariaTelemetryKey);
|
|
32
51
|
}
|
|
@@ -68,6 +87,7 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
68
87
|
eventProperties.properties[ariaTelemetryApplicationName] = nameProperty;
|
|
69
88
|
}
|
|
70
89
|
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
90
|
+
resetAriaLogger();
|
|
71
91
|
} catch (error) {
|
|
72
92
|
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
73
93
|
}
|
|
@@ -51,7 +51,7 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
51
51
|
|
|
52
52
|
// Initiate post chat render
|
|
53
53
|
if (state !== null && state !== void 0 && (_state$domainStates2 = state.domainStates) !== null && _state$domainStates2 !== void 0 && _state$domainStates2.postChatContext) {
|
|
54
|
-
await initiatePostChat(props, conversationDetails, state, dispatch);
|
|
54
|
+
await initiatePostChat(props, conversationDetails, state, dispatch, postchatContext);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
} catch (error) {
|
|
@@ -81,10 +81,11 @@ const embedModePostChatWorkflow = async (state, dispatch) => {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
|
-
const initiatePostChat = async (props, conversationDetailsParam, state, dispatch) => {
|
|
84
|
+
const initiatePostChat = async (props, conversationDetailsParam, state, dispatch, postchatContext) => {
|
|
85
85
|
var _conversationDetails;
|
|
86
86
|
conversationDetails = conversationDetailsParam;
|
|
87
|
-
|
|
87
|
+
const participantType = ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.participantType) ?? postchatContext.participantType;
|
|
88
|
+
await setSurveyMode(props, participantType, state, dispatch);
|
|
88
89
|
await renderSurvey(state, dispatch);
|
|
89
90
|
};
|
|
90
91
|
|
|
@@ -2,7 +2,7 @@ import { Dispatch } from "react";
|
|
|
2
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
3
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
|
-
declare const initiatePostChat: (props: ILiveChatWidgetProps, conversationDetailsParam: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction
|
|
5
|
+
declare const initiatePostChat: (props: ILiveChatWidgetProps, conversationDetailsParam: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, postchatContext: any) => Promise<void>;
|
|
6
6
|
declare const isPostChatEnabled: (props: ILiveChatWidgetProps, state: ILiveChatWidgetContext) => boolean;
|
|
7
7
|
declare const getPostChatContext: (chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
8
8
|
declare const setWidgetStateToInactive: (dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|