@dynatrace/react-native-plugin 2.309.1 → 2.311.2

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 (33) hide show
  1. package/README.md +8 -3
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.kt +6 -8
  4. package/files/plugin.gradle +1 -1
  5. package/instrumentation/jsx/ElementHelper.js +2 -2
  6. package/instrumentation/jsx/JsxDevRuntime.js +37 -44
  7. package/instrumentation/jsx/JsxRuntime.js +5 -11
  8. package/instrumentation/jsx/components/FunctionalComponent.js +0 -5
  9. package/instrumentation/jsx/components/Switch.js +7 -7
  10. package/instrumentation/jsx/components/Touchable.js +3 -3
  11. package/instrumentation/model/TypesUtil.js +34 -1
  12. package/ios/DynatraceRNBridge.h +1 -1
  13. package/ios/DynatraceRNBridge.mm +1 -2
  14. package/lib/core/Dynatrace.js +15 -0
  15. package/lib/next/Dynatrace.js +15 -13
  16. package/lib/next/DynatraceSecondGenForwarder.js +18 -0
  17. package/lib/next/appstart/AppStartObserver.js +2 -0
  18. package/lib/next/appstart/AppStartType.js +6 -6
  19. package/lib/next/events/EventPipeline.js +9 -8
  20. package/lib/next/events/EventTimestamp.js +3 -0
  21. package/lib/next/events/modifier/EventModifierUtil.js +3 -2
  22. package/lib/next/events/modifier/ModifyEventValidation.js +6 -4
  23. package/lib/next/events/modifier/SendEventValidation.js +6 -4
  24. package/lib/next/events/modifier/{NonFiniteNumbersModifier.js → ValueRestrictionModifier.js} +19 -13
  25. package/lib/next/events/spec/EventSpecContstants.js +1 -0
  26. package/package.json +7 -4
  27. package/react-native-dynatrace.podspec +1 -1
  28. package/scripts/Android.js +10 -4
  29. package/scripts/Config.js +1 -1
  30. package/scripts/Ios.js +3 -1
  31. package/scripts/PathsConstants.js +3 -1
  32. package/scripts/core/InstrumentCall.js +1 -0
  33. package/typings/react-native-dynatrace.d.ts +74 -0
package/README.md CHANGED
@@ -32,8 +32,8 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
32
32
  ## Agent Versions
33
33
  This agent versions are configured in this plugin:
34
34
 
35
- * Android Agent: 8.309.2.1011
36
- * iOS Agent: 8.309.1.1009
35
+ * Android Agent: 8.311.1.1007
36
+ * iOS Agent: 8.311.1.1013
37
37
 
38
38
  ## Quick Setup
39
39
 
@@ -327,7 +327,7 @@ Combining manual and auto instrumentation should not be a problem. As they're ru
327
327
 
328
328
  There are two options to create an action. Either using `enterAutoAction` (the previous `enterAction`) or `enterManualAction`:
329
329
 
330
- * `enterAutoAction` - Creates an Action which will be automatically handled by the plugin (This is the type of action which is internally used by the plugin when monitoring components and touchables). This means that the plugin decides about the hierachy of this action. If there is no open action, the following action will be a root action. All other actions created by this method, while a root action is open, will be automatically inserted as a child action. Furthermore the plugin will automatically link webrequest (if they are not tagged manually) to the open root action. Be aware that the timeout/wait time for sub actions or web requests cannot be modified on the Android side for React Native Auto actions. The timeout is fixed to a 1000ms.
330
+ * `enterAutoAction` - Creates an Action which will be automatically handled by the plugin (This is the type of action which is internally used by the plugin when monitoring components and touchables). This means that the plugin decides about the hierarchy of this action. If there is no open action, the following action will be a root action. All other actions created by this method, while a root action is open, will be automatically inserted as a child action. Furthermore the plugin will automatically link webrequest (if they are not tagged manually) to the open root action. Be aware that the timeout/wait time for sub actions or web requests cannot be modified on the Android side for React Native Auto actions. The timeout is fixed to a 1000ms.
331
331
 
