@dynatrace/react-native-plugin 2.339.1 → 2.341.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 (34) hide show
  1. package/README.md +116 -18
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.kt +0 -1
  4. package/files/plugin.gradle +1 -1
  5. package/instrumentation/BabelPluginDynatrace.js +1 -1
  6. package/instrumentation/DynatraceInstrumentation.js +1 -1
  7. package/instrumentation/jsx/CreateElement.js +5 -9
  8. package/instrumentation/jsx/ElementHelper.js +5 -6
  9. package/instrumentation/jsx/JsxDevRuntime.js +33 -31
  10. package/instrumentation/jsx/JsxRuntime.js +30 -30
  11. package/instrumentation/jsx/JsxRuntimeHelpers.js +14 -0
  12. package/instrumentation/jsx/components/ClassComponent.js +4 -8
  13. package/instrumentation/jsx/components/ComponentUtil.js +24 -25
  14. package/instrumentation/libs/UserInteraction.js +27 -24
  15. package/instrumentation/libs/react-native/RefreshControl.js +5 -9
  16. package/instrumentation/libs/withOnPressMonitoring.js +66 -57
  17. package/lib/core/DynatraceAction.js +1 -3
  18. package/lib/core/DynatraceInternal.js +38 -40
  19. package/lib/core/ErrorHandler.js +41 -21
  20. package/lib/core/NullAction.js +1 -3
  21. package/lib/core/util/JsonUtils.js +6 -0
  22. package/lib/features/ui-interaction/TouchMetaResolver.js +4 -3
  23. package/lib/next/events/HttpRequestEventData.js +2 -2
  24. package/lib/next/events/interface/HttpRequestEventDataTypes.js +2 -0
  25. package/lib/next/events/modifier/ModifyEventValidation.js +79 -51
  26. package/package.json +6 -5
  27. package/react-native-dynatrace.podspec +1 -1
  28. package/scripts/Config.js +6 -2
  29. package/scripts/DebugFlag.js +20 -0
  30. package/scripts/FileOperationHelper.js +15 -39
  31. package/scripts/Logger.js +2 -3
  32. package/scripts/core/InstrumentCall.js +101 -80
  33. package/scripts/util/CustomArgumentUtil.js +8 -6
  34. package/types.d.ts +159 -8
@@ -18,14 +18,10 @@ class DynatraceClassComponent extends react_1.Component {
18
18
  if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
19
19
  this.logger.info(LogMessages_1.LogMessage.COMPONENT_NOT_STARTED);
20
20
  }
21
- else {
22
- if (ConfigurationHandler_1.ConfigurationHandler.isLifecycleUpdateEnabled() ||
23
- !this.componentMounted) {
24
- const actionPrefix = !this.componentMounted
25
- ? 'Render '
26
- : 'Update ';
27
- this.internalAction = Dynatrace_1.Dynatrace.enterAutoAction(actionPrefix + this.wrappingName);
28
- }
21
+ else if (ConfigurationHandler_1.ConfigurationHandler.isLifecycleUpdateEnabled() ||
22
+ !this.componentMounted) {
23
+ const actionPrefix = this.componentMounted ? 'Update ' : 'Render ';
24
+ this.internalAction = Dynatrace_1.Dynatrace.enterAutoAction(actionPrefix + this.wrappingName);
29
25
  }
30
26
  return this.props.children;
31
27
  }
