@dynatrace/react-native-plugin 2.343.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 (53) hide show
  1. package/README.md +638 -660
  2. package/android/build.gradle +6 -2
  3. package/files/plugin-runtime.gradle +17 -33
  4. package/files/plugin.gradle +1 -1
  5. package/instrumentation/BabelPluginDynatrace.js +1 -1
  6. package/instrumentation/libs/UserInteraction.js +20 -6
  7. package/instrumentation/libs/react-navigation/ReactNavigation.js +14 -58
  8. package/instrumentation/libs/withOnPressMonitoring.js +3 -54
  9. package/internal.d.ts +1 -0
  10. package/internal.js +3 -1
  11. package/ios/DynatraceRNBridge.mm +9 -0
  12. package/lib/core/configuration/ConfigurationHandler.js +0 -21
  13. package/lib/dynatrace-reporter.js +1 -30
  14. package/lib/dynatrace-transformer.js +6 -34
  15. package/lib/next/configuration/INativeRuntimeConfiguration.js +0 -1
  16. package/lib/next/configuration/RuntimeConfigurationObserver.js +1 -6
  17. package/lib/next/navigation/NavigationTracker.js +93 -0
  18. package/lib/next/navigation/useNavigationTracking.js +54 -0
  19. package/package.json +9 -21
  20. package/public.js +3 -1
  21. package/react-native-dynatrace.podspec +1 -1
  22. package/scripts/Android.js +1 -20
  23. package/scripts/Config.js +0 -4
  24. package/scripts/Deprecations.js +18 -0
  25. package/scripts/Install.js +13 -0
  26. package/scripts/PathsConstants.js +0 -4
  27. package/scripts/Uninstall.js +0 -15
  28. package/scripts/core/InstrumentCall.js +2 -3
  29. package/scripts/util/DeprecationReport.js +24 -0
  30. package/types.d.ts +212 -10
  31. package/instrumentation/DynatraceInstrumentation.js +0 -1
  32. package/instrumentation/libs/community/Picker.InstrInfo.js +0 -20
  33. package/instrumentation/libs/community/gesture-handler/Touchables.InstrInfo.js +0 -25
  34. package/instrumentation/libs/react-native/RefreshControl.InstrInfo.js +0 -12
  35. package/instrumentation/libs/react-native/Switch.InstrInfo.js +0 -12
  36. package/instrumentation/libs/react-native/Touchables.InstrInfo.js +0 -25
  37. package/instrumentation/model/Reference.js +0 -2
  38. package/instrumentation/parser/Babel.js +0 -60
  39. package/instrumentation/parser/ParserUtil.js +0 -11
  40. package/lib/features/ui-interaction/Config.js +0 -42
  41. package/lib/features/ui-interaction/IUserInteractionEvent.js +0 -16
  42. package/lib/features/ui-interaction/Plugin.Fragment.Test.js +0 -170
  43. package/lib/features/ui-interaction/Plugin.js +0 -289
  44. package/lib/features/ui-interaction/RootDetection.js +0 -51
  45. package/lib/features/ui-interaction/RootWrapper.js +0 -236
  46. package/lib/features/ui-interaction/Run.js +0 -38
  47. package/lib/features/ui-interaction/Runtime.js +0 -843
  48. package/lib/features/ui-interaction/TouchMetaResolver.js +0 -493
  49. package/lib/features/ui-interaction/Types.js +0 -14
  50. package/lib/metro/getSourceMapInfo.js +0 -26
  51. package/scripts/LineOffsetAnalyze.js +0 -25
  52. package/scripts/core/LineOffsetAnalyzeCall.js +0 -165
  53. package/scripts/util/SourceMapUtil.js +0 -68
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
@@ -1114,16 +1134,93 @@ declare class ExceptionEventData implements IExceptionEventData {
1114
1134
  }
1115
1135
 
1116
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
+ */
1117
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
+ */
1118
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
+ */
1119
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
+ */
1120
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
+ */
1121
1203
  addEventProperty(key: string, value: string | number | boolean): void;
1122
1204
  }
1123
1205
 
1124
1206
  declare class UserActionConfiguration {
1125
1207
  readonly customName: string;
1126
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
+ */
1127
1224
  constructor(customName: string, completeAutomatically?: boolean);
1128
1225
  }
