@dynatrace/react-native-plugin 2.273.1 → 2.277.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.
- package/README.md +155 -41
- package/android/build.gradle +1 -1
- package/files/plugin.gradle +1 -1
- package/index.js +2 -0
- package/ios/DynatraceRNBridge.m +1 -1
- package/ios/lib/Dynatrace.xcframework/Info.plist +5 -5
- package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Dynatrace +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Headers/Dynatrace.h +1 -1
- package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Info.plist +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios.abi.json +1 -1
- package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Dynatrace +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace.h +1 -1
- package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Info.plist +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios-simulator.abi.json +1 -1
- package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/x86_64-apple-ios-simulator.abi.json +1 -1
- package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/_CodeSignature/CodeResources +15 -15
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Dynatrace +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Headers/Dynatrace.h +1 -1
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Info.plist +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-tvos.swiftsourceinfo +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Dynatrace +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace.h +1 -1
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Info.plist +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-tvos-simulator.swiftsourceinfo +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/x86_64-apple-tvos-simulator.swiftsourceinfo +0 -0
- package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/_CodeSignature/CodeResources +11 -11
- package/lib/instrumentor/DynatraceInstrumentation.js +1 -1
- package/lib/instrumentor/base/Application.js +4 -3
- package/lib/instrumentor/base/Dynatrace.js +27 -27
- package/lib/instrumentor/base/DynatraceInternal.js +2 -3
- package/lib/instrumentor/base/DynatraceRootAction.js +3 -3
- package/lib/instrumentor/base/ErrorHandler.js +1 -1
- package/lib/instrumentor/base/Logger.js +2 -2
- package/lib/instrumentor/base/Touchable.js +3 -3
- package/lib/instrumentor/base/configuration/Configuration.js +13 -18
- package/lib/instrumentor/base/configuration/ConfigurationBuilder.js +56 -0
- package/lib/instrumentor/base/configuration/ConfigurationDefaults.js +2 -10
- package/lib/instrumentor/base/configuration/ConfigurationHandler.js +15 -0
- package/lib/instrumentor/base/configuration/ConfigurationPreset.js +23 -0
- package/lib/instrumentor/base/configuration/ManualStartupConfiguration.js +6 -4
- package/lib/react/Component.js +6 -6
- package/lib/react-navigation/ReactNavigation.js +22 -0
- package/package.json +1 -168
- package/scripts/Config.js +3 -0
- package/typings/react-native-dynatrace.d.ts +230 -3
- package/lib/instrumentor/base/configuration/AutoStartupConfiguration.js +0 -28
- package/lib/instrumentor/base/configuration/interface/IAutoConfiguration.js +0 -2
- /package/lib/instrumentor/base/configuration/{interface/IManualConfiguration.js → IConfiguration.js} +0 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/Dynatrace.h</key>
|
|
12
12
|
<data>
|
|
13
|
-
|
|
13
|
+
s/CPxOz0ofQiidcBNcdBPLXXThk=
|
|
14
14
|
</data>
|
|
15
15
|
<key>Headers/DynatraceSwiftUI.h</key>
|
|
16
16
|
<data>
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
</data>
|
|
23
23
|
<key>Info.plist</key>
|
|
24
24
|
<data>
|
|
25
|
-
|
|
25
|
+
orZfswChsk9xPgHT6Jh18nDF9pE=
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/Dynatrace.swiftmodule/Project/arm64-apple-tvos-simulator.swiftsourceinfo</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
63qsETJzLoOTXA85jF/+AAc93is=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/Dynatrace.swiftmodule/Project/x86_64-apple-tvos-simulator.swiftsourceinfo</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
RWscDewlYeI+i5LoXp0o3q4hVA4=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.abi.json</key>
|
|
36
36
|
<data>
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
</data>
|
|
51
51
|
<key>Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.swiftmodule</key>
|
|
52
52
|
<data>
|
|
53
|
-
|
|
53
|
+
gsAXyGwln3KWPFQutoT3r/F3m2k=
|
|
54
54
|
</data>
|
|
55
55
|
<key>Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.abi.json</key>
|
|
56
56
|
<data>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
</data>
|
|
71
71
|
<key>Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.swiftmodule</key>
|
|
72
72
|
<data>
|
|
73
|
-
|
|
73
|
+
C83NVVhUlES5f5ShJO7v9tMLK64=
|
|
74
74
|
</data>
|
|
75
75
|
<key>Modules/module.modulemap</key>
|
|
76
76
|
<data>
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
<dict>
|
|
91
91
|
<key>hash2</key>
|
|
92
92
|
<data>
|
|
93
|
-
|
|
93
|
+
6xyhjqcVDTpmT/YyJlsrIDAex1CRcWeyFMI7TVdBFqE=
|
|
94
94
|
</data>
|
|
95
95
|
</dict>
|
|
96
96
|
<key>Headers/DynatraceSwiftUI.h</key>
|
|
@@ -111,14 +111,14 @@
|
|
|
111
111
|
<dict>
|
|
112
112
|
<key>hash2</key>
|
|
113
113
|
<data>
|
|
114
|
-
|
|
114
|
+
2Vg3HR4jz5kIQfR0mtAMlMMhPjr6PDj8mcf8jSXeHbs=
|
|
115
115
|
</data>
|
|
116
116
|
</dict>
|
|
117
117
|
<key>Modules/Dynatrace.swiftmodule/Project/x86_64-apple-tvos-simulator.swiftsourceinfo</key>
|
|
118
118
|
<dict>
|
|
119
119
|
<key>hash2</key>
|
|
120
120
|
<data>
|
|
121
|
-
|
|
121
|
+
f2qHCDmycW+YQIQGHGpKQEUrOmGhhbEJ6JWH86Cfj+k=
|
|
122
122
|
</data>
|
|
123
123
|
</dict>
|
|
124
124
|
<key>Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.abi.json</key>
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
<dict>
|
|
154
154
|
<key>hash2</key>
|
|
155
155
|
<data>
|
|
156
|
-
|
|
156
|
+
VDjfw41okIq8Cn/ceG9dZ21iE+s90OnEHyu3926lnpU=
|
|
157
157
|
</data>
|
|
158
158
|
</dict>
|
|
159
159
|
<key>Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.abi.json</key>
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
<dict>
|
|
189
189
|
<key>hash2</key>
|
|
190
190
|
<data>
|
|
191
|
-
|
|
191
|
+
+vas0q0DiggEwE9Hn08GfmNxbmLTjdHR1ISg2Xh6PPI=
|
|
192
192
|
</data>
|
|
193
193
|
</dict>
|
|
194
194
|
<key>Modules/module.modulemap</key>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o,n=require("@babel/runtime/helpers/interopRequireDefault"),r=n(require("@babel/runtime/helpers/toConsumableArray")),a=(Object.defineProperty(exports,"t",{value:!0}),exports.instrument=void 0,require("path")),c=require("jscodeshift"),i=require("jscodeshift/src/Collection"),e=require("../../scripts/FileOperationHelper"),t=require("../../scripts/PathsConstants"),u=require("../react-native/Touchables.InstrInfo"),l=require("../react-native/RefreshControl.InstrInfo"),f=require("../community/gesture-handler/Touchables.InstrInfo"),d=require("../community/Picker.InstrInfo"),s=require("./parser/Babel"),v=require("./model/Types"),p=(!function(n){n[n.i=-1]="Filtered",n[n.u=0]="Normal",n[n.o=1]="ReactNative",n[n.l=2]="React"}(o=o||{}),[]),m=(p.push.apply(p,(0,r.default)(u.instrumentationInfo)),p.push.apply(p,(0,r.default)(l.instrumentationInfo)),p.push.apply(p,(0,r.default)(f.instrumentationInfo)),p.push.apply(p,(0,r.default)(d.instrumentationInfo)),["AppRegistry","renderApplication","setUpErrorHandling"]),instrument=function(n,r,e){r=h(r);var t=w(r);if(t!==o.i){var i=!1,u=A(r,n);if(t===o.l)O(u),i=!0;else if(t===o.o)r.endsWith("AppRegistry.js")?void 0!==e&&e.autoStart&&(P(u),i=!0):r.endsWith("renderApplication.js")?(y(u),i=!0):r.endsWith("setUpErrorHandling.js")&&(T(u,e.autoStart),i=!0);else{var t=I(r,e);if(!t.input&&!t.lifecycle)return null!=e&&e.debug&&console.log("Dynatrace - Filtered All: ".concat(r)),N(r),n;t.lifecycle&&y(u)&&(i=!0),t.input&&p.forEach(function(n){n=k(u,n);u=n.root,i=i||n.v})}i?(n=u.toSource({quote:"single"}),H(n,r)):N(r),null!=e&&e.debug&&i&&console.log("Dynatrace - Modified Filename: "+r)}else r.includes(a.join("@dynatrace","react-native-plugin"))&&r.endsWith(a.join("lib","instrumentor","base","configuration","ConfigurationDefaults.js"))&&void 0!==e&&(t=A(r,n),void 0!==e.debug&&g(t,"debugAuto",e.debug),void 0!==e.lifecycle&&g(t,"lifecycleUpdateAuto",e.lifecycle.includeUpdate),void 0!==e.bundleName&&g(t,"bundleNameAuto",e.bundleName),void 0!==e.input&&g(t,"actionNamePrivacyAuto",e.input.actionNamePrivacy),n=t.toSource({quote:"single"}),H(n,r));return n},y=(exports.instrument=instrument,function(n){var r=n.findJSXElements(),t=!1;return 0<r.length&&(n.find(c.FunctionDeclaration).forEach(function(n){var r,e=(0,i.fromPaths)([n]);0<e.findJSXElements().length&&null!=n&&null!=n.value&&null!=n.value.id&&n.value.id.name&&(r=e.find(c.ClassDeclaration),e=e.find(c.ClassExpression),0===r.length)&&0===e.length&&(b(n,v.Types.FunctionalComponent,n.value.id.name),t=!0)}),n.find(c.ClassDeclaration).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n&&null!=n.value&&n.value.id&&n.value.id.name&&(b(n,v.Types.ClassComponent,n.value.id.name),t=!0)}),n.find(c.ArrowFunctionExpression).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.id&&null!=n.parent.value.id.name&&(b(n,v.Types.FunctionalComponent,n.parent.value.id.name),t=!0)})),t}),b=function(n,r,e){for(r=c.expressionStatement(c.assignmentExpression("=",c.memberExpression(c.identifier(e),c.identifier("_dtInfo")),q(r,e)));void 0!==n.parentPath&&"body"!==n.parentPath.name;)n=n.parentPath;void 0!==n.parentPath&&n.insertAfter(r)},q=function(n,r){return c.objectExpression([c.objectProperty(c.identifier("type"),c.numericLiteral(n)),c.objectProperty(c.identifier("name"),c.stringLiteral(r))])},g=function(n,r,e){var n=n.find(c.Identifier).filter(function(n){return n.node.name===r&&"VariableDeclarator"===n.parent.value.type});1===n.length&&("NumericLiteral"===(n=n.paths()[0].parent.value).init.type&&"number"==typeof e?n.init=c.numericLiteral(e):"StringLiteral"===n.init.type&&"string"==typeof e?n.init=c.stringLiteral(e):"BooleanLiteral"===n.init.type&&"boolean"==typeof e&&(n.init=c.booleanLiteral(e)))},A=function(n,r){return c.withParser((0,s.babelParser)(a.extname(n)))(r)},h=function(n){return a.isAbsolute(n)?n.replace(t.default.getApplicationPath()+a.sep,""):n},N=function(n){try{var r=a.join(t.default.getBuildPath(),n+".dtx");e.default.checkIfFileExistsSync(r),e.default.deleteFileSync(r)}catch(n){}},H=function(n,r){r=a.join(t.default.getBuildPath(),r);try{e.default.checkIfFileExistsSync(a.dirname(r))}catch(n){e.default.createDirectorySync(a.dirname(r))}e.default.writeTextToFileSync(r+".dtx",n)},I=function(n,r){var e={input:!1,lifecycle:!1};return void 0!==r&&(void 0!==r.lifecycle&&void 0!==r.lifecycle.instrument&&r.lifecycle.instrument(n)&&(e.lifecycle=!0),void 0!==r.input)&&void 0!==r.input.instrument&&r.input.instrument(n)&&(e.input=!0),e},O=function(n){var r,n=n.find(c.Program);1===n.length&&(r=c.expressionStatement(c.callExpression(c.memberExpression(c.callExpression(c.identifier("require"),[c.stringLiteral("@dynatrace/react-native-plugin/lib/instrumentor/base/ElementHelper")]),c.identifier("instrumentCreateElement")),[c.memberExpression(c.identifier("module"),c.identifier("exports"))])),n.paths()[0].node.body.push(r))},P=function(n){var r=U(n,"runApplication",!0);1===r.length&&(Z(n,{p:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),j(r.paths()[0].parent.value.body.body,0,C("_DynatraceApplicationHandler","startup",[])))},T=function(n,r){n=n.paths()[0].value.program.body;null!=n&&(j(n,n.length,R({p:"_DynatraceErrorHandler",module:"@dynatrace/react-native-plugin/lib/instrumentor/base/ErrorHandler",reference:""})),j(n,n.length,C("_DynatraceErrorHandler","registerErrorHandler",[])))},j=function(n,r){for(var e=arguments.length,t=new Array(2<e?e-2:0),i=2;i<e;i++)t[i-2]=arguments[i];return n.splice.apply(n,[r,0].concat(t))},U=function(n,r,t){for(var e=arguments.length,i=new Array(3<e?e-3:0),u=3;u<e;u++)i[u-3]=arguments[u];return n.find(c.Identifier).filter(function(n){return n.node.name===r}).filter(function(n){var r=void 0!==n.parent&&void 0!==n.parent.value;t||(r=r&&void 0!==n.parent.value.params&&n.parent.value.params.length===i.length);for(var e=0;e<0;e++)r=r&&n.parent.value.params[e].name===i[e];return r})},w=function(n){if(n.includes("@dynatrace"))return o.i;var r=a.extname(n);if(".js"!==r&&".ts"!==r&&".tsx"!==r&&".jsx"!==r)return o.i;for(var e=a.parse(n),t=e.dir.split(a.sep),i=0;i<t.length;i++)if("node_modules"===t[i]){if("react-native"===t[i+1]||"create-react-class"===t[i+1]||"react-clone-referenced-element"===t[i+1])return m.includes(e.name)?o.o:o.i;if("react"===t[i+1]&&"index"===e.name)return o.l}return o.u},B=function(n,r,e){var t=J(n,r,e);return M(n,r,e)||t},J=function(n,r,e){var t=V(n,r);return 0<t.length&&(void 0!==(t=E(t,r.reference,!1))&&(e.p=t.localName),X(n,e),!0)},M=function(n,r,e){var t=D(n,r.module);if(1===t.length){t=E(t,r.reference,!0);if(void 0!==t)return Y(n,e.defaultImport,t.localName,"ImportNamespaceSpecifier"===t.type),!0}return!1},k=function(n,r){var e=JSON.parse(JSON.stringify(r.new));return{root:n,v:B(n,r.old,e)||z(n,r.old,r.new.defaultImport)}},V=function(n,r){return n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r.module&&null!=n.node.specifiers&&n.node.specifiers.some(function(n){return x(n)&&n.imported.name===r.reference||n.local&&n.local.name===r.reference})})},x=function(n){return void 0!==n.imported},z=function(n,r,e){var t=!1;return n.find(c.CallExpression).filter(function(n){return G(n.node.callee)&&K(n.node.arguments[0])&&n.node.arguments[0].value===r.module&&void 0!==n.parent}).forEach(function(n){(void 0===n.parent.value.property||void 0!==n.parent.value.property&&void 0!==n.parent.value.property.name&&n.parent.value.property.name===r.reference)&&(n.node.arguments[0].value=e,t=t||!0)}),t},G=function(n){return"require"===n.name},K=function(n){return"StringLiteral"===n.type||"Literal"===n.type},D=function(n,r){return n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r})},E=function(n,e,t){var i;return n.forEach(function(n){void 0!==n.node.specifiers&&(n.node.specifiers=n.node.specifiers.filter(function(n){var r;return x(n)&&!t?((r=n.imported.name!==e)||null==n.local||n.imported.name===n.local.name||(i={localName:n.local.name,type:n.type}),r):!(!x(n)&&t&&(null!=n.local&&(i={localName:n.local.name,type:n.type}),1))}),0===n.node.specifiers.length)&&n.prune()}),i},Q=function(n,r){n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r.module}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(F(r))})},W=function(n,r,e){n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(e)})},_=function(n,r,e){var t=n.find(c.ImportDeclaration);0<t.length?c(t.paths()[0]).insertAfter(S(r,e)):1===(t=n.find(c.Program)).length&&t.paths()[0].node.body.unshift(S(r,e))},X=function(n,r){0<D(n,r.module).length?Q(n,r):_(n,r.module,[F(r)])},Y=function(n,r,e,t){var i=D(n,r),t=(t?un:tn)(e);0<i.length?W(n,r,t):_(n,r,[t])},Z=function(n,r){n=n.find(c.VariableDeclaration);0<n.length&&c(n.paths()[0]).insertAfter(R(r))},C=function(n,r,e){return c.expressionStatement($(n,r,e))},$=function(n,r,e){return c.callExpression(en(n,r),e)},R=function(n){return c.variableDeclaration("var",[nn(n)])},nn=function(n){return c.variableDeclarator(void 0!==n.p?c.identifier(n.p):c.identifier(n.reference),(0<n.reference.length?rn:L)(n))},rn=function(n){return c.memberExpression(L(n),c.identifier(n.reference))},en=function(n,r){return c.memberExpression(c.identifier(n),c.identifier(r))},L=function(n){return c.callExpression(c.identifier("require"),[c.literal(n.module)])},S=function(n,r){return c.importDeclaration(r,c.literal(n))},F=function(n){return void 0!==n.p?c.importSpecifier(c.identifier(n.reference),c.identifier(n.p)):c.importSpecifier(c.identifier(n.reference))},tn=function(n){return c.importDefaultSpecifier(c.identifier(n))},un=function(n){return c.importNamespaceSpecifier(c.identifier(n))};
|
|
1
|
+
"use strict";var o,n=require("@babel/runtime/helpers/interopRequireDefault"),r=n(require("@babel/runtime/helpers/toConsumableArray")),a=(Object.defineProperty(exports,"t",{value:!0}),exports.instrument=void 0,require("path")),c=require("jscodeshift"),i=require("jscodeshift/src/Collection"),e=require("../../scripts/FileOperationHelper"),t=require("../../scripts/PathsConstants"),u=require("../react-native/Touchables.InstrInfo"),l=require("../react-native/RefreshControl.InstrInfo"),f=require("../community/gesture-handler/Touchables.InstrInfo"),s=require("../community/Picker.InstrInfo"),v=require("./parser/Babel"),d=require("./model/Types"),p=(!function(n){n[n.i=-1]="Filtered",n[n.u=0]="Normal",n[n.o=1]="ReactNative",n[n.l=2]="React"}(o=o||{}),[]),m=(p.push.apply(p,(0,r.default)(u.instrumentationInfo)),p.push.apply(p,(0,r.default)(l.instrumentationInfo)),p.push.apply(p,(0,r.default)(f.instrumentationInfo)),p.push.apply(p,(0,r.default)(s.instrumentationInfo)),["AppRegistry","renderApplication","setUpErrorHandling"]),instrument=function(n,r,e){r=O(r);var t=J(r);if(t!==o.i){var i=!1,u=h(r,n);if(t===o.l)T(u),i=!0;else if(t===o.o)r.endsWith("AppRegistry.js")?void 0!==e&&e.autoStart&&(U(u),i=!0):r.endsWith("renderApplication.js")?(b(u),i=!0):r.endsWith("setUpErrorHandling.js")&&(w(u,e.autoStart),i=!0);else{var t=P(r,e);if(e.custom.reactnavigation&&y(r,u))i=!0;else{if(!t.input&&!t.lifecycle)return null!=e&&e.debug&&console.log("Dynatrace - Filtered All: ".concat(r)),H(r),n;t.lifecycle&&b(u)&&(i=!0),t.input&&p.forEach(function(n){n=z(u,n);u=n.root,i=i||n.v})}}i?(n=u.toSource({quote:"single"}),x(n,r)):H(r),null!=e&&e.debug&&i&&console.log("Dynatrace - Modified Filename: "+r)}else r.includes(a.join("@dynatrace","react-native-plugin"))&&r.endsWith(a.join("lib","instrumentor","base","configuration","ConfigurationPreset.js"))&&void 0!==e&&(t=h(r,n),void 0!==e.lifecycle&&N(t,"getLifecycleUpdate",e.lifecycle.includeUpdate),void 0!==e.debug&&N(t,"getLogLevel",e.debug?0:1),void 0!==e.bundleName&&N(t,"getBundleName",e.bundleName),void 0!==e.input&&void 0!==e.input.actionNamePrivacy&&N(t,"getActionNamePrivacy",e.input.actionNamePrivacy),e.autoStart&&N(t,"isAutoStartupEnabled",e.autoStart),n=t.toSource({quote:"single"}),x(n,r));return n},y=(exports.instrument=instrument,function(n,r){return!!g(n,r)&&(r.find(c.ImportDeclaration).at(0).insertBefore("import { registerListener } from '@dynatrace/react-native-plugin/lib/react-navigation/ReactNavigation';"),!0)}),g=function(n,r){var e=!1;return n.includes("react-navigation")&&n.includes("NavigationContainer.tsx")&&r.find(c.VariableDeclarator).forEach(function(n){e||null==n.value||null==n.value.id||"refContainer"!==n.value.id.name||null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.type&&"VariableDeclaration"===n.parent.value.type&&(n.parent.insertAfter("registerListener(refContainer);"),e=!0)}),e},b=function(n){var r=n.findJSXElements(),t=!1;return 0<r.length&&(n.find(c.FunctionDeclaration).forEach(function(n){var r,e=(0,i.fromPaths)([n]);0<e.findJSXElements().length&&null!=n&&null!=n.value&&null!=n.value.id&&n.value.id.name&&(r=e.find(c.ClassDeclaration),e=e.find(c.ClassExpression),0===r.length)&&0===e.length&&(q(n,d.Types.FunctionalComponent,n.value.id.name),t=!0)}),n.find(c.ClassDeclaration).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n&&null!=n.value&&n.value.id&&n.value.id.name&&(q(n,d.Types.ClassComponent,n.value.id.name),t=!0)}),n.find(c.ArrowFunctionExpression).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.id&&null!=n.parent.value.id.name&&(q(n,d.Types.FunctionalComponent,n.parent.value.id.name),t=!0)})),t},q=function(n,r,e){for(r=c.expressionStatement(c.assignmentExpression("=",c.memberExpression(c.identifier(e),c.identifier("_dtInfo")),A(r,e)));void 0!==n.parentPath&&"body"!==n.parentPath.name;)n=n.parentPath;void 0!==n.parentPath&&n.insertAfter(r)},A=function(n,r){return c.objectExpression([c.objectProperty(c.identifier("type"),c.numericLiteral(n)),c.objectProperty(c.identifier("name"),c.stringLiteral(r))])},N=function(n,r,e){var n=n.find(c.Identifier).filter(function(n){return n.node.name===r});1===n.length&&"ReturnStatement"===(n=n.paths()[0].parent.value.body.body[0]).type&&("boolean"==typeof e&&(n.argument=c.booleanLiteral(e)),"string"==typeof e&&(n.argument=c.stringLiteral(e)),"number"==typeof e)&&(n.argument=c.numericLiteral(e))},h=function(n,r){return c.withParser((0,v.babelParser)(a.extname(n)))(r)},O=function(n){return a.isAbsolute(n)?n.replace(t.default.getApplicationPath()+a.sep,""):n},H=function(n){try{var r=a.join(t.default.getBuildPath(),n+".dtx");e.default.checkIfFileExistsSync(r),e.default.deleteFileSync(r)}catch(n){}},x=function(n,r){r=a.join(t.default.getBuildPath(),r);try{e.default.checkIfFileExistsSync(a.dirname(r))}catch(n){e.default.createDirectorySync(a.dirname(r))}e.default.writeTextToFileSync(r+".dtx",n)},P=function(n,r){var e={input:!1,lifecycle:!1};return void 0!==r&&(void 0!==r.lifecycle&&void 0!==r.lifecycle.instrument&&r.lifecycle.instrument(n)&&(e.lifecycle=!0),void 0!==r.input)&&void 0!==r.input.instrument&&r.input.instrument(n)&&(e.input=!0),e},T=function(n){var r,n=n.find(c.Program);1===n.length&&(r=c.expressionStatement(c.callExpression(c.memberExpression(c.callExpression(c.identifier("require"),[c.stringLiteral("@dynatrace/react-native-plugin/lib/instrumentor/base/ElementHelper")]),c.identifier("instrumentCreateElement")),[c.memberExpression(c.identifier("module"),c.identifier("exports"))])),n.paths()[0].node.body.push(r))},U=function(n){var r=B(n,"runApplication",!0);1===r.length&&(nn(n,{p:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),I(r.paths()[0].parent.value.body.body,0,R("_DynatraceApplicationHandler","startup",[])))},w=function(n,r){n=n.paths()[0].value.program.body;null!=n&&(I(n,n.length,_({p:"_DynatraceErrorHandler",module:"@dynatrace/react-native-plugin/lib/instrumentor/base/ErrorHandler",reference:""})),I(n,n.length,R("_DynatraceErrorHandler","registerErrorHandler",[])))},I=function(n,r){for(var e=arguments.length,t=new Array(2<e?e-2:0),i=2;i<e;i++)t[i-2]=arguments[i];return n.splice.apply(n,[r,0].concat(t))},B=function(n,r,t){for(var e=arguments.length,i=new Array(3<e?e-3:0),u=3;u<e;u++)i[u-3]=arguments[u];return n.find(c.Identifier).filter(function(n){return n.node.name===r}).filter(function(n){var r=void 0!==n.parent&&void 0!==n.parent.value;t||(r=r&&void 0!==n.parent.value.params&&n.parent.value.params.length===i.length);for(var e=0;e<0;e++)r=r&&n.parent.value.params[e].name===i[e];return r})},J=function(n){if(n.includes("@dynatrace"))return o.i;var r=a.extname(n);if(".js"!==r&&".ts"!==r&&".tsx"!==r&&".jsx"!==r)return o.i;for(var e=a.parse(n),t=e.dir.split(a.sep),i=0;i<t.length;i++)if("node_modules"===t[i]){if("react-native"===t[i+1]||"create-react-class"===t[i+1]||"react-clone-referenced-element"===t[i+1])return m.includes(e.name)?o.o:o.i;if("react"===t[i+1]&&"index"===e.name)return o.l}return o.u},M=function(n,r,e){var t=k(n,r,e);return V(n,r,e)||t},k=function(n,r,e){var t=G(n,r);return 0<t.length&&(void 0!==(t=E(t,r.reference,!1))&&(e.p=t.localName),Z(n,e),!0)},V=function(n,r,e){var t=C(n,r.module);if(1===t.length){t=E(t,r.reference,!0);if(void 0!==t)return $(n,e.defaultImport,t.localName,"ImportNamespaceSpecifier"===t.type),!0}return!1},z=function(n,r){var e=JSON.parse(JSON.stringify(r.new));return{root:n,v:M(n,r.old,e)||K(n,r.old,r.new.defaultImport)}},G=function(n,r){return n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r.module&&null!=n.node.specifiers&&n.node.specifiers.some(function(n){return j(n)&&n.imported.name===r.reference||n.local&&n.local.name===r.reference})})},j=function(n){return void 0!==n.imported},K=function(n,r,e){var t=!1;return n.find(c.CallExpression).filter(function(n){return Q(n.node.callee)&&W(n.node.arguments[0])&&n.node.arguments[0].value===r.module&&void 0!==n.parent}).forEach(function(n){(void 0===n.parent.value.property||void 0!==n.parent.value.property&&void 0!==n.parent.value.property.name&&n.parent.value.property.name===r.reference)&&(n.node.arguments[0].value=e,t=t||!0)}),t},Q=function(n){return"require"===n.name},W=function(n){return"StringLiteral"===n.type||"Literal"===n.type},C=function(n,r){return n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r})},E=function(n,e,t){var i;return n.forEach(function(n){void 0!==n.node.specifiers&&(n.node.specifiers=n.node.specifiers.filter(function(n){var r;return j(n)&&!t?((r=n.imported.name!==e)||null==n.local||n.imported.name===n.local.name||(i={localName:n.local.name,type:n.type}),r):!(!j(n)&&t&&(null!=n.local&&(i={localName:n.local.name,type:n.type}),1))}),0===n.node.specifiers.length)&&n.prune()}),i},X=function(n,r){n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r.module}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(F(r))})},Y=function(n,r,e){n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(e)})},D=function(n,r,e){var t=n.find(c.ImportDeclaration);0<t.length?c(t.paths()[0]).insertAfter(S(r,e)):1===(t=n.find(c.Program)).length&&t.paths()[0].node.body.unshift(S(r,e))},Z=function(n,r){0<C(n,r.module).length?X(n,r):D(n,r.module,[F(r)])},$=function(n,r,e,t){var i=C(n,r),t=(t?an:on)(e);0<i.length?Y(n,r,t):D(n,r,[t])},nn=function(n,r){n=n.find(c.VariableDeclaration);0<n.length&&c(n.paths()[0]).insertAfter(_(r))},R=function(n,r,e){return c.expressionStatement(rn(n,r,e))},rn=function(n,r,e){return c.callExpression(un(n,r),e)},_=function(n){return c.variableDeclaration("var",[en(n)])},en=function(n){return c.variableDeclarator(void 0!==n.p?c.identifier(n.p):c.identifier(n.reference),(0<n.reference.length?tn:L)(n))},tn=function(n){return c.memberExpression(L(n),c.identifier(n.reference))},un=function(n,r){return c.memberExpression(c.identifier(n),c.identifier(r))},L=function(n){return c.callExpression(c.identifier("require"),[c.literal(n.module)])},S=function(n,r){return c.importDeclaration(r,c.literal(n))},F=function(n){return void 0!==n.p?c.importSpecifier(c.identifier(n.reference),c.identifier(n.p)):c.importSpecifier(c.identifier(n.reference))},on=function(n){return c.importDefaultSpecifier(c.identifier(n))},an=function(n){return c.importNamespaceSpecifier(c.identifier(n))};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApplicationHandler = void 0;
|
|
4
|
-
const
|
|
4
|
+
const ConfigurationBuilder_1 = require("./configuration/ConfigurationBuilder");
|
|
5
|
+
const ConfigurationHandler_1 = require("./configuration/ConfigurationHandler");
|
|
5
6
|
const Logger_1 = require("./Logger");
|
|
6
7
|
exports.ApplicationHandler = {
|
|
7
8
|
startup: () => {
|
|
8
|
-
if (!
|
|
9
|
+
if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
9
10
|
Logger_1.Logger.logDebug('Configuration set: ' +
|
|
10
|
-
JSON.stringify(
|
|
11
|
+
JSON.stringify(ConfigurationHandler_1.ConfigurationHandler.setConfiguration(new ConfigurationBuilder_1.ConfigurationBuilder('', '').buildConfiguration())));
|
|
11
12
|
Logger_1.Logger.logInfo('Dynatrace React Native Plugin started!');
|
|
12
13
|
}
|
|
13
14
|
},
|
|
@@ -16,7 +16,7 @@ const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
|
16
16
|
const DataCollectionLevel_1 = require("./model/DataCollectionLevel");
|
|
17
17
|
const UserPrivacyOptions_1 = require("./UserPrivacyOptions");
|
|
18
18
|
const Logger_1 = require("./Logger");
|
|
19
|
-
const
|
|
19
|
+
const ConfigurationHandler_1 = require("./configuration/ConfigurationHandler");
|
|
20
20
|
const DynatraceRootAction_1 = require("./DynatraceRootAction");
|
|
21
21
|
const NullRootAction_1 = require("./NullRootAction");
|
|
22
22
|
const DynatraceInternal_1 = require("./DynatraceInternal");
|
|
@@ -24,10 +24,10 @@ const DynatraceAction_1 = require("./DynatraceAction");
|
|
|
24
24
|
const NullAction_1 = require("./NullAction");
|
|
25
25
|
exports.Dynatrace = {
|
|
26
26
|
start: (configuration) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
if (!
|
|
27
|
+
if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
28
28
|
if (configuration !== undefined) {
|
|
29
29
|
yield DynatraceBridge_1.DynatraceNative.start(configuration);
|
|
30
|
-
|
|
30
|
+
ConfigurationHandler_1.ConfigurationHandler.setConfiguration(configuration);
|
|
31
31
|
Logger_1.Logger.logDebug('Manual Configuration set: ' + JSON.stringify(configuration));
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
@@ -55,10 +55,10 @@ exports.Dynatrace = {
|
|
|
55
55
|
},
|
|
56
56
|
enterAction: (name, platform) => exports.Dynatrace.enterAutoAction(name, platform),
|
|
57
57
|
enterManualAction: (name, platform) => {
|
|
58
|
-
if (
|
|
58
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
59
59
|
let key;
|
|
60
|
-
if (
|
|
61
|
-
key =
|
|
60
|
+
if (ConfigurationHandler_1.ConfigurationHandler.getBundleName() != null) {
|
|
61
|
+
key = ConfigurationHandler_1.ConfigurationHandler.getBundleName() + '_' + DynatraceInternal_1.DynatraceInternal.getCounter();
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
64
|
key = 'DEFAULT_' + DynatraceInternal_1.DynatraceInternal.getCounter();
|
|
@@ -79,10 +79,10 @@ exports.Dynatrace = {
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
enterAutoAction: (name, platform) => {
|
|
82
|
-
if (
|
|
82
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
83
83
|
let key;
|
|
84
|
-
if (
|
|
85
|
-
key =
|
|
84
|
+
if (ConfigurationHandler_1.ConfigurationHandler.getBundleName() != null) {
|
|
85
|
+
key = ConfigurationHandler_1.ConfigurationHandler.getBundleName() + '_' + DynatraceInternal_1.DynatraceInternal.getCounter();
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
88
|
key = 'DEFAULT_' + DynatraceInternal_1.DynatraceInternal.getCounter();
|
|
@@ -103,7 +103,7 @@ exports.Dynatrace = {
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
reportError: (errorName, errorCode, platform) => {
|
|
106
|
-
if (
|
|
106
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
107
107
|
Logger_1.Logger.logDebug(`Dynatrace reportError(${errorName}, ${errorCode})`);
|
|
108
108
|
DynatraceBridge_1.DynatraceNative.reportErrorWithoutStacktrace(errorName, errorCode, platform);
|
|
109
109
|
}
|
|
@@ -112,7 +112,7 @@ exports.Dynatrace = {
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
reportErrorWithStacktrace: (errorName, reason, stacktrace, platform) => {
|
|
115
|
-
if (
|
|
115
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
116
116
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
|
|
117
117
|
const reasonNewLineIndex = reason.indexOf('\n');
|
|
118
118
|
if (reasonNewLineIndex !== -1) {
|
|
@@ -127,7 +127,7 @@ exports.Dynatrace = {
|
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
reportErrorStacktrace: (errorName, errorValue, reason, stacktrace, platform) => {
|
|
130
|
-
if (
|
|
130
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
131
131
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
|
|
132
132
|
const reasonNewLineIndex = reason.indexOf('\n');
|
|
133
133
|
if (reasonNewLineIndex !== -1) {
|
|
@@ -142,7 +142,7 @@ exports.Dynatrace = {
|
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
reportCrash: (crashName, reason, stacktrace, platform) => {
|
|
145
|
-
if (
|
|
145
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
146
146
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(crashName)) {
|
|
147
147
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
|
|
148
148
|
const reasonNewLineIndex = reason.indexOf('\n');
|
|
@@ -159,7 +159,7 @@ exports.Dynatrace = {
|
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
reportCrashWithException: (crashName, crash, platform) => {
|
|
162
|
-
if (
|
|
162
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
163
163
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(crashName) &&
|
|
164
164
|
!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(crash.stack)) {
|
|
165
165
|
let crashReason = crash.message;
|
|
@@ -178,7 +178,7 @@ exports.Dynatrace = {
|
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
180
|
sendEvent: (name, attributes = {}, platform) => {
|
|
181
|
-
if (
|
|
181
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
182
182
|
if (StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(name)) {
|
|
183
183
|
Logger_1.Logger.logDebug(`Dynatrace sendEvent(${name}, ${attributes}): Name must be a non empty string`);
|
|
184
184
|
return;
|
|
@@ -198,7 +198,7 @@ exports.Dynatrace = {
|
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
sendBizEvent: (type, attributes = {}, platform) => {
|
|
201
|
-
if (
|
|
201
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
202
202
|
if (StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(type)) {
|
|
203
203
|
Logger_1.Logger.logDebug(`Dynatrace sendBizEvent(${type}, ${attributes})): Type must be a non empty string`);
|
|
204
204
|
return;
|
|
@@ -218,7 +218,7 @@ exports.Dynatrace = {
|
|
|
218
218
|
}
|
|
219
219
|
},
|
|
220
220
|
endSession: (platform) => {
|
|
221
|
-
if (
|
|
221
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
222
222
|
Logger_1.Logger.logDebug('Dynatrace endSession()');
|
|
223
223
|
DynatraceBridge_1.DynatraceNative.endVisit(platform);
|
|
224
224
|
}
|
|
@@ -227,7 +227,7 @@ exports.Dynatrace = {
|
|
|
227
227
|
}
|
|
228
228
|
},
|
|
229
229
|
identifyUser: (user, platform) => {
|
|
230
|
-
if (
|
|
230
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
231
231
|
Logger_1.Logger.logDebug(`Dynatrace identifyUser(${user})`);
|
|
232
232
|
DynatraceBridge_1.DynatraceNative.identifyUser(user, platform);
|
|
233
233
|
}
|
|
@@ -236,7 +236,7 @@ exports.Dynatrace = {
|
|
|
236
236
|
}
|
|
237
237
|
},
|
|
238
238
|
setGPSLocation: (latitude, longitude, platform) => {
|
|
239
|
-
if (
|
|
239
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
240
240
|
Logger_1.Logger.logDebug(`Dynatrace setGPSLocation(${latitude}, ${longitude})`);
|
|
241
241
|
DynatraceBridge_1.DynatraceNative.setGPSLocation(latitude, longitude, platform);
|
|
242
242
|
}
|
|
@@ -245,7 +245,7 @@ exports.Dynatrace = {
|
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
247
|
isCrashReportingOptedIn: (platform) => __awaiter(void 0, void 0, void 0, function* () {
|
|
248
|
-
if (
|
|
248
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
249
249
|
Logger_1.Logger.logDebug('Dynatrace isCrashReportingOptedIn()');
|
|
250
250
|
return DynatraceBridge_1.DynatraceNative.isCrashReportingOptedIn(platform);
|
|
251
251
|
}
|
|
@@ -255,7 +255,7 @@ exports.Dynatrace = {
|
|
|
255
255
|
}
|
|
256
256
|
}),
|
|
257
257
|
setCrashReportingOptedIn: (crashReporting, platform) => {
|
|
258
|
-
if (
|
|
258
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
259
259
|
Logger_1.Logger.logDebug(`Dynatrace setCrashReportingOptedIn(${crashReporting})`);
|
|
260
260
|
DynatraceBridge_1.DynatraceNative.setCrashReportingOptedIn(crashReporting, platform);
|
|
261
261
|
}
|
|
@@ -264,7 +264,7 @@ exports.Dynatrace = {
|
|
|
264
264
|
}
|
|
265
265
|
},
|
|
266
266
|
getDataCollectionLevel: (platform) => __awaiter(void 0, void 0, void 0, function* () {
|
|
267
|
-
if (
|
|
267
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
268
268
|
Logger_1.Logger.logDebug('Dynatrace getDataCollectionLevel()');
|
|
269
269
|
return DynatraceBridge_1.DynatraceNative.getDataCollectionLevel(platform);
|
|
270
270
|
}
|
|
@@ -274,7 +274,7 @@ exports.Dynatrace = {
|
|
|
274
274
|
}
|
|
275
275
|
}),
|
|
276
276
|
setDataCollectionLevel: (dataCollectionLevel, platform) => {
|
|
277
|
-
if (
|
|
277
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
278
278
|
Logger_1.Logger.logDebug(`Dynatrace setDataCollectionLevel(${dataCollectionLevel})`);
|
|
279
279
|
DynatraceBridge_1.DynatraceNative.setDataCollectionLevel(dataCollectionLevel, platform);
|
|
280
280
|
}
|
|
@@ -283,7 +283,7 @@ exports.Dynatrace = {
|
|
|
283
283
|
}
|
|
284
284
|
},
|
|
285
285
|
getUserPrivacyOptions: (platform) => __awaiter(void 0, void 0, void 0, function* () {
|
|
286
|
-
if (
|
|
286
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
287
287
|
Logger_1.Logger.logDebug('Dynatrace getUserPrivacyOptions()');
|
|
288
288
|
const options = yield DynatraceBridge_1.DynatraceNative.getUserPrivacyOptions(platform);
|
|
289
289
|
const currentOptions = new UserPrivacyOptions_1.UserPrivacyOptions(options.dataCollectionLevel, options.crashReportingOptedIn);
|
|
@@ -295,7 +295,7 @@ exports.Dynatrace = {
|
|
|
295
295
|
}
|
|
296
296
|
}),
|
|
297
297
|
applyUserPrivacyOptions: (userPrivacyOptions, platform) => {
|
|
298
|
-
if (
|
|
298
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
299
299
|
if ((userPrivacyOptions.crashReportingOptedIn === true ||
|
|
300
300
|
userPrivacyOptions.crashReportingOptedIn === false) &&
|
|
301
301
|
userPrivacyOptions.dataCollectionLevel in DataCollectionLevel_1.DataCollectionLevel) {
|
|
@@ -308,7 +308,7 @@ exports.Dynatrace = {
|
|
|
308
308
|
}
|
|
309
309
|
},
|
|
310
310
|
flushEvents: (platform) => {
|
|
311
|
-
if (
|
|
311
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
312
312
|
Logger_1.Logger.logDebug('Dynatrace flushEvents()');
|
|
313
313
|
DynatraceBridge_1.DynatraceNative.flushEvents(platform);
|
|
314
314
|
}
|
|
@@ -317,7 +317,7 @@ exports.Dynatrace = {
|
|
|
317
317
|
}
|
|
318
318
|
},
|
|
319
319
|
setBeaconHeaders: (headers, platform) => {
|
|
320
|
-
if (
|
|
320
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
321
321
|
Logger_1.Logger.logDebug('Dynatrace setBeaconHeaders(headers)');
|
|
322
322
|
if (headers && headers.size > 0) {
|
|
323
323
|
const obj = {};
|
|
@@ -4,10 +4,9 @@ exports.DynatraceInternal = void 0;
|
|
|
4
4
|
const StringUtils_1 = require("./util/StringUtils");
|
|
5
5
|
const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
6
6
|
const Logger_1 = require("./Logger");
|
|
7
|
-
const ErrorHandler_1 = require("./ErrorHandler");
|
|
8
7
|
let counter = 0;
|
|
9
8
|
exports.DynatraceInternal = {
|
|
10
|
-
reportErrorFromHandler: (isFatal, errorName, reason, stacktrace, platform) => {
|
|
9
|
+
reportErrorFromHandler: (isFatal, errorName, reason, stacktrace, isCustomErrorHandlerSet, platform) => {
|
|
11
10
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(reason)) {
|
|
12
11
|
const reasonNewLineIndex = reason.indexOf('\n');
|
|
13
12
|
if (reasonNewLineIndex !== -1) {
|
|
@@ -16,7 +15,7 @@ exports.DynatraceInternal = {
|
|
|
16
15
|
}
|
|
17
16
|
Logger_1.Logger.logDebug(`Dynatrace reportErrorStacktrace(${isFatal}, ${errorName}, ${reason}, ${stacktrace})`);
|
|
18
17
|
if (isFatal) {
|
|
19
|
-
DynatraceBridge_1.DynatraceNative.reportCrash(errorName, reason, stacktrace, true, __DEV__ ||
|
|
18
|
+
DynatraceBridge_1.DynatraceNative.reportCrash(errorName, reason, stacktrace, true, __DEV__ || isCustomErrorHandlerSet, platform);
|
|
20
19
|
}
|
|
21
20
|
else {
|
|
22
21
|
DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform);
|
|
@@ -7,7 +7,7 @@ const Logger_1 = require("./Logger");
|
|
|
7
7
|
const DynatraceAction_1 = require("./DynatraceAction");
|
|
8
8
|
const NullAction_1 = require("./NullAction");
|
|
9
9
|
const DynatraceInternal_1 = require("./DynatraceInternal");
|
|
10
|
-
const
|
|
10
|
+
const ConfigurationHandler_1 = require("./configuration/ConfigurationHandler");
|
|
11
11
|
class DynatraceRootAction extends DynatraceAction_1.DynatraceAction {
|
|
12
12
|
constructor(key, name) {
|
|
13
13
|
super(key, name, true);
|
|
@@ -18,8 +18,8 @@ class DynatraceRootAction extends DynatraceAction_1.DynatraceAction {
|
|
|
18
18
|
return new NullAction_1.NullAction();
|
|
19
19
|
}
|
|
20
20
|
let childKey;
|
|
21
|
-
if (
|
|
22
|
-
childKey =
|
|
21
|
+
if (ConfigurationHandler_1.ConfigurationHandler.getBundleName() != null) {
|
|
22
|
+
childKey = ConfigurationHandler_1.ConfigurationHandler.getBundleName() + '_' + DynatraceInternal_1.DynatraceInternal.getCounter();
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
childKey = 'DEFAULT_' + DynatraceInternal_1.DynatraceInternal.getCounter();
|
|
@@ -32,7 +32,7 @@ const _reportErrorToDynatrace = (exception, isFatal, oldHandler) => {
|
|
|
32
32
|
isFatal = false;
|
|
33
33
|
}
|
|
34
34
|
if (exception.stack != null) {
|
|
35
|
-
DynatraceInternal_1.DynatraceInternal.reportErrorFromHandler(isFatal, String(exception.name), exception.message, exception.stack);
|
|
35
|
+
DynatraceInternal_1.DynatraceInternal.reportErrorFromHandler(isFatal, String(exception.name), exception.message, exception.stack, _isCustomErrorHandlerSet);
|
|
36
36
|
Logger_1.Logger.logDebug(`ErrorHandler _reportErrorToDynatrace(${exception}, ${isFatal})`);
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Logger = void 0;
|
|
4
|
-
const
|
|
4
|
+
const ConfigurationHandler_1 = require("./configuration/ConfigurationHandler");
|
|
5
5
|
const LOG_PREFIX = 'DYNATRACE: ';
|
|
6
6
|
exports.Logger = {
|
|
7
7
|
logDebug: (message) => {
|
|
8
|
-
if (
|
|
8
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable() && ConfigurationHandler_1.ConfigurationHandler.isDebugEnabled()) {
|
|
9
9
|
console.log(LOG_PREFIX + message);
|
|
10
10
|
}
|
|
11
11
|
},
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TouchableHelper = void 0;
|
|
13
|
-
const
|
|
13
|
+
const ConfigurationHandler_1 = require("./configuration/ConfigurationHandler");
|
|
14
14
|
const TouchableHelper = (Dynatrace, Logger) => ({
|
|
15
15
|
attachOnPress(longPress, props, children) {
|
|
16
16
|
const origFunction = longPress && this._isLongPress(props)
|
|
@@ -25,7 +25,7 @@ const TouchableHelper = (Dynatrace, Logger) => ({
|
|
|
25
25
|
yield origFunction(event);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
else if (!
|
|
28
|
+
else if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
29
29
|
Logger.logInfo('TouchableHelper: React Native plugin has not been started yet! Touch will not be reported!');
|
|
30
30
|
if (origFunction != null) {
|
|
31
31
|
yield origFunction(event);
|
|
@@ -33,7 +33,7 @@ const TouchableHelper = (Dynatrace, Logger) => ({
|
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
let finalNameOfAction = nameOfAction;
|
|
36
|
-
if (
|
|
36
|
+
if (ConfigurationHandler_1.ConfigurationHandler.isActionNamePrivacyEnabled()) {
|
|
37
37
|
finalNameOfAction = isButton ? 'Button' : 'Touchable';
|
|
38
38
|
}
|
|
39
39
|
const action = Dynatrace.enterAutoAction(`Touch on ${finalNameOfAction}`);
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Configuration = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isDebugEnabled: () => mainConfig.logLevel === LogLevel_1.LogLevel.Debug,
|
|
18
|
-
isLifecycleUpdateEnabled: () => mainConfig.lifecycleUpdate,
|
|
19
|
-
isActionNamePrivacyEnabled: () => mainConfig.actionNamePrivacy,
|
|
20
|
-
getBundleName: () => mainConfig.bundleName,
|
|
21
|
-
};
|
|
4
|
+
class Configuration {
|
|
5
|
+
constructor(beaconUrl, applicationId, reportCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName) {
|
|
6
|
+
this.beaconUrl = beaconUrl;
|
|
7
|
+
this.applicationId = applicationId;
|
|
8
|
+
this.reportCrash = reportCrash;
|
|
9
|
+
this.logLevel = logLevel;
|
|
10
|
+
this.lifecycleUpdate = lifecycleUpdate;
|
|
11
|
+
this.userOptIn = userOptIn;
|
|
12
|
+
this.actionNamePrivacy = actionNamePrivacy;
|
|
13
|
+
this.bundleName = bundleName;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.Configuration = Configuration;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationBuilder = void 0;
|
|
4
|
+
const Configuration_1 = require("./Configuration");
|
|
5
|
+
const ConfigurationDefaults_1 = require("./ConfigurationDefaults");
|
|
6
|
+
const ConfigurationPreset_1 = require("./ConfigurationPreset");
|
|
7
|
+
class ConfigurationBuilder {
|
|
8
|
+
constructor(beaconUrl, applicationId) {
|
|
9
|
+
this.beaconUrl = '';
|
|
10
|
+
this.applicationId = '';
|
|
11
|
+
this.beaconUrl = beaconUrl;
|
|
12
|
+
this.applicationId = applicationId;
|
|
13
|
+
const preset = new ConfigurationPreset_1.ConfigurationPreset();
|
|
14
|
+
this.reportCrash = ConfigurationDefaults_1.DEFAULT_REPORT_CRASH;
|
|
15
|
+
this.logLevel = preset.getLogLevel();
|
|
16
|
+
this.lifecycleUpdate = preset.getLifecycleUpdate();
|
|
17
|
+
this.userOptIn = ConfigurationDefaults_1.DEFAULT_USER_OPT_IN;
|
|
18
|
+
this.actionNamePrivacy = preset.getActionNamePrivacy();
|
|
19
|
+
this.bundleName = preset.getBundleName();
|
|
20
|
+
this.autoStartup = preset.isAutoStartupEnabled();
|
|
21
|
+
}
|
|
22
|
+
withCrashReporting(reportCrash) {
|
|
23
|
+
this.reportCrash = reportCrash;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
withLogLevel(logLevel) {
|
|
27
|
+
this.logLevel = logLevel;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
withLifecycleUpdate(lifecycleUpdate) {
|
|
31
|
+
this.lifecycleUpdate = lifecycleUpdate;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
withUserOptIn(userOptIn) {
|
|
35
|
+
this.userOptIn = userOptIn;
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
withActionNamePrivacy(actionNamePrivacy) {
|
|
39
|
+
this.actionNamePrivacy = actionNamePrivacy;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
withBundleName(bundleName) {
|
|
43
|
+
this.bundleName = bundleName;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
buildConfiguration() {
|
|
47
|
+
if (!this.autoStartup && this.beaconUrl.length === 0) {
|
|
48
|
+
throw new Error('beaconUrl configuration property is empty. This configuration is not possible! Please use a proper beacon url.');
|
|
49
|
+
}
|
|
50
|
+
if (!this.autoStartup && this.applicationId.length === 0) {
|
|
51
|
+
throw new Error('applicationId configuration property is empty. This configuration is not possible! Please use a proper application id.');
|
|
52
|
+
}
|
|
53
|
+
return new Configuration_1.Configuration(this.beaconUrl, this.applicationId, this.reportCrash, this.logLevel, this.lifecycleUpdate, this.userOptIn, this.actionNamePrivacy, this.bundleName);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ConfigurationBuilder = ConfigurationBuilder;
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_ACTION_NAME_PRIVACY = exports.DEFAULT_USER_OPT_IN = exports.DEFAULT_REPORT_CRASH = exports.DEFAULT_LOGLEVEL = exports.DEFAULT_LIFECYCLE_UPDATE = void 0;
|
|
4
4
|
const LogLevel_1 = require("../model/LogLevel");
|
|
5
|
-
const debugAuto = false;
|
|
6
|
-
const lifecycleUpdateAuto = false;
|
|
7
|
-
const actionNamePrivacyAuto = false;
|
|
8
|
-
const bundleNameAuto = undefined;
|
|
9
5
|
exports.DEFAULT_LIFECYCLE_UPDATE = false;
|
|
10
|
-
exports.DEFAULT_LIFECYCLE_UPDATE_AUTO = lifecycleUpdateAuto;
|
|
11
6
|
exports.DEFAULT_LOGLEVEL = LogLevel_1.LogLevel.Info;
|
|
12
|
-
exports.DEFAULT_LOGLEVEL_AUTO = debugAuto ? LogLevel_1.LogLevel.Debug : LogLevel_1.LogLevel.Info;
|
|
13
7
|
exports.DEFAULT_REPORT_CRASH = true;
|
|
14
8
|
exports.DEFAULT_USER_OPT_IN = false;
|
|
15
|
-
exports.DEFAULT_ACTION_NAME_PRIVACY =
|
|
16
|
-
exports.DEFAULT_BUNDLE_NAME = undefined;
|
|
17
|
-
exports.DEFAULT_BUNDLE_NAME_AUTO = bundleNameAuto;
|
|
9
|
+
exports.DEFAULT_ACTION_NAME_PRIVACY = false;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationHandler = void 0;
|
|
4
|
+
const LogLevel_1 = require("../model/LogLevel");
|
|
5
|
+
let _configuration;
|
|
6
|
+
exports.ConfigurationHandler = {
|
|
7
|
+
setConfiguration(configuration) {
|
|
8
|
+
_configuration = configuration;
|
|
9
|
+
},
|
|
10
|
+
isConfigurationAvailable: () => _configuration !== undefined,
|
|
11
|
+
isDebugEnabled: () => _configuration.logLevel === LogLevel_1.LogLevel.Debug,
|
|
12
|
+
isLifecycleUpdateEnabled: () => _configuration.lifecycleUpdate,
|
|
13
|
+
isActionNamePrivacyEnabled: () => _configuration.actionNamePrivacy,
|
|
14
|
+
getBundleName: () => _configuration.bundleName,
|
|
15
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationPreset = void 0;
|
|
4
|
+
const ConfigurationDefaults_1 = require("./ConfigurationDefaults");
|
|
5
|
+
class ConfigurationPreset {
|
|
6
|
+
isAutoStartupEnabled() {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
getLifecycleUpdate() {
|
|
10
|
+
return ConfigurationDefaults_1.DEFAULT_LIFECYCLE_UPDATE;
|
|
11
|
+
}
|
|
12
|
+
getLogLevel() {
|
|
13
|
+
return ConfigurationDefaults_1.DEFAULT_LOGLEVEL;
|
|
14
|
+
}
|
|
15
|
+
getActionNamePrivacy() {
|
|
16
|
+
return ConfigurationDefaults_1.DEFAULT_ACTION_NAME_PRIVACY;
|
|
17
|
+
}
|
|
18
|
+
getBundleName() {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ConfigurationPreset = ConfigurationPreset;
|
|
23
|
+
;
|