@sap-ux/telemetry 2.0.3 → 2.0.5

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.
@@ -38,11 +38,14 @@ const parseErrorStack = (errorStack) => {
38
38
  return parsedStack;
39
39
  };
40
40
  let reportingTelemetryClient;
41
- export const reportRuntimeError = (error) => {
42
- if (process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY?.trim() !== 'true') {
41
+ const getReportingTelemetryClient = () => {
42
+ if (!reportingTelemetryClient) {
43
43
  reportingTelemetryClient = new appInsights.TelemetryClient(TelemetrySettings.azureInstrumentationKey);
44
44
  configAzureTelemetryClient(reportingTelemetryClient);
45
45
  }
46
+ return reportingTelemetryClient;
47
+ };
48
+ export const reportRuntimeError = (error) => {
46
49
  const properties = { message: error.message };
47
50
  if (error.stack) {
48
51
  const parsedStack = parseErrorStack(error.stack);
@@ -56,7 +59,7 @@ export const reportRuntimeError = (error) => {
56
59
  measurements: {}
57
60
  };
58
61
  if (process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY !== 'true') {
59
- reportingTelemetryClient.trackEvent(telemetryEvent);
62
+ getReportingTelemetryClient().trackEvent(telemetryEvent);
60
63
  }
61
64
  };
62
65
  export const reportEnableTelemetryOnOff = (enableTelemetry, commonProperties) => {
@@ -69,7 +72,7 @@ export const reportEnableTelemetryOnOff = (enableTelemetry, commonProperties) =>
69
72
  measurements: {}
70
73
  };
71
74
  if (process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY !== 'true') {
72
- reportingTelemetryClient.trackEvent(telemetryEvent);
75
+ getReportingTelemetryClient().trackEvent(telemetryEvent);
73
76
  }
74
77
  };
75
78
  //# sourceMappingURL=reporting.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/telemetry",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Library for sending usage telemetry data",
5
5
  "type": "module",
6
6
  "repository": {
@@ -19,12 +19,12 @@
19
19
  "axios": "1.18.1",
20
20
  "performance-now": "2.1.0",
21
21
  "yaml": "2.9.0",
22
- "@sap-ux/store": "2.0.7",
23
22
  "@sap-ux/project-access": "2.1.13",
24
- "@sap-ux/btp-utils": "2.0.6",
25
23
  "@sap-ux/ui5-config": "1.0.9",
24
+ "@sap-ux/btp-utils": "2.0.6",
26
25
  "@sap-ux/logger": "1.0.3",
27
- "@sap-ux/nodejs-utils": "1.0.9"
26
+ "@sap-ux/nodejs-utils": "1.0.10",
27
+ "@sap-ux/store": "2.0.7"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@jest/globals": "30.4.1",