@dynatrace/react-native-plugin 2.307.1 → 2.311.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.
Files changed (134) hide show
  1. package/README.md +13 -4
  2. package/android/build.gradle +3 -1
  3. package/android/src/main/java/com/dynatrace/android/agent/DynatraceAppStartModule.kt +128 -0
  4. package/android/src/main/java/com/dynatrace/android/agent/DynatraceInternalModule.kt +22 -0
  5. package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.kt +411 -0
  6. package/android/src/main/java/com/dynatrace/android/agent/DynatraceReactPackage.kt +54 -0
  7. package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.kt +86 -0
  8. package/android/src/main/java/com/dynatrace/android/agent/model/AppStartMeasurement.kt +15 -0
  9. package/android/src/main/java/com/dynatrace/android/agent/model/AppStartMeasurementType.kt +18 -0
  10. package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +228 -0
  11. package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +258 -0
  12. package/files/plugin.gradle +1 -1
  13. package/index.js +10 -10
  14. package/instrumentation/DynatraceInstrumentation.js +1 -0
  15. package/{lib → instrumentation/jsx}/CreateElement.js +6 -5
  16. package/{lib/instrumentor/base → instrumentation/jsx}/ElementHelper.js +14 -12
  17. package/instrumentation/jsx/JsxDevRuntime.js +54 -0
  18. package/instrumentation/jsx/JsxRuntime.js +57 -0
  19. package/instrumentation/jsx/JsxRuntimeUtil.js +31 -0
  20. package/instrumentation/jsx/components/ClassComponent.js +49 -0
  21. package/instrumentation/jsx/components/ComponentUtil.js +33 -0
  22. package/instrumentation/jsx/components/FunctionalComponent.js +15 -0
  23. package/{lib/instrumentor/base → instrumentation/jsx/components}/Picker.js +1 -1
  24. package/{lib/instrumentor/base → instrumentation/jsx/components}/RefreshControl.js +1 -1
  25. package/{lib/instrumentor/base → instrumentation/jsx/components}/Switch.js +8 -8
  26. package/{lib/instrumentor/base → instrumentation/jsx/components}/Touchable.js +8 -8
  27. package/instrumentation/libs/community/Picker.InstrInfo.js +20 -0
  28. package/{lib → instrumentation/libs}/community/Picker.js +1 -1
  29. package/instrumentation/libs/community/gesture-handler/Touchables.InstrInfo.js +23 -0
  30. package/{lib → instrumentation/libs}/community/gesture-handler/Touchables.js +1 -1
  31. package/{lib → instrumentation/libs}/react-native/RefreshControl.InstrInfo.js +2 -2
  32. package/{lib → instrumentation/libs}/react-native/RefreshControl.js +5 -5
  33. package/{lib → instrumentation/libs}/react-native/Switch.InstrInfo.js +2 -2
  34. package/{lib → instrumentation/libs}/react-native/Switch.js +5 -5
  35. package/instrumentation/libs/react-native/Touchables.InstrInfo.js +25 -0
  36. package/{lib → instrumentation/libs}/react-native/Touchables.js +1 -1
  37. package/{lib → instrumentation/libs}/react-navigation/ReactNavigation.js +6 -5
  38. package/{lib/instrumentor → instrumentation}/model/Types.js +1 -14
  39. package/instrumentation/model/TypesUtil.js +50 -0
  40. package/ios/DynatraceRNBridge.h +10 -1
  41. package/ios/DynatraceRNBridge.mm +152 -1
  42. package/jsx-dev-runtime.js +1 -1
  43. package/jsx-runtime.js +1 -1
  44. package/lib/core/Application.js +20 -0
  45. package/lib/{instrumentor/base → core}/Dynatrace.js +72 -48
  46. package/lib/{instrumentor/base → core}/DynatraceAction.js +23 -22
  47. package/lib/core/DynatraceInternal.js +46 -0
  48. package/lib/{instrumentor/base → core}/DynatraceRootAction.js +5 -4
  49. package/lib/{instrumentor/base → core}/DynatraceWebRequestTiming.js +6 -5
  50. package/lib/{instrumentor/base → core}/ErrorHandler.js +6 -5
  51. package/lib/{instrumentor/base → core}/configuration/Configuration.js +1 -1
  52. package/lib/{instrumentor/base → core}/configuration/ConfigurationDefaults.js +1 -2
  53. package/lib/{instrumentor/base → core}/configuration/ConfigurationHandler.js +2 -2
  54. package/lib/{instrumentor/base → core}/configuration/ManualStartupConfiguration.js +1 -1
  55. package/lib/core/logging/ConsoleLogger.js +27 -0
  56. package/lib/core/logging/LogLevel.js +12 -0
  57. package/lib/dynatrace-transformer.js +1 -1
  58. package/lib/next/Dynatrace.js +88 -0
  59. package/lib/next/DynatraceSecondGenForwarder.js +35 -0
  60. package/lib/next/IDynatrace.js +2 -0
  61. package/lib/next/IDynatraceForwarder.js +2 -0
  62. package/lib/next/appstart/AppStartObserver.js +34 -0
  63. package/lib/next/appstart/AppStartType.js +38 -0
  64. package/lib/next/events/EventCreator.js +77 -0
  65. package/lib/next/events/EventPipeline.js +58 -0
  66. package/lib/next/events/EventTimestamp.js +27 -0
  67. package/lib/next/events/ViewInfoCreator.js +27 -0
  68. package/lib/next/events/modifier/BaseDataEventModifier.js +31 -0
  69. package/lib/next/events/modifier/EventLimitation.js +69 -0
  70. package/lib/next/events/modifier/EventModifierUtil.js +89 -0
  71. package/lib/next/events/modifier/IEventModifier.js +2 -0
  72. package/lib/next/events/modifier/ModifyEventValidation.js +189 -0
  73. package/lib/next/events/modifier/SendEventValidation.js +86 -0
  74. package/lib/next/events/modifier/ValueRestrictionModifier.js +56 -0
  75. package/lib/next/events/spec/EventFieldKeysEnum.js +2 -0
  76. package/lib/next/events/spec/EventSpecContstants.js +47 -0
  77. package/lib/next/events/spec/IAppStartEvent.js +2 -0
  78. package/lib/next/events/spec/ICrashEvent.js +2 -0
  79. package/lib/next/events/spec/IErrorCodeEvent.js +2 -0
  80. package/lib/next/events/spec/IErrorExceptionEvent.js +2 -0
  81. package/lib/next/events/spec/IReactNativeEvent.js +2 -0
  82. package/lib/next/events/spec/IRumEvent.js +2 -0
  83. package/lib/next/provider/ITimestampProvider.js +2 -0
  84. package/lib/next/provider/TimestampProvider.js +10 -0
  85. package/package.json +42 -33
  86. package/react-native-dynatrace.podspec +1 -1
  87. package/scripts/Android.js +10 -4
  88. package/scripts/PathsConstants.js +3 -1
  89. package/scripts/core/InstrumentCall.js +1 -0
  90. package/src/lib/{instrumentor/base → core}/interface/NativeDynatraceBridge.ts +8 -0
  91. package/typings/react-native-dynatrace.d.ts +73 -0
  92. package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.java +0 -366
  93. package/android/src/main/java/com/dynatrace/android/agent/DynatraceReactPackage.java +0 -67
  94. package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.java +0 -108
  95. package/android/src/main/java/com/dynatrace/android/agent/PrivateDTBridge.java +0 -28
  96. package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.java +0 -192
  97. package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.java +0 -194
  98. package/lib/community/Picker.InstrInfo.js +0 -20
  99. package/lib/community/gesture-handler/Touchables.InstrInfo.js +0 -56
  100. package/lib/instrumentor/DynatraceInstrumentation.js +0 -1
  101. package/lib/instrumentor/base/Application.js +0 -16
  102. package/lib/instrumentor/base/DynatraceInternal.js +0 -34
  103. package/lib/instrumentor/base/Logger.js +0 -16
  104. package/lib/instrumentor/base/model/LogLevel.js +0 -17
  105. package/lib/jsx-dev-runtime.js +0 -70
  106. package/lib/jsx-runtime.js +0 -69
  107. package/lib/react/Component.js +0 -90
  108. package/lib/react-native/Touchables.InstrInfo.js +0 -60
  109. /package/{lib/instrumentor/base/interface → instrumentation/jsx}/IDynatraceProperties.js +0 -0
  110. /package/{lib → instrumentation/libs}/community/gesture-handler/index.js +0 -0
  111. /package/{lib → instrumentation/libs}/gesture-handler.js +0 -0
  112. /package/{lib → instrumentation/libs}/react-native/index.js +0 -0
  113. /package/{lib → instrumentation/libs}/react-native.js +0 -0
  114. /package/{lib/instrumentor → instrumentation}/model/Reference.js +0 -0
  115. /package/{lib/instrumentor → instrumentation}/parser/Babel.js +0 -0
  116. /package/lib/{instrumentor/base → core}/DynatraceBridge.js +0 -0
  117. /package/lib/{instrumentor/base → core}/NullAction.js +0 -0
  118. /package/lib/{instrumentor/base → core}/NullRootAction.js +0 -0
  119. /package/lib/{instrumentor/base → core}/NullWebRequestTiming.js +0 -0
  120. /package/lib/{instrumentor/base → core}/UserPrivacyOptions.js +0 -0
  121. /package/lib/{instrumentor/base → core}/configuration/ConfigurationBuilder.js +0 -0
  122. /package/lib/{instrumentor/base → core}/configuration/ConfigurationPreset.js +0 -0
  123. /package/lib/{instrumentor/base → core}/configuration/IConfiguration.js +0 -0
  124. /package/lib/{instrumentor/base → core}/interface/IDynatrace.js +0 -0
  125. /package/lib/{instrumentor/base → core}/interface/IDynatraceAction.js +0 -0
  126. /package/lib/{instrumentor/base → core}/interface/IDynatraceInternal.js +0 -0
  127. /package/lib/{instrumentor/base → core}/interface/IDynatraceRootAction.js +0 -0
  128. /package/lib/{instrumentor/base → core}/interface/IWebRequestTiming.js +0 -0
  129. /package/lib/{instrumentor/base → core}/interface/NativeDynatraceBridge.js +0 -0
  130. /package/lib/{instrumentor/base/interface → core/logging}/ILogger.js +0 -0
  131. /package/lib/{instrumentor/base → core}/model/DataCollectionLevel.js +0 -0
  132. /package/lib/{instrumentor/base → core}/model/Json.js +0 -0
  133. /package/lib/{instrumentor/base → core}/model/Platform.js +0 -0
  134. /package/lib/{instrumentor/base → core}/util/StringUtils.js +0 -0
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValueRestrictionModifier = void 0;
4
+ const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
5
+ const EventModifierUtil_1 = require("./EventModifierUtil");
6
+ class ValueRestrictionModifierImpl {
7
+ constructor() {
8
+ this.logger = new ConsoleLogger_1.ConsoleLogger('NonFiniteNumbersModifier');
9
+ }
10
+ modifyEvent(event) {
11
+ if (event != null && this.eventHasRestrictedValues(event)) {
12
+ event["dt.rum.has_nfn_values"] = true;
13
+ }
14
+ return JSON.parse(JSON.stringify(event, (_key, value) => {
15
+ if (value === undefined) {
16
+ return null;
17
+ }
18
+ return value;
19
+ }));
20
+ }
21
+ eventHasRestrictedValues(obj) {
22
+ for (const key in obj) {
23
+ if (Object.prototype.hasOwnProperty.call(obj, key) &&
24
+ (this.valueHasRestrictedValues(obj[key]) ||
25
+ obj[key] === undefined)) {
26
+ this.logger.debug(`eventHasNonFiniteNumbers() - ${key} contains non-finite numbers or undefined: ${obj[key]} changed to null!`);
27
+ return true;
28
+ }
29
+ }
30
+ return false;
31
+ }
32
+ valueHasRestrictedValues(val) {
33
+ if (typeof val === 'function') {
34
+ return true;
35
+ }
36
+ if (Array.isArray(val)) {
37
+ return this.arrayHasRestrictedValues(val);
38
+ }
39
+ if ((0, EventModifierUtil_1.isObject)(val)) {
40
+ return this.eventHasRestrictedValues(val);
41
+ }
42
+ return !this.isFinitePrimitive(val);
43
+ }
44
+ arrayHasRestrictedValues(arr) {
45
+ for (const val of arr) {
46
+ if (this.valueHasRestrictedValues(val) || val === undefined) {
47
+ return true;
48
+ }
49
+ }
50
+ return false;
51
+ }
52
+ isFinitePrimitive(value) {
53
+ return typeof value !== 'number' || isFinite(value);
54
+ }
55
+ }
56
+ exports.ValueRestrictionModifier = new ValueRestrictionModifierImpl();
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MODIFY_EVENT_WHITELIST_NAMESPACE = exports.MODIFY_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = exports.SEND_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES = exports.SEND_EVENT_WHITELIST_NAMESPACES = exports.AllCharacteristicsKeys = exports.KEY_NAME_REGEX = exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = exports.MAX_CUSTOM_EVENT_KEY_LENGTH = exports.MAX_CUSTOM_EVENT_FIELDS = void 0;
4
+ const SPECIFICATION_VERSION = '0.18';
5
+ exports.MAX_CUSTOM_EVENT_FIELDS = 50;
6
+ exports.MAX_CUSTOM_EVENT_KEY_LENGTH = 100;
7
+ exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = 5000;
8
+ exports.KEY_NAME_REGEX = RegExp('^[a-z0-9]+(?:\\.[a-z][a-z0-9]*|_[a-z0-9]+)*$');
9
+ exports.AllCharacteristicsKeys = [
10
+ "characteristics.has_anr",
11
+ "characteristics.has_crash",
12
+ "characteristics.has_csp_violation",
13
+ "characteristics.has_error",
14
+ "characteristics.has_exception",
15
+ "characteristics.has_failed_request",
16
+ "characteristics.has_request",
17
+ "characteristics.has_w3c_navigation_timings",
18
+ "characteristics.has_w3c_resource_timings",
19
+ "characteristics.has_navigation",
20
+ "characteristics.has_page_summary",
21
+ "characteristics.has_user_interaction",
22
+ "characteristics.has_view_summary",
23
+ "characteristics.is_api_reported",
24
+ "characteristics.is_app_start",
25
+ "characteristics.is_internal",
26
+ "characteristics.is_self_monitoring",
27
+ "characteristics.is_visibility_change",
28
+ "characteristics.has_event_properties",
29
+ "characteristics.has_session_properties",
30
+ ];
31
+ exports.SEND_EVENT_WHITELIST_NAMESPACES = [
32
+ "event_properties",
33
+ ];
34
+ exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES = [
35
+ "session_properties",
36
+ ];
37
+ exports.SEND_EVENT_WHITELIST_FIELDS = [
38
+ "duration",
39
+ ];
40
+ exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = exports.SEND_EVENT_WHITELIST_FIELDS;
41
+ exports.MODIFY_EVENT_WHITELIST_FIELDS = [
42
+ "exception.stack_trace",
43
+ ];
44
+ exports.MODIFY_EVENT_WHITELIST_NAMESPACE = [
45
+ "session_properties",
46
+ "event_properties",
47
+ ];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultTimestampProvider = exports.TimestampProvider = void 0;
4
+ class TimestampProvider {
5
+ getCurrentTimestamp() {
6
+ return new Date().getTime();
7
+ }
8
+ }
9
+ exports.TimestampProvider = TimestampProvider;
10
+ exports.defaultTimestampProvider = new TimestampProvider();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/react-native-plugin",
3
- "version": "2.307.1",
3
+ "version": "2.311.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",
@@ -33,6 +33,7 @@
33
33
  "prepare": "husky"