@@ -1,34 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isDynatraceIgnored = exports.isDynatraceNaming = exports.getNameFromComponent = void 0;
4
- const getNameFromComponent = (props) => {
5
- if (props !== undefined && props.children !== undefined) {
6
- let child;
7
- if (Array.isArray(props.children) && props.children.length === 1) {
8
- child = props.children[0];
9
- }
10
- else {
11
- child = props.children;
12
- }
13
- if (child.props !== undefined &&
14
- child.props.dtActionName !== undefined) {
15
- return child.props.dtActionName;
16
- }
17
- else if (child.type !== undefined) {
18
- if (child.type.displayName !== undefined) {
19
- return child.type.displayName;
20
- }
21
- else if (child.type._dtInfo !== undefined) {
22
- return child.type._dtInfo.name;
23
- }
24
- else {
25
- return child.type.name;
26
- }
27
- }
4
+ const getChildFromProperties = (props) => {
5
+ if (Array.isArray(props.children) && props.children.length === 1) {
6
+ return props.children[0];
7
+ }
8
+ return props.children;
9
+ };
10
+ const getNameFromChild = (child) => {
11
+ if (child.props !== undefined && child.props.dtActionName !== undefined) {
12
+ return child.props.dtActionName;
13
+ }
14
+ if (child.type === undefined) {
15
+ return 'Undefined Name';
28
16
  }
29
- else {
17
+ if (child.type.displayName !== undefined) {
18
+ return child.type.displayName;
19
+ }
20
+ if (child.type._dtInfo !== undefined) {
21
+ return child.type._dtInfo.name;
22
+ }
23
+ return child.type.name;
24
+ };
25
+ const getNameFromComponent = (props) => {
26
+ if (props === undefined || props.children === undefined) {
30
27
  return 'Undefined Name';
31
28
  }
29
+ const child = getChildFromProperties(props);
30
+ return getNameFromChild(child);
32
31
  };
33
32
  exports.getNameFromComponent = getNameFromComponent;
34
33
  const isDynatraceNaming = (properties) => typeof properties === 'object' &&
@@ -5,23 +5,25 @@ const React = require("react");
5
5
  const react_native_1 = require("react-native");
6
6
  const ConfigurationHandler_1 = require("../../lib/core/configuration/ConfigurationHandler");
7
7
  const EventPipeline_1 = require("../../lib/next/events/EventPipeline");
8
+ const EventTimestamp_1 = require("../../lib/next/events/EventTimestamp");
9
+ const TimestampProvider_1 = require("../../lib/next/provider/TimestampProvider");
8
10
  const TOUCH_FLUSH_DELAY = 250;
9
11
  let pendingTouch = null;
10
12
  const getFiberPath = (fiber) => {
11
- var _a, _b, _c;
13
+ var _a, _b, _c, _d, _e, _f, _g;
12
14
  let anyParentMasked = false;
13
15
  let path = [];
14
16
  let lastDtName;
15
17
  while (fiber != null) {
16
- const dtInfoName = (_a = fiber.type) === null || _a === void 0 ? void 0 : _a.dtName;
17
- const dtName = (_b = fiber.memoizedProps) === null || _b === void 0 ? void 0 : _b.dtName;
18
- const effectiveName = dtName !== null && dtName !== void 0 ? dtName : dtInfoName;
19
- if (effectiveName && effectiveName !== lastDtName) {
20
- path = [effectiveName, ...path];
21
- lastDtName = effectiveName;
18
+ const dtNameFromComponent = (_b = (_a = fiber.type) === null || _a === void 0 ? void 0 : _a.dtActionName) !== null && _b !== void 0 ? _b : (_c = fiber.type) === null || _c === void 0 ? void 0 : _c.dtName;
19
+ const dtNameFromProps = (_e = (_d = fiber.memoizedProps) === null || _d === void 0 ? void 0 : _d.dtActionName) !== null && _e !== void 0 ? _e : (_f = fiber.memoizedProps) === null || _f === void 0 ? void 0 : _f.dtName;
20
+ const dtName = dtNameFromProps !== null && dtNameFromProps !== void 0 ? dtNameFromProps : dtNameFromComponent;
21
+ if (dtName && dtName !== lastDtName) {
22
+ path = [dtName, ...path];
23
+ lastDtName = dtName;
22
24
  }
23
25
  anyParentMasked =
24
- anyParentMasked || ((_c = fiber.memoizedProps) === null || _c === void 0 ? void 0 : _c.dtMask) == true;
26
+ anyParentMasked || ((_g = fiber.memoizedProps) === null || _g === void 0 ? void 0 : _g.dtMask) == true;
25
27
  fiber = fiber.return;
26
28
  }
27
29
  return { path, anyParentMasked };
@@ -58,20 +60,20 @@ const getHostComponentInfo = (event) => {
58
60
  const id = path.join('/');
59
61
  const leaf = path[path.length - 1];
60
62
  const components = [leaf];
61
- const { nameOrigin, detectedName } = fiber.type !== 'RCTText'
62
- ? {
63
- nameOrigin: 'component',
64
- detectedName: (_b = fiber.memoizedProps.accessibilityLabel) !== null && _b !== void 0 ? _b : leaf,
65
- }
66
- : anyParentMasked
67
- ? {
68
- nameOrigin: 'masked',
69
- detectedName: '***',
70
- }
71
- : {
72
- nameOrigin: 'text',
73
- detectedName: flatten(fiber.memoizedProps.children),
74
- };
63
+ let nameOrigin;
64
+ let detectedName;
65
+ if (fiber.type !== 'RCTText') {
66
+ nameOrigin = 'component';
67
+ detectedName = (_b = fiber.memoizedProps.accessibilityLabel) !== null && _b !== void 0 ? _b : leaf;
68
+ }
69
+ else if (anyParentMasked) {
70
+ nameOrigin = 'masked';
71
+ detectedName = '***';
72
+ }
73
+ else {
74
+ nameOrigin = 'text';
75
+ detectedName = flatten(fiber.memoizedProps.children);
76
+ }
75
77
  return { id, components, detectedName, nameOrigin };
76
78
  };
77
79
  const flushTouch = (responderComponentInfo) => {
@@ -80,12 +82,13 @@ const flushTouch = (responderComponentInfo) => {
80
82
  const { touchedComponentInfo, positions, timeoutId } = pendingTouch;
81
83
  clearTimeout(timeoutId);
82
84
  pendingTouch = null;
83
- const event = Object.assign({ 'characteristics.has_user_interaction': true, 'ui_element.detected_name': touchedComponentInfo.detectedName, 'ui_element.components': touchedComponentInfo.components, 'ui_element.id': touchedComponentInfo.id, 'interaction.name': 'touch', positions, 'ui_element.name_origin': touchedComponentInfo.nameOrigin }, (responderComponentInfo && {
85
+ const eventTimestamp = new EventTimestamp_1.EventTimestamp(TimestampProvider_1.defaultTimestampProvider);
86
+ const event = Object.assign(Object.assign({ 'characteristics.has_user_interaction': true, 'ui_element.detected_name': touchedComponentInfo.detectedName, 'ui_element.components': touchedComponentInfo.components, 'ui_element.id': touchedComponentInfo.id, 'interaction.name': 'touch', positions, 'ui_element.name_origin': touchedComponentInfo.nameOrigin }, (responderComponentInfo && {
84
87
  'ui_element.responder.detected_name': responderComponentInfo.detectedName,
85
88
  'ui_element.responder.components': responderComponentInfo.components,
86
89
  'ui_element.responder.id': responderComponentInfo.id,
87
90
  'ui_element.responder.name_origin': responderComponentInfo.nameOrigin,
88
- }));
91
+ })), eventTimestamp.getEventTimeInfo());
89
92
  EventPipeline_1.EventPipeline.insertEvent(event);
90
93
  };
91
94
  const onTouch = (e) => {
@@ -4,12 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.RefreshControl = void 0;
5
5
  const react_native_1 = require("react-native");
6
6
  const Types_1 = require("../../model/Types");
7
- if (typeof react_native_1.RefreshControl === 'object') {
8
- exports.RefreshControl = Object.assign({ _dtInfo: { type: Types_1.Types.RefreshControl } }, react_native_1.RefreshControl);
9
- }
10
- else {
11
- exports.RefreshControl = (_a = class RefreshControl extends react_native_1.RefreshControl {
12
- },
13
- _a._dtInfo = { type: Types_1.Types.RefreshControl },
14
- _a);
15
- }
7
+ exports.RefreshControl = typeof react_native_1.RefreshControl === 'object'
8
+ ? Object.assign({ _dtInfo: { type: Types_1.Types.RefreshControl } }, react_native_1.RefreshControl) : (_a = class RefreshControl extends react_native_1.RefreshControl {
9
+ },
10
+ _a._dtInfo = { type: Types_1.Types.RefreshControl },
11
+ _a);
@@ -32,11 +32,13 @@ function withOnPressMonitoring(Component, fallbackName) {
32
32
  }
33
33
  exports.withOnPressMonitoring = withOnPressMonitoring;
34
34
  const dtGetUiBridge = () => {
35
+ var _a;
35
36
  const g = globalThis;
36
- return g && g.__DT_UII_BRIDGE ? g.__DT_UII_BRIDGE : null;
37
+ return (_a = g === null || g === void 0 ? void 0 : g.__DT_UII_BRIDGE) !== null && _a !== void 0 ? _a : null;
37
38
  };
38
39
  const dtBuildPressPath = (startPath, touchableName) => {
39
- const base = (startPath && String(startPath)) || '';
40
+ var _a;
41
+ const base = (_a = startPath === null || startPath === void 0 ? void 0 : startPath.toString()) !== null && _a !== void 0 ? _a : '';
40
42
  if (!base)
41
43
  return `Touchable(${touchableName})`;
42
44
  const cut1 = base.lastIndexOf('/Text');
@@ -45,65 +47,72 @@ const dtBuildPressPath = (startPath, touchableName) => {
45
47
  const parent = cut > 0 ? base.slice(0, cut) : base;
46
48
  return parent + `/Touchable(${touchableName})`;
47
49
  };
48
- const wrapOnPress = (onPress, touchableName, isButtonLike, buttonLabel) => {
49
- return (...args) => {
50
- const bridge = dtGetUiBridge();
51
- if (bridge && typeof bridge.registerPress === 'function') {
52
- try {
53
- const e = args && args[0];
54
- const ne = e && e.nativeEvent;
55
- const x = Number(ne && ne.pageX);
56
- const y = Number(ne && ne.pageY);
57
- const pos = Number.isFinite(x) && Number.isFinite(y)
58
- ? { x, y }
59
- : undefined;
60
- const startPath = bridge.getStartPath &&
61
- typeof bridge.getStartPath === 'function'
62
- ? bridge.getStartPath()
63
- : null;
64
- const nameForBridge = isButtonLike
65
- ? buttonLabel || touchableName
66
- : touchableName;
67
- bridge.registerPress({
68
- path: dtBuildPressPath(startPath, nameForBridge),
69
- elementName: nameForBridge,
70
- pos,
71
- });
72
- }
73
- catch (e) {
74
- const errorMsg = e instanceof Error ? e.stack || e.message : String(e);
75
- Logger.debug(LogMessages_1.LogMessage.REGISTER_PRESS_HOOK_FAILED, {
76
- errorMsg,
77
- });
78
- }
50
+ const registerPressOnBridge = (args, touchableName, isButtonLike, buttonLabel) => {
51
+ const bridge = dtGetUiBridge();
52
+ if (!bridge || typeof bridge.registerPress !== 'function') {
53
+ return;
54
+ }
55
+ try {
56
+ const e = args === null || args === void 0 ? void 0 : args[0];
57
+ const ne = e === null || e === void 0 ? void 0 : e.nativeEvent;
58
+ const x = Number(ne === null || ne === void 0 ? void 0 : ne.pageX);
59
+ const y = Number(ne === null || ne === void 0 ? void 0 : ne.pageY);
60
+ const pos = Number.isFinite(x) && Number.isFinite(y) ? { x, y } : undefined;
61
+ const startPath = typeof bridge.getStartPath === 'function'
62
+ ? bridge.getStartPath()
63
+ : null;
64
+ const nameForBridge = isButtonLike
65
+ ? buttonLabel || touchableName
66
+ : touchableName;
67
+ bridge.registerPress({
68
+ path: dtBuildPressPath(startPath, nameForBridge),
69
+ elementName: nameForBridge,
70
+ pos,
71
+ });
72
+ }
73
+ catch (e) {
74
+ const errorMsg = e instanceof Error ? e.stack || e.message : String(e);
75
+ Logger.debug(LogMessages_1.LogMessage.REGISTER_PRESS_HOOK_FAILED, {
76
+ errorMsg,
77
+ });
78
+ }
79
+ };
80
+ const notifyPressFromEvent = (args) => {
81
+ if (args[0] && typeof args[0] === 'object' && 'nativeEvent' in args[0]) {
82
+ (0, UserInteraction_1.notifyPress)(args[0]);
83
+ }
84
+ };
85
+ const invokeOnPressWithoutConfiguration = (onPress, args) => {
86
+ Logger.info(LogMessages_1.LogMessage.TOUCH_NOT_STARTED);
87
+ onPress(...args);
88
+ };
89
+ const invokeOnPressWithAction = (onPress, args, touchableName) => {
90
+ const action = Dynatrace_1.Dynatrace.enterAutoAction(`Touch on ${touchableName}`);
91
+ let isSync = true;
92
+ try {
93
+ const returnValue = onPress(...args);
94
+ if (returnValue instanceof Promise) {
95
+ isSync = false;
96
+ void Promise.resolve(returnValue).finally(() => {
97
+ action.leaveAction();
98
+ });
79
99
  }
80
- if (args[0] &&
81
- typeof args[0] === 'object' &&
82
- 'nativeEvent' in args[0]) {
83
- (0, UserInteraction_1.notifyPress)(args[0]);
100
+ }
101
+ finally {
102
+ if (isSync) {
103
+ action.leaveAction();
84
104
  }
105
+ }
106
+ };
107
+ const wrapOnPress = (onPress, touchableName, isButtonLike, buttonLabel) => {
108
+ return (...args) => {
109
+ registerPressOnBridge(args, touchableName, isButtonLike, buttonLabel);
110
+ notifyPressFromEvent(args);
85
111
  if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
86
- Logger.info(LogMessages_1.LogMessage.TOUCH_NOT_STARTED);
87
- onPress(...args);
88
- }
89
- else {
90
- const action = Dynatrace_1.Dynatrace.enterAutoAction(`Touch on ${touchableName}`);
91
- let isSync = true;
92
- try {
93
- const returnValue = onPress(...args);
94
- if (returnValue instanceof Promise) {
95
- isSync = false;
96
- return Promise.resolve(returnValue).finally(() => {
97
- action.leaveAction();
98
- });
99
- }
100
- }
101
- finally {
102
- if (isSync) {
103
- action.leaveAction();
104
- }
105
- }
112
+ invokeOnPressWithoutConfiguration(onPress, args);
113
+ return;
106
114
  }
115
+ invokeOnPressWithAction(onPress, args, touchableName);
107
116
  };
108
117
  };
109
118
  exports.wrapOnPress = wrapOnPress;
@@ -153,9 +153,7 @@ class DynatraceAction {
153
153
  this.logger.debug(LogMessages_1.LogMessage.ACTION_GET_REQUEST_TAG_CLOSED, {
154
154
  url,
155
155
  });
156
- return new Promise((resolve) => {
157
- resolve('');
158
- });
156
+ return Promise.resolve('');
159
157
  }
160
158
  this.logger.debug(LogMessages_1.LogMessage.ACTION_GET_REQUEST_TAG, {
161
159
  url,
@@ -10,52 +10,50 @@ const LogMessages_1 = require("./logging/LogMessages");
10
10
  let counter = 0;
11
11
  const logger = new ConsoleLogger_1.ConsoleLogger('DyntraceInt');
12
12
  exports.DynatraceInternal = {
13
- reportErrorFromHandler: (isFatal, errorName, reason, stacktrace, isReportFatalErrorAsCrash, platform) => {
14
- if (isFatal && isReportFatalErrorAsCrash) {
15
- if (react_native_1.Platform.OS === 'ios') {
16
- logger.debug(LogMessages_1.LogMessage.STORE_CRASH, {
17
- errorName,
18
- reason,
19
- stacktrace,
20
- });
21
- DynatraceBridge_1.DynatraceNative.storeCrash(errorName, reason, stacktrace);
22
- }
23
- else {
24
- logger.debug(LogMessages_1.LogMessage.REPORT_CRASH, {
25
- crashName: errorName,
26
- reason,
27
- stacktrace,
28
- });
29
- DynatraceBridge_1.DynatraceNative.reportCrash(errorName, reason, stacktrace, true, platform === null || platform === void 0 ? void 0 : platform.toString());
30
- }
31
- Dynatrace_1.Dynatrace.reportCrash({
13
+ reportErrorFromHandler: (_isFatal, errorName, reason, stacktrace, isLegacyApiReported = false, platform) => {
14
+ if (StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(stacktrace)) {
15
+ logger.debug(LogMessages_1.LogMessage.INTERNAL_REPORT_ERROR_SIMPLE, {
16
+ errorName,
17
+ });
18
+ DynatraceBridge_1.DynatraceNative.reportErrorWithoutStacktrace(errorName, -1);
19
+ Dynatrace_1.Dynatrace.reportErrorCode(errorName, -1, isLegacyApiReported);
20
+ }
21
+ else {
22
+ logger.debug(LogMessages_1.LogMessage.INTERNAL_REPORT_ERROR, {
23
+ errorName,
24
+ reason,
25
+ stacktrace,
26
+ });
27
+ DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform === null || platform === void 0 ? void 0 : platform.toString());
28
+ Dynatrace_1.Dynatrace.reportError({
32
29
  name: errorName,
33
30
  message: reason,
34
31
  stack: stacktrace,
35
- }, false, isFatal);
32
+ }, isLegacyApiReported);
33
+ }
34
+ },
35
+ reportFatalErrorAsCrashFromHandler: (isFatal, errorName, reason, stacktrace, platform) => {
36
+ if (react_native_1.Platform.OS === 'ios') {
37
+ logger.debug(LogMessages_1.LogMessage.STORE_CRASH, {
38
+ errorName,
39
+ reason,
40
+ stacktrace,
41
+ });
42
+ DynatraceBridge_1.DynatraceNative.storeCrash(errorName, reason, stacktrace);
36
43
  }
37
44
  else {
38
- if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(stacktrace)) {
39
- logger.debug(LogMessages_1.LogMessage.INTERNAL_REPORT_ERROR, {
40
- errorName,
41
- reason,
42
- stacktrace,
43
- });
44
- DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform === null || platform === void 0 ? void 0 : platform.toString());
45
- Dynatrace_1.Dynatrace.reportError({
46
- name: errorName,
47
- message: reason,
48
- stack: stacktrace,
49
- }, false);
50
- }
51
- else {
52
- logger.debug(LogMessages_1.LogMessage.INTERNAL_REPORT_ERROR_SIMPLE, {
53
- errorName,
54
- });
55
- DynatraceBridge_1.DynatraceNative.reportErrorWithoutStacktrace(errorName, -1);
56
- Dynatrace_1.Dynatrace.reportErrorCode(errorName, -1, false);
57
- }
45
+ logger.debug(LogMessages_1.LogMessage.REPORT_CRASH, {
46
+ crashName: errorName,
47
+ reason,
48
+ stacktrace,
49
+ });
50
+ DynatraceBridge_1.DynatraceNative.reportCrash(errorName, reason, stacktrace, true, platform === null || platform === void 0 ? void 0 : platform.toString());
58
51
  }
52
+ Dynatrace_1.Dynatrace.reportCrash({
53
+ name: errorName,
54
+ message: reason,
55
+ stack: stacktrace,
56
+ }, false, isFatal);
59
57
  },
60
58
  getCounter: () => counter++,
61
59
  };
@@ -1,49 +1,69 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reportErrorToDynatrace = exports.startErrorHandler = void 0;
4
+ const react_native_1 = require("react-native");
4
5
  const DynatraceInternal_1 = require("./DynatraceInternal");
5
- const Dynatrace_1 = require("./Dynatrace");
6
6
  const StringUtils_1 = require("./util/StringUtils");
7
7
  const ConsoleLogger_1 = require("./logging/ConsoleLogger");
8
8
  const LogMessages_1 = require("./logging/LogMessages");
9
- const react_native_1 = require("react-native");
10
9
  const logger = new ConsoleLogger_1.ConsoleLogger('ErrorHandler');
11
10
  let manualStart = { enabled: false };
12
11
  const startErrorHandler = (reportFatalErrorAsCrash) => {
13
12
  manualStart = {
14
13
  enabled: true,
15
- reportFatalErrorAsCrash: reportFatalErrorAsCrash,
14
+ reportFatalErrorAsCrash,
16
15
  };
17
16
  };
18
17
  exports.startErrorHandler = startErrorHandler;
19
18
  const reportErrorToDynatrace = (exception, isFatal, reportFatalErrorAsCrashFromConfig, autoStart) => {
20
- if (!autoStart && !manualStart)
19
+ if (!isErrorHandlingEnabled(autoStart)) {
21
20
  return 0;
22
- const reportFatalErrorAsCrash = manualStart.enabled
23
- ? manualStart.reportFatalErrorAsCrash
24
- : reportFatalErrorAsCrashFromConfig;
25
- if (exception != null && isExceptionAnError(exception)) {
26
- if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(exception.name)) {
27
- if (isFatal === undefined) {
28
- isFatal = false;
29
- }
30
- DynatraceInternal_1.DynatraceInternal.reportErrorFromHandler(isFatal, String(exception.name), adjustedReason(exception.message), exception.stack != null ? exception.stack : '', reportFatalErrorAsCrash);
31
- logger.debug(LogMessages_1.LogMessage.REPORT_ERROR_TO_DYNATRACE, {
32
- exception: String(exception),
33
- isFatal: String(isFatal),
34
- });
35
- }
36
21
  }
37
- else {
38
- Dynatrace_1.Dynatrace.reportError(String(exception), -1);
22
+ if (!isExceptionAnErrorWithName(exception)) {
23
+ DynatraceInternal_1.DynatraceInternal.reportErrorFromHandler(false, String(exception), '', '', true);
39
24
  logger.debug(LogMessages_1.LogMessage.REPORT_ERROR_TO_DYNATRACE, {
40
25
  exception: String(exception),
41
26
  isFatal: '-1',
42
27
  });
28
+ return getCrashDelay();
43
29
  }
44
- return react_native_1.Platform.OS === 'ios' ? 200 : 0;
30
+ const resolvedIsFatal = isFatal !== null && isFatal !== void 0 ? isFatal : false;
31
+ const reportFatalErrorAsCrash = resolveReportFatalErrorAsCrash(reportFatalErrorAsCrashFromConfig);
32
+ const { errorName, errorReason, errorStack } = buildErrorDetails(exception);
33
+ reportErrorFromException(resolvedIsFatal, reportFatalErrorAsCrash, errorName, errorReason, errorStack);
34
+ logger.debug(LogMessages_1.LogMessage.REPORT_ERROR_TO_DYNATRACE, {
35
+ exception: String(exception),
36
+ isFatal: String(resolvedIsFatal),
37
+ });
38
+ return getCrashDelay();
45
39
  };
46
40
  exports.reportErrorToDynatrace = reportErrorToDynatrace;
41
+ const isErrorHandlingEnabled = (autoStart) => autoStart || manualStart.enabled;
42
+ const resolveReportFatalErrorAsCrash = (reportFatalErrorAsCrashFromConfig) => manualStart.enabled
43
+ ? manualStart.reportFatalErrorAsCrash
44
+ : reportFatalErrorAsCrashFromConfig;
45
+ const isExceptionAnErrorWithName = (exception) => {
46
+ if (exception == null || !isExceptionAnError(exception)) {
47
+ return false;
48
+ }
49
+ return !StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(exception.name);
50
+ };
51
+ const buildErrorDetails = (exception) => {
52
+ var _a;
53
+ return ({
54
+ errorName: String(exception.name),
55
+ errorReason: adjustedReason(exception.message),
56
+ errorStack: (_a = exception.stack) !== null && _a !== void 0 ? _a : '',
57
+ });
58
+ };
59
+ const reportErrorFromException = (isFatal, reportFatalErrorAsCrash, errorName, errorReason, errorStack) => {
60
+ if (isFatal && reportFatalErrorAsCrash) {
61
+ DynatraceInternal_1.DynatraceInternal.reportFatalErrorAsCrashFromHandler(isFatal, errorName, errorReason, errorStack);
62
+ return;
63
+ }
64
+ DynatraceInternal_1.DynatraceInternal.reportErrorFromHandler(isFatal, errorName, errorReason, errorStack);
65
+ };
66
+ const getCrashDelay = () => (react_native_1.Platform.OS === 'ios' ? 200 : 0);
47
67
  const adjustedReason = (reason) => {
48
68
  if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
49
69
  const reasonNewLineIndex = reason.indexOf('\n');
@@ -24,9 +24,7 @@ class NullAction {
24
24
  return;
25
25
  }
26
26
  getRequestTag(url) {
27
- return new Promise((resolve) => {
28
- resolve('');
29
- });
27
+ return Promise.resolve('');
30
28
  }
31
29
  getRequestTagHeader() {
32
30
  return '';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonUtils = void 0;
4
+ exports.JsonUtils = {
5
+ stringify: (value) => typeof value === 'string' ? value : JSON.stringify(value),
6
+ };
@@ -148,9 +148,10 @@ class TouchMetaResolver {
148
148
  return null;
149
149
  }
150
150
  const props = (_a = node.memoizedProps) !== null && _a !== void 0 ? _a : {};
151
- const dtName = props.dtName;
152
- if (typeof dtName === 'string' && dtName.trim().length > 0) {
153
- return dtName.trim();
151
+ const dtActionName = props.dtActionName;
152
+ if (typeof dtActionName === 'string' &&
153
+ dtActionName.trim().length > 0) {
154
+ return dtActionName.trim();
154
155
  }
155
156
  const testId = props.testID;
156
157
  if (typeof testId === 'string' && testId.trim().length > 0) {
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ConsoleLogger_1 = require("../../core/logging/ConsoleLogger");
4
4
  const LogMessages_1 = require("../../core/logging/LogMessages");
5
5
  const TimestampProvider_1 = require("../provider/TimestampProvider");
6
+ const TraceContextUtils_1 = require("../util/TraceContextUtils");
7
+ const ConfigurationHandler_1 = require("../../core/configuration/ConfigurationHandler");
6
8
  const SendEventValidation_1 = require("./modifier/SendEventValidation");
7
9
  const EventModifierUtil_1 = require("./modifier/EventModifierUtil");
8
10
  const EventBuilderUtil_1 = require("./EventBuilderUtil");
9
- const TraceContextUtils_1 = require("../util/TraceContextUtils");
10
- const ConfigurationHandler_1 = require("../../core/configuration/ConfigurationHandler");
11
11
  const logger = new ConsoleLogger_1.ConsoleLogger('HttpRequestEventData');
12
12
  class HttpRequestEventData {
13
13
  constructor(url, requestMethod) {
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });