@dynatrace/react-native-plugin 2.341.1 → 2.345.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 (78) hide show
  1. package/README.md +674 -668
  2. package/android/build.gradle +16 -3
  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 -0
  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-runtime.gradle +17 -33
  12. package/files/plugin.gradle +1 -1
  13. package/instrumentation/BabelPluginDynatrace.js +1 -1
  14. package/instrumentation/libs/UserInteraction.js +21 -7
  15. package/instrumentation/libs/react-navigation/ReactNavigation.js +14 -58
  16. package/instrumentation/libs/withOnPressMonitoring.js +3 -54
  17. package/internal.d.ts +1 -0
  18. package/internal.js +3 -1
  19. package/ios/DTXScreenshotSelfMonitor.h +29 -0
  20. package/ios/DTXScreenshotSelfMonitor.mm +213 -0
  21. package/ios/DTXScreenshotSelfMonitorSwizzler.h +15 -0
  22. package/ios/DTXScreenshotSelfMonitorSwizzler.mm +68 -0
  23. package/ios/DynatraceRNBridge.h +6 -0
  24. package/ios/DynatraceRNBridge.mm +62 -0
  25. package/lib/core/Dynatrace.js +2 -0
  26. package/lib/core/configuration/ConfigurationHandler.js +0 -21
  27. package/lib/core/logging/LogMessages.js +42 -0
  28. package/lib/dynatrace-reporter.js +1 -30
  29. package/lib/dynatrace-transformer.js +6 -34
  30. package/lib/next/Dynatrace.js +26 -1
  31. package/lib/next/configuration/INativeRuntimeConfiguration.js +0 -1
  32. package/lib/next/configuration/RuntimeConfigurationObserver.js +1 -6
  33. package/lib/next/events/EventPipeline.js +48 -31
  34. package/lib/next/events/HttpRequestEventData.js +1 -1
  35. package/lib/next/events/spec/EventSpecContstants.js +1 -1
  36. package/lib/next/navigation/NavigationTracker.js +93 -0
  37. package/lib/next/navigation/useNavigationTracking.js +54 -0
  38. package/lib/next/userAction/NullUserAction.js +15 -0
  39. package/lib/next/userAction/UserActionConfiguration.js +10 -0
  40. package/lib/next/userAction/UserActionImpl.js +70 -0
  41. package/lib/next/util/TraceContextUtils.js +8 -14
  42. package/lib/next/util/Utils.js +13 -0
  43. package/package.json +10 -18
  44. package/public.js +5 -1
  45. package/react-native-dynatrace.podspec +10 -3
  46. package/scripts/Android.js +1 -20
  47. package/scripts/Config.js +17 -7
  48. package/scripts/Deprecations.js +18 -0
  49. package/scripts/Install.js +13 -0
  50. package/scripts/PathsConstants.js +0 -4
  51. package/scripts/Uninstall.js +0 -15
  52. package/scripts/core/InstrumentCall.js +14 -7
  53. package/scripts/util/DeprecationReport.js +24 -0
  54. package/src/lib/core/interface/NativeDynatraceBridge.ts +34 -1
  55. package/types.d.ts +236 -7
  56. package/instrumentation/DynatraceInstrumentation.js +0 -1
  57. package/instrumentation/libs/community/Picker.InstrInfo.js +0 -20
  58. package/instrumentation/libs/community/gesture-handler/Touchables.InstrInfo.js +0 -25
  59. package/instrumentation/libs/react-native/RefreshControl.InstrInfo.js +0 -12
  60. package/instrumentation/libs/react-native/Switch.InstrInfo.js +0 -12
  61. package/instrumentation/libs/react-native/Touchables.InstrInfo.js +0 -25
  62. package/instrumentation/parser/Babel.js +0 -60
  63. package/instrumentation/parser/ParserUtil.js +0 -11
  64. package/lib/features/ui-interaction/Config.js +0 -42
  65. package/lib/features/ui-interaction/IUserInteractionEvent.js +0 -16
  66. package/lib/features/ui-interaction/Plugin.Fragment.Test.js +0 -170
  67. package/lib/features/ui-interaction/Plugin.js +0 -289
  68. package/lib/features/ui-interaction/RootDetection.js +0 -51
  69. package/lib/features/ui-interaction/RootWrapper.js +0 -236
  70. package/lib/features/ui-interaction/Run.js +0 -38
  71. package/lib/features/ui-interaction/Runtime.js +0 -843
  72. package/lib/features/ui-interaction/TouchMetaResolver.js +0 -493
  73. package/lib/features/ui-interaction/Types.js +0 -14
  74. package/lib/metro/getSourceMapInfo.js +0 -26
  75. package/scripts/LineOffsetAnalyze.js +0 -25
  76. package/scripts/core/LineOffsetAnalyzeCall.js +0 -165
  77. package/scripts/util/SourceMapUtil.js +0 -68
  78. /package/{instrumentation/model/Reference.js → lib/next/userAction/UserAction.js} +0 -0
