@microsoft/omnichannel-chat-widget 1.0.5-main.b771061 → 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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.defaultInternalTelemetryData = void 0;
7
7
  const defaultInternalTelemetryData = {
8
- environmentVersion: "test",
8
+ environmentVersion: "prod",
9
9
  chatWidgetLocaleLCID: "1033",
10
10
  channelId: "lcw2.0"
11
11
  };
@@ -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 ((0, _utils.isNullOrUndefined)(_logger) && !(0, _utils.isNullOrEmptyString)(ariaTelemetryKey)) {
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
- _logger = _AriaSDK.AWTLogManager.initialize(ariaTelemetryKey, configuration);
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
  }
@@ -1,5 +1,5 @@
1
1
  export const defaultInternalTelemetryData = {
2
- environmentVersion: "test",
2
+ environmentVersion: "prod",
3
3
  chatWidgetLocaleLCID: "1033",
4
4
  channelId: "lcw2.0"
5
5
  };
@@ -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 (isNullOrUndefined(_logger) && !isNullOrEmptyString(ariaTelemetryKey)) {
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
- _logger = AWTLogManager.initialize(ariaTelemetryKey, configuration);
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.0.5-main.b771061",
3
+ "version": "1.0.5-main.d908c85",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",