332
332
  ```ts
333
333
  import { Dynatrace } from '@dynatrace/react-native-plugin';
@@ -1463,6 +1463,11 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
1463
1463
  <br/><br/>
1464
1464
  ## Changelog
1465
1465
 
1466
+ 2.311.1
1467
+ * Updated Android (8.311.1.1007) & iOS Agent (8.311.1.1013)
1468
+ * Configuration copied to android folder which supports cloud builds
1469
+ * Removed dynamic import for jsx runtime as it was causing issue
1470
+
1466
1471
  2.309.1
1467
1472
  * Updated Android (8.309.2.1011) & iOS Agent (8.309.1.1009)
1468
1473
  * Fixed issue with metro when internal require was not resolved correctly
@@ -72,7 +72,7 @@ repositories {
72
72
  }
73
73
 
74
74
  dependencies {
75
- implementation 'com.dynatrace.agent:agent-android:8.309.2.1011'
75
+ implementation 'com.dynatrace.agent:agent-android:8.311.1.1007'
76
76
  implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
77
77
  }
78
78
 
@@ -25,16 +25,15 @@ internal object DynatraceUtils {
25
25
  ) {
26
26
  // This is a int
27
27
  arrayList.add(array.getDouble(i).toInt())
28
- }
29
- if (value >= Long.MIN_VALUE && value <= Long.MAX_VALUE && value == value.toLong()
28
+ } else if (value >= Long.MIN_VALUE && value <= Long.MAX_VALUE && value == value.toLong()
30
29
  .toDouble()
31
30
  ) {
32
31
  // This is a long
33
32
  arrayList.add(array.getDouble(i).toLong())
34
33
  }
35
- break
34
+ } else {
35
+ arrayList.add(array.getDouble(i))
36
36
  }
37
- arrayList.add(array.getDouble(i))
38
37
  }
39
38
 
40
39
  ReadableType.String -> arrayList.add(array.getString(i))
@@ -63,16 +62,15 @@ internal object DynatraceUtils {
63
62
  ) {
64
63
  // This is a int
65
64
  hashMap[key] = map.getDouble(key).toInt()
66
- }
67
- if (value >= Long.MIN_VALUE && value <= Long.MAX_VALUE && value == value.toLong()
65
+ } else if (value >= Long.MIN_VALUE && value <= Long.MAX_VALUE && value == value.toLong()
68
66
  .toDouble()
69
67
  ) {
70
68
  // This is a long
71
69
  hashMap[key] = map.getDouble(key).toLong()
72
70
  }
73
- break
71
+ } else {
72
+ hashMap[key] = map.getDouble(key)
74
73
  }
75
- hashMap[key] = map.getDouble(key)
76
74
  }
77
75
 
78
76
  ReadableType.String -> hashMap[key] = map.getString(key)
@@ -1,3 +1,3 @@
1
1
  dependencies {
2
- classpath 'com.dynatrace.tools.android:gradle-plugin:8.309.2.1011'
2
+ classpath 'com.dynatrace.tools.android:gradle-plugin:8.311.1.1007'
3
3
  }
@@ -50,10 +50,10 @@ const modifyElement = (type, props, ...children) => {
50
50
  type._dtInfo.type === Types_1.Types.Pressable ||
51
51
  (0, TypesUtil_1.isTypeTouchable)(type._dtInfo.type)) {
52
52
  if (props.onPress != null) {
53
- props.onPress = (0, Touchable_1.TouchableHelper)(Dynatrace_1.Dynatrace, new ConsoleLogger_1.ConsoleLogger('TouchableHelper')).attachOnPress(false, props, children);
53
+ props.onPress = (0, Touchable_1.TouchableHelper)(Dynatrace_1.Dynatrace, new ConsoleLogger_1.ConsoleLogger('TouchableHelper')).attachOnPress(false, props, children, type._dtInfo.type);
54
54
  }
55
55
  if (props.onLongPress != null) {
56
- props.onLongPress = (0, Touchable_1.TouchableHelper)(Dynatrace_1.Dynatrace, new ConsoleLogger_1.ConsoleLogger('TouchableHelper')).attachOnPress(true, props, children);
56
+ props.onLongPress = (0, Touchable_1.TouchableHelper)(Dynatrace_1.Dynatrace, new ConsoleLogger_1.ConsoleLogger('TouchableHelper')).attachOnPress(true, props, children, type._dtInfo.type);
57
57
  }
58
58
  }
59
59
  else if (props.onValueChange != null &&
@@ -1,60 +1,53 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const Types_1 = require("../model/Types");
4
- const JsxRuntimeUtil_1 = require("./JsxRuntimeUtil");
5
4
  const FunctionalComponent_1 = require("./components/FunctionalComponent");
6
5
  const ClassComponent_1 = require("./components/ClassComponent");
7
6
  const ElementHelper_1 = require("./ElementHelper");
7
+ const ReactDevRuntime = require("react/jsx-dev-runtime");
8
8
  try {
9
- const _jsxDevRuntime = (0, JsxRuntimeUtil_1.dynamicRequireJSXDevRuntime)();
10
- if (_jsxDevRuntime != null) {
11
- const jsxDEV = (...args) => {
12
- if (args[0] !== undefined &&
13
- args[0]._dtInfo !== undefined &&
14
- !(0, ElementHelper_1.isDtActionIgnore)(args[1])) {
15
- if (args[0]._dtInfo.type === Types_1.Types.FunctionalComponent) {
16
- const wrapperProps = {
17
- children: _jsxDevRuntime.jsxDEV(...args),
18
- };
19
- wrapperProps.dtActionName =
20
- args[1] !== undefined &&
21
- args[1].dtActionName !== undefined
22
- ? args[1].dtActionName
23
- : args[0]._dtInfo.name;
24
- if (args[2] !== undefined) {
25
- return _jsxDevRuntime.jsxDEV(FunctionalComponent_1.DynatraceFunctionalComponent, wrapperProps, args[2] + '_dt');
26
- }
27
- else {
28
- return _jsxDevRuntime.jsxDEV(FunctionalComponent_1.DynatraceFunctionalComponent, wrapperProps);
29
- }
9
+ const jsxDEV = (...args) => {
10
+ if (args[0] !== undefined &&
11
+ args[0]._dtInfo !== undefined &&
12
+ !(0, ElementHelper_1.isDtActionIgnore)(args[1])) {
13
+ if (args[0]._dtInfo.type === Types_1.Types.FunctionalComponent) {
14
+ const wrapperProps = {
15
+ children: ReactDevRuntime.jsxDEV(...args),
16
+ };
17
+ wrapperProps.dtActionName =
18
+ args[1] !== undefined && args[1].dtActionName !== undefined
19
+ ? args[1].dtActionName
20
+ : args[0]._dtInfo.name;
21
+ if (args[2] !== undefined) {
22
+ return ReactDevRuntime.jsxDEV(FunctionalComponent_1.DynatraceFunctionalComponent, wrapperProps, args[2] + '_dt');
30
23
  }
31
- else if (args[0]._dtInfo.type === Types_1.Types.ClassComponent &&
32
- args[0].prototype !== undefined &&
33
- args[0].prototype.isReactComponent !== undefined) {
34
- const wrapperProps = {
35
- children: _jsxDevRuntime.jsxDEV(...args),
36
- };
37
- if (args[2] !== undefined) {
38
- return _jsxDevRuntime.jsxDEV(ClassComponent_1.DynatraceClassComponent, wrapperProps, args[2] + '_dt');
39
- }
40
- else {
41
- return _jsxDevRuntime.jsxDEV(ClassComponent_1.DynatraceClassComponent, wrapperProps);
42
- }
24
+ else {
25
+ return ReactDevRuntime.jsxDEV(FunctionalComponent_1.DynatraceFunctionalComponent, wrapperProps);
43
26
  }
44
- if (Array.isArray(args[1].children)) {
45
- (0, ElementHelper_1.modifyElement)(args[0], args[1], ...args[1].children);
27
+ }
28
+ else if (args[0]._dtInfo.type === Types_1.Types.ClassComponent &&
29
+ args[0].prototype !== undefined &&
30
+ args[0].prototype.isReactComponent !== undefined) {
31
+ const wrapperProps = {
32
+ children: ReactDevRuntime.jsxDEV(...args),
33
+ };
34
+ if (args[2] !== undefined) {
35
+ return ReactDevRuntime.jsxDEV(ClassComponent_1.DynatraceClassComponent, wrapperProps, args[2] + '_dt');
46
36
  }
47
37
  else {
48
- (0, ElementHelper_1.modifyElement)(args[0], args[1], args[1].children);
38
+ return ReactDevRuntime.jsxDEV(ClassComponent_1.DynatraceClassComponent, wrapperProps);
49
39
  }
50
40
  }
51
- return _jsxDevRuntime.jsxDEV(...args);
52
- };
53
- module.exports = Object.assign(Object.assign({}, _jsxDevRuntime), { jsxDEV });
54
- }
55
- else {
56
- module.exports = {};
57
- }
41
+ if (Array.isArray(args[1].children)) {
42
+ (0, ElementHelper_1.modifyElement)(args[0], args[1], ...args[1].children);
43
+ }
44
+ else {
45
+ (0, ElementHelper_1.modifyElement)(args[0], args[1], args[1].children);
46
+ }
47
+ }
48
+ return ReactDevRuntime.jsxDEV(...args);
49
+ };
50
+ module.exports = Object.assign(Object.assign({}, ReactDevRuntime), { jsxDEV });
58
51
  }
59
52
  catch (error) {
60
53
  module.exports = {};
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const Types_1 = require("../model/Types");
4
- const JsxRuntimeUtil_1 = require("./JsxRuntimeUtil");
5
4
  const FunctionalComponent_1 = require("./components/FunctionalComponent");
6
5
  const ClassComponent_1 = require("./components/ClassComponent");
7
6
  const ElementHelper_1 = require("./ElementHelper");
7
+ const ReactRuntime = require("react/jsx-runtime");
8
8
  const instrumentJsxCall = (jsxFunction) => (...args) => {
9
9
  if (args[0] !== undefined &&
10
10
  args[0]._dtInfo !== undefined &&
@@ -47,16 +47,10 @@ const instrumentJsxCall = (jsxFunction) => (...args) => {
47
47
  return jsxFunction(...args);
48
48
  };
49
49
  try {
50
- const _jsxRuntime = (0, JsxRuntimeUtil_1.dynamicRequireJSXRuntime)();
51
- if (_jsxRuntime != null) {
52
- const jsx = instrumentJsxCall(_jsxRuntime.jsx);
53
- const jsxs = instrumentJsxCall(_jsxRuntime.jsxs);
54
- module.exports = Object.assign(Object.assign({}, _jsxRuntime), { jsx,
55
- jsxs });
56
- }
57
- else {
58
- module.exports = {};
59
- }
50
+ const jsx = instrumentJsxCall(ReactRuntime.jsx);
51
+ const jsxs = instrumentJsxCall(ReactRuntime.jsxs);
52
+ module.exports = Object.assign(Object.assign({}, ReactRuntime), { jsx,
53
+ jsxs });
60
54
  }
61
55
  catch (error) {
62
56
  module.exports = {};
@@ -3,15 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynatraceFunctionalComponent = void 0;
4
4
  const react_1 = require("react");
5
5
  const Dynatrace_1 = require("../../../lib/core/Dynatrace");
6
- const NullAction_1 = require("../../../lib/core/NullAction");
7
- const ConsoleLogger_1 = require("../../../lib/core/logging/ConsoleLogger");
8
6
  const ComponentUtil_1 = require("./ComponentUtil");
9
7
  const DynatraceFunctionalComponent = (props) => {
10
8
  const componentName = (0, ComponentUtil_1.getNameFromComponent)(props);
11
9
  const action = Dynatrace_1.Dynatrace.enterAutoAction(`Render ${componentName}`);
12
- if (action instanceof NullAction_1.NullAction) {
13
- new ConsoleLogger_1.ConsoleLogger(`Component ${componentName}`).info('React Native plugin has not been started yet! Component will not be reported!');
14
- }
15
10
  (0, react_1.useEffect)(() => {
16
11
  action.leaveAction();
17
12
  });
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SwitchHelper = void 0;
4
4
  const IDynatraceProperties_1 = require("../IDynatraceProperties");
5
+ const ConfigurationHandler_1 = require("../../../lib/core/configuration/ConfigurationHandler");
5
6
  const SwitchHelper = (Dynatrace) => ({
6
7
  attachOnValueChange: (switchProps) => {
7
8
  if ((0, IDynatraceProperties_1.isDynatraceIgnored)(switchProps)) {
@@ -11,13 +12,12 @@ const SwitchHelper = (Dynatrace) => ({
11
12
  const nameOfAction = _findActionName(switchProps);
12
13
  if (origOnValueChange != null) {
13
14
  switchProps.onValueChange = (value) => {
14
- let finalNameOfAction;
15
- if (nameOfAction == null) {
16
- finalNameOfAction = `Touch on Switch to ${value}`;
17
- }
18
- else {
19
- finalNameOfAction = `Touch on Switch ${nameOfAction} to ${value}`;
20
- }
15
+ const useGenericName = nameOfAction == null ||
16
+ (!(0, IDynatraceProperties_1.isDynatraceNaming)(switchProps) &&
17
+ ConfigurationHandler_1.ConfigurationHandler.isActionNamePrivacyEnabled());
18
+ const finalNameOfAction = useGenericName
19
+ ? `Touch on Switch to ${value}`
20
+ : `Touch on ${nameOfAction} to ${value}`;
21
21
  const action = Dynatrace.enterAutoAction(finalNameOfAction);
22
22
  let isSyncError = true;
23
23
  try {
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TouchableHelper = void 0;
4
4
  const ConfigurationHandler_1 = require("../../../lib/core/configuration/ConfigurationHandler");
5
5
  const IDynatraceProperties_1 = require("../IDynatraceProperties");
6
+ const TypesUtil_1 = require("../../model/TypesUtil");
6
7
  const TouchableHelper = (Dynatrace, Logger) => ({
7
- attachOnPress(longPress, props, children) {
8
+ attachOnPress(longPress, props, children, type) {
8
9
  const origFunction = longPress && this._isLongPress(props)
9
10
  ? props.onLongPress
10
11
  : props.onPress;
11
12
  const nameOfAction = this._findActionName(props, children);
12
- const isButton = this._isPropsButton(props);
13
13
  const wrappedFunction = (event) => {
14
14
  if (nameOfAction == null) {
15
15
  Logger.debug('Skipping creation of action as no name was found!');
@@ -33,7 +33,7 @@ const TouchableHelper = (Dynatrace, Logger) => ({
33
33
  let finalNameOfAction = nameOfAction;
34
34
  if (!(0, IDynatraceProperties_1.isDynatraceNaming)(props) &&
35
35
  ConfigurationHandler_1.ConfigurationHandler.isActionNamePrivacyEnabled()) {
36
- finalNameOfAction = isButton ? 'Button' : 'Touchable';
36
+ finalNameOfAction = (0, TypesUtil_1.getNameForType)(type);
37
37
  }
38
38
  const action = Dynatrace.enterAutoAction(`Touch on ${finalNameOfAction}`);
39
39
  if (origFunction != null) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTypeTouchable = exports.isTypeGestureHandlerTouchable = exports.isTypeReactNativeTouchable = void 0;
3
+ exports.getNameForType = exports.isTypeTouchable = exports.isTypeGestureHandlerTouchable = exports.isTypeReactNativeTouchable = void 0;
4
4
  const Types_1 = require("./Types");
5
5
  const isTypeReactNativeTouchable = (type) => type === Types_1.Types.TouchableHighlight ||
6
6
  type === Types_1.Types.TouchableNativeFeedback ||
@@ -15,3 +15,36 @@ const isTypeGestureHandlerTouchable = (type) => type === Types_1.Types.Touchable
15
15
  exports.isTypeGestureHandlerTouchable = isTypeGestureHandlerTouchable;
16
16
  const isTypeTouchable = (type) => (0, exports.isTypeGestureHandlerTouchable)(type) || (0, exports.isTypeReactNativeTouchable)(type);
17
17
  exports.isTypeTouchable = isTypeTouchable;
18
+ const getNameForType = (type) => {
19
+ switch (type) {
20
+ case Types_1.Types.Button:
21
+ case Types_1.Types.RectButtonGestureHandler:
22
+ return 'Button';
23
+ case Types_1.Types.Text:
24
+ return 'Text';
25
+ case Types_1.Types.TouchableHighlight:
26
+ case Types_1.Types.TouchableNativeFeedback:
27
+ case Types_1.Types.TouchableOpacity:
28
+ case Types_1.Types.TouchableWithoutFeedback:
29
+ case Types_1.Types.TouchableHighlightGestureHandler:
30
+ case Types_1.Types.TouchableNativeFeedbackGestureHandler:
31
+ case Types_1.Types.TouchableOpacityGestureHandler:
32
+ case Types_1.Types.TouchableWithoutFeedbackGestureHandler:
33
+ return 'Touchable';
34
+ case Types_1.Types.Pressable:
35
+ return 'Pressable';
36
+ case Types_1.Types.Picker:
37
+ return 'Picker';
38
+ case Types_1.Types.RefreshControl:
39
+ return 'Refresh Control';
40
+ case Types_1.Types.Switch:
41
+ return 'Switch';
42
+ case Types_1.Types.ClassComponent:
43
+ return 'Class Component';
44
+ case Types_1.Types.FunctionalComponent:
45
+ return 'Functional Component';
46
+ default:
47
+ return 'Undefined';
48
+ }
49
+ };
50
+ exports.getNameForType = getNameForType;
@@ -33,7 +33,7 @@ typedef enum : NSUInteger {
33
33
  @end
34
34
 
35
35
  @interface DTXAction (CrossPlatform)
36
- + (DTX_StatusCode)internalReportError:(NSString* _Nonnull)errorName errorValue:(int)errorValue;
36
+ - (DTX_StatusCode)internalReportError:(NSString* _Nonnull)errorName errorValue:(int)errorValue;
37
37
  @end
38
38
 
39
39
  @interface Dynatrace (Events)
@@ -356,8 +356,7 @@ RCT_EXPORT_METHOD(reportErrorInAction:(nonnull NSString *)key errorName:(NSStrin
356
356
  DTXAction *action = [self getAction:key];
357
357
  if (action == nil)
358
358
  return;
359
- [action reportErrorWithName:errorName errorValue:[errorCode intValue]];
360
- // [action internalReportError:errorName errorValue:[errorCode intValue]];
359
+ [action internalReportError:errorName errorValue:[errorCode intValue]];
361
360
  }
362
361
  }
363
362
 
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Dynatrace = void 0;
13
13
  const Types_1 = require("../../instrumentation/model/Types");
14
14
  const DynatraceSecondGenForwarder_1 = require("../next/DynatraceSecondGenForwarder");
15
+ const Dynatrace_1 = require("../next/Dynatrace");
15
16
  const StringUtils_1 = require("./util/StringUtils");
16
17
  const DynatraceBridge_1 = require("./DynatraceBridge");
17
18
  const DataCollectionLevel_1 = require("./model/DataCollectionLevel");
@@ -335,4 +336,18 @@ exports.Dynatrace = {
335
336
  logger.info('setBeaconHeaders(headers): React Native plugin has not been started yet! Setting Beacon Headers is not possible!');
336
337
  }
337
338
  },
339
+ addEventModifier: (eventModifier) => Dynatrace_1.Dynatrace.addEventModifier(eventModifier),
340
+ removeEventModifier: (eventModifier) => Dynatrace_1.Dynatrace.removeEventModifier(eventModifier),
341
+ sendEvent: (properties) => {
342
+ Dynatrace_1.Dynatrace.sendEvent(properties);
343
+ },
344
+ startView: (name) => {
345
+ Dynatrace_1.Dynatrace.startView(name);
346
+ },
347
+ stopView: () => {
348
+ Dynatrace_1.Dynatrace.stopView();
349
+ },
350
+ sendSessionPropertyEvent: (properties) => {
351
+ Dynatrace_1.Dynatrace.sendSessionPropertyEvent(properties);
352
+ },
338
353
  };
@@ -24,6 +24,7 @@ class DynatraceImpl {
24
24
  }
25
25
  startView(name) {
26
26
  this.logger.debug(`startView(${name})`);
27
+ EventPipeline_1.EventPipeline.generateViewData(name);
27
28
  if (name != null && name.length > 0) {
28
29
  DynatraceBridge_1.DynatraceNative.startView(name);
29
30
  }
@@ -33,45 +34,46 @@ class DynatraceImpl {
33
34
  }
34
35
  stopView() {
35
36
  this.logger.debug('stopView()');
37
+ EventPipeline_1.EventPipeline.releaseViewData();
36
38
  DynatraceBridge_1.DynatraceNative.stopView();
37
39
  }
38
- reportCrash(crash, isApiReported, isFatal = true, additionalData = {}) {
39
- this.logger.debug(`reportCrash(${JSON.stringify(crash)}, ${isFatal}, ${JSON.stringify(additionalData)})`);
40
+ reportCrash(crash, isApiReported, isFatal = true) {
41
+ this.logger.debug(`reportCrash(${JSON.stringify(crash)}, ${isFatal})`);
40
42
  const eventTimestamp = new EventTimestamp_1.EventTimestamp(this.timestampProvider);
41
43
  const event = Object.assign(Object.assign({}, (0, EventCreator_1.createCrashEvent)(crash.name, crash.message, crash.stack, isFatal)), eventTimestamp.getEventTimeInfo());
42
44
  if (isApiReported) {
43
45
  event["characteristics.is_api_reported"] =
44
46
  true;
45
47
  }
46
- EventPipeline_1.EventPipeline.insertEvent(event, additionalData);
48
+ EventPipeline_1.EventPipeline.insertEvent(event);
47
49
  }
48
- reportErrorCode(errorName, errorCode, isApiReported, additionalData = {}) {
49
- this.logger.debug(`reportErrorCode(${errorName}, ${errorCode}, ${JSON.stringify(additionalData)})`);
50
+ reportErrorCode(errorName, errorCode, isApiReported) {
51
+ this.logger.debug(`reportErrorCode(${errorName}, ${errorCode})`);
50
52
  const eventTimestamp = new EventTimestamp_1.EventTimestamp(this.timestampProvider);
51
53
  const event = Object.assign(Object.assign({}, (0, EventCreator_1.createErrorCodeEvent)(errorName, errorCode)), eventTimestamp.getEventTimeInfo());
52
54
  if (isApiReported) {
53
55
  event["characteristics.is_api_reported"] =
54
56
  true;
55
57
  }
56
- EventPipeline_1.EventPipeline.insertEvent(event, additionalData);
58
+ EventPipeline_1.EventPipeline.insertEvent(event);
57
59
  }
58
- reportError(error, isApiReported, additionalData = {}) {
59
- this.logger.debug(`reportError(${JSON.stringify(error)}, ${JSON.stringify(additionalData)})`);
60
+ reportError(error, isApiReported) {
61
+ this.logger.debug(`reportError(${JSON.stringify(error)})`);
60
62
  const eventTimestamp = new EventTimestamp_1.EventTimestamp(this.timestampProvider);
61
63
  const event = Object.assign(Object.assign({}, (0, EventCreator_1.createErrorEvent)(error.name, error.message, error.stack)), eventTimestamp.getEventTimeInfo());
62
64
  if (isApiReported) {
63
65
  event["characteristics.is_api_reported"] =
64
66
  true;
65
67
  }
66
- EventPipeline_1.EventPipeline.insertEvent(event, additionalData);
68
+ EventPipeline_1.EventPipeline.insertEvent(event);
67
69
  }
68
- sendEvent(properties) {
69
- this.logger.debug(`sendEvent(${JSON.stringify(properties)})`);
70
+ sendEvent(properties, context) {
71
+ this.logger.debug(`sendEvent(${JSON.stringify(properties, context)})`);
70
72
  const eventValidated = SendEventValidation_1.SendEventValidation.modifyEvent(properties);
71
73
  if (eventValidated != null && (0, EventModifierUtil_1.containEventProperties)(eventValidated)) {
72
74
  eventValidated["characteristics.has_event_properties"] = true;
73
75
  }
74
- EventPipeline_1.EventPipeline.insertEvent(eventValidated, {});
76
+ EventPipeline_1.EventPipeline.insertEvent(eventValidated, context);
75
77
  }
76
78
  sendSessionPropertyEvent(properties) {
77
79
  this.logger.debug(`sendSessionPropertyEvent(${JSON.stringify(properties)})`);
@@ -80,7 +82,7 @@ class DynatraceImpl {
80
82
  (0, EventModifierUtil_1.containSessionProperties)(eventValidated)) {
81
83
  eventValidated["characteristics.has_session_properties"] = true;
82
84
  }
83
- EventPipeline_1.EventPipeline.insertEvent(eventValidated, {});
85
+ EventPipeline_1.EventPipeline.insertEvent(eventValidated);
84
86
  }
85
87
  }
86
88
  exports.Dynatrace = new DynatraceImpl(TimestampProvider_1.defaultTimestampProvider);
@@ -1,17 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynatraceSecondGenForwarder = void 0;
4
+ const Dynatrace_1 = require("./Dynatrace");
4
5
  class DynatraceSecondGenForwarderImpl {
5
6
  reportError(errorName, errorCode) {
7
+ Dynatrace_1.Dynatrace.reportErrorCode(errorName, errorCode, true);
6
8
  }
7
9
  reportErrorWithStacktrace(errorName, reason, stacktrace) {
10
+ Dynatrace_1.Dynatrace.reportError({
11
+ name: errorName,
12
+ message: reason,
13
+ stack: stacktrace,
14
+ }, true);
8
15
  }
9
16
  reportErrorStacktrace(errorName, errorValue, reason, stacktrace) {
17
+ Dynatrace_1.Dynatrace.reportError({
18
+ name: errorName,
19
+ message: reason,
20
+ stack: stacktrace,
21
+ }, true);
10
22
  }
11
23
  reportCrash(crashName, reason, stacktrace) {
24
+ Dynatrace_1.Dynatrace.reportCrash({
25
+ name: crashName,
26
+ message: reason,
27
+ stack: stacktrace,
28
+ }, true, false);
12
29
  }
13
30
  reportCrashWithException(crashName, crash) {
14
31
  const copyCrash = Object.assign(Object.assign({}, crash), { name: crashName });
32
+ Dynatrace_1.Dynatrace.reportCrash(copyCrash, true, false);
15
33
  }
16
34
  }
17
35
  exports.DynatraceSecondGenForwarder = new DynatraceSecondGenForwarderImpl();
@@ -5,6 +5,7 @@ const react_native_1 = require("react-native");
5
5
  const EventCreator_1 = require("../events/EventCreator");
6
6
  const ConsoleLogger_1 = require("../../core/logging/ConsoleLogger");
7
7
  const DynatraceBridge_1 = require("../../core/DynatraceBridge");
8
+ const EventPipeline_1 = require("../events/EventPipeline");
8
9
  class AppStartObserverImpl {
9
10
  constructor() {
10
11
  this.EMIT_APP_START = 'dynatraceAppStartMeasurements';
@@ -21,6 +22,7 @@ class AppStartObserverImpl {
21
22
  this.logger.debug(`emitter(${JSON.stringify(data)}})`);
22
23
  const appStartEvent = (0, EventCreator_1.createAppStartEvent)(data);
23
24
  if (appStartEvent != null) {
25
+ EventPipeline_1.EventPipeline.insertEvent(Object.assign({}, appStartEvent), {});
24
26
  }
25
27
  else {
26
28
  this.logger.debug(`emitter(${JSON.stringify(data)}}): App Start event ignored!`);
@@ -13,26 +13,26 @@ var AppStartType;
13
13
  exports.AppStartTypeKeyMapping = [
14
14
  {
15
15
  type: AppStartType.RELOAD,
16
- key: "app_start.react_native.application.reload",
16
+ key: "app_start.react_native.run_js_bundle.load_time",
17
17
  },
18
18
  {
19
19
  type: AppStartType.DOWNLOAD_START,
20
- key: "app_start.react_native.application.download_start",
20
+ key: "app_start.react_native.download.start_time",
21
21
  },
22
22
  {
23
23
  type: AppStartType.RUN_JS_BUNDLE_START,
24
- key: "app_start.react_native.application.run_js_bundle_start",
24
+ key: "app_start.react_native.run_js_bundle.start_time",
25
25
  },
26
26
  {
27
27
  type: AppStartType.DOWNLOAD_END,
28
- key: "app_start.react_native.application.download_end",
28
+ key: "app_start.react_native.download.end_time",
29
29
  },
30
30
  {
31
31
  type: AppStartType.RUN_JS_BUNDLE_END,
32
- key: "app_start.react_native.application.run_js_bundle_end",
32
+ key: "app_start.react_native.run_js_bundle.end_time",
33
33
  },
34
34
  {
35
35
  type: AppStartType.CONTENT_APPEARED,
36
- key: "app_start.react_native.application.content_appeared",
36
+ key: "app_start.react_native.content_appeared",
37
37
  },
38
38
  ];
@@ -4,7 +4,7 @@ exports.EventPipeline = void 0;
4
4
  const DynatraceBridge_1 = require("../../core/DynatraceBridge");
5
5
  const ConsoleLogger_1 = require("../../core/logging/ConsoleLogger");
6
6
  const BaseDataEventModifier_1 = require("./modifier/BaseDataEventModifier");
7
- const NonFiniteNumbersModifier_1 = require("./modifier/NonFiniteNumbersModifier");
7
+ const ValueRestrictionModifier_1 = require("./modifier/ValueRestrictionModifier");
8
8
  const ModifyEventValidation_1 = require("./modifier/ModifyEventValidation");
9
9
  const ViewInfoCreator_1 = require("./ViewInfoCreator");
10
10
  class EventPipelineImpl {
@@ -12,22 +12,23 @@ class EventPipelineImpl {
12
12
  this.customEventModifierChain = new ModifyEventValidation_1.ModifyEventValidation();
13
13
  this.logger = new ConsoleLogger_1.ConsoleLogger('EventPipeline');
14
14
  }
15
- getEventModifierChain(additionalData) {
15
+ getEventModifierChain() {
16
16
  return [
17
17
  new BaseDataEventModifier_1.BaseDataEventModifier(this.viewInfo),
18
18
  this.customEventModifierChain,
19
- NonFiniteNumbersModifier_1.NonFiniteNumbersModifier,
19
+ ValueRestrictionModifier_1.ValueRestrictionModifier,
20
20
  ];
21
21
  }
22
- insertEvent(event, additionalData) {
23
- this.logger.debug(`insertEvent(${JSON.stringify(event)}, ${JSON.stringify(additionalData)})`);
24
- this.getEventModifierChain(additionalData).forEach((modifier) => {
22
+ insertEvent(event, context) {
23
+ this.logger.debug(`insertEvent(${JSON.stringify(event)})`);
24
+ this.getEventModifierChain().forEach((modifier) => {
25
25
  try {
26
- event = modifier.modifyEvent(event);
26
+ event = modifier.modifyEvent(event, context);
27
27
  }
28
28
  catch (error) {
29
29
  if (event != null) {
30
- event["dt.rum.api.has_enrich_exception"] = true;
30
+ event["dt.rum.api.has_enrich_exception"] =
31
+ true;
31
32
  }
32
33
  }
33
34
  });
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventTimestamp = void 0;
4
+ const ConsoleLogger_1 = require("../../core/logging/ConsoleLogger");
4
5
  class EventTimestamp {
5
6
  constructor(timestampProvider) {
6
7
  this.duration = 0;
7
8
  this.timestampProvider = timestampProvider;
8
9
  this.startTimestamp = timestampProvider.getCurrentTimestamp();
10
+ this.logger = new ConsoleLogger_1.ConsoleLogger('EventTimestamp');
9
11
  }
10
12
  getEventTimeInfo() {
11
13
  return {
@@ -18,6 +20,7 @@ class EventTimestamp {
18
20
  this.duration = endTimestamp - this.startTimestamp;
19
21
  }
20
22
  else {
23
+ this.logger.debug(`End timestamp (${endTimestamp}) can't be before start timestamp (${this.startTimestamp})!`);
21
24
  }