@@ -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
@@ -224,6 +224,8 @@ declare class UserPrivacyOptions {
224
224
 
225
225
  /**
226
226
  * Interface for Action
227
+ *
228
+ * Note: This feature is only supported for RUM Classic.
227
229
  */
228
230
  interface IDynatraceAction {
229
231
  /**
@@ -233,6 +235,8 @@ interface IDynatraceAction {
233
235
  * is null or empty. String values are limited to 250 characters and will be truncated if they
234
236
  * exceed this limit.
235
237
  *
238
+ * Note: This feature is only supported for RUM Classic.
239
+ *
236
240
  * @param {string} errorName Name of the error event (limited to 250 characters)
237
241
  * @param {number} errorCode The error code to report
238
242
  * @param {Platform} platform Optional platform filter. Defaults to both Android and iOS.
@@ -262,6 +266,8 @@ interface IDynatraceAction {
262
266
  * is null or empty. String values are limited to 250 characters and will be truncated if they
263
267
  * exceed this limit.
264
268
  *
269
+ * Note: This feature is only supported for RUM Classic.
270
+ *
265
271
  * @param eventName Name of the event to report (limited to 250 characters)
266
272
  * @param platform Optional platform filter. Defaults to both Android and iOS.
267
273
  *
@@ -285,6 +291,8 @@ interface IDynatraceAction {
285
291
  * valueName or value is null or empty. String values are limited to 250 characters and will
286
292
  * be truncated if they exceed this limit.
287
293
  *
294
+ * Note: This feature is only supported for RUM Classic.
295
+ *
288
296
  * @param valueName Name of the value being reported (limited to 250 characters)
289
297
  * @param value String value to report (limited to 250 characters)
290
298
  * @param platform Optional platform filter. Defaults to both Android and iOS.
@@ -309,6 +317,8 @@ interface IDynatraceAction {
309
317
  * valueName is null or empty. The valueName is limited to 250 characters and will be
310
318
  * truncated if it exceeds this limit.
311
319
  *
320
+ * Note: This feature is only supported for RUM Classic.
321
+ *
312
322
  * @param valueName Name of the value being reported (limited to 250 characters)
313
323
  * @param value Integer value to report
314
324
  * @param platform Optional platform filter. Defaults to both Android and iOS.
@@ -333,6 +343,8 @@ interface IDynatraceAction {
333
343
  * valueName is null or empty. The valueName is limited to 250 characters and will be
334
344
  * truncated if it exceeds this limit.
335
345
  *
346
+ * Note: This feature is only supported for RUM Classic.
347
+ *
336
348
  * @param valueName Name of the value being reported (limited to 250 characters)
337
349
  * @param value Double (floating-point) value to report
338
350
  * @param platform Optional platform filter. Defaults to both Android and iOS.
@@ -355,6 +367,8 @@ interface IDynatraceAction {
355
367
  *
356
368
  * **Note:** When a parent action is exited, all nested child actions are automatically closed.
357
369
  *
370
+ * Note: This feature is only supported for RUM Classic.
371
+ *
358
372
  * @param platform Optional platform filter. Defaults to both Android and iOS.
359
373
  *
360
374
  * @example
@@ -377,6 +391,8 @@ interface IDynatraceAction {
377
391
  * Use this when an action was started incorrectly or should not contribute to monitoring data
378
392
  * (e.g., test actions, debug sessions, pre-production validation).
379
393
  *
394
+ * Note: This feature is only supported for RUM Classic.
395
+ *
380
396
  * @param platform Optional platform filter. Defaults to both Android and iOS.
381
397
  *
382
398
  * @example
@@ -409,6 +425,8 @@ interface IDynatraceAction {
409
425
  * The tag value is evaluated by the corresponding web server agent.
410
426
  * The Dynatrace server will link the server-side PurePath data with this mobile user action.
411
427
  *
428
+ * Note: This feature is only supported for RUM Classic.
429
+ *
412
430
  * @param {string} url The URL of the request you want to track
413
431
  * @returns {Promise<string>} The request tag value to be used as the HTTP header value
414
432
  *
@@ -438,6 +456,8 @@ interface IDynatraceAction {
438
456
  * Returns the HTTP header name required for manual web request tagging. Use this in combination
439
457
  * with `getRequestTag()` to link web requests with mobile actions.
440
458
  *
459
+ * Note: This feature is only supported for RUM Classic.
460
+ *
441
461
  * @returns {string} The name of the HTTP header to use for request tagging
442
462
  *
443
463
  * @example
@@ -1113,6 +1133,97 @@ declare class ExceptionEventData implements IExceptionEventData {
1113
1133
  toJSON(): JSONObject | null;
1114
1134
  }
1115
1135
 
1136
+ interface UserAction {
1137
+ /**
1138
+ * Returns the custom name of this user action as set in {@link UserActionConfiguration}.
1139
+ *
1140
+ * @example
1141
+ * ```ts
1142
+ * import { Dynatrace, UserAction, UserActionConfiguration } from '@dynatrace/react-native-plugin';
1143
+ *
1144
+ * const userAction: UserAction = Dynatrace.createUserAction(new UserActionConfiguration('My Action'));
1145
+ * const name = userAction.getCustomName();
1146
+ * ```
1147
+ */
1148
+ getCustomName(): string;
1149
+ /**
1150
+ * Returns whether this user action is configured to complete automatically.
1151
+ *
1152
+ * @example
1153
+ * ```ts
1154
+ * import { Dynatrace, UserAction, UserActionConfiguration } from '@dynatrace/react-native-plugin';
1155
+ *
1156
+ * const userAction: UserAction = Dynatrace.createUserAction(new UserActionConfiguration('My Action'));
1157
+ * const completesAutomatically = userAction.isCompleteAutomatically();
1158
+ * ```
1159
+ */
1160
+ isCompleteAutomatically(): boolean;
1161
+ /**
1162
+ * Overrides whether this user action should complete automatically.
1163
+ *
1164
+ * @param enabled - `true` to enable automatic completion, `false` to require a manual {@link complete} call
1165
+ *
1166
+ * @example
1167
+ * ```ts
1168
+ * import { Dynatrace, UserAction, UserActionConfiguration } from '@dynatrace/react-native-plugin';
1169
+ *
1170
+ * const userAction: UserAction = Dynatrace.createUserAction(new UserActionConfiguration('My Action'));
1171
+ * userAction.setCompleteAutomatically(true);
1172
+ * ```
1173
+ */
1174
+ setCompleteAutomatically(enabled: boolean): void;
1175
+ /**
1176
+ * Completes this user action.
1177
+ *
1178
+ * Must be called when `completeAutomatically` is `false`.
1179
+ *
1180
+ * @example
1181
+ * ```ts
1182
+ * import { Dynatrace, UserAction, UserActionConfiguration } from '@dynatrace/react-native-plugin';
1183
+ *
1184
+ * const userAction: UserAction = Dynatrace.createUserAction(new UserActionConfiguration('My Action'));
1185
+ * userAction.complete();
1186
+ * ```
1187
+ */
1188
+ complete(): void;
1189
+ /**
1190
+ * Adds a custom event property to this user action.
1191
+ *
1192
+ * @param key - The property key (must start with `event_properties.`)
1193
+ * @param value - The property value; can be a `string`, `number`, or `boolean`
1194
+ *
1195
+ * @example
1196
+ * ```ts
1197
+ * import { Dynatrace, UserAction, UserActionConfiguration } from '@dynatrace/react-native-plugin';
1198
+ *
1199
+ * const userAction: UserAction = Dynatrace.createUserAction(new UserActionConfiguration('My Action'));
1200
+ * userAction.addEventProperty('event_properties.my_key', 'my_value');
1201
+ * ```
1202
+ */
1203
+ addEventProperty(key: string, value: string | number | boolean): void;
1204
+ }
1205
+
1206
+ declare class UserActionConfiguration {
1207
+ readonly customName: string;
1208
+ readonly completeAutomatically: boolean;
1209
+ /**
1210
+ * Creates a configuration for a manual user action.
1211
+ *
1212
+ * @param customName - The name of the user action as it will appear in Dynatrace
1213
+ * @param completeAutomatically - Whether the action completes automatically
1214
+ * defaults to `false`
1215
+ *
1216
+ * @example
1217
+ * ```ts
1218
+ * import { Dynatrace, UserActionConfiguration } from '@dynatrace/react-native-plugin';
1219
+ *
1220
+ * const configuration = new UserActionConfiguration('My User Action');
1221
+ * Dynatrace.createUserAction(configuration);
1222
+ * ```
1223
+ */
1224
+ constructor(customName: string, completeAutomatically?: boolean);
1225
+ }
1226
+
1116
1227
  interface IDynatrace$1 {
1117
1228
  /**
1118
1229
  * Adds an event modifier that is executed just before the event is transferred.
@@ -1133,6 +1244,8 @@ interface IDynatrace$1 {
1133
1244
  *
1134
1245
  * See the public documentation for a detailed list of reserved/open fields.
1135
1246
  *
1247
+ * Note: This feature is not supported for RUM Classic.
1248
+ *
1136
1249
  * @param eventModifier The modifier function to modify a given JSONObject
1137
1250
  * @returns The registered event modifier instance
1138
1251
  *
@@ -1154,6 +1267,8 @@ interface IDynatrace$1 {
1154
1267
  /**
1155
1268
  * Removes an event modifier so it will no longer modify events.
1156
1269
  *
1270
+ * Note: This feature is not supported for RUM Classic.
1271
+ *
1157
1272
  * @param eventModifier The modifier function to be removed
1158
1273
  * @returns True if the modifier was successfully removed, false otherwise
1159
1274
  *
@@ -1171,6 +1286,8 @@ interface IDynatrace$1 {
1171
1286
  /**
1172
1287
  * Sends an exception event for error tracking and monitoring.
1173
1288
  *
1289
+ * Note: This feature is not supported for RUM Classic.
1290
+ *
1174
1291
  * @param exceptionEventData The exception event data built using ExceptionEventData
1175
1292
  *
1176
1293
  * @example
@@ -1197,6 +1314,8 @@ interface IDynatrace$1 {
1197
1314
  /**
1198
1315
  * Sends a custom event with event properties and optional duration.
1199
1316
  *
1317
+ * Note: This feature is not supported for RUM Classic.
1318
+ *
1200
1319
  * @param eventData The event data built using EventData
1201
1320
  *
1202
1321
  * @example
@@ -1222,6 +1341,8 @@ interface IDynatrace$1 {
1222
1341
  * **Note:** Only one view context can be active at a time. Starting a new view will
1223
1342
  * automatically stop any currently active view context.
1224
1343
  *
1344
+ * Note: This feature is not supported for RUM Classic.
1345
+ *
1225
1346
  * @param name Name of the view (e.g., screen name, page title)
1226
1347
  *
1227
1348
  * @example
@@ -1241,6 +1362,8 @@ interface IDynatrace$1 {
1241
1362
  * **Note:** While you can send multiple session properties at once, if you report the same
1242
1363
  * property multiple times, session aggregation will only use one of the values (first or last).
1243
1364
  *
1365
+ * Note: This feature is not supported for RUM Classic.
1366
+ *
1244
1367
  * @param sessionPropertyEventData The session property event data built using SessionPropertyEventData builder
1245
1368
  *
1246
1369
  * @example
@@ -1262,6 +1385,8 @@ interface IDynatrace$1 {
1262
1385
  /**
1263
1386
  * Sends an HTTP request event for network activity monitoring.
1264
1387
  *
1388
+ * Note: This feature is not supported for RUM Classic.
1389
+ *
1265
1390
  * @param {HttpRequestEventData} httpRequestEvent Event object containing the HTTP request details.
1266
1391
  *
1267
1392
  * The {@link HttpRequestEventData} class supports the following builder methods:
@@ -1322,6 +1447,8 @@ interface IDynatrace$1 {
1322
1447
  * for distributed tracing. If existing headers are provided, they will be
1323
1448
  * reused according to the W3C Trace Context specification.
1324
1449
  *
1450
+ * Note: This feature is not supported for RUM Classic.
1451
+ *
1325
1452
  * @param traceparent Optional existing W3C traceparent header value.
1326
1453
  * @param tracestate Optional existing W3C tracestate header value.
1327
1454
  * @returns A {@link TraceContext} with traceparent and tracestate values, or `undefined` if:
@@ -1348,11 +1475,51 @@ interface IDynatrace$1 {
1348
1475
  * ```
1349
1476
  */
1350
1477
  generateTraceContext(traceparent?: TraceparentHeader, tracestate?: string): TraceContext | undefined;
1478
+ /**
1479
+ * Creates a new manual user action.
1480
+ *
1481
+ * The returned {@link UserAction} must be explicitly completed by calling {@link UserAction.complete},
1482
+ * unless `completeAutomatically` is set to `true` in the {@link UserActionConfiguration}.
1483
+ *
1484
+ * Note: This feature is not supported for RUM Classic.
1485
+ *
1486
+ * @param configuration - The configuration for the user action, created via {@link UserActionConfiguration}
1487
+ * @returns A new {@link UserAction} instance representing the started user action
1488
+ *
1489
+ * @example
1490
+ * ```ts
1491
+ * import { Dynatrace, UserAction, UserActionConfiguration } from '@dynatrace/react-native-plugin';
1492
+ *
1493
+ * const configuration = new UserActionConfiguration('My User Action', true);
1494
+ * const userAction: UserAction = Dynatrace.createUserAction(configuration);
1495
+ * userAction.setCompleteAutomatically(false);
1496
+ * userAction.addEventProperty('event_properties.my_key', 'my_value');
1497
+ * userAction.complete();
1498
+ * ```
1499
+ */
1500
+ createUserAction(configuration: UserActionConfiguration): UserAction;
1501
+ /**
1502
+ * Enables or disables automatic user action detection.
1503
+ *
1504
+ * Note: This feature is not supported for RUM Classic.
1505
+ *
1506
+ * @param enabled - `true` to enable automatic detection, `false` to disable it
1507
+ *
1508
+ * @example
1509
+ * ```ts
1510
+ * import { Dynatrace } from '@dynatrace/react-native-plugin';
1511
+ *
1512
+ * Dynatrace.setAutomaticUserActionDetection(true);
1513
+ * ```
1514
+ */
1515
+ setAutomaticUserActionDetection(enabled: boolean): void;
1351
1516
  }
1352
1517
 
1353
1518
  /**
1354
1519
  * Root action that extends the standard IDynatraceAction with the ability to create
1355
1520
  * nested child actions for hierarchical action tracking.
1521
+ *
1522
+ * Note: This feature is only supported for RUM Classic.
1356
1523
  */
1357
1524
  interface IDynatraceRootAction extends IDynatraceAction {
1358
1525
  /**
@@ -1363,6 +1530,8 @@ interface IDynatraceRootAction extends IDynatraceAction {
1363
1530
  * **Note:** When the parent action is closed with `leaveAction()` or `cancel()`, all
1364
1531
  * child actions are automatically closed as well.
1365
1532
  *
1533
+ * Note: This feature is only supported for RUM Classic.
1534
+ *
1366
1535
  * @param {string} name Name of the child action (limited to 250 characters)
1367
1536
  * @param {Platform} platform Optional platform filter. Defaults to both Android and iOS.
1368
1537
  * @returns {IDynatraceAction} The created child action instance
@@ -1418,6 +1587,8 @@ interface IDynatrace extends IDynatrace$1 {
1418
1587
  * process will remove the name of a Functional Component. Still this parameter is optional as
1419
1588
  * other properties can be used at runtime as well (e.g. dtActionName).
1420
1589
  *
1590
+ * Note: This feature is only supported for RUM Classic.
1591
+ *
1421
1592
  * @param Component Functional or Class Component
1422
1593
  * @param {string} name The name of the Component
1423
1594
  * @returns The Component which was wrapped to be monitored
@@ -1440,6 +1611,8 @@ interface IDynatrace extends IDynatrace$1 {
1440
1611
  /**
1441
1612
  * Reroutes to `Dynatrace.enterAutoAction`
1442
1613
  *
1614
+ * Note: This feature is only supported for RUM Classic.
1615
+ *
1443
1616
  * @deprecated Please use either {@link enterAutoAction}, which is doing the same or alternatively {@link enterManualAction}.
1444
1617
  */
1445
1618
  enterAction(name: string, platform?: Platform): IDynatraceAction;
@@ -1450,6 +1623,8 @@ interface IDynatrace extends IDynatrace$1 {
1450
1623
  * is open, will be automatically inserted as a child action. Furthermore the plugin will automatically
1451
1624
  * link webrequest (if they are not tagged manually) to the open root action.
1452
1625
  *
1626
+ * Note: This feature is only supported for RUM Classic.
1627
+ *
1453
1628
  * @param {string} name Name of the action, which will be created. This name must not be empty. (limited to 250 characters)
1454
1629
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1455
1630
  * @returns {IDynatraceAction} Action that is created. If name was empty a NullAction will be provided,
@@ -1474,6 +1649,8 @@ interface IDynatrace extends IDynatrace$1 {
1474
1649
  * because of the full manual approach the plugin will not link webrequest automatically. Webrequest
1475
1650
  * have to be manually tagged by using the tag provided by the action via {@link IDynatraceAction.getRequestTag}.
1476
1651
  *
1652
+ * Note: This feature is only supported for RUM Classic.
1653
+ *
1477
1654
  * @param {string} name Name of the action, which will be created. This name must not be empty. (limited to 250 characters)
1478
1655
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1479
1656
  * @returns {IDynatraceRootAction} Action that is created. If name was empty a NullRootAction will be provided,
@@ -1494,6 +1671,8 @@ interface IDynatrace extends IDynatrace$1 {
1494
1671
  /**
1495
1672
  * Similar to {@link IDynatraceAction.reportError}. But the error event is reported as root action.
1496
1673
  *
1674
+ * Note: To enable event properties, call the sendExceptionEvent method instead.
1675
+ *
1497
1676
  * @param {string} errorName Name of the error event (limited to 250 characters)
1498
1677
  * @param {number} errorCode The code of the error
1499
1678
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
@@ -1511,6 +1690,8 @@ interface IDynatrace extends IDynatrace$1 {
1511
1690
  /**
1512
1691
  * Reports a stacktrace
1513
1692
  *
1693
+ * Note: To enable event properties, call the sendExceptionEvent method instead.
1694
+ *
1514
1695
  * @deprecated Please use {@link reportErrorStacktrace} instead.
1515
1696
  *
1516
1697
  * @param {String} errorName Name of the Error - SyntaxError (limited to 250 characters)
@@ -1524,6 +1705,8 @@ interface IDynatrace extends IDynatrace$1 {
1524
1705
  * Use this method to capture and report errors with their full stack traces, typically within
1525
1706
  * try-catch blocks to handle exceptions gracefully while maintaining observability.
1526
1707
  *
1708
+ * Note: To enable event properties, call the sendExceptionEvent method instead.
1709
+ *
1527
1710
  * @param errorName Name or type of the error (e.g., 'DatabaseError', 'NetworkError'). Limited to 250 characters.
1528
1711
  * @param errorValue The error message or value describing what went wrong
1529
1712
  * @param reason Additional context explaining why the error occurred
@@ -1617,6 +1800,8 @@ interface IDynatrace extends IDynatrace$1 {
1617
1800
  *
1618
1801
  * Note: Business events are only supported on Dynatrace SaaS deployments currently.
1619
1802
  *
1803
+ * Note: This feature is not supported for RUM Classic.
1804
+ *
1620
1805
  * @param {string} type Mandatory event type
1621
1806
  * @param {JSONObject} attributes Must be a valid JSON object and cannot contain functions,
1622
1807
  * undefined, Infinity and NaN as values, otherwise they will be removed.
@@ -1640,6 +1825,8 @@ interface IDynatrace extends IDynatrace$1 {
1640
1825
  * Can be called to end the current visit and start a new visit. All current actions are
1641
1826
  * closed and sent to the server.
1642
1827
  *
1828
+ * Note: This feature is only supported for RUM Classic.
1829
+ *
1643
1830
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1644
1831
  *
1645
1832
  * @example
@@ -1769,6 +1956,8 @@ interface IDynatrace extends IDynatrace$1 {
1769
1956
  * sent in packages where the oldest event has an age of up to 2 minutes (the default; the maximum age can be configured).
1770
1957
  * Using this function, you can force sending of all collected events regardless of their age.
1771
1958
  *
1959
+ * Note: This feature is only supported for RUM Classic.
1960
+ *
1772
1961
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1773
1962
  *
1774
1963
  * @example
@@ -1785,6 +1974,8 @@ interface IDynatrace extends IDynatrace$1 {
1785
1974
  * reconnect to the beacon endpoint with the new headers. To clear the previous headers,
1786
1975
  * call the method with a null or empty value.
1787
1976
  *
1977
+ * Note: This feature is only supported for RUM Classic.
1978
+ *
1788
1979
  * @param {Map<string, string>} headers a set of http headers
1789
1980
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1790
1981
  *
@@ -2111,12 +2302,16 @@ declare class ConfigurationBuilder {
2111
2302
  /**
2112
2303
  * Interface for manually measuring web request timing and performance metrics.
2113
2304
  * Use this to track custom HTTP requests that are not automatically instrumented.
2305
+ *
2306
+ * Note: This feature is only supported for RUM Classic.
2114
2307
  */
2115
2308
  interface IDynatraceWebRequestTiming {
2116
2309
  /**
2117
2310
  * Starts the measurement of the web request timing. Call this method immediately before
2118
2311
  * initiating the HTTP request.
2119
2312
  *
2313
+ * Note: This feature is only supported for RUM Classic.
2314
+ *
2120
2315
  * @example
2121
2316
  * ```ts
2122
2317
  * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin';
@@ -2154,6 +2349,8 @@ interface IDynatraceWebRequestTiming {
2154
2349
  * completes (either successfully or with an error). The response code and message will be
2155
2350
  * transferred to Dynatrace and displayed in the web UI.
2156
2351
  *
2352
+ * Note: This feature is only supported for RUM Classic.
2353
+ *
2157
2354
  * @param {number} responseCode HTTP status code of the response (e.g., 200, 404, 500)
2158
2355
  * @param {string} responseMessage Response message or error description
2159
2356
  *
@@ -2193,6 +2390,8 @@ interface IDynatraceWebRequestTiming {
2193
2390
  * method after the request completes to track both timing and payload sizes. The response code,
2194
2391
  * message, and size metrics will be transferred to Dynatrace and displayed in the web UI.
2195
2392
  *
2393
+ * Note: This feature is only supported for RUM Classic.
2394
+ *
2196
2395
  * @param {number} responseCode HTTP status code of the response (e.g., 200, 404, 500)
2197
2396
  * @param {string} responseMessage Response message or error description
2198
2397
  * @param {number} requestSize Size of the request payload in bytes
@@ -2251,6 +2450,8 @@ interface IDynatraceWebRequestTiming {
2251
2450
  * The tag value is evaluated by the corresponding web server agent.
2252
2451
  * The Dynatrace server will link the server-side PurePath data with this mobile user action.
2253
2452
  *
2453
+ * Note: This feature is only supported for RUM Classic.
2454
+ *
2254
2455
  * @returns {string} The request tag value to be used as the HTTP header value
2255
2456
  *
2256
2457
  * @example
@@ -2273,6 +2474,8 @@ interface IDynatraceWebRequestTiming {
2273
2474
  * Returns the HTTP header name required for request tagging. Use this header name in
2274
2475
  * combination with `getRequestTag()` to properly tag HTTP requests for tracking.
2275
2476
  *
2477
+ * Note: This feature is only supported for RUM Classic.
2478
+ *
2276
2479
  * @returns {string} The name of the HTTP header to use for request tagging
2277
2480
  *
2278
2481
  * @example
@@ -2309,6 +2512,8 @@ declare class DynatraceWebRequestTiming implements IDynatraceWebRequestTiming {
2309
2512
  /**
2310
2513
  * Constructor for creating a DynatraceWebRequestTiming
2311
2514
  *
2515
+ * Note: To enable event properties and report additional fields, call the sendHttpRequestEvent method instead.
2516
+ *
2312
2517
  * @param {string} requestTag Request Tag for the action to be linked to
2313
2518
  * @param {string} url URL that should be linked
2314
2519
  *
@@ -2346,6 +2551,35 @@ declare class DynatraceWebRequestTiming implements IDynatraceWebRequestTiming {
2346
2551
  getRequestTagHeader(): string;
2347
2552
  }
2348
2553
 
2554
+ /**
2555
+ * Structural interface for a navigation container that exposes state change events.
2556
+ * Implemented by `NavigationContainerRef` from `@react-navigation/native`.
2557
+ * Accepts any library whose container satisfies this shape.
2558
+ */
2559
+ interface NavigationContainerLike {
2560
+ addListener(event: 'state', cb: () => void): () => void;
2561
+ getRootState(): unknown;
2562
+ }
2563
+ /**
2564
+ * React hook for automatic navigation screen tracking. Use this as an alternative
2565
+ * to the Babel injection when you prefer a runtime setup or use a navigation library
2566
+ * other than `@react-navigation/native`.
2567
+ *
2568
+ * @param navigationRef A React ref pointing to a {@link NavigationContainerLike} instance.
2569
+ *
2570
+ * @example
2571
+ * ```ts
2572
+ * import { useNavigationTracking, NavigationContainerLike } from '@dynatrace/react-native-plugin';
2573
+ *
2574
+ * // The same ref you pass to NavigationContainer, e.g. from useNavigationContainerRef().
2575
+ * declare const navigationRef: { current: NavigationContainerLike | null };
2576
+ *
2577
+ * // Call this from the component that renders NavigationContainer.
2578
+ * useNavigationTracking(navigationRef);
2579
+ * ```
2580
+ */
2581
+ declare const useNavigationTracking: (navigationRef: React.RefObject<NavigationContainerLike | null>) => void;
2582
+
2349
2583
  /**
2350
2584
  * Configuration for React Native transformer
2351
2585
  */
@@ -2445,12 +2679,7 @@ interface InstrumentationReactConfiguration {
2445
2679
  enabled: boolean;
2446
2680
  };
2447
2681
  userInteraction: boolean;
2448
- sourcemap: {
2449
- enabled: boolean;
2450
- androidSourcemapLocation: string;
2451
- };
2452
2682
  debugBabelPlugin?: boolean;
2453
- useLegacyJscodeshift?: boolean;
2454
2683
  }
2455
2684
  /**
2456
2685
  * Combined React configuration including transformer and instrumentation settings
@@ -2504,5 +2733,5 @@ declare module 'react' {
2504
2733
  }
2505
2734
  }
2506
2735
 
2507
- export { ConfigurationBuilder, DataCollectionLevel, Dynatrace, DynatraceWebRequestTiming, EventData, ExceptionEventData, HttpRequestEventData, LogLevel, ManualStartupConfiguration, Platform, SessionPropertyEventData, UserPrivacyOptions };
2508
- export type { DynatraceUserConfiguration, IConfiguration, IDynatraceAction, IDynatraceRootAction, IDynatraceWebRequestTiming, IEventModifier, JSONObject };
2736
+ export { ConfigurationBuilder, DataCollectionLevel, Dynatrace, DynatraceWebRequestTiming, EventData, ExceptionEventData, HttpRequestEventData, LogLevel, ManualStartupConfiguration, Platform, SessionPropertyEventData, UserActionConfiguration, UserPrivacyOptions, useNavigationTracking };
2737
+ export type { DynatraceUserConfiguration, IConfiguration, IDynatraceAction, IDynatraceRootAction, IDynatraceWebRequestTiming, IEventModifier, JSONObject, NavigationContainerLike, UserAction };
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));function _createForOfIteratorHelper(e,t){var n,r,i,o,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return i=!(r=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return r=e.done,e},e:function(e){i=!0,n=e},f:function(){try{r||null==a.return||a.return()}finally{if(i)throw n}}};if(Array.isArray(e)||(a=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),o=0,{s:t=function(){},n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(exports,"__esModule",{value:!0}),exports.instrument=void 0;var FileType,nodePath=require("path"),jscodeshift=require("jscodeshift"),Collection_1=require("jscodeshift/src/Collection"),FileOperationHelper_1=require("../scripts/FileOperationHelper"),PathsConstants_1=require("../scripts/PathsConstants"),GetValuesFromPackage_1=require("../lib/core/util/GetValuesFromPackage"),InstrumentUtil_1=require("../scripts/util/InstrumentUtil"),Run_1=require("../lib/features/ui-interaction/Run"),Touchables_InstrInfo_1=require("./libs/react-native/Touchables.InstrInfo"),RefreshControl_InstrInfo_1=require("./libs/react-native/RefreshControl.InstrInfo"),Switch_InstrInfo_1=require("./libs/react-native/Switch.InstrInfo"),Touchables_InstrInfo_2=require("./libs/community/gesture-handler/Touchables.InstrInfo"),Picker_InstrInfo_1=require("./libs/community/Picker.InstrInfo"),Types_1=require("./model/Types"),ParserUtil_1=require("./parser/ParserUtil"),referenceListInput=((e=>{e[e.Filtered=-1]="Filtered",e[e.Normal=0]="Normal",e[e.ReactNative=1]="ReactNative",e[e.React=2]="React",e[e.ReactNativeCssInterop=3]="ReactNativeCssInterop"})(FileType=FileType||{}),[]),whiteList=(referenceListInput.push.apply(referenceListInput,(0,_toConsumableArray2.default)(Touchables_InstrInfo_1.instrumentationInfo)),referenceListInput.push.apply(referenceListInput,(0,_toConsumableArray2.default)(RefreshControl_InstrInfo_1.instrumentationInfo)),referenceListInput.push.apply(referenceListInput,(0,_toConsumableArray2.default)(Switch_InstrInfo_1.instrumentationInfo)),referenceListInput.push.apply(referenceListInput,(0,_toConsumableArray2.default)(Touchables_InstrInfo_2.instrumentationInfo)),referenceListInput.push.apply(referenceListInput,(0,_toConsumableArray2.default)(Picker_InstrInfo_1.instrumentationInfo)),new Set(["AppRegistry","AppRegistryImpl","renderApplication","ExceptionsManager"])),instrumentationLibraryFolder="@dynatrace/react-native-plugin/instrumentation/libs",getRegisteredFeatures=function(){return[{isEnabled:function(e,t){return!0===(null==t?void 0:t.userInteraction)},run:function(e,t,n){return(0,Run_1.runDTUserInteraction)(e,t,n)}}]},getEnabledFeatures=function(t,n){return getRegisteredFeatures().filter(function(e){return e.isEnabled(t,n)})},applyInputInstrumentation=function(e){var t=e,n=!1;return referenceListInput.forEach(function(e){e=swapReferences(t,e);t=e.root,n=n||e.modified}),{root:t,modified:n}},applyEnabledFeatures=function(e,t,n,r){var i,o=e,a=!1,s=_createForOfIteratorHelper(r);try{for(s.s();!(i=s.n()).done;){var l=i.value;try{var u=l.run(o,t,n),o=u.root;u.modified&&(a=!0)}catch(e){var c=e instanceof Error?e.stack||e.message:String(e);null!=n&&n.debug&&console.log("[DynatraceInstrumentationRaw]: Feature instrumentation failed for ".concat(t,": ").concat(c))}}}catch(e){s.e(e)}finally{s.f()}return{root:o,modified:a}},applyReactNativeInstrumentation=function(e,t,n){return t.endsWith("AppRegistryImpl.js")?{root:e,modified:(null==n?void 0:n.autoStart)&&addStartupCallRegistryImpl(e)}:t.endsWith("AppRegistry.js")?{root:e,modified:(null==n?void 0:n.autoStart)&&addStartupCallRegistry(e)}:t.endsWith("renderApplication.js")?(addInfoToComponent(e),{root:e,modified:!0}):t.endsWith("ExceptionsManager.js")?(t=void 0!==n&&n.autoStart&&n.errorHandler.enabled,addReportErrorToDynatraceCall(e,n.errorHandler.reportFatalErrorAsCrash,t),{root:e,modified:!0}):{root:e,modified:!1}},applyNormalInstrumentation=function(e,t,n,r){var i=!1,o=getInstrumentationList(n,r),a=getEnabledFeatures(n,r);if(r.navigation.enabled&&instrumentReactNavigation(n,t))i=!0;else{if(!o.input&&!o.lifecycle&&0===a.length)return null!=r&&r.debug&&console.log("Dynatrace - Filtered All: ".concat(n)),deleteTransformation(n),{root:t,modified:!1,filteredOut:!0};o.lifecycle&&addInfoToComponent(t)&&(i=!0),o.input&&(t=(o=applyInputInstrumentation(t)).root,i=i||o.modified)}o=applyEnabledFeatures(t,n,r,a);return{root:t=o.root,modified:i=i||o.modified,filteredOut:!1}},finalizeInstrumentation=function(e,t,n,r,i){return i?(i=t.toSource({quote:"single"}),writeTransformation(i,n),null!=r&&r.debug&&console.log("Dynatrace - Modified Filename: "+n),i):(deleteTransformation(n),e)},isOwnConfigurationPresetFile=function(e){return!!e.includes(nodePath.join("@dynatrace","react-native-plugin"))&&e.endsWith(nodePath.join("lib","core","configuration","ConfigurationPreset.js"))},applyConfigurationPresetInstrumentation=function(e,t,n){var r;return void 0===n?e:(r=(0,GetValuesFromPackage_1.getHostAppBundleInfo)(PathsConstants_1.default.getPackageJsonFile()),e=parseSource(t,e),void 0!==n.lifecycle&&changeConfigurationValue(e,"getLifecycleUpdate",n.lifecycle.includeUpdate),void 0!==n.debug&&changeConfigurationValue(e,"getLogLevel",n.debug?0:1),void 0!==n.bundleName?changeConfigurationValue(e,"getBundleName",n.bundleName):null!==r&&changeConfigurationValue(e,"getBundleName",null==r?void 0:r.name),void 0!==n.bundleVersion?changeConfigurationValue(e,"getBundleVersion",n.bundleVersion):null!==r&&changeConfigurationValue(e,"getBundleVersion",null==r?void 0:r.version),void 0!==(null==(r=n.input)?void 0:r.actionNamePrivacy)&&changeConfigurationValue(e,"getActionNamePrivacy",n.input.actionNamePrivacy),void 0!==(null==(r=n.input)?void 0:r.actionNamePreference)&&changeConfigurationValue(e,"getActionNamePreference",n.input.actionNamePreference),void 0!==(null==(r=n.input)?void 0:r.actionNameAlgorithm)&&changeConfigurationValue(e,"getActionNameAlgorithm",n.input.actionNameAlgorithm),void 0!==n.errorHandler&&(changeConfigurationValue(e,"isErrorHandlerEnabled",n.errorHandler.enabled),changeConfigurationValue(e,"isReportFatalErrorAsCrash",n.errorHandler.reportFatalErrorAsCrash)),n.autoStart&&changeConfigurationValue(e,"isAutoStartupEnabled",n.autoStart),r=e.toSource({quote:"single"}),writeTransformation(r,t),r)},applyGeneralInstrumentation=function(e,t,n){var r,i,o=shouldInstrumentFile(t);return o===FileType.Filtered?e:(r=parseSource(t,e),o===FileType.React?(addCreateElementInstrumentation(r),finalizeInstrumentation(e,r,t,n,!0)):o===FileType.ReactNative?(i=applyReactNativeInstrumentation(r,t,n),finalizeInstrumentation(e,i.root,t,n,i.modified)):o===FileType.ReactNativeCssInterop?(i=replaceReactWithDynatraceJsxRuntime(r),finalizeInstrumentation(e,r,t,n,i)):(o=applyNormalInstrumentation(e,r,t,n)).filteredOut?e:finalizeInstrumentation(e,o.root,t,n,o.modified))},instrument=function(e,t,n){t=correctFilename(t),e=applyGeneralInstrumentation(e,t,n);return isOwnConfigurationPresetFile(t)?applyConfigurationPresetInstrumentation(e,t,n):e},instrumentReactNavigation=(exports.instrument=instrument,function(e,t){return!!instrumentReactBaseNavigationContainer(e,t)&&(e="import { monitorNavigation } from '".concat(instrumentationLibraryFolder,"/react-navigation/ReactNavigation';"),t.find(jscodeshift.ImportDeclaration).at(0).insertBefore(e),!0)}),instrumentReactBaseNavigationContainer=function(e,t){var n=!1;return e.includes("@react-navigation")&&e.includes("core")&&(e.includes("BaseNavigationContainer.js")||e.includes("BaseNavigationContainer.tsx"))&&t.find(jscodeshift.VariableDeclarator,{id:{name:"getRootState"}}).forEach(function(e){n=!0,e.parent.insertAfter("monitorNavigation(getRootState);")}),n},addInfoToComponent=function(e){var t=e.findJSXElements(),i=!1;return 0<t.length&&(e.find(jscodeshift.FunctionDeclaration).forEach(function(e){var t=(0,Collection_1.fromPaths)([e]),n=t.findJSXElements(),r="string"==typeof(null==(r=null==(r=e.value)?void 0:r.id)?void 0:r.name)?e.value.id.name:void 0;0<n.length&&void 0!==r&&""!==r&&(n=t.find(jscodeshift.ClassDeclaration),t=t.find(jscodeshift.ClassExpression),0===n.length)&&0===t.length&&(insertExpressionIntoNextBody(e,Types_1.Types.FunctionalComponent,r),i=!0)}),e.find(jscodeshift.ClassDeclaration).forEach(function(e){var t=(0,Collection_1.fromPaths)([e]).findJSXElements(),n="string"==typeof(null==(n=null==(n=e.value)?void 0:n.id)?void 0:n.name)?e.value.id.name:void 0;0<t.length&&void 0!==n&&""!==n&&(insertExpressionIntoNextBody(e,Types_1.Types.ClassComponent,n),i=!0)}),e.find(jscodeshift.ArrowFunctionExpression).forEach(function(e){var t=(0,Collection_1.fromPaths)([e]).findJSXElements(),n="string"==typeof(null==(n=null==(n=null==(n=e.parent)?void 0:n.value)?void 0:n.id)?void 0:n.name)?e.parent.value.id.name:void 0;0<t.length&&void 0!==n&&""!==n&&(insertExpressionIntoNextBody(e,Types_1.Types.FunctionalComponent,n),i=!0)}),e.find(jscodeshift.FunctionExpression).forEach(function(e){var t=(0,Collection_1.fromPaths)([e]).findJSXElements(),n="string"==typeof(null==(n=null==(n=null==(n=e.parent)?void 0:n.value)?void 0:n.id)?void 0:n.name)?e.parent.value.id.name:void 0;0<t.length&&void 0!==n&&""!==n&&(insertExpressionIntoNextBody(e,Types_1.Types.FunctionalComponent,n),i=!0)})),i},insertExpressionIntoNextBody=function(e,t,n){for(t=jscodeshift.expressionStatement(jscodeshift.assignmentExpression("=",jscodeshift.memberExpression(jscodeshift.identifier(n),jscodeshift.identifier("_dtInfo")),createComponentInfo(t,n)));"body"!==(null==e?void 0:e.parentPath.name);)e=e.parentPath;void 0!==e.parentPath&&e.insertAfter(t)},createComponentInfo=function(e,t){return jscodeshift.objectExpression([jscodeshift.objectProperty(jscodeshift.identifier("type"),jscodeshift.numericLiteral(e)),jscodeshift.objectProperty(jscodeshift.identifier("name"),jscodeshift.stringLiteral(t))])},changeConfigurationValue=function(e,t,n){var e=e.find(jscodeshift.Identifier).filter(function(e){return e.node.name===t});1===e.length&&"ReturnStatement"===(e=e.paths()[0].parent.value.body.body[0]).type&&("boolean"==typeof n&&(e.argument=jscodeshift.booleanLiteral(n)),"string"==typeof n&&(e.argument=jscodeshift.stringLiteral(n)),"number"==typeof n)&&(e.argument=jscodeshift.numericLiteral(n))},parseSource=function(e,t){return jscodeshift.withParser((0,ParserUtil_1.chooseParser)(e,t))(t)},correctFilename=function(e){return nodePath.isAbsolute(e)?e.replace(PathsConstants_1.default.getApplicationPath()+nodePath.sep,""):e},deleteTransformation=function(e){try{var t=nodePath.join(PathsConstants_1.default.getBuildPath(),e+InstrumentUtil_1.INSTRUMENTED_FILE_EXTENSION);FileOperationHelper_1.default.checkIfFileExistsSync(t),FileOperationHelper_1.default.deleteFileSync(t)}catch(e){}},writeTransformation=function(e,t){t=nodePath.join(PathsConstants_1.default.getBuildPath(),t);try{FileOperationHelper_1.default.checkIfFileExistsSync(nodePath.dirname(t))}catch(e){FileOperationHelper_1.default.createDirectorySync(nodePath.dirname(t))}FileOperationHelper_1.default.writeTextToFileSync(t+InstrumentUtil_1.INSTRUMENTED_FILE_EXTENSION,e)},getInstrumentationList=function(e,t){var n,r,i={input:!1,lifecycle:!1};return!0===(null==(n=null==(r=null==t?void 0:t.lifecycle)?void 0:r.instrument)?void 0:n.call(r,e))&&(i.lifecycle=!0),!0===(null==(r=null==(n=null==t?void 0:t.input)?void 0:n.instrument)?void 0:r.call(n,e))&&(i.input=!0),i},addCreateElementInstrumentation=function(e){var t,e=e.find(jscodeshift.Program);1===e.length&&(t=jscodeshift.expressionStatement(jscodeshift.callExpression(jscodeshift.memberExpression(jscodeshift.callExpression(jscodeshift.identifier("require"),[jscodeshift.stringLiteral("@dynatrace/react-native-plugin/instrumentation/jsx/ElementHelper")]),jscodeshift.identifier("instrumentCreateElement")),[jscodeshift.memberExpression(jscodeshift.identifier("module"),jscodeshift.identifier("exports"))])),e.paths()[0].node.body.push(t))},addStartupCallRegistryImpl=function(e){var t=e.find(jscodeshift.FunctionDeclaration,{id:{name:"runApplication"}});return 1===t.length&&(addRequire(e,{customName:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),insertInArray(t.get().value.body.body,0,expressionStatement("_DynatraceApplicationHandler","startup",[])),!0)},addStartupCallRegistry=function(e){var t=e.find(jscodeshift.ObjectMethod,{key:{name:"runApplication"}});return 1===t.length&&(addRequire(e,{customName:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),insertInArray(t.get().value.body.body,0,expressionStatement("_DynatraceApplicationHandler","startup",[])),!0)},addReportErrorToDynatraceCall=function(e,n,r){var i=jscodeshift;e.find(i.FunctionDeclaration,{id:{name:"handleException"}}).forEach(function(e){var t=i.callExpression(i.memberExpression(i.callExpression(i.identifier("require"),[i.literal("@dynatrace/react-native-plugin/lib/core/ErrorHandler")]),i.identifier("reportErrorToDynatrace")),[i.identifier("e"),i.identifier("isFatal"),i.literal(n),i.literal(r)]),t=i.expressionStatement(i.callExpression(i.identifier("setTimeout"),[i.arrowFunctionExpression([],i.blockStatement(e.node.body.body)),t]));e.node.body.body=[t]})},replaceReactWithDynatraceJsxRuntime=function(e){var t=!1,e=e.find(jscodeshift.CallExpression,{callee:{name:"require"}});return e.find(jscodeshift.Literal,{value:"react/jsx-runtime"}).replaceWith(function(e){e=e.node;return e.value="@dynatrace/react-native-plugin/jsx-runtime",t=!0,e}),e.find(jscodeshift.Literal,{value:"react/jsx-dev-runtime"}).replaceWith(function(e){e=e.node;return e.value="@dynatrace/react-native-plugin/jsx-dev-runtime",t=!0,e}),t},insertInArray=function(e,t){for(var n=arguments.length,r=new Array(2<n?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.splice.apply(e,[t,0].concat(r))},getNodeModulesFileType=function(e,t){return"react-native"===e||"create-react-class"===e||"react-clone-referenced-element"===e?whiteList.has(t)?FileType.ReactNative:FileType.Filtered:"react"===e&&"index"===t?FileType.React:"react-native-css-interop"!==e||"jsx-runtime"!==t&&"jsx-dev-runtime"!==t?void 0:FileType.ReactNativeCssInterop},shouldInstrumentFile=function(e){if(e.includes("@dynatrace"))return FileType.Filtered;var t=nodePath.extname(e);if(".js"!==t&&".ts"!==t&&".tsx"!==t&&".jsx"!==t)return FileType.Filtered;for(var n=nodePath.parse(e),r=n.dir.split(nodePath.sep),i=0;i<r.length;i++)if("node_modules"===r[i]){var o=getNodeModulesFileType(r[i+1],n.name);if(void 0!==o)return o}return FileType.Normal},handleImports=function(e,t,n){var r=handleDestructuredImport(e,t,n);return handleDefaultImport(e,t,n)||r},handleDestructuredImport=function(e,t,n){var r=findImportSpecifier(e,t);return 0<r.length&&(void 0!==(r=removeImportSpecifier(r,t.reference,!1))&&(n.customName=r.localName),addReference(e,n),!0)},handleDefaultImport=function(e,t,n){var r=findImportDeclaration(e,t.module);if(1===r.length){r=removeImportSpecifier(r,t.reference,!0);if(void 0!==r)return addDefaultImport(e,n.defaultImport,r.localName,"ImportNamespaceSpecifier"===r.type),!0}return!1},swapReferences=function(e,t){var n=JSON.parse(JSON.stringify(t.new));return{root:e,modified:handleImports(e,t.old,n)||modifyRequireModule(e,t.old,t.new.defaultImport)}},findImportSpecifier=function(e,t){return e.find(jscodeshift.ImportDeclaration).filter(function(e){return e.node.source.value===t.module&&null!=e.node.specifiers&&e.node.specifiers.some(function(e){return isImportSpecifier(e)&&e.imported.name===t.reference||e.local&&e.local.name===t.reference})})},isImportSpecifier=function(e){return void 0!==e.imported},modifyRequireModule=function(e,t,n){var r=!1;return e.find(jscodeshift.CallExpression).filter(function(e){return isRequire(e.node.callee)&&isArgumentALiteral(e.node.arguments[0])&&e.node.arguments[0].value===t.module&&void 0!==e.parent}).forEach(function(e){(void 0===e.parent.value.property||void 0!==e.parent.value.property&&void 0!==e.parent.value.property.name&&e.parent.value.property.name===t.reference)&&(e.node.arguments[0].value=n,r=r||!0)}),r},isRequire=function(e){return"require"===e.name},isArgumentALiteral=function(e){return"StringLiteral"===e.type||"Literal"===e.type},findImportDeclaration=function(e,t){return e.find(jscodeshift.ImportDeclaration).filter(function(e){return e.node.source.value===t})},removeImportSpecifier=function(e,n,r){var i;return e.forEach(function(e){void 0!==e.node.specifiers&&(e.node.specifiers=e.node.specifiers.filter(function(e){var t;return isImportSpecifier(e)&&!r?((t=e.imported.name!==n)||null==e.local||e.imported.name===e.local.name||(i={localName:e.local.name.toString(),type:e.type}),t):!(!isImportSpecifier(e)&&r&&(null!=e.local&&(i={localName:e.local.name.toString(),type:e.type}),1))}),0===e.node.specifiers.length)&&e.prune()}),i},insertImportSpecifier=function(e,t){e.find(jscodeshift.ImportDeclaration).filter(function(e){return e.node.source.value===t.module}).forEach(function(e){null!=e.node.specifiers&&e.node.specifiers.push(importSpecifier(t))})},insertImportDefaultSpecifier=function(e,t,n){e.find(jscodeshift.ImportDeclaration).filter(function(e){return e.node.source.value===t}).forEach(function(e){null!=e.node.specifiers&&e.node.specifiers.push(n)})},insertImportDeclaration=function(e,t,n){var r=e.find(jscodeshift.ImportDeclaration);0<r.length?jscodeshift(r.paths()[0]).insertAfter(importDeclaration(t,n)):1===(r=e.find(jscodeshift.Program)).length&&r.paths()[0].node.body.unshift(importDeclaration(t,n))},addReference=function(e,t){0<findImportDeclaration(e,t.module).length?insertImportSpecifier(e,t):insertImportDeclaration(e,t.module,[importSpecifier(t)])},addDefaultImport=function(e,t,n,r){var i=findImportDeclaration(e,t),r=(r?importNamespaceSpecifier:importDefaultSpecifier)(n);0<i.length?insertImportDefaultSpecifier(e,t,r):insertImportDeclaration(e,t,[r])},addRequire=function(e,t){e=e.find(jscodeshift.VariableDeclaration);0<e.length&&jscodeshift(e.paths()[0]).insertAfter(requireDeclaration(t))},expressionStatement=function(e,t,n){return jscodeshift.expressionStatement(callExpression(e,t,n))},callExpression=function(e,t,n){return jscodeshift.callExpression(memberExpression(e,t),n)},requireDeclaration=function(e){return jscodeshift.variableDeclaration("var",[requireDeclarator(e)])},requireDeclarator=function(e){return jscodeshift.variableDeclarator(void 0!==e.customName?jscodeshift.identifier(e.customName):jscodeshift.identifier(e.reference),(0<e.reference.length?memberExpressionRequire:requireExpression)(e))},memberExpressionRequire=function(e){return jscodeshift.memberExpression(requireExpression(e),jscodeshift.identifier(e.reference))},memberExpression=function(e,t){return jscodeshift.memberExpression(jscodeshift.identifier(e),jscodeshift.identifier(t))},requireExpression=function(e){return jscodeshift.callExpression(jscodeshift.identifier("require"),[jscodeshift.literal(e.module)])},importDeclaration=function(e,t){return jscodeshift.importDeclaration(t,jscodeshift.literal(e))},importSpecifier=function(e){return void 0!==e.customName?jscodeshift.importSpecifier(jscodeshift.identifier(e.reference),jscodeshift.identifier(e.customName)):jscodeshift.importSpecifier(jscodeshift.identifier(e.reference))},importDefaultSpecifier=function(e){return jscodeshift.importDefaultSpecifier(jscodeshift.identifier(e))},importNamespaceSpecifier=function(e){return jscodeshift.importNamespaceSpecifier(jscodeshift.identifier(e))};
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instrumentationDefaultImport = exports.instrumentationModule = exports.instrumentationFolder = exports.instrumentationInfo = void 0;
4
- exports.instrumentationInfo = [];
5
- exports.instrumentationFolder = '@dynatrace/react-native-plugin/instrumentation/libs';
6
- exports.instrumentationModule = `${exports.instrumentationFolder}/community/Picker`;
7
- exports.instrumentationDefaultImport = exports.instrumentationModule;
8
- const generateInstrumentation = (name) => ({
9
- old: {
10
- module: '@react-native-picker/picker',
11
- reference: name,
12
- },
13
- new: {
14
- module: exports.instrumentationModule,
15
- reference: name,
16
- defaultImport: exports.instrumentationModule,
17
- },
18
- });
19
- exports.instrumentationInfo.push(generateInstrumentation('Picker'));
20
- exports.instrumentationInfo.push(generateInstrumentation('PickerIOS'));
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instrumentationDefaultImport = exports.instrumentationModule = exports.instrumentationFolder = exports.instrumentationInfo = void 0;
4
- exports.instrumentationInfo = [];
5
- exports.instrumentationFolder = '@dynatrace/react-native-plugin/instrumentation/libs';
6
- exports.instrumentationModule = `${exports.instrumentationFolder}/community/gesture-handler/`;
7
- exports.instrumentationDefaultImport = `${exports.instrumentationFolder}/gesture-handler`;
8
- const generateInstrumentation = (name) => ({
9
- old: {
10
- module: 'react-native-gesture-handler',
11
- reference: name,
12
- },
13
- new: {
14
- module: exports.instrumentationModule,
15
- reference: name,
16
- defaultImport: exports.instrumentationDefaultImport,
17
- },
18
- });
19
- exports.instrumentationInfo.push(generateInstrumentation('TouchableHighlight'));
20
- exports.instrumentationInfo.push(generateInstrumentation('TouchableOpacity'));
21
- exports.instrumentationInfo.push(generateInstrumentation('TouchableNativeFeedback'));
22
- exports.instrumentationInfo.push(generateInstrumentation('TouchableWithoutFeedback'));
23
- exports.instrumentationInfo.push(generateInstrumentation('RectButton'));
24
- exports.instrumentationInfo.push(generateInstrumentation('BorderlessButton'));
25
- exports.instrumentationInfo.push(generateInstrumentation('BaseButton'));