@dynatrace/react-native-plugin 2.287.3 → 2.291.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 +157 -54
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.java +3 -4
- package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.java +3 -3
- package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.java +3 -3
- package/files/default.config.js +14 -0
- package/files/plugin.gradle +1 -1
- package/ios/DynatraceRNBridge.mm +5 -8
- package/lib/instrumentor/DynatraceInstrumentation.js +1 -1
- package/lib/instrumentor/base/Dynatrace.js +10 -3
- package/lib/instrumentor/base/DynatraceInternal.js +21 -5
- package/lib/instrumentor/base/ErrorHandler.js +7 -23
- package/lib/instrumentor/base/configuration/Configuration.js +6 -4
- package/lib/instrumentor/base/configuration/ConfigurationBuilder.js +11 -1
- package/lib/instrumentor/base/configuration/ConfigurationDefaults.js +4 -2
- package/lib/instrumentor/base/configuration/ConfigurationHandler.js +2 -0
- package/lib/instrumentor/base/configuration/ConfigurationPreset.js +6 -0
- package/lib/instrumentor/base/configuration/ManualStartupConfiguration.js +4 -2
- package/lib/react-native/Touchables.js +15 -58
- package/package.json +4 -3
- package/react-native-dynatrace.podspec +1 -3
- package/scripts/Config.js +4 -0
- package/scripts/Ios.js +2 -2
- package/scripts/util/PlistConstants.js +1 -1
- package/src/lib/instrumentor/base/interface/NativeDynatraceBridge.ts +2 -2
- package/typings/react-native-dynatrace.d.ts +952 -88
|
@@ -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("../react-native/Switch.InstrInfo"),s=require("../community/gesture-handler/Touchables.InstrInfo"),v=require("../community/Picker.InstrInfo"),d=require("./parser/Babel"),p=require("./model/Types"),m=(!function(n){n[n.i=-1]="Filtered",n[n.u=0]="Normal",n[n.o=1]="ReactNative",n[n.l=2]="React"}(o=o||{}),[]),y=(m.push.apply(m,(0,r.default)(u.instrumentationInfo)),m.push.apply(m,(0,r.default)(l.instrumentationInfo)),m.push.apply(m,(0,r.default)(f.instrumentationInfo)),m.push.apply(m,(0,r.default)(s.instrumentationInfo)),m.push.apply(m,(0,r.default)(v.instrumentationInfo)),["AppRegistry","renderApplication","setUpErrorHandling"]),instrument=function(n,r,e){r=P(r);var t=M(r);if(t!==o.i){var i=!1,u=N(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")?(q(u),i=!0):r.endsWith("setUpErrorHandling.js")&&(B(u,e.autoStart),i=!0);else{var t=w(r,e);if(e.custom.reactnavigation&&g(r,u))i=!0;else{if(!t.input&&!t.lifecycle)return null!=e&&e.debug&&console.log("Dynatrace - Filtered All: ".concat(r)),I(r),n;t.lifecycle&&q(u)&&(i=!0),t.input&&m.forEach(function(n){n=G(u,n);u=n.root,i=i||n.v})}}i?(n=u.toSource({quote:"single"}),H(n,r)):I(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=N(r,n),void 0!==e.lifecycle&&h(t,"getLifecycleUpdate",e.lifecycle.includeUpdate),void 0!==e.debug&&h(t,"getLogLevel",e.debug?0:1),void 0!==e.bundleName&&h(t,"getBundleName",e.bundleName),void 0!==e.input&&void 0!==e.input.actionNamePrivacy&&h(t,"getActionNamePrivacy",e.input.actionNamePrivacy),e.autoStart&&h(t,"isAutoStartupEnabled",e.autoStart),n=t.toSource({quote:"single"}),H(n,r));return n},g=(exports.instrument=instrument,function(n,r){return!!b(n,r)&&(r.find(c.ImportDeclaration).at(0).insertBefore("import { registerListener } from '@dynatrace/react-native-plugin/lib/react-navigation/ReactNavigation';"),!0)}),b=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},q=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&&(A(n,p.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&&(A(n,p.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&&(A(n,p.Types.FunctionalComponent,n.parent.value.id.name),t=!0)})),t},A=function(n,r,e){for(r=c.expressionStatement(c.assignmentExpression("=",c.memberExpression(c.identifier(e),c.identifier("_dtInfo")),O(r,e)));void 0!==n.parentPath&&"body"!==n.parentPath.name;)n=n.parentPath;void 0!==n.parentPath&&n.insertAfter(r)},O=function(n,r){return c.objectExpression([c.objectProperty(c.identifier("type"),c.numericLiteral(n)),c.objectProperty(c.identifier("name"),c.stringLiteral(r))])},h=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))},N=function(n,r){return c.withParser((0,d.babelParser)(a.extname(n)))(r)},P=function(n){return a.isAbsolute(n)?n.replace(t.default.getApplicationPath()+a.sep,""):n},I=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)},w=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=J(n,"runApplication",!0);1===r.length&&(rn(n,{p:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),x(r.paths()[0].parent.value.body.body,0,R("_DynatraceApplicationHandler","startup",[])))},B=function(n,r){n=n.paths()[0].value.program.body;null!=n&&(x(n,n.length,_({p:"_DynatraceErrorHandler",module:"@dynatrace/react-native-plugin/lib/instrumentor/base/ErrorHandler",reference:""})),x(n,n.length,R("_DynatraceErrorHandler","registerErrorHandler",[])))},x=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))},J=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){return void 0!==n.parent&&void 0!==n.parent.value&&void 0!==n.parent.value.params}).filter(function(n){var r=void 0!==n.parent&&void 0!==n.parent.value;t||(r=r&&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})},M=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 y.includes(e.name)?o.o:o.i;if("react"===t[i+1]&&"index"===e.name)return o.l}return o.u},k=function(n,r,e){var t=V(n,r,e);return z(n,r,e)||t},V=function(n,r,e){var t=K(n,r);return 0<t.length&&(void 0!==(t=E(t,r.reference,!1))&&(e.p=t.localName),$(n,e),!0)},z=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 nn(n,e.defaultImport,t.localName,"ImportNamespaceSpecifier"===t.type),!0}return!1},G=function(n,r){var e=JSON.parse(JSON.stringify(r.new));return{root:n,v:k(n,r.old,e)||Q(n,r.old,r.new.defaultImport)}},K=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},Q=function(n,r,e){var t=!1;return n.find(c.CallExpression).filter(function(n){return W(n.node.callee)&&X(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},W=function(n){return"require"===n.name},X=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},Y=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))})},Z=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))},$=function(n,r){0<C(n,r.module).length?Y(n,r):D(n,r.module,[F(r)])},nn=function(n,r,e,t){var i=C(n,r),t=(t?cn:an)(e);0<i.length?Z(n,r,t):D(n,r,[t])},rn=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(en(n,r,e))},en=function(n,r,e){return c.callExpression(on(n,r),e)},_=function(n){return c.variableDeclaration("var",[tn(n)])},tn=function(n){return c.variableDeclarator(void 0!==n.p?c.identifier(n.p):c.identifier(n.reference),(0<n.reference.length?un:L)(n))},un=function(n){return c.memberExpression(L(n),c.identifier(n.reference))},on=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))},an=function(n){return c.importDefaultSpecifier(c.identifier(n))},cn=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("../react-native/Switch.InstrInfo"),s=require("../community/gesture-handler/Touchables.InstrInfo"),v=require("../community/Picker.InstrInfo"),d=require("./parser/Babel"),p=require("./model/Types"),m=(!function(n){n[n.i=-1]="Filtered",n[n.u=0]="Normal",n[n.o=1]="ReactNative",n[n.l=2]="React"}(o=o||{}),[]),y=(m.push.apply(m,(0,r.default)(u.instrumentationInfo)),m.push.apply(m,(0,r.default)(l.instrumentationInfo)),m.push.apply(m,(0,r.default)(f.instrumentationInfo)),m.push.apply(m,(0,r.default)(s.instrumentationInfo)),m.push.apply(m,(0,r.default)(v.instrumentationInfo)),["AppRegistry","renderApplication","setUpErrorHandling"]),instrument=function(n,r,e){r=P(r);var t=M(r);if(t!==o.i){var i=!1,u=N(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")?(q(u),i=!0):r.endsWith("setUpErrorHandling.js")&&void 0!==e&&e.autoStart&&e.errorHandler.enabled&&(B(u,e.autoStart,e.errorHandler.reportFatalErrorAsCrash),i=!0);else{var t=w(r,e);if(e.custom.reactnavigation&&g(r,u))i=!0;else{if(!t.input&&!t.lifecycle)return null!=e&&e.debug&&console.log("Dynatrace - Filtered All: ".concat(r)),E(r),n;t.lifecycle&&q(u)&&(i=!0),t.input&&m.forEach(function(n){n=G(u,n);u=n.root,i=i||n.v})}}i?(n=u.toSource({quote:"single"}),H(n,r)):E(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=N(r,n),void 0!==e.lifecycle&&h(t,"getLifecycleUpdate",e.lifecycle.includeUpdate),void 0!==e.debug&&h(t,"getLogLevel",e.debug?0:1),void 0!==e.bundleName&&h(t,"getBundleName",e.bundleName),void 0!==e.input&&void 0!==e.input.actionNamePrivacy&&h(t,"getActionNamePrivacy",e.input.actionNamePrivacy),void 0!==e.errorHandler&&(h(t,"isErrorHandlerEnabled",e.errorHandler.enabled),h(t,"isReportFatalErrorAsCrash",e.errorHandler.reportFatalErrorAsCrash)),e.autoStart&&h(t,"isAutoStartupEnabled",e.autoStart),n=t.toSource({quote:"single"}),H(n,r));return n},g=(exports.instrument=instrument,function(n,r){return!!b(n,r)&&(r.find(c.ImportDeclaration).at(0).insertBefore("import { registerListener } from '@dynatrace/react-native-plugin/lib/react-navigation/ReactNavigation';"),!0)}),b=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},q=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&&(A(n,p.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&&(A(n,p.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&&(A(n,p.Types.FunctionalComponent,n.parent.value.id.name),t=!0)})),t},A=function(n,r,e){for(r=c.expressionStatement(c.assignmentExpression("=",c.memberExpression(c.identifier(e),c.identifier("_dtInfo")),O(r,e)));void 0!==n.parentPath&&"body"!==n.parentPath.name;)n=n.parentPath;void 0!==n.parentPath&&n.insertAfter(r)},O=function(n,r){return c.objectExpression([c.objectProperty(c.identifier("type"),c.numericLiteral(n)),c.objectProperty(c.identifier("name"),c.stringLiteral(r))])},h=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))},N=function(n,r){return c.withParser((0,d.babelParser)(a.extname(n)))(r)},P=function(n){return a.isAbsolute(n)?n.replace(t.default.getApplicationPath()+a.sep,""):n},E=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)},w=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=J(n,"runApplication",!0);1===r.length&&(rn(n,{p:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),I(r.paths()[0].parent.value.body.body,0,D("_DynatraceApplicationHandler","startup",[])))},B=function(n,r,e){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,D("_DynatraceErrorHandler","registerErrorHandler",[c.literal(e)])))},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))},J=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){return void 0!==n.parent&&void 0!==n.parent.value&&void 0!==n.parent.value.params}).filter(function(n){var r=void 0!==n.parent&&void 0!==n.parent.value;t||(r=r&&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})},M=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 y.includes(e.name)?o.o:o.i;if("react"===t[i+1]&&"index"===e.name)return o.l}return o.u},k=function(n,r,e){var t=V(n,r,e);return z(n,r,e)||t},V=function(n,r,e){var t=K(n,r);return 0<t.length&&(void 0!==(t=j(t,r.reference,!1))&&(e.p=t.localName),$(n,e),!0)},z=function(n,r,e){var t=C(n,r.module);if(1===t.length){t=j(t,r.reference,!0);if(void 0!==t)return nn(n,e.defaultImport,t.localName,"ImportNamespaceSpecifier"===t.type),!0}return!1},G=function(n,r){var e=JSON.parse(JSON.stringify(r.new));return{root:n,v:k(n,r.old,e)||Q(n,r.old,r.new.defaultImport)}},K=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},Q=function(n,r,e){var t=!1;return n.find(c.CallExpression).filter(function(n){return W(n.node.callee)&&X(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},W=function(n){return"require"===n.name},X=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})},j=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},Y=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))})},Z=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)})},R=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))},$=function(n,r){0<C(n,r.module).length?Y(n,r):R(n,r.module,[F(r)])},nn=function(n,r,e,t){var i=C(n,r),t=(t?cn:an)(e);0<i.length?Z(n,r,t):R(n,r,[t])},rn=function(n,r){n=n.find(c.VariableDeclaration);0<n.length&&c(n.paths()[0]).insertAfter(_(r))},D=function(n,r,e){return c.expressionStatement(en(n,r,e))},en=function(n,r,e){return c.callExpression(on(n,r),e)},_=function(n){return c.variableDeclaration("var",[tn(n)])},tn=function(n){return c.variableDeclarator(void 0!==n.p?c.identifier(n.p):c.identifier(n.reference),(0<n.reference.length?un:L)(n))},un=function(n){return c.memberExpression(L(n),c.identifier(n.reference))},on=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))},an=function(n){return c.importDefaultSpecifier(c.identifier(n))},cn=function(n){return c.importNamespaceSpecifier(c.identifier(n))};
|
|
@@ -22,11 +22,18 @@ const NullRootAction_1 = require("./NullRootAction");
|
|
|
22
22
|
const DynatraceInternal_1 = require("./DynatraceInternal");
|
|
23
23
|
const DynatraceAction_1 = require("./DynatraceAction");
|
|
24
24
|
const NullAction_1 = require("./NullAction");
|
|
25
|
+
const ErrorHandler_1 = require("./ErrorHandler");
|
|
25
26
|
exports.Dynatrace = {
|
|
26
27
|
start: (configuration) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
28
|
if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
28
29
|
if (configuration !== undefined) {
|
|
29
|
-
DynatraceBridge_1.DynatraceNative.start(configuration);
|
|
30
|
+
yield DynatraceBridge_1.DynatraceNative.start(configuration);
|
|
31
|
+
if (configuration.errorHandler) {
|
|
32
|
+
(0, ErrorHandler_1.registerErrorHandler)(configuration.reportFatalErrorAsCrash);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
Logger_1.Logger.logDebug('Dynatrace error handler will not be enabled as errorHandler was set to false!');
|
|
36
|
+
}
|
|
30
37
|
ConfigurationHandler_1.ConfigurationHandler.setConfiguration(configuration);
|
|
31
38
|
Logger_1.Logger.logDebug('Configuration set: ' + configuration.toString());
|
|
32
39
|
}
|
|
@@ -151,7 +158,7 @@ exports.Dynatrace = {
|
|
|
151
158
|
}
|
|
152
159
|
}
|
|
153
160
|
Logger_1.Logger.logDebug(`Dynatrace reportCrash(${crashName}, ${reason}, ${stacktrace})`);
|
|
154
|
-
DynatraceBridge_1.DynatraceNative.reportCrash(crashName, reason, stacktrace, false,
|
|
161
|
+
DynatraceBridge_1.DynatraceNative.reportCrash(crashName, reason, stacktrace, false, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
155
162
|
}
|
|
156
163
|
}
|
|
157
164
|
else {
|
|
@@ -170,7 +177,7 @@ exports.Dynatrace = {
|
|
|
170
177
|
}
|
|
171
178
|
}
|
|
172
179
|
Logger_1.Logger.logDebug(`Dynatrace reportCrashWithException(${crashName}, ${crash.stack})`);
|
|
173
|
-
DynatraceBridge_1.DynatraceNative.reportCrash(crashName, crashReason, crash.stack, true,
|
|
180
|
+
DynatraceBridge_1.DynatraceNative.reportCrash(crashName, crashReason, crash.stack, true, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
174
181
|
}
|
|
175
182
|
}
|
|
176
183
|
else {
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DynatraceInternal = void 0;
|
|
4
|
+
const ReactNative = require("react-native");
|
|
4
5
|
const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
6
|
+
const Dynatrace_1 = require("./Dynatrace");
|
|
5
7
|
const Logger_1 = require("./Logger");
|
|
8
|
+
const StringUtils_1 = require("./util/StringUtils");
|
|
6
9
|
let counter = 0;
|
|
7
10
|
exports.DynatraceInternal = {
|
|
8
|
-
reportErrorFromHandler: (isFatal, errorName, reason, stacktrace,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
reportErrorFromHandler: (isFatal, errorName, reason, stacktrace, isReportFatalErrorAsCrash, platform) => {
|
|
12
|
+
if (isFatal && isReportFatalErrorAsCrash) {
|
|
13
|
+
if (ReactNative.Platform.OS === 'ios') {
|
|
14
|
+
DynatraceBridge_1.DynatraceNative.storeCrash(errorName, reason, stacktrace);
|
|
15
|
+
Logger_1.Logger.logDebug(`ErrorHandler storeCrash(${errorName}, ${reason}, ${stacktrace})`);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
DynatraceBridge_1.DynatraceNative.reportCrash(errorName, reason, stacktrace, true, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
19
|
+
Logger_1.Logger.logDebug(`Dynatrace reportCrash(${errorName}, ${reason}, ${stacktrace})`);
|
|
20
|
+
}
|
|
12
21
|
}
|
|
13
22
|
else {
|
|
14
|
-
|
|
23
|
+
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(stacktrace)) {
|
|
24
|
+
DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
25
|
+
Logger_1.Logger.logDebug(`Dynatrace reportError(${errorName}, ${reason}, ${stacktrace})`);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
Dynatrace_1.Dynatrace.reportError(errorName, -1);
|
|
29
|
+
Logger_1.Logger.logDebug(`Dynatrace reportErrorWithoutStacktrace(${errorName})`);
|
|
30
|
+
}
|
|
15
31
|
}
|
|
16
32
|
},
|
|
17
33
|
getCounter: () => counter++,
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._reportErrorToDynatrace = exports.
|
|
3
|
+
exports._reportErrorToDynatrace = exports.registerErrorHandler = void 0;
|
|
4
4
|
const ReactNative = require("react-native");
|
|
5
5
|
const DynatraceInternal_1 = require("./DynatraceInternal");
|
|
6
|
-
const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
7
6
|
const Dynatrace_1 = require("./Dynatrace");
|
|
8
7
|
const StringUtils_1 = require("./util/StringUtils");
|
|
9
8
|
const Logger_1 = require("./Logger");
|
|
10
|
-
|
|
11
|
-
let _isCustomErrorHandlerSet = false;
|
|
9
|
+
let _isReportFatalErrorAsCrash = true;
|
|
12
10
|
const _isReactNativeGlobal = (globalScope) => globalScope.ErrorUtils !== undefined;
|
|
13
|
-
const registerErrorHandler = () => {
|
|
11
|
+
const registerErrorHandler = (reportFatalErrorAsCrash) => {
|
|
14
12
|
if (global !== undefined && _isReactNativeGlobal(global)) {
|
|
13
|
+
_isReportFatalErrorAsCrash = reportFatalErrorAsCrash;
|
|
15
14
|
const oldHandler = global.ErrorUtils.getGlobalHandler();
|
|
16
15
|
global.ErrorUtils.setGlobalHandler((error, isFatal) => {
|
|
17
16
|
(0, exports._reportErrorToDynatrace)(error, isFatal, oldHandler);
|
|
18
17
|
});
|
|
19
18
|
const setter = global.ErrorUtils.setGlobalHandler;
|
|
20
19
|
global.ErrorUtils.setGlobalHandler = (errorHandler) => {
|
|
21
|
-
_isCustomErrorHandlerSet = true;
|
|
22
20
|
setter((error, isFatal) => {
|
|
23
21
|
(0, exports._reportErrorToDynatrace)(error, isFatal, errorHandler);
|
|
24
22
|
});
|
|
@@ -26,33 +24,19 @@ const registerErrorHandler = () => {
|
|
|
26
24
|
}
|
|
27
25
|
};
|
|
28
26
|
exports.registerErrorHandler = registerErrorHandler;
|
|
29
|
-
const isCustomErrorHandlerSet = () => _isCustomErrorHandlerSet;
|
|
30
|
-
exports.isCustomErrorHandlerSet = isCustomErrorHandlerSet;
|
|
31
27
|
const _reportErrorToDynatrace = (exception, isFatal, oldHandler) => {
|
|
32
28
|
if (exception != null && isExceptionAnError(exception)) {
|
|
33
29
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(exception.name)) {
|
|
34
30
|
if (isFatal === undefined) {
|
|
35
31
|
isFatal = false;
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
DynatraceBridge_1.DynatraceNative.storeCrash(String(exception.name), adjustedReason(exception.message), exception.stack, Platform_1.Platform.Ios.toString());
|
|
40
|
-
Logger_1.Logger.logDebug(`ErrorHandler storeCrash(${exception}, ${isFatal})`);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
DynatraceInternal_1.DynatraceInternal.reportErrorFromHandler(isFatal, String(exception.name), adjustedReason(exception.message), exception.stack, _isCustomErrorHandlerSet);
|
|
44
|
-
Logger_1.Logger.logDebug(`ErrorHandler _reportErrorToDynatrace(${exception}, ${isFatal})`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
Dynatrace_1.Dynatrace.reportError(String(exception.name) + ': ' + exception.message, -1);
|
|
49
|
-
Logger_1.Logger.logDebug(`ErrorHandler _reportErrorToDynatrace(${exception})`);
|
|
50
|
-
}
|
|
33
|
+
DynatraceInternal_1.DynatraceInternal.reportErrorFromHandler(isFatal, String(exception.name), adjustedReason(exception.message), exception.stack != null ? exception.stack : "", _isReportFatalErrorAsCrash);
|
|
34
|
+
Logger_1.Logger.logDebug(`ErrorHandler _reportErrorToDynatrace(${exception}, ${isFatal})`);
|
|
51
35
|
}
|
|
52
36
|
}
|
|
53
37
|
else {
|
|
54
38
|
Dynatrace_1.Dynatrace.reportError(String(exception), -1);
|
|
55
|
-
Logger_1.Logger.logDebug(`ErrorHandler _reportErrorToDynatrace(${exception})`);
|
|
39
|
+
Logger_1.Logger.logDebug(`ErrorHandler _reportErrorToDynatrace(${exception}, -1)`);
|
|
56
40
|
}
|
|
57
41
|
if (oldHandler !== undefined) {
|
|
58
42
|
if (ReactNative.Platform.OS === 'ios') {
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Configuration = void 0;
|
|
4
4
|
const LogLevel_1 = require("../model/LogLevel");
|
|
5
5
|
class Configuration {
|
|
6
|
-
constructor(beaconUrl, applicationId, reportCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName) {
|
|
6
|
+
constructor(beaconUrl, applicationId, reportCrash, errorHandler, reportFatalErrorAsCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName) {
|
|
7
7
|
this.beaconUrl = beaconUrl;
|
|
8
8
|
this.applicationId = applicationId;
|
|
9
9
|
this.reportCrash = reportCrash;
|
|
10
|
+
this.errorHandler = errorHandler;
|
|
11
|
+
this.reportFatalErrorAsCrash = reportFatalErrorAsCrash;
|
|
10
12
|
this.logLevel = logLevel;
|
|
11
13
|
this.lifecycleUpdate = lifecycleUpdate;
|
|
12
14
|
this.userOptIn = userOptIn;
|
|
@@ -21,9 +23,9 @@ class Configuration {
|
|
|
21
23
|
else {
|
|
22
24
|
configurationString = `{Startup: Manual Start, applicationId: ${this.applicationId}, beaconUrl: ${this.beaconUrl},`;
|
|
23
25
|
}
|
|
24
|
-
configurationString += ` reportCrash: ${this.reportCrash},
|
|
25
|
-
+ `
|
|
26
|
-
+ ` logLevel: ${(0, LogLevel_1.LogLevelToString)(this.logLevel)}`;
|
|
26
|
+
configurationString += ` reportCrash: ${this.reportCrash}, errorHandler: ${this.errorHandler}, reportFatalErrorAsCrash: ${this.reportFatalErrorAsCrash},`
|
|
27
|
+
+ ` lifecycleUpdate: ${this.lifecycleUpdate}, userOptIn: ${this.userOptIn},`
|
|
28
|
+
+ ` actionNamePrivacy: ${this.actionNamePrivacy}, logLevel: ${(0, LogLevel_1.LogLevelToString)(this.logLevel)}`;
|
|
27
29
|
if (this.bundleName !== undefined) {
|
|
28
30
|
configurationString += `, bundleName: ${this.bundleName}`;
|
|
29
31
|
}
|
|
@@ -12,6 +12,8 @@ class ConfigurationBuilder {
|
|
|
12
12
|
this.applicationId = applicationId;
|
|
13
13
|
const preset = new ConfigurationPreset_1.ConfigurationPreset();
|
|
14
14
|
this.reportCrash = ConfigurationDefaults_1.DEFAULT_REPORT_CRASH;
|
|
15
|
+
this.errorHandler = preset.isErrorHandlerEnabled();
|
|
16
|
+
this.reportFatalErrorAsCrash = preset.isReportFatalErrorAsCrash();
|
|
15
17
|
this.logLevel = preset.getLogLevel();
|
|
16
18
|
this.lifecycleUpdate = preset.getLifecycleUpdate();
|
|
17
19
|
this.userOptIn = ConfigurationDefaults_1.DEFAULT_USER_OPT_IN;
|
|
@@ -23,6 +25,14 @@ class ConfigurationBuilder {
|
|
|
23
25
|
this.reportCrash = reportCrash;
|
|
24
26
|
return this;
|
|
25
27
|
}
|
|
28
|
+
withErrorHandler(errorHandler) {
|
|
29
|
+
this.errorHandler = errorHandler;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
withReportFatalErrorAsCrash(reportFatalErrorAsCrash) {
|
|
33
|
+
this.reportFatalErrorAsCrash = reportFatalErrorAsCrash;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
26
36
|
withLogLevel(logLevel) {
|
|
27
37
|
this.logLevel = logLevel;
|
|
28
38
|
return this;
|
|
@@ -50,7 +60,7 @@ class ConfigurationBuilder {
|
|
|
50
60
|
if (!this.autoStartup && this.applicationId.length === 0) {
|
|
51
61
|
throw new Error('applicationId configuration property is empty. This configuration is not possible! Please use a proper application id.');
|
|
52
62
|
}
|
|
53
|
-
return new Configuration_1.Configuration(this.beaconUrl, this.applicationId, this.reportCrash, this.logLevel, this.lifecycleUpdate, this.userOptIn, this.actionNamePrivacy, this.bundleName);
|
|
63
|
+
return new Configuration_1.Configuration(this.beaconUrl, this.applicationId, this.reportCrash, this.errorHandler, this.reportFatalErrorAsCrash, this.logLevel, this.lifecycleUpdate, this.userOptIn, this.actionNamePrivacy, this.bundleName);
|
|
54
64
|
}
|
|
55
65
|
}
|
|
56
66
|
exports.ConfigurationBuilder = ConfigurationBuilder;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_ACTION_NAME_PRIVACY = exports.DEFAULT_USER_OPT_IN = exports.
|
|
3
|
+
exports.DEFAULT_ACTION_NAME_PRIVACY = exports.DEFAULT_USER_OPT_IN = exports.DEFAULT_LOGLEVEL = exports.DEFAULT_FATAL_AS_CRASH = exports.DEFAULT_ERROR_HANDLER = exports.DEFAULT_REPORT_CRASH = exports.DEFAULT_LIFECYCLE_UPDATE = void 0;
|
|
4
4
|
const LogLevel_1 = require("../model/LogLevel");
|
|
5
5
|
exports.DEFAULT_LIFECYCLE_UPDATE = false;
|
|
6
|
-
exports.DEFAULT_LOGLEVEL = LogLevel_1.LogLevel.Info;
|
|
7
6
|
exports.DEFAULT_REPORT_CRASH = true;
|
|
7
|
+
exports.DEFAULT_ERROR_HANDLER = true;
|
|
8
|
+
exports.DEFAULT_FATAL_AS_CRASH = true;
|
|
9
|
+
exports.DEFAULT_LOGLEVEL = LogLevel_1.LogLevel.Info;
|
|
8
10
|
exports.DEFAULT_USER_OPT_IN = false;
|
|
9
11
|
exports.DEFAULT_ACTION_NAME_PRIVACY = false;
|
|
@@ -8,6 +8,8 @@ exports.ConfigurationHandler = {
|
|
|
8
8
|
_configuration = configuration;
|
|
9
9
|
},
|
|
10
10
|
isConfigurationAvailable: () => _configuration !== undefined,
|
|
11
|
+
isErrorHandlerEnabled: () => _configuration.errorHandler,
|
|
12
|
+
isReportFatalErrorAsCrash: () => _configuration.reportFatalErrorAsCrash,
|
|
11
13
|
isDebugEnabled: () => _configuration.logLevel === LogLevel_1.LogLevel.Debug,
|
|
12
14
|
isLifecycleUpdateEnabled: () => _configuration.lifecycleUpdate,
|
|
13
15
|
isActionNamePrivacyEnabled: () => _configuration.actionNamePrivacy,
|
|
@@ -12,6 +12,12 @@ class ConfigurationPreset {
|
|
|
12
12
|
getLogLevel() {
|
|
13
13
|
return ConfigurationDefaults_1.DEFAULT_LOGLEVEL;
|
|
14
14
|
}
|
|
15
|
+
isErrorHandlerEnabled() {
|
|
16
|
+
return ConfigurationDefaults_1.DEFAULT_ERROR_HANDLER;
|
|
17
|
+
}
|
|
18
|
+
isReportFatalErrorAsCrash() {
|
|
19
|
+
return ConfigurationDefaults_1.DEFAULT_FATAL_AS_CRASH;
|
|
20
|
+
}
|
|
15
21
|
getActionNamePrivacy() {
|
|
16
22
|
return ConfigurationDefaults_1.DEFAULT_ACTION_NAME_PRIVACY;
|
|
17
23
|
}
|
|
@@ -15,6 +15,8 @@ class ManualStartupConfiguration {
|
|
|
15
15
|
this.beaconUrl = beaconUrl;
|
|
16
16
|
const preset = new ConfigurationPreset_1.ConfigurationPreset();
|
|
17
17
|
this.logLevel = preset.getLogLevel();
|
|
18
|
+
this.errorHandler = preset.isErrorHandlerEnabled();
|
|
19
|
+
this.reportFatalErrorAsCrash = preset.isReportFatalErrorAsCrash();
|
|
18
20
|
this.lifecycleUpdate = preset.getLifecycleUpdate();
|
|
19
21
|
this.actionNamePrivacy = preset.getActionNamePrivacy();
|
|
20
22
|
this.bundleName = preset.getBundleName();
|
|
@@ -39,8 +41,8 @@ class ManualStartupConfiguration {
|
|
|
39
41
|
}
|
|
40
42
|
toString() {
|
|
41
43
|
let configurationString = `{Startup: Manual Start, applicationId: ${this.applicationId}, beaconUrl: ${this.beaconUrl},`
|
|
42
|
-
+ ` reportCrash: ${this.reportCrash},
|
|
43
|
-
+ ` actionNamePrivacy: ${this.actionNamePrivacy}, logLevel: ${(0, LogLevel_1.LogLevelToString)(this.logLevel)}`;
|
|
44
|
+
+ ` reportCrash: ${this.reportCrash}, errorHandler: ${this.errorHandler}, reportFatalErrorAsCrash: ${this.reportFatalErrorAsCrash},`
|
|
45
|
+
+ ` lifecycleUpdate: ${this.lifecycleUpdate}, userOptIn: ${this.userOptIn}, actionNamePrivacy: ${this.actionNamePrivacy}, logLevel: ${(0, LogLevel_1.LogLevelToString)(this.logLevel)}`;
|
|
44
46
|
if (this.bundleName !== undefined) {
|
|
45
47
|
configurationString += `, bundleName: ${this.bundleName}`;
|
|
46
48
|
}
|
|
@@ -1,63 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.Pressable = exports.Text = exports.TouchableWithoutFeedback = exports.TouchableNativeFeedback = exports.TouchableHighlight = exports.TouchableOpacity = exports.Button = void 0;
|
|
5
4
|
const ReactNative = require("react-native");
|
|
5
|
+
const React = require("react");
|
|
6
6
|
const Types_1 = require("../instrumentor/model/Types");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
_b._dtInfo = { type: Types_1.Types.TouchableOpacity },
|
|
23
|
-
_b);
|
|
24
|
-
}
|
|
25
|
-
if (typeof ReactNative.TouchableHighlight === 'object') {
|
|
26
|
-
exports.TouchableHighlight = Object.assign({ _dtInfo: { type: Types_1.Types.TouchableHighlight } }, ReactNative.TouchableHighlight);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
exports.TouchableHighlight = (_c = class TouchableHighlight extends (ReactNative.TouchableHighlight) {
|
|
30
|
-
},
|
|
31
|
-
_c._dtInfo = { type: Types_1.Types.TouchableHighlight },
|
|
32
|
-
_c);
|
|
33
|
-
}
|
|
34
|
-
if (typeof ReactNative.TouchableNativeFeedback === 'object') {
|
|
35
|
-
exports.TouchableNativeFeedback = Object.assign({ _dtInfo: { type: Types_1.Types.TouchableNativeFeedback } }, ReactNative.TouchableNativeFeedback);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
exports.TouchableNativeFeedback = (_d = class TouchableNativeFeedback extends (ReactNative.TouchableNativeFeedback) {
|
|
39
|
-
},
|
|
40
|
-
_d._dtInfo = { type: Types_1.Types.TouchableNativeFeedback },
|
|
41
|
-
_d);
|
|
42
|
-
}
|
|
43
|
-
if (typeof ReactNative.TouchableWithoutFeedback === 'object') {
|
|
44
|
-
exports.TouchableWithoutFeedback = Object.assign({ _dtInfo: { type: Types_1.Types.TouchableWithoutFeedback } }, ReactNative.TouchableWithoutFeedback);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
exports.TouchableWithoutFeedback = (_e = class TouchableWithoutFeedback extends (ReactNative.TouchableWithoutFeedback) {
|
|
48
|
-
},
|
|
49
|
-
_e._dtInfo = { type: Types_1.Types.TouchableWithoutFeedback },
|
|
50
|
-
_e);
|
|
51
|
-
}
|
|
52
|
-
if (typeof ReactNative.Text === 'object') {
|
|
53
|
-
exports.Text = Object.assign({ _dtInfo: { type: Types_1.Types.Text } }, ReactNative.Text);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
exports.Text = (_f = class Text extends ReactNative.Text {
|
|
57
|
-
},
|
|
58
|
-
_f._dtInfo = { type: Types_1.Types.Text },
|
|
59
|
-
_f);
|
|
60
|
-
}
|
|
61
|
-
if (typeof ReactNative.Pressable === 'object') {
|
|
62
|
-
exports.Pressable = Object.assign({ _dtInfo: { type: Types_1.Types.Pressable } }, ReactNative.Pressable);
|
|
63
|
-
}
|
|
7
|
+
exports.Button = React.forwardRef((props, ref) => React.createElement(ReactNative.Button, Object.assign({}, props, { ref: ref })));
|
|
8
|
+
exports.Button._dtInfo = { type: Types_1.Types.Button };
|
|
9
|
+
exports.TouchableOpacity = React.forwardRef((props, ref) => React.createElement(ReactNative.TouchableOpacity, Object.assign({}, props, { ref: ref })));
|
|
10
|
+
exports.TouchableOpacity._dtInfo = { type: Types_1.Types.TouchableOpacity };
|
|
11
|
+
exports.TouchableHighlight = React.forwardRef((props, ref) => React.createElement(ReactNative.TouchableHighlight, Object.assign({}, props, { ref: ref })));
|
|
12
|
+
exports.TouchableHighlight._dtInfo = { type: Types_1.Types.TouchableHighlight };
|
|
13
|
+
exports.TouchableNativeFeedback = React.forwardRef((props, ref) => React.createElement(ReactNative.TouchableNativeFeedback, Object.assign({}, props, { ref: ref })));
|
|
14
|
+
exports.TouchableNativeFeedback._dtInfo = { type: Types_1.Types.TouchableNativeFeedback };
|
|
15
|
+
exports.TouchableWithoutFeedback = React.forwardRef((props, ref) => React.createElement(ReactNative.TouchableWithoutFeedback, Object.assign({}, props, { ref: ref })));
|
|
16
|
+
exports.TouchableWithoutFeedback._dtInfo = { type: Types_1.Types.TouchableWithoutFeedback };
|
|
17
|
+
exports.Text = React.forwardRef((props, ref) => React.createElement(ReactNative.Text, Object.assign({}, props, { ref: ref })));
|
|
18
|
+
exports.Text._dtInfo = { type: Types_1.Types.Text };
|
|
19
|
+
exports.Pressable = React.forwardRef((props, ref) => React.createElement(ReactNative.Pressable, Object.assign({}, props, { ref: ref })));
|
|
20
|
+
exports.Pressable._dtInfo = { type: Types_1.Types.Pressable };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/react-native-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.291.1",
|
|
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",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"author": "Dynatrace",
|
|
72
72
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@babel/runtime": "^7.24.
|
|
74
|
+
"@babel/runtime": "^7.24.5",
|
|
75
75
|
"jscodeshift": "^0.15.2",
|
|
76
76
|
"plist": "^3.1.0",
|
|
77
77
|
"proxy-polyfill": "^0.3.2",
|
|
78
|
-
"semver": "^7.6.
|
|
78
|
+
"semver": "^7.6.2"
|
|
79
79
|
},
|
|
80
80
|
"homepage": "https://www.dynatrace.com/",
|
|
81
81
|
"peerDependencies": {
|
|
@@ -146,6 +146,7 @@
|
|
|
146
146
|
"lib/community/gesture-handler/*.js",
|
|
147
147
|
"lib/react-navigation/*.js",
|
|
148
148
|
"lib/react-native/*.js",
|
|
149
|
+
"lib/react-native/Touchables.jsx",
|
|
149
150
|
"lib/react/*.js",
|
|
150
151
|
"lib/metro/*.js",
|
|
151
152
|
"lib/util/*.js",
|
|
@@ -111,7 +111,7 @@ Pod::Spec.new do |s|
|
|
|
111
111
|
#
|
|
112
112
|
|
|
113
113
|
s.dependency "React"
|
|
114
|
-
s.dependency 'Dynatrace', '~> 8.
|
|
114
|
+
s.dependency 'Dynatrace', '~> 8.291.1.1004'
|
|
115
115
|
|
|
116
116
|
# Allows for better compatibility for older and newer versions
|
|
117
117
|
if defined?(install_modules_dependencies)
|
|
@@ -136,5 +136,3 @@ Pod::Spec.new do |s|
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
end
|
|
139
|
-
|
|
140
|
-
|
package/scripts/Config.js
CHANGED
package/scripts/Ios.js
CHANGED
|
@@ -128,9 +128,9 @@ const checkForExcludedControls = (config) => config != null && config.indexOf('D
|
|
|
128
128
|
const updatedExcludedStr = (config) => {
|
|
129
129
|
if (checkForExcludedControls(config)) {
|
|
130
130
|
const controlsArr = Object.keys(PlistConstants_1.CONTROLS_PROP_OPTIONS);
|
|
131
|
-
let updatedStr = `${PlistConstants_1.START_CONTROLS_PROP}${PlistConstants_1.CONTROLS_PROP_OPTIONS.PickerView}`;
|
|
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' && config.indexOf(PlistConstants_1.CONTROLS_PROP_OPTIONS[controlsArr[index]].trim()) >= 0) {
|
|
133
|
+
if (controlsArr[index] !== 'PickerView' && controlsArr[index] !== 'Switch' && config.indexOf(PlistConstants_1.CONTROLS_PROP_OPTIONS[controlsArr[index]].trim()) >= 0) {
|
|
134
134
|
updatedStr = updatedStr + PlistConstants_1.CONTROLS_PROP_OPTIONS[controlsArr[index]];
|
|
135
135
|
}
|
|
136
136
|
}
|
|
@@ -5,7 +5,7 @@ exports.START_PLIST = '<plist><dict>';
|
|
|
5
5
|
exports.END_PLIST = '</dict></plist>';
|
|
6
6
|
exports.AUTO_START_PROP = '<key>DTXAutoStart</key>';
|
|
7
7
|
exports.FLAVOR_PROP = '<key>DTXFlavor</key>\n<string>react_native</string>';
|
|
8
|
-
exports.DEFAULT_CONTROLS_PROP = '<key>DTXExcludedControls</key>\n<array>\n\t<string>PickerView</string>\n</array>';
|
|
8
|
+
exports.DEFAULT_CONTROLS_PROP = '<key>DTXExcludedControls</key>\n<array>\n\t<string>PickerView</string>\n\t<string>Switch</string>\n</array>';
|
|
9
9
|
exports.START_CONTROLS_PROP = '<key>DTXExcludedControls</key>\n<array>';
|
|
10
10
|
exports.END_CONTROLS_PROP = '\n</array>';
|
|
11
11
|
exports.CONTROLS_PROP_OPTIONS = {
|
|
@@ -33,9 +33,9 @@ export interface Spec extends TurboModule {
|
|
|
33
33
|
reportError(errorName: string, errorValue: string, reason: string, stacktrace: string, platform?: string): void;
|
|
34
34
|
|
|
35
35
|
// eslint-disable-next-line max-len
|
|
36
|
-
reportCrash(errorName: string, reason: string, stacktrace: string, isRealError: boolean,
|
|
36
|
+
reportCrash(errorName: string, reason: string, stacktrace: string, isRealError: boolean, platform?: string): void;
|
|
37
37
|
|
|
38
|
-
storeCrash(errorName: string, reason: string, stacktrace: string
|
|
38
|
+
storeCrash(errorName: string, reason: string, stacktrace: string): void;
|
|
39
39
|
|
|
40
40
|
reportErrorInAction(key: string, errorName: string, errorCode: number, platform?: string): void;
|
|
41
41
|
|