34
34
  },
35
35
  "jest": {
36
+ "displayName": "@dynatrace/react-native-plugin",
36
37
  "preset": "react-native",
37
38
  "moduleDirectories": [
38
39
  "node_modules"
@@ -74,8 +75,8 @@
74
75
  "author": "Dynatrace",
75
76
  "license": "SEE LICENSE IN LICENSE.md",
76
77
  "dependencies": {
77
- "@babel/runtime": "^7.26.7",
78
- "jscodeshift": "^17.1.2",
78
+ "@babel/runtime": "^7.27.0",
79
+ "jscodeshift": "^17.3.0",
79
80
  "plist": "^3.1.0",
80
81
  "proxy-polyfill": "^0.3.2",
81
82
  "semver": "^7.7.1"
@@ -129,46 +130,54 @@
129
130
  "uglify-js": "^3.17.4"
130
131
  },
131
132
  "files": [
132
- "command/command.js",
133
- "command/util/*",
134
- "command/interface/*",
135
- "android/build.gradle",
136
- "android/src/**/*",
137
- "ios/**/*",
138
- "files/*",
139
- "lib/instrumentor/base/*.js",
140
- "lib/instrumentor/base/model/*.js",
141
- "lib/instrumentor/base/configuration/*.js",
142
- "lib/instrumentor/base/configuration/interface/*.js",
143
- "lib/instrumentor/base/interface/*.js",
144
- "lib/instrumentor/base/util/*.js",
145
- "lib/instrumentor/model/*.js",
146
- "lib/instrumentor/parser/*.js",
147
- "lib/instrumentor/DynatraceInstrumentation.js",
148
- "lib/*.js",
149
- "lib/community/*.js",
150
- "lib/community/gesture-handler/*.js",
151
- "lib/react-navigation/*.js",
152
- "lib/react-native/*.js",
153
- "lib/react-native/Touchables.jsx",
154
- "lib/react/*.js",
155
- "lib/metro/*.js",
156
- "lib/util/*.js",
157
133
  "react-native.config.js",
158
134
  "react-native-dynatrace.js",
159
135
  "react-native-dynatrace.podspec",
136
+ "jsx-runtime.js",
137
+ "jsx-dev-runtime.js",
160
138
  "README.md",
161
139
  "LICENSE.md",
140
+ "package.json",
141
+ "android/build.gradle",
142
+ "android/src/**/*",
143
+ "ios/**/*",
144
+ "files/*",
145
+ "typings/*",
146
+ "command/command.js",
147
+ "command/util/*",
148
+ "command/interface/*",
162
149
  "scripts/*",
163
150
  "scripts/api/*",
164
151
  "scripts/core/*",
165
152
  "scripts/api/model/*",
166
153
  "scripts/util/*",
167
- "typings/*",
168
- "package.json",
169
- "jsx-runtime.js",
170
- "jsx-dev-runtime.js",
171
- "src/lib/instrumentor/base/interface/NativeDynatraceBridge.ts"
154
+ "instrumentation/jsx/*.js",
155
+ "instrumentation/jsx/components/*.js",
156
+ "instrumentation/libs/*.js",
157
+ "instrumentation/libs/community/*.js",
158
+ "instrumentation/libs/community/gesture-handler/*.js",
159
+ "instrumentation/libs/react-navigation/*.js",
160
+ "instrumentation/libs/react-native/*.js",
161
+ "instrumentation/libs/react-native/Touchables.jsx",
162
+ "instrumentation/model/*.js",
163
+ "instrumentation/parser/*.js",
164
+ "instrumentation/DynatraceInstrumentation.js",
165
+ "lib/*.js",
166
+ "lib/core/*.js",
167
+ "lib/core/configuration/*.js",
168
+ "lib/core/interface/*.js",
169
+ "lib/core/logging/*.js",
170
+ "lib/core/model/*.js",
171
+ "lib/core/util/*.js",
172
+ "lib/core/*.js",
173
+ "lib/metro/*.js",
174
+ "lib/next/*.js",
175
+ "lib/next/appstart/*.js",
176
+ "lib/next/events/*.js",
177
+ "lib/next/events/modifier/*.js",
178
+ "lib/next/events/spec/*.js",
179
+ "lib/next/provider/*.js",
180
+ "src/lib/core/interface/NativeDynatraceBridge.ts"
172
181
  ],
173
182
  "codegenConfig": {
174
183
  "name": "DynatraceBridgeSpec",
@@ -111,7 +111,7 @@ Pod::Spec.new do |s|
111
111
  #
112
112
 
113
113
  s.dependency "React"
114
- s.dependency 'Dynatrace', '~> 8.307.1.1014'
114
+ s.dependency 'Dynatrace', '~> 8.311.1.1013'
115
115
 
116
116
  # Allows for better compatibility for older and newer versions
117
117
  if defined?(install_modules_dependencies)
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.writeGradleConfig = exports.instrumentAndroidPlatform = exports.GRADLE_APPLY_BUILDSCRIPT = exports.GRADLE_DYNATRACE_FILE = void 0;
4
+ exports.copyGradleConfigFile = exports.writeGradleConfig = exports.instrumentAndroidPlatform = exports.GRADLE_APPLY_BUILDSCRIPT = exports.GRADLE_DYNATRACE_FILE = void 0;
5
5
  const Logger_1 = require("./Logger");
6
6
  const FileOperationHelper_1 = require("./FileOperationHelper");
7
7
  const PathsConstants_1 = require("./PathsConstants");
8
+ const path_1 = require("path");
8
9
  const GRADLE_CONFIG_IDENTIFIER = '// AUTO - INSERTED';
9
- exports.GRADLE_DYNATRACE_FILE = 'apply from: "../node_modules/@dynatrace/react-native-plugin/files/dynatrace.gradle"';
10
+ exports.GRADLE_DYNATRACE_FILE = `apply from: "./${PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE}"`;
10
11
  const GRADLE_BUILDSCRIPT_IDENTIFIER = 'buildscript';
11
12
  exports.GRADLE_APPLY_BUILDSCRIPT = 'apply from: "../node_modules/@dynatrace/react-native-plugin/files/plugin.gradle", to: buildscript';
12
13
  const GRADLE_REACT_NATIVE_PLUGIN = 'apply plugin: "com.facebook.react.rootproject"';
@@ -39,7 +40,7 @@ const changeReactNativeBuildGradleFile = (pathToGradle, remove) => {
39
40
  if (gradleFileContentLines[i].indexOf('plugin.gradle') > -1) {
40
41
  gradlePluginFileIndex = i;
41
42
  }
42
- else if (gradleFileContentLines[i].indexOf('dynatrace.gradle') > -1) {
43
+ else if (gradleFileContentLines[i].indexOf(PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE) > -1) {
43
44
  gradleDynatraceFileIndex = i;
44
45
  }
45
46
  }
@@ -112,9 +113,14 @@ const writeGradleConfig = (androidConfig) => {
112
113
  gradleFileContentLines.splice(gradleFileIndex + 1, 0, androidConfig.config);
113
114
  const fullGradleFile = gradleFileContentLines.join('\n');
114
115
  FileOperationHelper_1.default.writeTextToFileSync(PathsConstants_1.default.getDynatraceGradleFile(), fullGradleFile);
115
- Logger_1.default.logMessageSync('Replaced old configuration with current configuration in dynatrace.gradle', Logger_1.default.INFO);
116
+ Logger_1.default.logMessageSync(`Replaced old configuration with current configuration in ${PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE}`, Logger_1.default.INFO);
116
117
  };
117
118
  exports.writeGradleConfig = writeGradleConfig;
119
+ const copyGradleConfigFile = (pathToGradle) => {
120
+ const gradleDirectory = (0, path_1.dirname)(pathToGradle);
121
+ FileOperationHelper_1.default.copyFileSync(PathsConstants_1.default.getDynatraceGradleFile(), (0, path_1.join)(gradleDirectory, PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE));
122
+ };
123
+ exports.copyGradleConfigFile = copyGradleConfigFile;
118
124
  const removeOldGradleConfig = (gradleFileContent) => {
119
125
  const gradleFileContentLines = gradleFileContent.split('\n');
120
126
  const gradleConfigIndex = [];
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DYNATRACE_CONFIG_GRADLE_FILE = void 0;
4
5
  const path_1 = require("path");
5
6
  const PATH_FILES = 'files';
6
7
  const PATH_LOGS = 'logs';
8
+ exports.DYNATRACE_CONFIG_GRADLE_FILE = 'dynatrace.gradle';
7
9
  let rootPath = __dirname;
8
10
  exports.default = {
9
11
  setRoot: (newRoot) => {
@@ -25,7 +27,7 @@ exports.default = {
25
27
  getAndroidFolder: () => (0, path_1.join)(getApplicationPath(), 'android'),
26
28
  getAndroidGradleFile: (androidFolder) => (0, path_1.join)(androidFolder, 'build.gradle'),
27
29
  getIOSFolder: () => (0, path_1.join)(getApplicationPath(), 'ios'),
28
- getDynatraceGradleFile: () => (0, path_1.join)(getPluginPath(), PATH_FILES, 'dynatrace.gradle'),
30
+ getDynatraceGradleFile: () => (0, path_1.join)(getPluginPath(), PATH_FILES, exports.DYNATRACE_CONFIG_GRADLE_FILE),
29
31
  getCurrentLogPath: () => (0, path_1.join)(getPluginPath(), PATH_LOGS, 'currentLog.txt'),
30
32
  getLogPath: () => (0, path_1.join)(getPluginPath(), PATH_LOGS),
31
33
  };
@@ -54,6 +54,7 @@ const instrumentCommand = () => {
54
54
  Logger_1.default.logMessageSync('Starting Android Instrumentation with Dynatrace!', Logger_1.default.INFO);
55
55
  android.instrumentAndroidPlatform(pathToGradle, false);
56
56
  android.writeGradleConfig(configAgent.android);
57
+ android.copyGradleConfigFile(pathToGradle);
57
58
  }
58
59
  catch (e) {
59
60
  if (e instanceof Error) {
@@ -6,6 +6,10 @@ import { TurboModuleRegistry } from 'react-native';
6
6
  import { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
7
7
 
8
8
  export interface Spec extends TurboModule {
9
+ // Event Listener for AppStart
10
+ addListener: (eventName: string) => void;
11
+ removeListeners: (count: number) => void;
12
+
9
13
  getConstants: () => {
10
14
  DATA_COLLECTION_OFF: string;
11
15
  DATA_COLLECTION_PERFORMANCE: string;
@@ -154,6 +158,10 @@ export interface Spec extends TurboModule {
154
158
  requestSize: number,
155
159
  responseSize: number,
156
160
  ): void;
161
+
162
+ startView(name: string): void;
163
+
164
+ stopView(): void;
157
165
  }
158
166
 
159
167
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
@@ -580,6 +580,79 @@ export declare const Dynatrace: {
580
580
  * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#business-event-capturing
581
581
  */
582
582
  sendBizEvent(type: string, attributes?: JSONObject, platform?: Platform): void;
583
+
584
+ /**
585
+ * Adds an event modifier, which will be executed in the end before
586
+ * the event is transfered. This allows to modify the event to some extent.
587
+ *
588
+ * @param eventModifier Function which is modify an event
589
+ */
590
+ addEventModifier(eventModifier: IEventModifier): IEventModifier;
591
+
592
+ /**
593
+ * Is removing an event modifier again, so it will not modify events anymore.
594
+ *
595
+ * @param eventModifier Function which should be removed
596
+ */
597
+ removeEventModifier(eventModifier: IEventModifier): boolean;
598
+
599
+ /**
600
+ * Send a Event
601
+ *
602
+ * With sendEvent, you can report a event.
603
+ *
604
+ * Note: The 'dt' key, as well as all 'dt.' prefixed keys are considered reserved by Dynatrace
605
+ * and will be stripped from the passed in attributes. TODO: Add Others here.
606
+ *
607
+ * @param {string} type Mandatory event type
608
+ * @param {JSONObject} properties Must be a valid JSON object and cannot contain functions,
609
+ * undefined, Infinity and NaN as values, otherwise they will be removed.
610
+ * Attributes need to be serializable using JSON.stringify.
611
+ * The resulting event will be populated with attributes parameter,
612
+ * and enriched with additional properties, thus also empty objects are valid.
613
+ * @param {any} context optional context that can be used to manipulate the resulting event
614
+ * using an event modifier
615
+ */
616
+ sendEvent(properties: JSONObject, context?: any): void;
617
+
618
+ /**
619
+ * Sets the current view context which will be used for every event happening in the meantime.
620
+ *
621
+ * @param name Name of the current view
622
+ */
623
+ startView(name: string): void;
624
+
625
+ /**
626
+ * Removes the current view context
627
+ */
628
+ stopView(): void;
629
+
630
+ /**
631
+ * Send a Session Properties Event.
632
+ *
633
+ * With sendSessionPropertyEvent you can report properties that apply to all events in the current session. Any
634
+ * custom properties must be added in the 'session_properties.*' namespace, otherwise they will be dropped. Only one
635
+ * session properties event may be active for every session.
636
+ *
637
+ * @param properties any attributes that should be reported for every event in the session.
638
+ */
639
+ sendSessionPropertyEvent(properties: JSONObject): void;
640
+ }
641
+
642
+ /**
643
+ * Interface which declares event modification through modifyEvent
644
+ */
645
+ export declare interface IEventModifier {
646
+ /**
647
+ * Event as JSONObject is received and can be modified. If instead of the event
648
+ * null is returned, the event will be canceled.
649
+ *
650
+ * @param event Event as JSONObject
651
+ * @param context optional context that can be used to manipulate the resulting event
652
+ * using an event modifier or undefined if not available
653
+ * @returns Either the modified event or null if you want to cancel the event
654
+ */
655
+ modifyEvent(event: JSONObject | null, context?: any): JSONObject | null;
583
656
  }
584
657
 
585
658
  export declare interface IDynatraceAction {