@dynatrace/react-native-plugin 2.339.1 → 2.343.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 (62) hide show
  1. package/README.md +149 -23
  2. package/android/build.gradle +11 -2
  3. package/android/src/main/java/com/dynatrace/android/agent/DynatraceAppStartModule.kt +9 -31
  4. package/android/src/main/java/com/dynatrace/android/agent/DynatraceConfigurationModule.kt +1 -0
  5. package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.kt +41 -1
  6. package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.kt +1 -0
  7. package/android/src/main/java/com/dynatrace/android/agent/ScreenshotSelfMonitor.kt +175 -0
  8. package/android/src/main/java/com/dynatrace/android/agent/UIChangeScreenshotListener.kt +124 -0
  9. package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +33 -0
  10. package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +40 -0
  11. package/files/plugin.gradle +1 -1
  12. package/instrumentation/BabelPluginDynatrace.js +1 -1
  13. package/instrumentation/DynatraceInstrumentation.js +1 -1
  14. package/instrumentation/jsx/CreateElement.js +5 -9
  15. package/instrumentation/jsx/ElementHelper.js +5 -6
  16. package/instrumentation/jsx/JsxDevRuntime.js +33 -31
  17. package/instrumentation/jsx/JsxRuntime.js +30 -30
  18. package/instrumentation/jsx/JsxRuntimeHelpers.js +14 -0
  19. package/instrumentation/jsx/components/ClassComponent.js +4 -8
  20. package/instrumentation/jsx/components/ComponentUtil.js +24 -25
  21. package/instrumentation/libs/UserInteraction.js +27 -24
  22. package/instrumentation/libs/react-native/RefreshControl.js +5 -9
  23. package/instrumentation/libs/withOnPressMonitoring.js +66 -57
  24. package/ios/DTXScreenshotSelfMonitor.h +29 -0
  25. package/ios/DTXScreenshotSelfMonitor.mm +213 -0
  26. package/ios/DTXScreenshotSelfMonitorSwizzler.h +15 -0
  27. package/ios/DTXScreenshotSelfMonitorSwizzler.mm +68 -0
  28. package/ios/DynatraceRNBridge.h +6 -0
  29. package/ios/DynatraceRNBridge.mm +53 -0
  30. package/lib/core/Dynatrace.js +2 -0
  31. package/lib/core/DynatraceAction.js +1 -3
  32. package/lib/core/DynatraceInternal.js +38 -40
  33. package/lib/core/ErrorHandler.js +41 -21
  34. package/lib/core/NullAction.js +1 -3
  35. package/lib/core/logging/LogMessages.js +42 -0
  36. package/lib/core/util/JsonUtils.js +6 -0
  37. package/lib/features/ui-interaction/IUserInteractionEvent.js +1 -1
  38. package/lib/features/ui-interaction/Runtime.js +1 -1
  39. package/lib/features/ui-interaction/TouchMetaResolver.js +4 -3
  40. package/lib/next/Dynatrace.js +26 -1
  41. package/lib/next/events/EventPipeline.js +48 -31
  42. package/lib/next/events/HttpRequestEventData.js +3 -3
  43. package/lib/next/events/interface/HttpRequestEventDataTypes.js +2 -0
  44. package/lib/next/events/modifier/ModifyEventValidation.js +79 -51
  45. package/lib/next/events/spec/EventSpecContstants.js +1 -1
  46. package/lib/next/userAction/NullUserAction.js +15 -0
  47. package/lib/next/userAction/UserAction.js +2 -0
  48. package/lib/next/userAction/UserActionConfiguration.js +10 -0
  49. package/lib/next/userAction/UserActionImpl.js +70 -0
  50. package/lib/next/util/TraceContextUtils.js +8 -14
  51. package/lib/next/util/Utils.js +13 -0
  52. package/package.json +11 -6
  53. package/public.js +3 -1
  54. package/react-native-dynatrace.podspec +10 -3
  55. package/scripts/Config.js +22 -4
  56. package/scripts/DebugFlag.js +20 -0
  57. package/scripts/FileOperationHelper.js +15 -39
  58. package/scripts/Logger.js +2 -3
  59. package/scripts/core/InstrumentCall.js +110 -81
  60. package/scripts/util/CustomArgumentUtil.js +8 -6
  61. package/src/lib/core/interface/NativeDynatraceBridge.ts +34 -1
  62. package/types.d.ts +187 -9
