@dynatrace/react-native-plugin
Version:
This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.
50 lines (49 loc) • 2.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ReactDevRuntime = require("react/jsx-dev-runtime");
const Types_1 = require("../model/Types");
const FunctionalComponent_1 = require("./components/FunctionalComponent");
const ClassComponent_1 = require("./components/ClassComponent");
const ElementHelper_1 = require("./ElementHelper");
try {
const jsxDEV = (...args) => {
if (args[0] !== undefined &&
args[0]._dtInfo !== undefined &&
!(0, ElementHelper_1.isDtActionIgnore)(args[1])) {
if (args[0]._dtInfo.type === Types_1.Types.FunctionalComponent) {
const wrapperProps = {
children: ReactDevRuntime.jsxDEV(...args),
};
wrapperProps.dtActionName =
args[1] !== undefined && args[1].dtActionName !== undefined
? args[1].dtActionName
: args[0]._dtInfo.name;
if (args[2] !== undefined) {
return ReactDevRuntime.jsxDEV(FunctionalComponent_1.DynatraceFunctionalComponent, wrapperProps, args[2] + '_dt');
}
else {
return ReactDevRuntime.jsxDEV(FunctionalComponent_1.DynatraceFunctionalComponent, wrapperProps);
}
}
else if (args[0]._dtInfo.type === Types_1.Types.ClassComponent &&
args[0].prototype !== undefined &&
args[0].prototype.isReactComponent !== undefined) {
const wrapperProps = {
children: ReactDevRuntime.jsxDEV(...args),
};
if (args[2] !== undefined) {
return ReactDevRuntime.jsxDEV(ClassComponent_1.DynatraceClassComponent, wrapperProps, args[2] + '_dt');
}
else {
return ReactDevRuntime.jsxDEV(ClassComponent_1.DynatraceClassComponent, wrapperProps);
}
}
(0, ElementHelper_1.modifyElement)(args[0], args[1]);
}
return ReactDevRuntime.jsxDEV(...args);
};
module.exports = Object.assign(Object.assign({}, ReactDevRuntime), { jsxDEV });
}
catch (error) {
module.exports = {};
}