@dynatrace/react-native-plugin 2.321.2 → 2.323.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.
- package/README.md +54 -17
- package/android/build.gradle +3 -3
- package/files/plugin-runtime.gradle +8 -1
- package/files/plugin.gradle +1 -1
- package/index.js +1 -0
- package/instrumentation/DynatraceInstrumentation.js +1 -1
- package/instrumentation/jsx/CreateElement.js +1 -1
- package/instrumentation/jsx/ElementHelper.js +2 -21
- package/instrumentation/jsx/IDynatraceProperties.js +0 -7
- package/instrumentation/jsx/JsxDevRuntime.js +2 -7
- package/instrumentation/jsx/JsxRuntime.js +2 -7
- package/instrumentation/jsx/components/ComponentUtil.js +12 -1
- package/instrumentation/jsx/components/Picker.js +3 -3
- package/instrumentation/jsx/components/RefreshControl.js +3 -3
- package/instrumentation/libs/community/gesture-handler/Touchables.js +7 -37
- package/instrumentation/libs/react-native/Switch.js +55 -12
- package/instrumentation/libs/react-native/Touchables.js +8 -47
- package/instrumentation/libs/withOnPressMonitoring.js +121 -0
- package/instrumentation/model/Types.js +3 -15
- package/instrumentation/model/TypesUtil.js +5 -34
- package/lib/core/Dynatrace.js +4 -1
- package/lib/core/ErrorHandler.js +18 -34
- package/lib/next/Dynatrace.js +16 -10
- package/lib/next/events/EventCreator.js +2 -1
- package/lib/next/events/HttpRequestEventBuilder.js +196 -0
- package/lib/next/events/ViewInfoCreator.js +1 -1
- package/lib/next/events/modifier/EventModifierUtil.js +14 -1
- package/lib/next/events/modifier/SendEventValidation.js +23 -10
- package/lib/next/events/spec/EventSpecContstants.js +1 -1
- package/package.json +6 -4
- package/react-native-dynatrace.podspec +1 -1
- package/scripts/Ios.js +1 -1
- package/scripts/Logger.js +20 -1
- package/scripts/core/InstrumentCall.js +62 -34
- package/scripts/util/SourceMapUtil.js +4 -4
- package/src/instrumentation/jsx/IDynatraceProperties.ts +15 -0
- package/typings/react-native-dynatrace.d.ts +130 -1
- package/instrumentation/jsx/components/Switch.js +0 -57
- package/instrumentation/jsx/components/Touchable.js +0 -151
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TouchableHelper = void 0;
|
|
4
|
-
const ConfigurationHandler_1 = require("../../../lib/core/configuration/ConfigurationHandler");
|
|
5
|
-
const IDynatraceProperties_1 = require("../IDynatraceProperties");
|
|
6
|
-
const TypesUtil_1 = require("../../model/TypesUtil");
|
|
7
|
-
const TouchableHelper = (Dynatrace, Logger) => ({
|
|
8
|
-
attachOnPress(longPress, props, children, type) {
|
|
9
|
-
const origFunction = longPress && this._isLongPress(props)
|
|
10
|
-
? props.onLongPress
|
|
11
|
-
: props.onPress;
|
|
12
|
-
const nameOfAction = this._findActionName(props, children);
|
|
13
|
-
const wrappedFunction = (event) => {
|
|
14
|
-
if (nameOfAction == null) {
|
|
15
|
-
Logger.debug('Skipping creation of action as no name was found!');
|
|
16
|
-
if (origFunction != null) {
|
|
17
|
-
return origFunction(event);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else if (origFunction != null &&
|
|
21
|
-
origFunction._dtWrapped !== undefined &&
|
|
22
|
-
origFunction._dtWrapped === true) {
|
|
23
|
-
Logger.debug(`Skip wrapping of ${nameOfAction} onPress as it is already wrapped!`);
|
|
24
|
-
return origFunction(event);
|
|
25
|
-
}
|
|
26
|
-
else if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
27
|
-
Logger.info('React Native plugin has not been started yet! Touch will not be reported!');
|
|
28
|
-
if (origFunction != null) {
|
|
29
|
-
return origFunction(event);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
let finalNameOfAction = nameOfAction;
|
|
34
|
-
if (!(0, IDynatraceProperties_1.isDynatraceNaming)(props) &&
|
|
35
|
-
ConfigurationHandler_1.ConfigurationHandler.isActionNamePrivacyEnabled()) {
|
|
36
|
-
finalNameOfAction = (0, TypesUtil_1.getNameForType)(type);
|
|
37
|
-
}
|
|
38
|
-
const action = Dynatrace.enterAutoAction(`Touch on ${finalNameOfAction}`);
|
|
39
|
-
if (origFunction != null) {
|
|
40
|
-
let isSyncError = true;
|
|
41
|
-
try {
|
|
42
|
-
const returnValue = origFunction(event);
|
|
43
|
-
if (_isPromise(returnValue)) {
|
|
44
|
-
isSyncError = false;
|
|
45
|
-
return Promise.resolve(returnValue).finally(() => {
|
|
46
|
-
action.leaveAction();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
action.leaveAction();
|
|
51
|
-
}
|
|
52
|
-
isSyncError = false;
|
|
53
|
-
}
|
|
54
|
-
finally {
|
|
55
|
-
if (isSyncError) {
|
|
56
|
-
action.leaveAction();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
action.leaveAction();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
wrappedFunction._dtWrapped = true;
|
|
66
|
-
return wrappedFunction;
|
|
67
|
-
},
|
|
68
|
-
_findActionName(props, children) {
|
|
69
|
-
if ((0, IDynatraceProperties_1.isDynatraceNaming)(props)) {
|
|
70
|
-
return props.dtActionName;
|
|
71
|
-
}
|
|
72
|
-
else if (this._isPropsButton(props) && props.title != null) {
|
|
73
|
-
return props.title;
|
|
74
|
-
}
|
|
75
|
-
else if (props.accessibilityLabel != null) {
|
|
76
|
-
return props.accessibilityLabel;
|
|
77
|
-
}
|
|
78
|
-
else if (children != null && children.length > 0) {
|
|
79
|
-
if (children.length === 1 && typeof children[0] === 'string') {
|
|
80
|
-
return children[0];
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
return this._walkChildrenToFindText(children);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (props.children != null) {
|
|
87
|
-
if (typeof props.children === 'string') {
|
|
88
|
-
return props.children;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
return this._walkChildrenToFindText(props.children);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return null;
|
|
95
|
-
},
|
|
96
|
-
_isPropsButton: (props) => props.title != null,
|
|
97
|
-
_isImageButton: (props) => props.source != null,
|
|
98
|
-
_isLongPress: (props) => props.onLongPress != null,
|
|
99
|
-
_isImageURISourceType: (source) => source.uri != null,
|
|
100
|
-
_isIconButton: (element) => {
|
|
101
|
-
const type = element.type;
|
|
102
|
-
return type != null && type.name === 'Icon';
|
|
103
|
-
},
|
|
104
|
-
_walkTreeToFindText(element) {
|
|
105
|
-
if (element == null || element.props == null) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
else if (this._isImageButton(element.props)) {
|
|
109
|
-
if (this._isImageURISourceType(element.props.source)) {
|
|
110
|
-
return 'Image Button: ' + element.props.source.uri;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
return 'Image Button';
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else if (this._isIconButton(element) && element.props.name != null) {
|
|
117
|
-
return 'Icon Button: ' + element.props.name;
|
|
118
|
-
}
|
|
119
|
-
return this._walkChildrenToFindText(element.props.children);
|
|
120
|
-
},
|
|
121
|
-
_walkChildrenToFindText(children) {
|
|
122
|
-
if (typeof children === 'string') {
|
|
123
|
-
return children;
|
|
124
|
-
}
|
|
125
|
-
else if (Array.isArray(children)) {
|
|
126
|
-
for (const child of children) {
|
|
127
|
-
if (this._isReactElement(child)) {
|
|
128
|
-
const name = this._walkTreeToFindText(child);
|
|
129
|
-
if (name != null) {
|
|
130
|
-
return name;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else if (typeof child === 'string') {
|
|
134
|
-
return child;
|
|
135
|
-
}
|
|
136
|
-
else if (Array.isArray(child)) {
|
|
137
|
-
return this._walkChildrenToFindText(child);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
return this._walkTreeToFindText(children);
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
_isReactElement: (node) => node != null && node.props != null,
|
|
147
|
-
});
|
|
148
|
-
exports.TouchableHelper = TouchableHelper;
|
|
149
|
-
const _isPromise = (object) => object != null &&
|
|
150
|
-
typeof object.then === 'function' &&
|
|
151
|
-
typeof object.catch === 'function';
|