22
25
  }
23
26
  }
@@ -5,8 +5,9 @@ const MAX_STRING_LENGTH_FOR_VALUES = 5000;
5
5
  const flattenAdditionalData = (obj, parent, res = {}) => {
6
6
  for (const key in obj) {
7
7
  const propName = parent != null ? parent + '.' + key : key;
8
- if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
9
- (0, exports.flattenAdditionalData)(obj[key], propName, res);
8
+ const valueOfObject = obj[key];
9
+ if ((0, exports.isObject)(valueOfObject)) {
10
+ (0, exports.flattenAdditionalData)(valueOfObject, propName, res);
10
11
  }
11
12
  else {
12
13
  res[propName] = obj[key];
@@ -95,10 +95,12 @@ class ModifyEventValidation {
95
95
  }
96
96
  const finalEntries = baseEntries.concat(limitedEntries);
97
97
  const sizedEntries = new EventLimitation_1.EventLimitation().limitEventProperties(finalEntries);
98
- sizedEntries.push([
99
- "dt.rum.api.has_dropped_fields",
100
- sizedEntries.length < userEnrichedEventEntries.length,
101
- ]);
98
+ if (sizedEntries.length < userEnrichedEventEntries.length) {
99
+ sizedEntries.push([
100
+ "dt.rum.api.has_dropped_fields",
101
+ true,
102
+ ]);
103
+ }
102
104
  if (Array.isArray(overriddenKeys) && overriddenKeys.length > 0) {
103
105
  sizedEntries.push([
104
106
  "dt.rum.overridden_keys",
@@ -29,10 +29,12 @@ class SendEventValidationImpl {
29
29
  const limitedEntries = new EventLimitation_1.EventLimitation().limitEventEntries(filteredEvent);
30
30
  const sizedEntries = new EventLimitation_1.EventLimitation().limitEventProperties(limitedEntries);
31
31
  this.applyOverriddenKeys(sizedEntries);
32
- sizedEntries.push([
33
- "dt.rum.api.has_dropped_fields",
34
- sizedEntries.length < eventCopy.length,
35
- ]);
32
+ if (sizedEntries.length < eventCopy.length) {
33
+ sizedEntries.push([
34
+ "dt.rum.api.has_dropped_fields",
35
+ true,
36
+ ]);
37
+ }
36
38
  const jsonObject = Object.fromEntries(sizedEntries);
37
39
  if (jsonObject["duration"] !== undefined) {
38
40
  jsonObject["start_time"] =
@@ -1,43 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NonFiniteNumbersModifier = void 0;
3
+ exports.ValueRestrictionModifier = void 0;
4
4
  const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
5
5
  const EventModifierUtil_1 = require("./EventModifierUtil");
6
- class NonFiniteNumbersModifierImpl {
6
+ class ValueRestrictionModifierImpl {
7
7
  constructor() {
8
8
  this.logger = new ConsoleLogger_1.ConsoleLogger('NonFiniteNumbersModifier');
9
9
  }
10
10
  modifyEvent(event) {
11
- if (event != null && this.eventHasNonFiniteNumbers(event)) {
11
+ if (event != null && this.eventHasRestrictedValues(event)) {
12
12
  event["dt.rum.has_nfn_values"] = true;
13
13
  }
14
- return event;
14
+ return JSON.parse(JSON.stringify(event, (_key, value) => {
15
+ if (value === undefined) {
16
+ return null;
17
+ }
18
+ return value;
19
+ }));
15
20
  }
16
- eventHasNonFiniteNumbers(obj) {
21
+ eventHasRestrictedValues(obj) {
17
22
  for (const key in obj) {
18
23
  if (Object.prototype.hasOwnProperty.call(obj, key) &&
19
- this.valueHasNonFiniteNumber(obj[key])) {
20
- this.logger.debug(`eventHasNonFiniteNumbers() - ${key} contains non-finite numbers: ${obj[key]} changed to null!`);
24
+ (this.valueHasRestrictedValues(obj[key]) ||
25
+ obj[key] === undefined)) {
26
+ this.logger.debug(`eventHasNonFiniteNumbers() - ${key} contains non-finite numbers or undefined: ${obj[key]} changed to null!`);
21
27
  return true;
22
28
  }
23
29
  }
24
30
  return false;
25
31
  }
26
- valueHasNonFiniteNumber(val) {
32
+ valueHasRestrictedValues(val) {
27
33
  if (typeof val === 'function') {
28
34
  return true;
29
35
  }
30
36
  if (Array.isArray(val)) {
31
- return this.arrayHasNonFiniteNumbers(val);
37
+ return this.arrayHasRestrictedValues(val);
32
38
  }
33
39
  if ((0, EventModifierUtil_1.isObject)(val)) {
34
- return this.eventHasNonFiniteNumbers(val);
40
+ return this.eventHasRestrictedValues(val);
35
41
  }
36
42
  return !this.isFinitePrimitive(val);
37
43
  }
38
- arrayHasNonFiniteNumbers(arr) {
44
+ arrayHasRestrictedValues(arr) {
39
45
  for (const val of arr) {
40
- if (this.valueHasNonFiniteNumber(val)) {
46
+ if (this.valueHasRestrictedValues(val) || val === undefined) {
41
47
  return true;
42
48
  }
43
49
  }
@@ -47,4 +53,4 @@ class NonFiniteNumbersModifierImpl {
47
53
  return typeof value !== 'number' || isFinite(value);
48
54
  }
49
55
  }
50
- exports.NonFiniteNumbersModifier = new NonFiniteNumbersModifierImpl();
56
+ exports.ValueRestrictionModifier = new ValueRestrictionModifierImpl();
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MODIFY_EVENT_WHITELIST_NAMESPACE = exports.MODIFY_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = exports.SEND_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES = exports.SEND_EVENT_WHITELIST_NAMESPACES = exports.AllCharacteristicsKeys = exports.KEY_NAME_REGEX = exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = exports.MAX_CUSTOM_EVENT_KEY_LENGTH = exports.MAX_CUSTOM_EVENT_FIELDS = void 0;
4
+ const SPECIFICATION_VERSION = '0.18';
4
5
  exports.MAX_CUSTOM_EVENT_FIELDS = 50;
5
6
  exports.MAX_CUSTOM_EVENT_KEY_LENGTH = 100;
6
7
  exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = 5000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/react-native-plugin",
3
- "version": "2.309.1",
3
+ "version": "2.311.2",
4
4
  "description": "This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.",
5
5
  "main": "index.js",
6
6
  "types": "typings/react-native-dynatrace.d.ts",
@@ -24,6 +24,8 @@
24
24
  "uninstall": "node ./scripts/Uninstall.js",
25
25
  "test": "jest --runInBand",
26
26
  "test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand",
27
+ "test:local": "npm run lint && node runner.js test",
28
+ "tsc:local": "tsc -p tsconfig.local.json",
27
29
  "tsc": "tsc",
28
30
  "tsc:prod": "tsc -p tsconfig.release.json",
29
31
  "lint": "eslint --cache src/**/*.ts --ignore-pattern .gitignore",
@@ -33,6 +35,7 @@
33
35
  "prepare": "husky"
34
36
  },
35
37
  "jest": {
38
+ "displayName": "@dynatrace/react-native-plugin",
36
39
  "preset": "react-native",
37
40
  "moduleDirectories": [
38
41
  "node_modules"
@@ -65,7 +68,7 @@
65
68
  },
66
69
  "jest-junit": {
67
70
  "suiteName": "jest tests",
68
- "outputDirectory": ".",
71
+ "outputDirectory": "test_report",
69
72
  "outputName": "junit.xml",
70
73
  "uniqueOutputName": "true",
71
74
  "ancestorSeparator": " › ",
@@ -74,8 +77,8 @@
74
77
  "author": "Dynatrace",
75
78
  "license": "SEE LICENSE IN LICENSE.md",
76
79
  "dependencies": {
77
- "@babel/runtime": "^7.26.10",
78
- "jscodeshift": "^17.2.0",
80
+ "@babel/runtime": "^7.27.0",
81
+ "jscodeshift": "^17.3.0",
79
82
  "plist": "^3.1.0",
80
83
  "proxy-polyfill": "^0.3.2",
81
84
  "semver": "^7.7.1"
@@ -111,7 +111,7 @@ Pod::Spec.new do |s|
111
111
  #
112
112
 
113
113
  s.dependency "React"
114
- s.dependency 'Dynatrace', '~> 8.309.1.1009'
114
+ s.dependency 'Dynatrace', '~> 8.311.1.1013'
115
115
 
116
116
  # Allows for better compatibility for older and newer versions
117
117
  if defined?(install_modules_dependencies)
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.writeGradleConfig = exports.instrumentAndroidPlatform = exports.GRADLE_APPLY_BUILDSCRIPT = exports.GRADLE_DYNATRACE_FILE = void 0;
4
+ exports.copyGradleConfigFile = exports.writeGradleConfig = exports.instrumentAndroidPlatform = exports.GRADLE_APPLY_BUILDSCRIPT = exports.GRADLE_DYNATRACE_FILE = void 0;
5
+ const path_1 = require("path");
5
6
  const Logger_1 = require("./Logger");
6
7
  const FileOperationHelper_1 = require("./FileOperationHelper");
7
8
  const PathsConstants_1 = require("./PathsConstants");
8
9
  const GRADLE_CONFIG_IDENTIFIER = '// AUTO - INSERTED';
9
- exports.GRADLE_DYNATRACE_FILE = 'apply from: "../node_modules/@dynatrace/react-native-plugin/files/dynatrace.gradle"';
10
+ exports.GRADLE_DYNATRACE_FILE = `apply from: "./${PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE}"`;
10
11
  const GRADLE_BUILDSCRIPT_IDENTIFIER = 'buildscript';
11
12
  exports.GRADLE_APPLY_BUILDSCRIPT = 'apply from: "../node_modules/@dynatrace/react-native-plugin/files/plugin.gradle", to: buildscript';
12
13
  const GRADLE_REACT_NATIVE_PLUGIN = 'apply plugin: "com.facebook.react.rootproject"';
@@ -39,7 +40,7 @@ const changeReactNativeBuildGradleFile = (pathToGradle, remove) => {
39
40
  if (gradleFileContentLines[i].indexOf('plugin.gradle') > -1) {
40
41
  gradlePluginFileIndex = i;
41
42
  }
42
- else if (gradleFileContentLines[i].indexOf('dynatrace.gradle') > -1) {
43
+ else if (gradleFileContentLines[i].indexOf(PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE) > -1) {
43
44
  gradleDynatraceFileIndex = i;
44
45
  }
45
46
  }
@@ -112,9 +113,14 @@ const writeGradleConfig = (androidConfig) => {
112
113
  gradleFileContentLines.splice(gradleFileIndex + 1, 0, androidConfig.config);
113
114
  const fullGradleFile = gradleFileContentLines.join('\n');
114
115
  FileOperationHelper_1.default.writeTextToFileSync(PathsConstants_1.default.getDynatraceGradleFile(), fullGradleFile);
115
- Logger_1.default.logMessageSync('Replaced old configuration with current configuration in dynatrace.gradle', Logger_1.default.INFO);
116
+ Logger_1.default.logMessageSync(`Replaced old configuration with current configuration in ${PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE}`, Logger_1.default.INFO);
116
117
  };
117
118
  exports.writeGradleConfig = writeGradleConfig;
119
+ const copyGradleConfigFile = (pathToGradle) => {
120
+ const gradleDirectory = (0, path_1.dirname)(pathToGradle);
121
+ FileOperationHelper_1.default.copyFileSync(PathsConstants_1.default.getDynatraceGradleFile(), (0, path_1.join)(gradleDirectory, PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE));
122
+ };
123
+ exports.copyGradleConfigFile = copyGradleConfigFile;
118
124
  const removeOldGradleConfig = (gradleFileContent) => {
119
125
  const gradleFileContentLines = gradleFileContent.split('\n');
120
126
  const gradleConfigIndex = [];
package/scripts/Config.js CHANGED
@@ -21,7 +21,7 @@ exports.defaultConfig = {
21
21
  debug: false,
22
22
  errorHandler: {
23
23
  enabled: true,
24
- reportFatalErrorAsCrash: true
24
+ reportFatalErrorAsCrash: true,
25
25
  },
26
26
  lifecycle: {
27
27
  includeUpdate: false,
package/scripts/Ios.js CHANGED
@@ -130,7 +130,9 @@ const updatedExcludedStr = (config) => {
130
130
  const controlsArr = Object.keys(PlistConstants_1.CONTROLS_PROP_OPTIONS);
131
131
  let updatedStr = `${PlistConstants_1.START_CONTROLS_PROP}${PlistConstants_1.CONTROLS_PROP_OPTIONS.PickerView}${PlistConstants_1.CONTROLS_PROP_OPTIONS.Switch}`;
132
132
  for (let index = 0; index < controlsArr.length; index++) {
133
- if (controlsArr[index] !== 'PickerView' && controlsArr[index] !== 'Switch' && config.indexOf(PlistConstants_1.CONTROLS_PROP_OPTIONS[controlsArr[index]].trim()) >= 0) {
133
+ if (controlsArr[index] !== 'PickerView'
134
+ && controlsArr[index] !== 'Switch'
135
+ && config.indexOf(PlistConstants_1.CONTROLS_PROP_OPTIONS[controlsArr[index]].trim()) >= 0) {
134
136
  updatedStr = updatedStr + PlistConstants_1.CONTROLS_PROP_OPTIONS[controlsArr[index]];
135
137
  }
136
138
  }
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DYNATRACE_CONFIG_GRADLE_FILE = void 0;
4
5
  const path_1 = require("path");
5
6
  const PATH_FILES = 'files';
6
7
  const PATH_LOGS = 'logs';
8
+ exports.DYNATRACE_CONFIG_GRADLE_FILE = 'dynatrace.gradle';
7
9
  let rootPath = __dirname;
8
10
  exports.default = {
9
11
  setRoot: (newRoot) => {
@@ -25,7 +27,7 @@ exports.default = {
25
27
  getAndroidFolder: () => (0, path_1.join)(getApplicationPath(), 'android'),
26
28
  getAndroidGradleFile: (androidFolder) => (0, path_1.join)(androidFolder, 'build.gradle'),
27
29
  getIOSFolder: () => (0, path_1.join)(getApplicationPath(), 'ios'),
28
- getDynatraceGradleFile: () => (0, path_1.join)(getPluginPath(), PATH_FILES, 'dynatrace.gradle'),
30
+ getDynatraceGradleFile: () => (0, path_1.join)(getPluginPath(), PATH_FILES, exports.DYNATRACE_CONFIG_GRADLE_FILE),
29
31
  getCurrentLogPath: () => (0, path_1.join)(getPluginPath(), PATH_LOGS, 'currentLog.txt'),
30
32
  getLogPath: () => (0, path_1.join)(getPluginPath(), PATH_LOGS),
31
33
  };
@@ -54,6 +54,7 @@ const instrumentCommand = () => {
54
54
  Logger_1.default.logMessageSync('Starting Android Instrumentation with Dynatrace!', Logger_1.default.INFO);
55
55
  android.instrumentAndroidPlatform(pathToGradle, false);
56
56
  android.writeGradleConfig(configAgent.android);
57
+ android.copyGradleConfigFile(pathToGradle);
57
58
  }
58
59
  catch (e) {
59
60
  if (e instanceof Error) {
@@ -580,7 +580,81 @@ export declare const Dynatrace: {
580
580
  * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#business-event-capturing
581
581
  */
582
582
  sendBizEvent(type: string, attributes?: JSONObject, platform?: Platform): void;
583
+
584
+ /**
585
+ * Adds an event modifier, which will be executed in the end before
586
+ * the event is transfered. This allows to modify the event to some extent.
587
+ *
588
+ * @param eventModifier Function which is modify an event
589
+ */
590
+ addEventModifier(eventModifier: IEventModifier): IEventModifier;
591
+
592
+ /**
593
+ * Is removing an event modifier again, so it will not modify events anymore.
594
+ *
595
+ * @param eventModifier Function which should be removed
596
+ */
597
+ removeEventModifier(eventModifier: IEventModifier): boolean;
598
+
599
+ /**
600
+ * Send a Event
601
+ *
602
+ * With sendEvent, you can report a event.
603
+ *
604
+ * Note: The 'dt' key, as well as all 'dt.' prefixed keys are considered reserved by Dynatrace
605
+ * and will be stripped from the passed in attributes. TODO: Add Others here.
606
+ *
607
+ * @param {string} type Mandatory event type
608
+ * @param {JSONObject} properties Must be a valid JSON object and cannot contain functions,
609
+ * undefined, Infinity and NaN as values, otherwise they will be removed.
610
+ * Attributes need to be serializable using JSON.stringify.
611
+ * The resulting event will be populated with attributes parameter,
612
+ * and enriched with additional properties, thus also empty objects are valid.
613
+ * @param {any} context optional context that can be used to manipulate the resulting event
614
+ * using an event modifier
615
+ */
616
+ sendEvent(properties: JSONObject, context?: any): void;
617
+
618
+ /**
619
+ * Sets the current view context which will be used for every event happening in the meantime.
620
+ *
621
+ * @param name Name of the current view
622
+ */
623
+ startView(name: string): void;
624
+
625
+ /**
626
+ * Removes the current view context
627
+ */
628
+ stopView(): void;
629
+
630
+ /**
631
+ * Send a Session Properties Event.
632
+ *
633
+ * With sendSessionPropertyEvent you can report properties that apply to all events in the current session. Any
634
+ * custom properties must be added in the 'session_properties.*' namespace, otherwise they will be dropped. Only one
635
+ * session properties event may be active for every session.
636
+ *
637
+ * @param properties any attributes that should be reported for every event in the session.
638
+ */
639
+ sendSessionPropertyEvent(properties: JSONObject): void;
583
640
  }
641
+
642
+ /**
643
+ * Interface which declares event modification through modifyEvent
644
+ */
645
+ export declare interface IEventModifier {
646
+ /**
647
+ * Event as JSONObject is received and can be modified. If instead of the event
648
+ * null is returned, the event will be canceled.
649
+ *
650
+ * @param event Event as JSONObject
651
+ * @param context optional context that can be used to manipulate the resulting event
652
+ * using an event modifier or undefined if not available
653
+ * @returns Either the modified event or null if you want to cancel the event
654
+ */
655
+ modifyEvent(event: JSONObject | null, context?: any): JSONObject | null;
656
+ }
657
+
584
658
  export declare interface IDynatraceAction {
585
659
  /**
586
660
  * Reports an error as key-value pair with the time at which it occurred.