@dynatrace/react-native-plugin 2.311.2 → 2.313.1

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/README.md CHANGED
@@ -32,8 +32,8 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
32
32
  ## Agent Versions
33
33
  This agent versions are configured in this plugin:
34
34
 
35
- * Android Agent: 8.311.1.1007
36
- * iOS Agent: 8.311.1.1013
35
+ * Android Agent: 8.313.1.1004
36
+ * iOS Agent: 8.313.1.1016
37
37
 
38
38
  ## Quick Setup
39
39
 
@@ -177,8 +177,6 @@ Define a mobile app in Dynatrace and open the Mobile app instrumentation setting
177
177
 
178
178
  > **Note**: Define the components that you want to see lifecycle instrumented ([example](#lifecycle)). This is important as you will only see Application startup and Touches out of the box.
179
179
 
180
- > **Note for Expo**: If you are using expo make sure to use the upstreamTransformer property in the `dynatrace.config.js` file: `upstreamTransformer: require.resolve('@expo/metro-config/babel-transformer')`
181
-
182
180
  For more details about the configuration, see [Advanced topics](#structure-of-the-dynatracejs-file).
183
181
 
184
182
  ## 4. Update Babel Configuration
@@ -1463,7 +1461,12 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
1463
1461
  <br/><br/>
1464
1462
  ## Changelog
1465
1463
 
1466
- 2.311.1
1464
+ 2.313.1
1465
+ * Updated Android (8.313.1.1004) & iOS Agent (8.313.1.1016)
1466
+ * Expo transformer is now automatically used, if available.
1467
+ * LogLevel was broken for manual startup
1468
+
1469
+ 2.311.2
1467
1470
  * Updated Android (8.311.1.1007) & iOS Agent (8.311.1.1013)
1468
1471
  * Configuration copied to android folder which supports cloud builds
1469
1472
  * Removed dynamic import for jsx runtime as it was causing issue
@@ -72,7 +72,7 @@ repositories {
72
72
  }
73
73
 
74
74
  dependencies {
75
- implementation 'com.dynatrace.agent:agent-android:8.311.1.1007'
75
+ implementation 'com.dynatrace.agent:agent-android:8.313.1.1004'
76
76
  implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
77
77
  }
78
78
 
@@ -1,3 +1,3 @@
1
1
  dependencies {
2
- classpath 'com.dynatrace.tools.android:gradle-plugin:8.311.1.1007'
2
+ classpath 'com.dynatrace.tools.android:gradle-plugin:8.313.1.1004'
3
3
  }
@@ -350,4 +350,7 @@ exports.Dynatrace = {
350
350
  sendSessionPropertyEvent: (properties) => {
351
351
  Dynatrace_1.Dynatrace.sendSessionPropertyEvent(properties);
352
352
  },
353
+ sendExceptionEvent: (error, fields) => {
354
+ Dynatrace_1.Dynatrace.sendExceptionEvent(error, fields);
355
+ },
353
356
  };
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_ACTION_NAME_PRIVACY = exports.DEFAULT_USER_OPT_IN = exports.DEFAULT_LOGLEVEL = exports.DEFAULT_FATAL_AS_CRASH = exports.DEFAULT_ERROR_HANDLER = exports.DEFAULT_REPORT_CRASH = exports.DEFAULT_LIFECYCLE_UPDATE = void 0;
4
+ const LogLevel_1 = require("../logging/LogLevel");
4
5
  exports.DEFAULT_LIFECYCLE_UPDATE = false;
5
6
  exports.DEFAULT_REPORT_CRASH = true;
6
7
  exports.DEFAULT_ERROR_HANDLER = true;
7
8
  exports.DEFAULT_FATAL_AS_CRASH = true;
8
- exports.DEFAULT_LOGLEVEL = 1;
9
+ exports.DEFAULT_LOGLEVEL = LogLevel_1.LogLevel.Info;
9
10
  exports.DEFAULT_USER_OPT_IN = false;
10
11
  exports.DEFAULT_ACTION_NAME_PRIVACY = false;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConfigurationHandler = void 0;
4
+ const LogLevel_1 = require("../logging/LogLevel");
4
5
  let _configuration;
5
6
  exports.ConfigurationHandler = {
6
7
  setConfiguration(configuration) {
@@ -10,7 +11,7 @@ exports.ConfigurationHandler = {
10
11
  isErrorHandlerEnabled: () => _configuration.errorHandler,
11
12
  isReportFatalErrorAsCrash: () => _configuration.reportFatalErrorAsCrash,
12
13
  isDebugEnabled: () => exports.ConfigurationHandler.isConfigurationAvailable() &&
13
- _configuration.logLevel === 0,
14
+ _configuration.logLevel === LogLevel_1.LogLevel.Debug,
14
15
  isLifecycleUpdateEnabled: () => _configuration.lifecycleUpdate,
15
16
  isActionNamePrivacyEnabled: () => _configuration.actionNamePrivacy,
16
17
  getBundleName: () => _configuration.bundleName,
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConsoleLogger = void 0;
4
4
  const ConfigurationHandler_1 = require("../configuration/ConfigurationHandler");
5
+ const LogLevel_1 = require("./LogLevel");
5
6
  class ConsoleLogger {
6
7
  constructor(name, logLevel) {
7
8
  this.name = name;
@@ -19,7 +20,7 @@ class ConsoleLogger {
19
20
  console.log(`[${this.name}]: ${msg}`);
20
21
  }
21
22
  isDebugEnabled() {
22
- return (this.level === 0 ||
23
+ return (this.level === LogLevel_1.LogLevel.Debug ||
23
24
  (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable() &&
24
25
  ConfigurationHandler_1.ConfigurationHandler.isDebugEnabled()));
25
26
  }
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogLevelToString = void 0;
3
+ exports.LogLevelToString = exports.LogLevel = void 0;
4
+ var LogLevel;
5
+ (function (LogLevel) {
6
+ LogLevel[LogLevel["Debug"] = 0] = "Debug";
7
+ LogLevel[LogLevel["Info"] = 1] = "Info";
8
+ })(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
4
9
  const LogLevelToString = (level) => {
5
- if (level === 0) {
10
+ if (level === LogLevel.Debug) {
6
11
  return 'Debug';
7
12
  }
8
13
  else {
@@ -40,18 +40,24 @@ const transform = (src, filename, options) => {
40
40
  });
41
41
  };
42
42
  exports.transform = transform;
43
+ const safeRequire = (modulePath) => {
44
+ try {
45
+ return require(modulePath);
46
+ }
47
+ catch (_a) {
48
+ return null;
49
+ }
50
+ };
43
51
  const getUpstreamTransformer = (reactOptions) => {
44
52
  if (reactOptions !== undefined &&
45
53
  reactOptions.upstreamTransformer !== undefined) {
46
54
  return require(reactOptions.upstreamTransformer);
47
55
  }
48
56
  else {
49
- try {
50
- return require('metro-react-native-babel-transformer/src/index');
51
- }
52
- catch (e) {
53
- return require('@react-native/metro-babel-transformer');
54
- }
57
+ const transformer = safeRequire('@expo/metro-config/babel-transformer') ||
58
+ safeRequire('metro-react-native-babel-transformer/src/index') ||
59
+ safeRequire('@react-native/metro-babel-transformer');
60
+ return transformer;
55
61
  }
56
62
  };
57
63
  exports.getUpstreamTransformer = getUpstreamTransformer;
@@ -67,6 +67,15 @@ class DynatraceImpl {
67
67
  }
68
68
  EventPipeline_1.EventPipeline.insertEvent(event);
69
69
  }
70
+ sendExceptionEvent(error, fields) {
71
+ const fieldsCheck = !fields ? null : fields;
72
+ this.logger.debug(`sendExceptionEvent(${JSON.stringify(error)}, ${JSON.stringify(fieldsCheck)})`);
73
+ const event = Object.assign({}, (0, EventCreator_1.createErrorEvent)(error.name, error.message, error.stack));
74
+ let eventValidated = SendEventValidation_1.SendEventValidation.modifyEvent(fieldsCheck);
75
+ eventValidated = Object.assign(Object.assign({}, event), eventValidated);
76
+ eventValidated["characteristics.is_api_reported"] = true;
77
+ EventPipeline_1.EventPipeline.insertEvent(eventValidated);
78
+ }
70
79
  sendEvent(properties, context) {
71
80
  this.logger.debug(`sendEvent(${JSON.stringify(properties, context)})`);
72
81
  const eventValidated = SendEventValidation_1.SendEventValidation.modifyEvent(properties);
@@ -17,12 +17,12 @@ class BaseDataEventModifier {
17
17
  event["dt.rum.event.source.type"] = 'react_native';
18
18
  const bundleName = ConfigurationHandler_1.ConfigurationHandler.getBundleName();
19
19
  if (bundleName !== undefined) {
20
- event["app.react_native.bundle.name"] =
20
+ event["react_native.bundle.name"] =
21
21
  bundleName;
22
22
  }
23
23
  const bundleVersion = ConfigurationHandler_1.ConfigurationHandler.getBundleVersion();
24
24
  if (bundleVersion !== undefined) {
25
- event["app.react_native.bundle.version"] =
25
+ event["react_native.bundle.version"] =
26
26
  bundleVersion;
27
27
  }
28
28
  return event;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/react-native-plugin",
3
- "version": "2.311.2",
3
+ "version": "2.313.1",
4
4
  "description": "This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.",
5
5
  "main": "index.js",
6
6
  "types": "typings/react-native-dynatrace.d.ts",
@@ -37,6 +37,11 @@
37
37
  "jest": {
38
38
  "displayName": "@dynatrace/react-native-plugin",
39
39
  "preset": "react-native",
40
+ "moduleNameMapper": {
41
+ "@expo/metro-config/babel-transformer": "<rootDir>/__mocks__/@expo/metro-config/babel-transformer.js",
42
+ "metro-react-native-babel-transformer/src/index": "<rootDir>/__mocks__/metro-react-native-babel-transformer.js",
43
+ "@react-native/metro-babel-transformer": "<rootDir>/__mocks__/@react-native/metro-babel-transformer.js"
44
+ },
40
45
  "moduleDirectories": [
41
46
  "node_modules"
42
47
  ],
@@ -77,11 +82,11 @@
77
82
  "author": "Dynatrace",
78
83
  "license": "SEE LICENSE IN LICENSE.md",
79
84
  "dependencies": {
80
- "@babel/runtime": "^7.27.0",
85
+ "@babel/runtime": "^7.27.1",
81
86
  "jscodeshift": "^17.3.0",
82
87
  "plist": "^3.1.0",
83
88
  "proxy-polyfill": "^0.3.2",
84
- "semver": "^7.7.1"
89
+ "semver": "^7.7.2"
85
90
  },
86
91
  "homepage": "https://www.dynatrace.com/",
87
92
  "peerDependencies": {
@@ -111,7 +111,7 @@ Pod::Spec.new do |s|
111
111
  #
112
112
 
113
113
  s.dependency "React"
114
- s.dependency 'Dynatrace', '~> 8.311.1.1013'
114
+ s.dependency 'Dynatrace', '~> 8.313.1.1016'
115
115
 
116
116
  # Allows for better compatibility for older and newer versions
117
117
  if defined?(install_modules_dependencies)