1129
1226
 
@@ -1147,6 +1244,8 @@ interface IDynatrace$1 {
1147
1244
  *
1148
1245
  * See the public documentation for a detailed list of reserved/open fields.
1149
1246
  *
1247
+ * Note: This feature is not supported for RUM Classic.
1248
+ *
1150
1249
  * @param eventModifier The modifier function to modify a given JSONObject
1151
1250
  * @returns The registered event modifier instance
1152
1251
  *
@@ -1168,6 +1267,8 @@ interface IDynatrace$1 {
1168
1267
  /**
1169
1268
  * Removes an event modifier so it will no longer modify events.
1170
1269
  *
1270
+ * Note: This feature is not supported for RUM Classic.
1271
+ *
1171
1272
  * @param eventModifier The modifier function to be removed
1172
1273
  * @returns True if the modifier was successfully removed, false otherwise
1173
1274
  *
@@ -1185,6 +1286,8 @@ interface IDynatrace$1 {
1185
1286
  /**
1186
1287
  * Sends an exception event for error tracking and monitoring.
1187
1288
  *
1289
+ * Note: This feature is not supported for RUM Classic.
1290
+ *
1188
1291
  * @param exceptionEventData The exception event data built using ExceptionEventData
1189
1292
  *
1190
1293
  * @example
@@ -1211,6 +1314,8 @@ interface IDynatrace$1 {
1211
1314
  /**
1212
1315
  * Sends a custom event with event properties and optional duration.
1213
1316
  *
1317
+ * Note: This feature is not supported for RUM Classic.
1318
+ *
1214
1319
  * @param eventData The event data built using EventData
1215
1320
  *
1216
1321
  * @example
@@ -1236,6 +1341,8 @@ interface IDynatrace$1 {
1236
1341
  * **Note:** Only one view context can be active at a time. Starting a new view will
1237
1342
  * automatically stop any currently active view context.
1238
1343
  *
1344
+ * Note: This feature is not supported for RUM Classic.
1345
+ *
1239
1346
  * @param name Name of the view (e.g., screen name, page title)
1240
1347
  *
1241
1348
  * @example
@@ -1255,6 +1362,8 @@ interface IDynatrace$1 {
1255
1362
  * **Note:** While you can send multiple session properties at once, if you report the same
1256
1363
  * property multiple times, session aggregation will only use one of the values (first or last).
1257
1364
  *
1365
+ * Note: This feature is not supported for RUM Classic.
1366
+ *
1258
1367
  * @param sessionPropertyEventData The session property event data built using SessionPropertyEventData builder
1259
1368
  *
1260
1369
  * @example
@@ -1276,6 +1385,8 @@ interface IDynatrace$1 {
1276
1385
  /**
1277
1386
  * Sends an HTTP request event for network activity monitoring.
1278
1387
  *
1388
+ * Note: This feature is not supported for RUM Classic.
1389
+ *
1279
1390
  * @param {HttpRequestEventData} httpRequestEvent Event object containing the HTTP request details.
1280
1391
  *
1281
1392
  * The {@link HttpRequestEventData} class supports the following builder methods:
@@ -1336,6 +1447,8 @@ interface IDynatrace$1 {
1336
1447
  * for distributed tracing. If existing headers are provided, they will be
1337
1448
  * reused according to the W3C Trace Context specification.
1338
1449
  *
1450
+ * Note: This feature is not supported for RUM Classic.
1451
+ *
1339
1452
  * @param traceparent Optional existing W3C traceparent header value.
1340
1453
  * @param tracestate Optional existing W3C tracestate header value.
1341
1454
  * @returns A {@link TraceContext} with traceparent and tracestate values, or `undefined` if:
@@ -1365,14 +1478,39 @@ interface IDynatrace$1 {
1365
1478
  /**
1366
1479
  * Creates a new manual user action.
1367
1480
  *
1368
- * @param configuration The user action configuration
1369
- * @returns A new {@link UserAction} instance
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
+ * ```
1370
1499
  */
1371
1500
  createUserAction(configuration: UserActionConfiguration): UserAction;
1372
1501
  /**
1373
1502
  * Enables or disables automatic user action detection.
1374
1503
  *
1375
- * @param enabled True to enable, false to disable
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
+ * ```
1376
1514
  */
1377
1515
  setAutomaticUserActionDetection(enabled: boolean): void;
1378
1516
  }
@@ -1380,6 +1518,8 @@ interface IDynatrace$1 {
1380
1518
  /**
1381
1519
  * Root action that extends the standard IDynatraceAction with the ability to create
1382
1520
  * nested child actions for hierarchical action tracking.
1521
+ *
1522
+ * Note: This feature is only supported for RUM Classic.
1383
1523
  */
1384
1524
  interface IDynatraceRootAction extends IDynatraceAction {
1385
1525
  /**
@@ -1390,6 +1530,8 @@ interface IDynatraceRootAction extends IDynatraceAction {
1390
1530
  * **Note:** When the parent action is closed with `leaveAction()` or `cancel()`, all
1391
1531
  * child actions are automatically closed as well.
1392
1532
  *
1533
+ * Note: This feature is only supported for RUM Classic.
1534
+ *
1393
1535
  * @param {string} name Name of the child action (limited to 250 characters)
1394
1536
  * @param {Platform} platform Optional platform filter. Defaults to both Android and iOS.
1395
1537
  * @returns {IDynatraceAction} The created child action instance
@@ -1445,6 +1587,8 @@ interface IDynatrace extends IDynatrace$1 {
1445
1587
  * process will remove the name of a Functional Component. Still this parameter is optional as
1446
1588
  * other properties can be used at runtime as well (e.g. dtActionName).
1447
1589
  *
1590
+ * Note: This feature is only supported for RUM Classic.
1591
+ *
1448
1592
  * @param Component Functional or Class Component
1449
1593
  * @param {string} name The name of the Component
1450
1594
  * @returns The Component which was wrapped to be monitored
@@ -1467,6 +1611,8 @@ interface IDynatrace extends IDynatrace$1 {
1467
1611
  /**
1468
1612
  * Reroutes to `Dynatrace.enterAutoAction`
1469
1613
  *
1614
+ * Note: This feature is only supported for RUM Classic.
1615
+ *
1470
1616
  * @deprecated Please use either {@link enterAutoAction}, which is doing the same or alternatively {@link enterManualAction}.
1471
1617
  */
1472
1618
  enterAction(name: string, platform?: Platform): IDynatraceAction;
@@ -1477,6 +1623,8 @@ interface IDynatrace extends IDynatrace$1 {
1477
1623
  * is open, will be automatically inserted as a child action. Furthermore the plugin will automatically
1478
1624
  * link webrequest (if they are not tagged manually) to the open root action.
1479
1625
  *
1626
+ * Note: This feature is only supported for RUM Classic.
1627
+ *
1480
1628
  * @param {string} name Name of the action, which will be created. This name must not be empty. (limited to 250 characters)
1481
1629
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1482
1630
  * @returns {IDynatraceAction} Action that is created. If name was empty a NullAction will be provided,
@@ -1501,6 +1649,8 @@ interface IDynatrace extends IDynatrace$1 {
1501
1649
  * because of the full manual approach the plugin will not link webrequest automatically. Webrequest
1502
1650
  * have to be manually tagged by using the tag provided by the action via {@link IDynatraceAction.getRequestTag}.
1503
1651
  *
1652
+ * Note: This feature is only supported for RUM Classic.
1653
+ *
1504
1654
  * @param {string} name Name of the action, which will be created. This name must not be empty. (limited to 250 characters)
1505
1655
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1506
1656
  * @returns {IDynatraceRootAction} Action that is created. If name was empty a NullRootAction will be provided,
@@ -1521,6 +1671,8 @@ interface IDynatrace extends IDynatrace$1 {
1521
1671
  /**
1522
1672
  * Similar to {@link IDynatraceAction.reportError}. But the error event is reported as root action.
1523
1673
  *
1674
+ * Note: To enable event properties, call the sendExceptionEvent method instead.
1675
+ *
1524
1676
  * @param {string} errorName Name of the error event (limited to 250 characters)
1525
1677
  * @param {number} errorCode The code of the error
1526
1678
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
@@ -1538,6 +1690,8 @@ interface IDynatrace extends IDynatrace$1 {
1538
1690
  /**
1539
1691
  * Reports a stacktrace
1540
1692
  *
1693
+ * Note: To enable event properties, call the sendExceptionEvent method instead.
1694
+ *
1541
1695
  * @deprecated Please use {@link reportErrorStacktrace} instead.
1542
1696
  *
1543
1697
  * @param {String} errorName Name of the Error - SyntaxError (limited to 250 characters)
@@ -1551,6 +1705,8 @@ interface IDynatrace extends IDynatrace$1 {
1551
1705
  * Use this method to capture and report errors with their full stack traces, typically within
1552
1706
  * try-catch blocks to handle exceptions gracefully while maintaining observability.
1553
1707
  *
1708
+ * Note: To enable event properties, call the sendExceptionEvent method instead.
1709
+ *
1554
1710
  * @param errorName Name or type of the error (e.g., 'DatabaseError', 'NetworkError'). Limited to 250 characters.
1555
1711
  * @param errorValue The error message or value describing what went wrong
1556
1712
  * @param reason Additional context explaining why the error occurred
@@ -1644,6 +1800,8 @@ interface IDynatrace extends IDynatrace$1 {
1644
1800
  *
1645
1801
  * Note: Business events are only supported on Dynatrace SaaS deployments currently.
1646
1802
  *
1803
+ * Note: This feature is not supported for RUM Classic.
1804
+ *
1647
1805
  * @param {string} type Mandatory event type
1648
1806
  * @param {JSONObject} attributes Must be a valid JSON object and cannot contain functions,
1649
1807
  * undefined, Infinity and NaN as values, otherwise they will be removed.
@@ -1667,6 +1825,8 @@ interface IDynatrace extends IDynatrace$1 {
1667
1825
  * Can be called to end the current visit and start a new visit. All current actions are
1668
1826
  * closed and sent to the server.
1669
1827
  *
1828
+ * Note: This feature is only supported for RUM Classic.
1829
+ *
1670
1830
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1671
1831
  *
1672
1832
  * @example
@@ -1796,6 +1956,8 @@ interface IDynatrace extends IDynatrace$1 {
1796
1956
  * sent in packages where the oldest event has an age of up to 2 minutes (the default; the maximum age can be configured).
1797
1957
  * Using this function, you can force sending of all collected events regardless of their age.
1798
1958
  *
1959
+ * Note: This feature is only supported for RUM Classic.
1960
+ *
1799
1961
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1800
1962
  *
1801
1963
  * @example
@@ -1812,6 +1974,8 @@ interface IDynatrace extends IDynatrace$1 {
1812
1974
  * reconnect to the beacon endpoint with the new headers. To clear the previous headers,
1813
1975
  * call the method with a null or empty value.
1814
1976
  *
1977
+ * Note: This feature is only supported for RUM Classic.
1978
+ *
1815
1979
  * @param {Map<string, string>} headers a set of http headers
1816
1980
  * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
1817
1981
  *
@@ -2138,12 +2302,16 @@ declare class ConfigurationBuilder {
2138
2302
  /**
2139
2303
  * Interface for manually measuring web request timing and performance metrics.
2140
2304
  * Use this to track custom HTTP requests that are not automatically instrumented.
2305
+ *
2306
+ * Note: This feature is only supported for RUM Classic.
2141
2307
  */
2142
2308
  interface IDynatraceWebRequestTiming {
2143
2309
  /**
2144
2310
  * Starts the measurement of the web request timing. Call this method immediately before
2145
2311
  * initiating the HTTP request.
2146
2312
  *
2313
+ * Note: This feature is only supported for RUM Classic.
2314
+ *
2147
2315
  * @example
2148
2316
  * ```ts
2149
2317
  * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin';
@@ -2181,6 +2349,8 @@ interface IDynatraceWebRequestTiming {
2181
2349
  * completes (either successfully or with an error). The response code and message will be
2182
2350
  * transferred to Dynatrace and displayed in the web UI.
2183
2351
  *
2352
+ * Note: This feature is only supported for RUM Classic.
2353
+ *
2184
2354
  * @param {number} responseCode HTTP status code of the response (e.g., 200, 404, 500)
2185
2355
  * @param {string} responseMessage Response message or error description
2186
2356
  *
@@ -2220,6 +2390,8 @@ interface IDynatraceWebRequestTiming {
2220
2390
  * method after the request completes to track both timing and payload sizes. The response code,
2221
2391
  * message, and size metrics will be transferred to Dynatrace and displayed in the web UI.
2222
2392
  *
2393
+ * Note: This feature is only supported for RUM Classic.
2394
+ *
2223
2395
  * @param {number} responseCode HTTP status code of the response (e.g., 200, 404, 500)
2224
2396
  * @param {string} responseMessage Response message or error description
2225
2397
  * @param {number} requestSize Size of the request payload in bytes
@@ -2278,6 +2450,8 @@ interface IDynatraceWebRequestTiming {
2278
2450
  * The tag value is evaluated by the corresponding web server agent.
2279
2451
  * The Dynatrace server will link the server-side PurePath data with this mobile user action.
2280
2452
  *
2453
+ * Note: This feature is only supported for RUM Classic.
2454
+ *
2281
2455
  * @returns {string} The request tag value to be used as the HTTP header value
2282
2456
  *
2283
2457
  * @example
@@ -2300,6 +2474,8 @@ interface IDynatraceWebRequestTiming {
2300
2474
  * Returns the HTTP header name required for request tagging. Use this header name in
2301
2475
  * combination with `getRequestTag()` to properly tag HTTP requests for tracking.
2302
2476
  *
2477
+ * Note: This feature is only supported for RUM Classic.
2478
+ *
2303
2479
  * @returns {string} The name of the HTTP header to use for request tagging
2304
2480
  *
2305
2481
  * @example
@@ -2336,6 +2512,8 @@ declare class DynatraceWebRequestTiming implements IDynatraceWebRequestTiming {
2336
2512
  /**
2337
2513
  * Constructor for creating a DynatraceWebRequestTiming
2338
2514
  *
2515
+ * Note: To enable event properties and report additional fields, call the sendHttpRequestEvent method instead.
2516
+ *
2339
2517
  * @param {string} requestTag Request Tag for the action to be linked to
2340
2518
  * @param {string} url URL that should be linked
2341
2519
  *
@@ -2373,6 +2551,35 @@ declare class DynatraceWebRequestTiming implements IDynatraceWebRequestTiming {
2373
2551
  getRequestTagHeader(): string;
2374
2552
  }
2375
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
+
2376
2583
  /**
2377
2584
  * Configuration for React Native transformer
2378
2585
  */
@@ -2472,12 +2679,7 @@ interface InstrumentationReactConfiguration {
2472
2679
  enabled: boolean;
2473
2680
  };
2474
2681
  userInteraction: boolean;
2475
- sourcemap: {
2476
- enabled: boolean;
2477
- androidSourcemapLocation: string;
2478
- };
2479
2682
  debugBabelPlugin?: boolean;
2480
- useLegacyJscodeshift?: boolean;
2481
2683
  }
2482
2684
  /**
2483
2685
  * Combined React configuration including transformer and instrumentation settings
@@ -2531,5 +2733,5 @@ declare module 'react' {
2531
2733
  }
2532
2734
  }
2533
2735
 
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 };
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'));
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instrumentationInfo = void 0;
4
- exports.instrumentationInfo = [];
5
- exports.instrumentationInfo.push({
6
- old: { module: 'react-native', reference: 'RefreshControl' },
7
- new: {
8
- module: '@dynatrace/react-native-plugin/instrumentation/libs/react-native/',
9
- reference: 'RefreshControl',
10
- defaultImport: '@dynatrace/react-native-plugin/instrumentation/libs/react-native',
11
- },
12
- });
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instrumentationInfo = void 0;
4
- exports.instrumentationInfo = [];
5
- exports.instrumentationInfo.push({
6
- old: { module: 'react-native', reference: 'Switch' },
7
- new: {
8
- module: '@dynatrace/react-native-plugin/instrumentation/libs/react-native/',
9
- reference: 'Switch',
10
- defaultImport: '@dynatrace/react-native-plugin/instrumentation/libs/react-native',
11
- },
12
- });