@@ -1,24 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.instrumentCommand = void 0;
4
- const path_1 = require("path");
4
+ const node_path_1 = require("node:path");
5
5
  const Logger_1 = require("../Logger");
6
6
  const Config_1 = require("../Config");
7
7
  const android = require("../Android");
8
8
  const PathsConstants_1 = require("../PathsConstants");
9
- const nodePath = require("path");
10
9
  const Ios_1 = require("../Ios");
11
10
  const InstrumentUtil_1 = require("../util/InstrumentUtil");
12
11
  const CustomArgumentUtil_1 = require("../util/CustomArgumentUtil");
13
12
  const Platform_1 = require("../api/model/Platform");
14
13
  const SourceMapUtil_1 = require("../util/SourceMapUtil");
15
- const instrumentCommand = () => {
16
- if (process.argv.includes('--help')) {
17
- Logger_1.default.logMessageSync(`
14
+ const platformLogPrefix = { info: ' ℹ️ ', warning: ' ⚠️ ', error: ' ❌ ' };
15
+ const logHelpMessage = () => {
16
+ const iOSDefaultPath = (0, node_path_1.join)(PathsConstants_1.default.getIOSFolder(), '<appName>', 'Info.plist');
17
+ const iOSSupportingDefaultPath = (0, node_path_1.join)(PathsConstants_1.default.getIOSFolder(), '<appName>', 'Supporting', 'Info.plist');
18
+ Logger_1.default.logMessageSync(`
18
19
  Usage: npx instrumentDynatrace [options]
19
20
 
20
21
  Options:
21
22
  --help Show this help message and exit.
23
+ --reset Clear any previously-persisted custom config path and
24
+ revert the Metro/Babel transformer to the default
25
+ dynatrace.config.js lookup. Use this if you previously
26
+ ran with config="..." and want to go back to the default.
22
27
  config="/custom/path/to/dynatrace.config.js"
23
28
  Specify a custom path to the Dynatrace configuration file.
24
29
  Default: ${PathsConstants_1.default.getConfigFilePath()}
@@ -28,8 +33,8 @@ const instrumentCommand = () => {
28
33
  plist="/custom/path/to/Info.plist"
29
34
  Specify a custom path to the Info.plist file of your ios project.
30
35
  Default: Extracts <appName> from app.json and then tries
31
- ${nodePath.join(PathsConstants_1.default.getIOSFolder(), "<appName>", 'Info.plist')}
32
- and ${nodePath.join(PathsConstants_1.default.getIOSFolder(), "<appName>", "Supporting", "Info.plist")}
36
+ ${iOSDefaultPath}
37
+ and ${iOSSupportingDefaultPath}
33
38
  in that order
34
39
 
35
40
  Examples:
@@ -37,95 +42,119 @@ const instrumentCommand = () => {
37
42
  npx instrumentDynatrace config="/custom/path/to/dynatrace.config.js"
38
43
  npx instrumentDynatrace gradle="/custom/path/to/build.gradle"
39
44
  npx instrumentDynatrace plist="/custom/path/to/Info.plist"
45
+ npx instrumentDynatrace --reset
40
46
  `, Logger_1.default.INFO);
41
- return;
47
+ };
48
+ const persistCustomArguments = (argv) => {
49
+ if (!argv.isEmpty()) {
50
+ (0, CustomArgumentUtil_1.writeCustomArguments)(argv);
42
51
  }
43
- Logger_1.default.logMessageSync('⏳ Starting instrumentation of React Native application ..', Logger_1.default.INFO);
44
- Logger_1.default.withPrefix({ info: ' ℹ️ ', warning: ' ⚠️ ' }, () => (0, InstrumentUtil_1.showVersionOfPlugin)());
52
+ };
53
+ const resolveInstrumentationPaths = (argv) => {
45
54
  let pathToConfig = PathsConstants_1.default.getConfigFilePath();
46
55
  let pathToGradle = PathsConstants_1.default.getAndroidGradleFile(PathsConstants_1.default.getAndroidFolder());
47
56
  let pathToAppGradle = PathsConstants_1.default.getAndroidAppGradleFile(PathsConstants_1.default.getAndroidFolder());
48
- let androidAvailable = true;
49
57
  let pathToPList;
50
- let iosAvailable = true;
51
- const argv = (0, CustomArgumentUtil_1.parseCommandLine)(process.argv.slice(2));
52
- if (argv.isEmpty()) {
53
- (0, CustomArgumentUtil_1.clearCustomArguments)();
54
- }
55
- else {
56
- (0, CustomArgumentUtil_1.writeCustomArguments)(argv);
57
- }
58
58
  if (argv.isCustomConfigurationPathSet()) {
59
59
  pathToConfig = argv.getCustomConfigurationPath();
60
60
  }
61
- Logger_1.default.withPrefix({ info: ' ℹ️ ', warning: ' ⚠️ ', error: ' ❌ ' }, () => {
62
- if (argv.isCustomGradlePathSet()) {
63
- pathToGradle = argv.getCustomGradlePath();
64
- if (!/build\.gradle(\.kts)?$/.test(pathToGradle)) {
65
- throw new Error(`--gradle must point to build.gradle or build.gradle.kts file, got ${pathToGradle}`);
66
- }
67
- const androidFolder = nodePath.dirname(pathToGradle);
68
- pathToAppGradle = PathsConstants_1.default.getAndroidAppGradleFile(androidFolder);
69
- androidAvailable = (0, InstrumentUtil_1.isPlatformAvailable)(pathToGradle, Platform_1.Platform.Android);
70
- }
71
- else {
72
- androidAvailable = (0, InstrumentUtil_1.isPlatformAvailable)(PathsConstants_1.default.getAndroidFolder(), Platform_1.Platform.Android);
73
- }
74
- if (argv.isCustomPlistPathSet()) {
75
- pathToPList = (0, path_1.resolve)(argv.getCustomPlistPath());
76
- iosAvailable = (0, InstrumentUtil_1.isPlatformAvailable)(pathToPList, Platform_1.Platform.IOS);
61
+ if (argv.isCustomGradlePathSet()) {
62
+ pathToGradle = argv.getCustomGradlePath();
63
+ if (!/build\.gradle(\.kts)?$/.test(pathToGradle)) {
64
+ throw new Error(`--gradle must point to build.gradle or build.gradle.kts file, got ${pathToGradle}`);
77
65
  }
78
- else {
79
- iosAvailable = (0, InstrumentUtil_1.isPlatformAvailable)(PathsConstants_1.default.getIOSFolder(), Platform_1.Platform.IOS);
80
- }
81
- });
82
- pathToConfig = (0, path_1.resolve)(pathToConfig);
83
- pathToGradle = (0, path_1.resolve)(pathToGradle);
84
- pathToAppGradle = (0, path_1.resolve)(pathToAppGradle);
85
- if (iosAvailable || androidAvailable) {
86
- try {
87
- Logger_1.default.logMessageSync('⏳ Trying to read configuration file: ' + pathToConfig, Logger_1.default.INFO);
88
- const configAgent = (0, Config_1.readConfig)(pathToConfig);
89
- if (androidAvailable) {
90
- try {
91
- Logger_1.default.logMessageSync('⏳ Starting Android Instrumentation with Dynatrace!', Logger_1.default.INFO);
92
- Logger_1.default.withPrefix({ info: ' ℹ️ ', warning: ' ⚠️ ', error: ' ❌ ' }, () => {
93
- android.instrumentAndroidPlatform(pathToGradle, false);
94
- android.writeGradleConfig(configAgent.android, pathToGradle);
95
- android.ensureRuntimeScriptApplied(pathToAppGradle);
96
- });
97
- Logger_1.default.logMessageSync(' ✅ Finished Android Instrumentation with Dynatrace!', Logger_1.default.INFO);
98
- }
99
- catch (e) {
100
- if (e instanceof Error) {
101
- Logger_1.default.logMessageSync(' ❌ Android Instrumentation failed: ' + e.message, Logger_1.default.ERROR);
102
- }
103
- }
104
- }
105
- if (iosAvailable) {
106
- try {
107
- Logger_1.default.logMessageSync('⏳ Starting iOS Instrumentation with Dynatrace!', Logger_1.default.INFO);
108
- Logger_1.default.withPrefix({ info: ' ℹ️ ', warning: ' ⚠️ ', error: ' ❌ ' }, () => Ios_1.default.modifyPListFile(pathToPList, configAgent.ios, false));
109
- Logger_1.default.logMessageSync(' ✅ Finished iOS Instrumentation with Dynatrace!', Logger_1.default.INFO);
110
- }
111
- catch (e) {
112
- if (e instanceof Error) {
113
- Logger_1.default.logMessageSync(' ❌ iOS Instrumentation failed: ' + e.message, Logger_1.default.ERROR);
114
- }
115
- }
116
- }
117
- (0, SourceMapUtil_1.patchMetroSourceMap)();
118
- Logger_1.default.logMessageSync('🎉 Finished instrumentation of React Native application ..', Logger_1.default.INFO);
66
+ pathToAppGradle = PathsConstants_1.default.getAndroidAppGradleFile((0, node_path_1.dirname)(pathToGradle));
67
+ }
68
+ if (argv.isCustomPlistPathSet()) {
69
+ pathToPList = argv.getCustomPlistPath();
70
+ }
71
+ return {
72
+ pathToConfig: (0, node_path_1.resolve)(pathToConfig),
73
+ pathToGradle: (0, node_path_1.resolve)(pathToGradle),
74
+ pathToAppGradle: (0, node_path_1.resolve)(pathToAppGradle),
75
+ pathToPList: pathToPList ? (0, node_path_1.resolve)(pathToPList) : undefined,
76
+ };
77
+ };
78
+ const detectPlatformAvailability = (argv, paths) => {
79
+ const androidAvailable = argv.isCustomGradlePathSet()
80
+ ? (0, InstrumentUtil_1.isPlatformAvailable)(paths.pathToGradle, Platform_1.Platform.Android)
81
+ : (0, InstrumentUtil_1.isPlatformAvailable)(PathsConstants_1.default.getAndroidFolder(), Platform_1.Platform.Android);
82
+ const iosAvailable = argv.isCustomPlistPathSet()
83
+ ? (0, InstrumentUtil_1.isPlatformAvailable)(paths.pathToPList, Platform_1.Platform.IOS)
84
+ : (0, InstrumentUtil_1.isPlatformAvailable)(PathsConstants_1.default.getIOSFolder(), Platform_1.Platform.IOS);
85
+ return { androidAvailable, iosAvailable };
86
+ };
87
+ const instrumentAndroidIfAvailable = (androidAvailable, pathToGradle, pathToAppGradle, androidConfig) => {
88
+ if (!androidAvailable) {
89
+ return;
90
+ }
91
+ try {
92
+ Logger_1.default.logMessageSync('⏳ Starting Android Instrumentation with Dynatrace!', Logger_1.default.INFO);
93
+ Logger_1.default.withPrefix(platformLogPrefix, () => {
94
+ android.instrumentAndroidPlatform(pathToGradle, false);
95
+ android.writeGradleConfig(androidConfig, pathToGradle);
96
+ android.ensureRuntimeScriptApplied(pathToAppGradle);
97
+ });
98
+ Logger_1.default.logMessageSync(' ✅ Finished Android Instrumentation with Dynatrace!', Logger_1.default.INFO);
99
+ }
100
+ catch (e) {
101
+ if (e instanceof Error) {
102
+ Logger_1.default.logMessageSync(' ❌ Android Instrumentation failed: ' + e.message, Logger_1.default.ERROR);
119
103
  }
120
- catch (e) {
121
- if (e instanceof Error) {
122
- Logger_1.default.logMessageSync('❌ Instrumentation failed: ' + e.message, Logger_1.default.ERROR);
123
- }
104
+ }
105
+ };
106
+ const instrumentIosIfAvailable = (iosAvailable, pathToPList, iosConfig) => {
107
+ if (!iosAvailable) {
108
+ return;
109
+ }
110
+ try {
111
+ Logger_1.default.logMessageSync('⏳ Starting iOS Instrumentation with Dynatrace!', Logger_1.default.INFO);
112
+ Logger_1.default.withPrefix(platformLogPrefix, () => Ios_1.default.modifyPListFile(pathToPList, iosConfig, false));
113
+ Logger_1.default.logMessageSync(' ✅ Finished iOS Instrumentation with Dynatrace!', Logger_1.default.INFO);
114
+ }
115
+ catch (e) {
116
+ if (e instanceof Error) {
117
+ Logger_1.default.logMessageSync(' ❌ iOS Instrumentation failed: ' + e.message, Logger_1.default.ERROR);
124
118
  }
125
119
  }
126
- else {
120
+ };
121
+ const runPlatformInstrumentation = (paths, availability) => {
122
+ if (!availability.iosAvailable && !availability.androidAvailable) {
127
123
  Logger_1.default.logMessageSync('⚠️ Both Android and iOS Folder are not available - Skip instrumentation.', Logger_1.default.WARNING);
124
+ return;
125
+ }
126
+ try {
127
+ Logger_1.default.logMessageSync('⏳ Trying to read configuration file: ' + paths.pathToConfig, Logger_1.default.INFO);
128
+ const configAgent = (0, Config_1.readConfig)(paths.pathToConfig);
129
+ instrumentAndroidIfAvailable(availability.androidAvailable, paths.pathToGradle, paths.pathToAppGradle, configAgent.android);
130
+ instrumentIosIfAvailable(availability.iosAvailable, paths.pathToPList, configAgent.ios);
131
+ (0, SourceMapUtil_1.patchMetroSourceMap)();
132
+ Logger_1.default.logMessageSync('🎉 Finished instrumentation of React Native application ..', Logger_1.default.INFO);
133
+ }
134
+ catch (e) {
135
+ if (e instanceof Error) {
136
+ Logger_1.default.logMessageSync('❌ Instrumentation failed: ' + e.message, Logger_1.default.ERROR);
137
+ }
138
+ }
139
+ };
140
+ const instrumentCommand = () => {
141
+ const commandArgs = process.argv;
142
+ if (commandArgs.includes('--help')) {
143
+ logHelpMessage();
144
+ return;
128
145
  }
146
+ if (commandArgs.includes('--reset')) {
147
+ (0, CustomArgumentUtil_1.clearCustomArguments)();
148
+ Logger_1.default.logMessageSync('✅ Custom config path cleared. Metro/Babel transformer will use dynatrace.config.js.', Logger_1.default.INFO);
149
+ return;
150
+ }
151
+ Logger_1.default.logMessageSync('⏳ Starting instrumentation of React Native application ..', Logger_1.default.INFO);
152
+ Logger_1.default.withPrefix({ info: ' ℹ️ ', warning: ' ⚠️ ' }, () => (0, InstrumentUtil_1.showVersionOfPlugin)());
153
+ const argv = (0, CustomArgumentUtil_1.parseCommandLine)(commandArgs.slice(2));
154
+ persistCustomArguments(argv);
155
+ const instrumentationPaths = resolveInstrumentationPaths(argv);
156
+ const availability = Logger_1.default.withPrefix(platformLogPrefix, () => detectPlatformAvailability(argv, instrumentationPaths));
157
+ runPlatformInstrumentation(instrumentationPaths, availability);
129
158
  Logger_1.default.closeLogFile();
130
159
  };
131
160
  exports.instrumentCommand = instrumentCommand;
@@ -10,17 +10,19 @@ exports.PROCESS_CUSTOM_ARGUMENT_NAME = 'dtCustomArguments';
10
10
  const parseCommandLine = (inputArgs) => {
11
11
  const parsedArgs = new CustomArgumentsBuilderImpl_1.CustomArgumentsBuilderImpl();
12
12
  inputArgs.forEach((entry) => {
13
- const parts = entry.split('=');
14
- if (parts.length === 2) {
15
- switch (parts[0]) {
13
+ const eqIndex = entry.indexOf('=');
14
+ if (eqIndex !== -1) {
15
+ const key = entry.slice(0, eqIndex);
16
+ const value = entry.slice(eqIndex + 1);
17
+ switch (key) {
16
18
  case "gradle":
17
- parsedArgs.withGradleArgument(parts[1]);
19
+ parsedArgs.withGradleArgument(value);
18
20
  break;
19
21
  case "config":
20
- parsedArgs.withConfigurationArgument(parts[1]);
22
+ parsedArgs.withConfigurationArgument(value);
21
23
  break;
22
24
  case "plist":
23
- parsedArgs.withPlistArgument(parts[1]);
25
+ parsedArgs.withPlistArgument(value);
24
26
  break;
25
27
  }
26
28
  }
@@ -54,7 +54,6 @@ export interface Spec extends TurboModule {
54
54
  platform?: string,
55
55
  ): void;
56
56
 
57
- // eslint-disable-next-line max-len
58
57
  reportCrash(
59
58
  errorName: string,
60
59
  reason: string,
@@ -123,6 +122,40 @@ export interface Spec extends TurboModule {
123
122
  appStartKeys: string[],
124
123
  ): void;
125
124
 
125
+ setAutomaticUserActionDetection(enabled: boolean): void;
126
+
127
+ createUserAction(
128
+ actionId: string,
129
+ name: string,
130
+ completeAutomatically: boolean,
131
+ properties?: UnsafeObject | null,
132
+ ): void;
133
+
134
+ addEventStringPropertyToUserAction(
135
+ actionId: string,
136
+ key: string,
137
+ value: string,
138
+ ): void;
139
+
140
+ addEventDoublePropertyToUserAction(
141
+ actionId: string,
142
+ key: string,
143
+ value: number,
144
+ ): void;
145
+
146
+ addEventBooleanPropertyToUserAction(
147
+ actionId: string,
148
+ key: string,
149
+ value: boolean,
150
+ ): void;
151
+
152
+ completeUserAction(actionId: string): void;
153
+
154
+ setCompleteUserActionAutomatically(
155
+ actionId: string,
156
+ enabled: boolean,
157
+ ): void;
158
+
126
159
  setGPSLocation(
127
160
  latitude: number,
128
161
  longitude: number,
package/types.d.ts CHANGED
@@ -684,17 +684,17 @@ interface IEventModifier {
684
684
  modifyEvent(event: JSONObject): JSONObject | null;
685
685
  }
686
686
 
687
- /**
688
- * Represents the allowed types for event property values.
689
- */
690
- type EventProperty = string | number | boolean;
691
-
692
687
  type TraceparentHeader = `${string}-${string}-${string}-${string}`;
693
688
  interface TraceContext {
694
689
  traceparent: TraceparentHeader;
695
690
  tracestate: string;
696
691
  }
697
692
 
693
+ /**
694
+ * Represents the allowed types for event property values.
695
+ */
696
+ type EventProperty = string | number | boolean;
697
+
698
698
  /**
699
699
  * Base interface for all events.
700
700
  */
@@ -1113,6 +1113,20 @@ declare class ExceptionEventData implements IExceptionEventData {
1113
1113
  toJSON(): JSONObject | null;
1114
1114
  }
1115
1115
 
1116
+ interface UserAction {
1117
+ getCustomName(): string;
1118
+ isCompleteAutomatically(): boolean;
1119
+ setCompleteAutomatically(enabled: boolean): void;
1120
+ complete(): void;
1121
+ addEventProperty(key: string, value: string | number | boolean): void;
1122
+ }
1123
+
1124
+ declare class UserActionConfiguration {
1125
+ readonly customName: string;
1126
+ readonly completeAutomatically: boolean;
1127
+ constructor(customName: string, completeAutomatically?: boolean);
1128
+ }
1129
+
1116
1130
  interface IDynatrace$1 {
1117
1131
  /**
1118
1132
  * Adds an event modifier that is executed just before the event is transferred.
@@ -1348,6 +1362,19 @@ interface IDynatrace$1 {
1348
1362
  * ```
1349
1363
  */
1350
1364
  generateTraceContext(traceparent?: TraceparentHeader, tracestate?: string): TraceContext | undefined;
1365
+ /**
1366
+ * Creates a new manual user action.
1367
+ *
1368
+ * @param configuration The user action configuration
1369
+ * @returns A new {@link UserAction} instance
1370
+ */
1371
+ createUserAction(configuration: UserActionConfiguration): UserAction;
1372
+ /**
1373
+ * Enables or disables automatic user action detection.
1374
+ *
1375
+ * @param enabled True to enable, false to disable
1376
+ */
1377
+ setAutomaticUserActionDetection(enabled: boolean): void;
1351
1378
  }
1352
1379
 
1353
1380
  /**
@@ -1845,8 +1872,8 @@ declare class ManualStartupConfiguration implements IConfiguration {
1845
1872
  * Builder for manual startup configuration used with `Dynatrace.start()`.
1846
1873
  */
1847
1874
  declare class ConfigurationBuilder {
1848
- private beaconUrl;
1849
- private applicationId;
1875
+ private readonly beaconUrl;
1876
+ private readonly applicationId;
1850
1877
  private reportCrash;
1851
1878
  private errorHandler;
1852
1879
  private reportFatalErrorAsCrash;
@@ -2346,6 +2373,157 @@ declare class DynatraceWebRequestTiming implements IDynatraceWebRequestTiming {
2346
2373
  getRequestTagHeader(): string;
2347
2374
  }
2348
2375
 
2376
+ /**
2377
+ * Configuration for React Native transformer
2378
+ */
2379
+ interface TransformerReactConfiguration {
2380
+ /**
2381
+ * Path to an upstream transformer to use before Dynatrace transformation
2382
+ */
2383
+ upstreamTransformer?: string;
2384
+ }
2385
+ /**
2386
+ * Configuration for React Native instrumentation
2387
+ */
2388
+ interface InstrumentationReactConfiguration {
2389
+ /**
2390
+ * Whether to automatically start the Dynatrace agent (and insert instrumentation for startup)
2391
+ */
2392
+ autoStart: boolean;
2393
+ /**
2394
+ * Enable debug mode for additional console output during instrumentation and runtime
2395
+ */
2396
+ debug: boolean;
2397
+ /**
2398
+ * Unique name for the bundle. Required for multiple bundle setups and sourcemap deobfuscation.
2399
+ */
2400
+ bundleName?: string;
2401
+ /**
2402
+ * Version of the bundle
2403
+ */
2404
+ bundleVersion?: string;
2405
+ /**
2406
+ * Error handler configuration
2407
+ */
2408
+ errorHandler: {
2409
+ /**
2410
+ * Enable the Dynatrace error/crash handler
2411
+ */
2412
+ enabled: boolean;
2413
+ /**
2414
+ * Report fatal/unhandled errors as crashes instead of errors
2415
+ *
2416
+ * @remarks
2417
+ * When false, fatal errors are reported as errors and the current session remains open
2418
+ */
2419
+ reportFatalErrorAsCrash: boolean;
2420
+ };
2421
+ /**
2422
+ * Lifecycle event monitoring configuration
2423
+ */
2424
+ lifecycle: {
2425
+ /**
2426
+ * Include React component update lifecycle events
2427
+ */
2428
+ includeUpdate: boolean;
2429
+ /**
2430
+ * Determine which files should have lifecycle instrumentation
2431
+ *
2432
+ * @param filename - Path to the file being instrumented
2433
+ * @returns true to instrument the file, false to skip
2434
+ *
2435
+ * @defaultValue Returns false for all files
2436
+ */
2437
+ instrument: (filename: string) => boolean;
2438
+ };
2439
+ /**
2440
+ * User input monitoring configuration
2441
+ */
2442
+ input: {
2443
+ /**
2444
+ * Determine which files should have input instrumentation
2445
+ *
2446
+ * @param filename - Path to the file being instrumented
2447
+ * @returns true to instrument the file, false to skip
2448
+ *
2449
+ * @defaultValue Returns true for all files
2450
+ */
2451
+ instrument: (filename: string) => boolean;
2452
+ /**
2453
+ * Enable action name privacy to exclude automatic text/label detection
2454
+ *
2455
+ * @defaultValue false
2456
+ *
2457
+ * @remarks
2458
+ * When true, action names will not include accessibility labels, button titles,
2459
+ * or inner text. Use dtActionName property to set custom names.
2460
+ */
2461
+ actionNamePrivacy?: boolean;
2462
+ actionNamePreference?: ActionNamePreference;
2463
+ actionNameAlgorithm?: ActionNameAlgorithm;
2464
+ };
2465
+ /**
2466
+ * Navigation monitoring configuration
2467
+ */
2468
+ navigation: {
2469
+ /**
2470
+ * Enable automatic navigation tracking
2471
+ */
2472
+ enabled: boolean;
2473
+ };
2474
+ userInteraction: boolean;
2475
+ sourcemap: {
2476
+ enabled: boolean;
2477
+ androidSourcemapLocation: string;
2478
+ };
2479
+ debugBabelPlugin?: boolean;
2480
+ useLegacyJscodeshift?: boolean;
2481
+ }
2482
+ /**
2483
+ * Combined React configuration including transformer and instrumentation settings
2484
+ */
2485
+ type ReactConfiguration = TransformerReactConfiguration & InstrumentationReactConfiguration;
2486
+ /**
2487
+ * Main Dynatrace configuration structure
2488
+ */
2489
+ interface DynatraceConfiguration {
2490
+ /**
2491
+ * React Native specific configuration
2492
+ */
2493
+ react: ReactConfiguration;
2494
+ /**
2495
+ * Android native agent configuration
2496
+ */
2497
+ android?: NativeConfiguration;
2498
+ /**
2499
+ * iOS native agent configuration
2500
+ */
2501
+ ios?: NativeConfiguration;
2502
+ }
2503
+ /**
2504
+ * The type of dynatrace.config.js
2505
+ * All properties are optional since the user can only specify a subset
2506
+ * Will be merged with defaultConfig to ensure all required values are present
2507
+ * When T is a primitive or a function, then DeepPartial<T> resolves to T for better readability
2508
+ */
2509
+ type DeepPartial<T> = T extends Function ? T : T extends object ? {
2510
+ [K in keyof T]?: DeepPartial<T[K]>;
2511
+ } : T;
2512
+ type DynatraceUserConfiguration = DeepPartial<DynatraceConfiguration>;
2513
+ /**
2514
+ * Native platform (Android/iOS) configuration
2515
+ */
2516
+ interface NativeConfiguration {
2517
+ /**
2518
+ * Platform-specific configuration string
2519
+ *
2520
+ * @remarks
2521
+ * For Android: Contains Gradle DSL configuration block
2522
+ * For iOS: Contains plist key-value pairs
2523
+ */
2524
+ config?: string;
2525
+ }
2526
+
2349
2527
  declare module 'react' {
2350
2528
  namespace JSX {
2351
2529
  interface IntrinsicAttributes extends IDynatraceProperties {
@@ -2353,5 +2531,5 @@ declare module 'react' {
2353
2531
  }
2354
2532
  }
2355
2533
 
2356
- export { ConfigurationBuilder, DataCollectionLevel, Dynatrace, DynatraceWebRequestTiming, EventData, ExceptionEventData, HttpRequestEventData, LogLevel, ManualStartupConfiguration, Platform, SessionPropertyEventData, UserPrivacyOptions };
2357
- export type { IConfiguration, IDynatraceAction, IDynatraceRootAction, IDynatraceWebRequestTiming, IEventModifier, JSONObject };
2534
+ export { ConfigurationBuilder, DataCollectionLevel, Dynatrace, DynatraceWebRequestTiming, EventData, ExceptionEventData, HttpRequestEventData, LogLevel, ManualStartupConfiguration, Platform, SessionPropertyEventData, UserActionConfiguration, UserPrivacyOptions };
2535
+ export type { DynatraceUserConfiguration,IConfiguration, IDynatraceAction, IDynatraceRootAction, IDynatraceWebRequestTiming, IEventModifier, JSONObject, UserAction };